Skip to content

Instantly share code, notes, and snippets.

@crohr
Created November 24, 2015 16:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crohr/b4a0c980173d9d2c0826 to your computer and use it in GitHub Desktop.
Save crohr/b4a0c980173d9d2c0826 to your computer and use it in GitHub Desktop.
Simple postinstall file for rails apps on https://packager.io
#!/bin/sh
set -e
CLI="my-app"
# if a DATABASE_URL is properly configured, then we can run migrations and web process
if $CLI config:get DATABASE_URL ; then
$CLI run rake db:migrate
$CLI scale web=1
fi
# If sidekiq url is present, then start worker process
if $CLI config:get SIDEKIQ_URL ; then
$CLI scale worker=1
fi
# Simple (i.e. stop then start) restart
service my-app restart
# or, Puma rolling restart
$CLI run pumactl restart
# or, Unicorn rolling restart?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment