Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Starting thin server on different ports

I'm a newbie o thin. I have a ruby on rails application. Today I can start the application normally, by the command

sudo thin start -d

We have created a new database for tests. (one is a clean database, and he other is for testing so can be messed up) on the database.yml file.

I would like to start the same application in two different ports using the different databases.

To start an application with the database I can use the ENV option of thin:

sudo thin start -d -e production -p 3040

It woks fine. But when I try to start the 'regular' server, it says thins is already running. How could I start both application in the ame thin command. Is there a way to make a configuration file for this?

like image 427
lcguida Avatar asked Nov 04 '11 11:11

lcguida


1 Answers

Just to people know.

I found the solutions for this question. You CAN start the thin server on different ports with tha same application and with the same environment.

You just need to set different PID files by the -P (UpperCase) parameter.

Example:

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

thin start -e production -p 3030 -d

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

thin start -e production -p 3040 -P MY_PID.pid -d
like image 135
lcguida Avatar answered Sep 30 '22 17:09

lcguida