Created
January 11, 2017 15:46
-
-
Save mebeling/cdb2557a63f9bc76c8e1f83d80155bfc to your computer and use it in GitHub Desktop.
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
# deploy application | |
deploy_revision "#{base}" do | |
Chef::Log.info(" ##==-- baseball-statistics repo_rev is #{node[:repo_rev]} --==## ") | |
repository "<repo.git>" | |
revision node['repo_rev'] | |
user 'ubuntu' | |
group 'ubuntu' | |
purge_before_symlink %w{log} | |
symlink_before_migrate( | |
{ | |
"config/db-config.yml" => "config/db-config.yml", | |
"config/amqp-config.yml" => "config/amqp-config.yml", | |
"config/league.rb" => "config/league.rb", | |
"config/aws.yml" => "config/aws.yml", | |
"config/translation.yml" => "config/translation.yml", | |
"config/trinidad.yml" => "config/trinidad.yml" | |
} | |
) | |
restart_command do | |
bash "start service" do | |
user 'root' | |
group 'root' | |
code <<-"EOH" | |
/etc/init.d/#{league_name}-statistics start | |
EOH | |
end | |
end | |
before_restart do | |
bash "run bundler" do | |
user 'ubuntu' | |
group 'ubuntu' | |
cwd "/opt" | |
code <<-"EOH" | |
. ~/.profile | |
. /etc/profile | |
cd #{release_path} | |
gem install bundler --version 1.13.6 --no-ri --no-rdoc | |
bundle install | |
EOH | |
end | |
bash "stop service" do | |
user 'root' | |
group 'root' | |
code <<-"EOH" | |
/etc/init.d/#{league_name}-statistics stop | |
EOH | |
only_if {File.exists?("/var/run/trinidad/#{league_name}-statistics.pid")} | |
end | |
bash "run db:migrate" do | |
user 'ubuntu' | |
group 'ubuntu' | |
timeout 10800 | |
cwd "/opt" | |
code <<-"EOH" | |
. ~/.profile | |
. /etc/profile | |
cd #{release_path} | |
RACK_ENV=#{environment} rake db:migrate | |
EOH | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment