Starting Standalone Passenger on startup

2,869 views
Skip to first unread message

Sajax

unread,
Nov 19, 2010, 7:49:01 AM11/19/10
to Phusion Passenger Discussions
Hi,

I've been trying to learn about deployment and currently have
everything working nicely with Nginx & Passenger working for Ruby
1.9.2, and using Passenger Standalone for 1.8.7 apps (Redmine etc)
with a reverse proxy back to Nginx. This all works well, but if the
server reboots then I have to manually restart all the standalone
instances, I've tried to find a way to automate this but I've not
figured this one out.

Manually starting is done with

rvm use 1.8.7@redmine (Default Ruby is 1.9.2 in RVM)

cd /www/public_ruby/redmine

passenger start -a 127.0.0.1 -p 3000 -d -e production

I've probably given myself a double hit here by being both unfamiliar
with Linux (Ubuntu Server) & Passenger but I like the setup and would
like to stick with it.

Thanks for any help.

Hongli Lai

unread,
Nov 19, 2010, 8:33:37 AM11/19/10
to phusion-...@googlegroups.com

There are many tools you can use for starting services during boot. We
use daemon tools. Other things include SysV init scripts, entries in
/etc/rc.local, etc.

--
Phusion | The Computer Science Company

Web: http://www.phusion.nl/
E-mail: in...@phusion.nl
Chamber of commerce no: 08173483 (The Netherlands)

Franck D'agostini

unread,
Nov 19, 2010, 12:05:27 PM11/19/10
to Phusion Passenger Discussions
I create a init script per application using Passenger Standalone.

Here's one of those : /etc/init.d/myapp

#!/bin/bash
### BEGIN INIT INFO
# Provides: myapp passenger in standalone
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# X-Interactive: true
# Short-Description: Start/stop de-fra.com web site
### END INIT INFO

#PATH=/sbin:/usr/sbin:/bin:/usr/bin
GEM_HOME=/usr/local/rvm/gems/ruby-1.8.7-p302
RVM=/usr/local/bin/rvm
PASSENGER=/usr/local/rvm/gems/ruby-1.8.7-p302/bin/passenger
ADDRESS=127.0.0.1
PORT=3000
ENVIRONMENT=production
APP="/var/www/myapp/current"
USER=deploy
RUBY_VERSION=1.8.7
USER=deploy
SET_PATH="cd $APP; $RVM use $RUBY_VERSION; export GEM_HOME=$GEM_HOME"
CMD="$SET_PATH; $PASSENGER start -a $ADDRESS -p $PORT -e $ENVIRONMENT -
d"

. /lib/lsb/init-functions

case "$1" in
start)
echo "Starting myapp passenger"
echo $CMD
su - $USER -c "$CMD"
;;
stop)
echo "Stopping myapp passenger"
cd $APP
$PASSENGER stop -p $PORT
;;
*)
echo "Usage: $0 start|stop" >&2
exit 3
;;
esac


On 19 nov, 14:33, Hongli Lai <hon...@phusion.nl> wrote:
> E-mail: i...@phusion.nl

Sajax

unread,
Dec 2, 2010, 12:54:49 PM12/2/10
to Phusion Passenger Discussions
Thanks, I'll give this a go. I've used rvm for a user rather than a
system wide deployment which has made things more difficult /
impossible, so I'll try a system wide install instead.

On Nov 19, 5:05 pm, "Franck D'agostini" <franck.dagost...@gmail.com>
wrote:

John Gonzales

unread,
Mar 17, 2012, 7:30:55 AM3/17/12
to phusion-...@googlegroups.com
You could try this init script which takes into account user-level RVM and gemsets: http://memcloud.com/note/show/167
Reply all
Reply to author
Forward
0 new messages