Add unicorn.sh and nginx.conf install script; add deploy:restart task

This commit is contained in:
Rei
2014-03-02 22:54:43 +08:00
parent 4e8b8db933
commit fcdea1bcb9
3 changed files with 10 additions and 12 deletions

2
Vagrantfile vendored
View File

@@ -55,7 +55,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# View the documentation for the provider you're using for more
# information on available options.
config.vm.provision :shell, :path => "bin/setup.sh"
config.vm.provision :shell, :path => "script/setup.sh"
# Enable provisioning with Puppet stand alone. Puppet manifests
# are contained in a directory path relative to this Vagrantfile.

View File

@@ -13,20 +13,10 @@ namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
# Your restart mechanism here, for example:
# execute :touch, release_path.join('tmp/restart.txt')
execute :sudo, :service, :unicorn_campo, :restart
end
end
after :publishing, :restart
after :restart, :clear_cache do
on roles(:web), in: :groups, limit: 3, wait: 10 do
# Here we can do anything such as:
# within release_path do
# execute :rake, 'cache:clear'
# end
end
end
end

8
script/setup.sh Executable file → Normal file
View File

@@ -14,6 +14,7 @@ service elasticsearch start
su postgres <<EOF
createuser -d -R -S $USER
createdb campo_production -O $USER
EOF
su $USER <<EOF
@@ -25,3 +26,10 @@ EOF
mkdir -p $DEPLOY_PATH
chown $USER:$USER $DEPLOY_PATH
wget -O /etc/init.d/unicorn_campo https://raw.github.com/chloerei/campo/master/script/unicorn.sh
chmod +x /etc/init.d/unicorn_campo
wget -O /etc/nginx/sites-available/campo.conf https://raw.github.com/chloerei/campo/master/script/unicorn.sh
ln -s /etc/nginx/sites-available/campo.conf /etc/nginx/sites-enabled/
service nginx restart