Skip to content

Instantly share code, notes, and snippets.

@namxam
Created December 29, 2012 14:33
Show Gist options
  • Save namxam/4407243 to your computer and use it in GitHub Desktop.
Save namxam/4407243 to your computer and use it in GitHub Desktop.
description "Your App"
author "Maximilian Schulz <m.schulz@kulturfluss.de>"
# Define when to run the app
start on (local-filesystems and runlevel [2345])
stop on runlevel [016]
# Default config
respawn
respawn limit 10 5
# App configuration
env APP_NAME=your_app
env APP_HOME=/var/rails/your_app
env APP_USER=your_app_user
# Ensure that some directories are available
pre-start script
# Create folder for logs and adjust ownership
mkdir -p /var/log/$APP_NAME
chown -R $APP_USER:www-data /var/log/$APP_NAME
end script
# Run the server by utilizing ubuntus's start-stop-daemon
exec start-stop-daemon \
--start \
--pidfile /var/run/thin/$APP_NAME.pid \
--chuid $APP_USER:www-data \
--chdir $APP_HOME \
--exec /home/$APP_USER/.rvm/bin/rvm-shell -- ruby-1.9.3-p194 -c 'bundle exec rails server'
respawn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment