mirror of
https://github.com/zhigang1992/tsemple.git
synced 2026-01-12 22:53:00 +08:00
Add unicorn.sh and nginx.conf install script; add deploy:restart task
This commit is contained in:
2
Vagrantfile
vendored
2
Vagrantfile
vendored
@@ -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.
|
||||
|
||||
@@ -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
8
script/setup.sh
Executable file → Normal 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
|
||||
|
||||
Reference in New Issue
Block a user