Report this

What is the reason for this report?

Setup multiple environment with Strapi image

Posted on April 25, 2021

Hi !

I’m a student trying to learn all those DevOps things and Digital Ocean.

I created a new Droplet using the OneClick strapi button available on the Marketplace of DO.

On that OneClick deploy documentation they are telling us that we can create multiple environment thanks to PM2. (https://strapi.io/documentation/developer-docs/latest/setup-deployment-guides/installation/digitalocean-one-click.html)

So here’s what I did :

I did a cp -r of my strapi-development directory and named the new one strapi-production, I created a new process of that Strapi with PM2 and changed it’s port from 1377 to 3000.

Everything is running fine (without errors at least) but I don’t know how I’m supposed to access my strapi-production now. When I go to the IP of my Droplet I can only see the first strapi that was configured (so strapi-development).

How am I supposed to access to my new one? Should I modify the /etc/nginx/conf.d/upstream.conf file ? Do I need a subdomain for my development one?

I’m taking all the help I can have, even best practices etc as I’m learning the DevOps side.

Have a nice day



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Heya,

Just came across this answer and decided to write some general guidelines for anyone who comes across this in the future despite the old question.

Since you’ve changed the port to 3000, to access your strapi-production setup, you need to add the port number to your IP address, like this: http://your_droplet_ip:3000.

If it’s inaccessible, most likely, there might be an issue with Nginx configuration. Yes, you would need to modify the /etc/nginx/conf.d/upstream.conf file or respective Nginx configuration file for strapi-production set on port 3000.

A subdomain setup can certainly isolate and provide more control on your environments. You would just have to make sure that DNS settings for the subdomain are set appropriately and Nginx is configured to listen on that subdomain.

These articles may be of help:

Hope that this helps!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.