new
This commit is contained in:
parent
6d85dd2f42
commit
9c1c216ba3
3
Gemfile
3
Gemfile
@ -29,8 +29,7 @@ gem 'jquery-rails'
|
|||||||
# To use ActiveModel has_secure_password
|
# To use ActiveModel has_secure_password
|
||||||
gem 'bcrypt-ruby', '~> 3.0.0'
|
gem 'bcrypt-ruby', '~> 3.0.0'
|
||||||
|
|
||||||
gem 'capistrano'
|
|
||||||
gem 'rvm-capistrano'
|
|
||||||
|
|
||||||
gem 'formtastic'
|
gem 'formtastic'
|
||||||
gem 'haml'
|
gem 'haml'
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
set :application, 'site_perso_app'
|
set :application, 'site_perso_app'
|
||||||
set :domain, 'new.nicolasbally.com'
|
set :domain, 'nicolasbally.com'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ set :application, 'site_perso_app'
|
|||||||
role :db, domain, :primary => true
|
role :db, domain, :primary => true
|
||||||
|
|
||||||
set :scm, :git
|
set :scm, :git
|
||||||
set :repository, "git@gitlab.bally.me:root/site-perso.git"
|
set :repository, "git@git.nicolasbally.com:root/site_perso_app.git"
|
||||||
set :branch, "master"
|
set :branch, "master"
|
||||||
|
|
||||||
default_run_options[:pty] = true
|
default_run_options[:pty] = true
|
||||||
@ -85,6 +85,12 @@ set :application, 'site_perso_app'
|
|||||||
|
|
||||||
run "rm -rf #{release_path}/db/production.sqlite3"
|
run "rm -rf #{release_path}/db/production.sqlite3"
|
||||||
run "ln -s #{deploy_to}shared/production.sqlite3 #{release_path}/db/production.sqlite3"
|
run "ln -s #{deploy_to}shared/production.sqlite3 #{release_path}/db/production.sqlite3"
|
||||||
|
|
||||||
|
sudo "cp #{release_path}/config/unicorn_init_d /etc/init.d/#{application}"
|
||||||
|
|
||||||
|
sudo "chmod +x /etc/init.d/#{application}"
|
||||||
|
sudo "update-rc.d #{application} defaults "
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
task :start do
|
task :start do
|
||||||
@ -98,6 +104,10 @@ set :application, 'site_perso_app'
|
|||||||
end
|
end
|
||||||
|
|
||||||
task :reload_nginx do
|
task :reload_nginx do
|
||||||
|
|
||||||
|
sudo "rm -rf /etc/nginx/sites-enabled/#{application}"
|
||||||
|
sudo "ln -s #{current_path}/config/nginx.conf /etc/nginx/sites-enabled/#{application} "
|
||||||
|
|
||||||
sudo "service nginx reload"
|
sudo "service nginx reload"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -112,3 +122,4 @@ set :application, 'site_perso_app'
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
upstream site_perso_app_unicorn {
|
upstream site_perso_app_unicorn {
|
||||||
server unix:/home/web/site_perso_app/shared/tmp/unicorn.sock fail_timeout=0;
|
server unix:/home/web/site_perso_app/shared/unicorn.sock fail_timeout=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
|
64
config/unicorn_init_d
Executable file
64
config/unicorn_init_d
Executable file
@ -0,0 +1,64 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
set -u
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Change these to match your app:
|
||||||
|
APP_NAME=site_perso_app
|
||||||
|
APP_RUBY=1.9.3-p0
|
||||||
|
APP_ROOT="/home/web/site_perso_app/current"
|
||||||
|
PID="/home/web/site_perso_app/shared/unicorn.pid"
|
||||||
|
ENV=production
|
||||||
|
|
||||||
|
GEM_HOME="/home/web/.rvm/gems/ruby-$APP_RUBY"
|
||||||
|
|
||||||
|
UNICORN_OPTS="-D -E $ENV -c $APP_ROOT/config/unicorn.rb"
|
||||||
|
|
||||||
|
SET_PATH="cd $APP_ROOT; rvm 1.9.3-p0"
|
||||||
|
CMD="$SET_PATH; unicorn $UNICORN_OPTS"
|
||||||
|
|
||||||
|
old_pid="$PID.oldbin"
|
||||||
|
|
||||||
|
cd $APP_ROOT || exit 1
|
||||||
|
|
||||||
|
sig () {
|
||||||
|
test -s "$PID" && kill -$1 `cat $PID`
|
||||||
|
}
|
||||||
|
|
||||||
|
oldsig () {
|
||||||
|
test -s $old_pid && kill -$1 `cat $old_pid`
|
||||||
|
}
|
||||||
|
|
||||||
|
case ${1-help} in
|
||||||
|
start)
|
||||||
|
sig 0 && echo >&2 "Already running" && exit 0
|
||||||
|
su - web -c "$CMD"
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
sig QUIT && exit 0
|
||||||
|
echo >&2 "Not running"
|
||||||
|
;;
|
||||||
|
force-stop)
|
||||||
|
sig TERM && exit 0
|
||||||
|
echo >&2 "Not running"
|
||||||
|
;;
|
||||||
|
restart|reload)
|
||||||
|
sig HUP && echo reloaded OK && exit 0
|
||||||
|
echo >&2 "Couldn't reload, starting '$CMD' instead"
|
||||||
|
su - web -c "$CMD"
|
||||||
|
;;
|
||||||
|
upgrade)
|
||||||
|
sig USR2 && exit 0
|
||||||
|
echo >&2 "Couldn't upgrade, starting '$CMD' instead"
|
||||||
|
su - web -c "$CMD"
|
||||||
|
;;
|
||||||
|
rotate)
|
||||||
|
sig USR1 && echo rotated logs OK && exit 0
|
||||||
|
echo >&2 "Couldn't rotate logs" && exit 1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo >&2 "Usage: $0 "
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
Loading…
x
Reference in New Issue
Block a user