Running a thin server on different ports

I am new to thin form. I have a ruby ​​on the rails. Today I can start the application normally, with the command

sudo thin start -d 

We have created a new database for tests. (one is a pure database, and the other is for testing, so it can be confused) in the database.yml file.

I would like to run the same application on two different ports using different databases.

To start the application with the database, I can use the ENV option:

 sudo thin start -d -e production -p 3040 

This is normal. But when I try to start a β€œnormal” server, it says that thins is already running. How could I run both applications in a thin ame command. Is there a way to make a configuration file for this?

+6
source share
1 answer

Just to let people know.

I have found solutions for this issue. You can run a thin server on different ports with the same application and the same environment.

You just need to install different PID files using the -P (UpperCase) option.

Example:

Server 1 (port 3030, production environment, default pid, disabled)

 thin start -e production -p 3030 -d 

Server 2 (port 3040, production environment, file file "MY_PID.pid", disconnected)

 thin start -e production -p 3040 -P MY_PID.pid -d 
+13
source

Source: https://habr.com/ru/post/900772/


All Articles