Skip to content

Instantly share code, notes, and snippets.

@thbar
Created June 28, 2012 21:51
Show Gist options
  • Save thbar/3014198 to your computer and use it in GitHub Desktop.
Save thbar/3014198 to your computer and use it in GitHub Desktop.
DotCloud deployment hooks
<%
yaml = YAML.load(IO.read('../environment.yml'))
%>
production:
adapter: postgresql
encoding: unicode
database: my_app
username: my_app
password: <%= yaml['MY_APP_DB_SQL_PASSWORD'] %>
pool: 5
host: <%= yaml['DOTCLOUD_DB_SQL_HOST'] %>
port: <%= yaml['DOTCLOUD_DB_SQL_PORT'] %>
#!/bin/sh
set -e
service_id=$(ruby -e "require 'json'; env = JSON.parse(File.read('/home/dotcloud/environment.json')); puts env['DOTCLOUD_SERVICE_ID']")
echo ====== postinstall hook started! =======
echo Currently in folder `pwd`
cp config/database.dotcloud.yml config/database.yml
echo ====== verifying ruby version ======
rake cron:verify
echo ====== precompiling assets ===========
rake assets:precompile
if [ "$service_id" = "0" ]
then
echo ====== migrating db ==========
rake db:migrate RAILS_ENV=production
echo ====== installing crontab ======
rake cron:install
fi
echo ====== postinstall done! =======
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment