1

I'm trying to run thin server in upstart. Here is what my upstart.conf file contains:

description 'kitfaye'

start on runlevel [12356] stop  on runlevel [!12356]
respawn

script
   exec su -l deploy -c "export RAILS_ENV=production && cd
  /home/deploy/kitfaye && thin start -e production -p 8003 -R config.ru"
end script

After I reboot my ubuntu machine I can see in htop 4 processes of thin. You can see them in attachment picture. Of course I can't connect to 8003 port. What's going on there?

https://drive.google.com/file/d/0B-jLZf9ippNgYzIwSFZzZUozamM/edit?usp=sharing

enter image description here

HBruijn
  • 77,029
  • 24
  • 135
  • 201
m8labs
  • 113
  • 4

2 Answers2

3

If you press F5 in htop you see the process hierarchy, which helps explain what you're seeing here.

They're probably ordered like this 586 -> 677 -> 1077 -> 1082.

586 'su' - spawns 677 'export ...; cd ...; thin start ...' which spawns 1077 'thin start ...' which spawns 1082

3onyc
  • 46
  • 1
  • The problem was in another place, but since this pointed me to the right direction I accepted this answer. – m8labs Sep 07 '14 at 12:23
  • 1
    @MaratAl: A brief explanation of how you solved it would have been appreciated. – chech Feb 16 '15 at 09:08
0

If you have a fairly recent version of Upstart (I think precise is fine) then I would suggest using this config instead:

description "kitfaye"

start on runlevel [2345]
stop on runlevel [016]

setuid deploy
chdir /home/deploy/kitfaye
env RAILS_ENV=production

exec thin start -e production -p 8003 -R config.ru"
CameronNemo
  • 399
  • 1
  • 6