Created
June 28, 2012 21:51
-
-
Save thbar/3014198 to your computer and use it in GitHub Desktop.
DotCloud deployment hooks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% | |
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'] %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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