mirror of
https://github.com/zhigang1992/tsemple.git
synced 2026-01-12 17:52:57 +08:00
Fix setup script error
This commit is contained in:
@@ -13,7 +13,7 @@ namespace :deploy do
|
||||
desc 'Restart application'
|
||||
task :restart do
|
||||
on roles(:app), in: :sequence, wait: 5 do
|
||||
execute :sudo, :service, :unicorn_campo, :restart
|
||||
execute '/etc/init.d/unicorn_campo', :restart
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
USER=vagrant
|
||||
USER=deploy
|
||||
DEPLOY_PATH=/var/www/campo
|
||||
|
||||
apt-get update
|
||||
@@ -30,6 +30,6 @@ 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
|
||||
wget -O /etc/nginx/sites-available/campo.conf https://raw.github.com/chloerei/campo/master/config/nginx.conf
|
||||
ln -s /etc/nginx/sites-available/campo.conf /etc/nginx/sites-enabled/
|
||||
service nginx restart
|
||||
|
||||
16
script/unicorn.sh
Executable file → Normal file
16
script/unicorn.sh
Executable file → Normal file
@@ -5,7 +5,7 @@ set -e
|
||||
TIMEOUT=${TIMEOUT-60}
|
||||
APP_ROOT=/var/www/campo/current
|
||||
PID=$APP_ROOT/tmp/pids/unicorn.pid
|
||||
USER=vagrant
|
||||
USER=deploy
|
||||
CMD="cd $APP_ROOT ; RAILS_ENV=production bundle exec unicorn -D -c $APP_ROOT/config/unicorn.rb"
|
||||
action="$1"
|
||||
set -u
|
||||
@@ -20,10 +20,18 @@ oldsig () {
|
||||
test -s $old_pid && kill -$1 `cat $old_pid`
|
||||
}
|
||||
|
||||
run () {
|
||||
if [ "$(id -un)" = "$AS_USER" ]; then
|
||||
eval $1
|
||||
else
|
||||
su -c "$1" - $USER
|
||||
fi
|
||||
}
|
||||
|
||||
case $action in
|
||||
start)
|
||||
sig 0 && echo >&2 "Already running" && exit 0
|
||||
su - $USER -c "$CMD"
|
||||
run "$CMD"
|
||||
;;
|
||||
stop)
|
||||
sig QUIT && exit 0
|
||||
@@ -36,7 +44,7 @@ case $action in
|
||||
restart|reload)
|
||||
sig HUP && echo reloaded OK && exit 0
|
||||
echo >&2 "Couldn't reload, starting '$CMD' instead"
|
||||
su - $USER -c "$CMD"
|
||||
run "$CMD"
|
||||
;;
|
||||
upgrade)
|
||||
if sig USR2 && sleep 2 && sig 0 && oldsig QUIT
|
||||
@@ -56,7 +64,7 @@ case $action in
|
||||
exit 0
|
||||
fi
|
||||
echo >&2 "Couldn't upgrade, starting '$CMD' instead"
|
||||
su - $USER -c "$CMD"
|
||||
run "$CMD"
|
||||
;;
|
||||
reopen-logs)
|
||||
sig USR1
|
||||
|
||||
Reference in New Issue
Block a user