suite
This commit is contained in:
parent
e45e4894d8
commit
000ce04cd9
31
Capfile
31
Capfile
@ -1,29 +1,4 @@
|
||||
# Load DSL and Setup Up Stages
|
||||
require 'capistrano/setup'
|
||||
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
|
||||
Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
|
||||
|
||||
# Includes default deployment tasks
|
||||
require 'capistrano/deploy'
|
||||
|
||||
# Includes tasks from other gems included in your Gemfile
|
||||
#
|
||||
# For documentation on these, see for example:
|
||||
#
|
||||
# https://github.com/capistrano/rvm
|
||||
# https://github.com/capistrano/rbenv
|
||||
# https://github.com/capistrano/chruby
|
||||
# https://github.com/capistrano/bundler
|
||||
# https://github.com/capistrano/rails
|
||||
#
|
||||
require 'capistrano/rvm'
|
||||
# We're going to use the full capistrano/rails since
|
||||
# it includes the asset compilation, DB migrations
|
||||
# and bundler
|
||||
require 'capistrano/rails'
|
||||
# require 'capistrano/rbenv'
|
||||
# require 'capistrano/chruby'
|
||||
# require 'capistrano/bundler'
|
||||
# require 'capistrano/rails/assets'
|
||||
# require 'capistrano/rails/migrations'
|
||||
require 'sshkit/sudo'
|
||||
# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
|
||||
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
|
||||
load 'config/deploy' # remove this line to skip loading any of the default tasks
|
12
Gemfile
12
Gemfile
@ -28,18 +28,16 @@ gem 'haml-rails'
|
||||
gem "therubyracer"
|
||||
|
||||
|
||||
gem 'capistrano', '~> 3.0', require: false, group: :development
|
||||
|
||||
|
||||
group :development, :test do
|
||||
gem 'byebug'
|
||||
#gem 'capistrano-rails'
|
||||
#gem "rvm-capistrano"
|
||||
|
||||
|
||||
gem 'capistrano-rails', '~> 1.1', require: false
|
||||
gem 'capistrano-bundler', '~> 1.1', require: false
|
||||
gem 'capistrano-rvm', '~> 0.1', require: false
|
||||
gem 'sshkit-sudo', require: false
|
||||
#gem 'net-ssh', '~>2.7.0'
|
||||
gem "capistrano", '2.15.5', group: :development, require: false
|
||||
gem "rvm-capistrano",'1.4.1', group: :development
|
||||
gem 'net-ssh', '~>2.7.0'
|
||||
|
||||
|
||||
gem 'web-console', '~> 2.0'
|
||||
|
50
Gemfile.lock
50
Gemfile.lock
@ -46,19 +46,12 @@ GEM
|
||||
builder (3.2.2)
|
||||
byebug (5.0.0)
|
||||
columnize (= 0.9.0)
|
||||
capistrano (3.4.0)
|
||||
i18n
|
||||
rake (>= 10.0.0)
|
||||
sshkit (~> 1.3)
|
||||
capistrano-bundler (1.1.4)
|
||||
capistrano (~> 3.1)
|
||||
sshkit (~> 1.2)
|
||||
capistrano-rails (1.1.3)
|
||||
capistrano (~> 3.1)
|
||||
capistrano-bundler (~> 1.1)
|
||||
capistrano-rvm (0.1.2)
|
||||
capistrano (~> 3.0)
|
||||
sshkit (~> 1.2)
|
||||
capistrano (2.15.5)
|
||||
highline
|
||||
net-scp (>= 1.0.0)
|
||||
net-sftp (>= 2.0.0)
|
||||
net-ssh (>= 2.0.14)
|
||||
net-ssh-gateway (>= 1.1.0)
|
||||
carrierwave (0.10.0)
|
||||
activemodel (>= 3.2.0)
|
||||
activesupport (>= 3.2.0)
|
||||
@ -71,7 +64,6 @@ GEM
|
||||
coffee-script-source
|
||||
execjs
|
||||
coffee-script-source (1.9.1.1)
|
||||
colorize (0.7.7)
|
||||
columnize (0.9.0)
|
||||
debug_inspector (0.0.2)
|
||||
erubis (2.7.0)
|
||||
@ -91,6 +83,7 @@ GEM
|
||||
haml (>= 4.0.6, < 5.0)
|
||||
html2haml (>= 1.0.1)
|
||||
railties (>= 4.0.1)
|
||||
highline (1.7.10)
|
||||
html2haml (2.0.0)
|
||||
erubis (~> 2.7.0)
|
||||
haml (~> 4.0.0)
|
||||
@ -124,7 +117,11 @@ GEM
|
||||
mysql2 (0.3.18)
|
||||
net-scp (1.2.1)
|
||||
net-ssh (>= 2.6.5)
|
||||
net-ssh (2.9.2)
|
||||
net-sftp (2.1.2)
|
||||
net-ssh (>= 2.6.5)
|
||||
net-ssh (2.7.0)
|
||||
net-ssh-gateway (1.3.0)
|
||||
net-ssh (>= 2.6.5)
|
||||
nokogiri (1.6.6.2)
|
||||
mini_portile (~> 0.6.0)
|
||||
rack (1.6.1)
|
||||
@ -158,10 +155,11 @@ GEM
|
||||
rake (10.4.2)
|
||||
rdoc (4.2.0)
|
||||
json (~> 1.4)
|
||||
ref (1.0.5)
|
||||
rmagick (2.15.0)
|
||||
ruby_parser (3.6.6)
|
||||
sexp_processor (~> 4.1)
|
||||
rvm-capistrano (1.4.1)
|
||||
capistrano (>= 2.0.0)
|
||||
sass (3.4.14)
|
||||
sass-rails (5.0.3)
|
||||
railties (>= 4.0.0, < 5.0)
|
||||
@ -180,15 +178,6 @@ GEM
|
||||
actionpack (>= 3.0)
|
||||
activesupport (>= 3.0)
|
||||
sprockets (>= 2.8, < 4.0)
|
||||
sshkit (1.7.1)
|
||||
colorize (>= 0.7.0)
|
||||
net-scp (>= 1.1.2)
|
||||
net-ssh (>= 2.8.0)
|
||||
sshkit-sudo (0.0.3)
|
||||
sshkit
|
||||
therubyracer (0.12.2)
|
||||
libv8 (~> 3.16.14.0)
|
||||
ref
|
||||
thor (0.19.1)
|
||||
thread_safe (0.3.5)
|
||||
tilt (1.4.1)
|
||||
@ -222,10 +211,7 @@ DEPENDENCIES
|
||||
acts_as_tree
|
||||
bcrypt (~> 3.1.7)
|
||||
byebug
|
||||
capistrano (~> 3.0)
|
||||
capistrano-bundler (~> 1.1)
|
||||
capistrano-rails (~> 1.1)
|
||||
capistrano-rvm (~> 0.1)
|
||||
capistrano (= 2.15.5)
|
||||
carrierwave
|
||||
coffee-rails (~> 4.1.0)
|
||||
formtastic (= 2.3.0)
|
||||
@ -236,15 +222,19 @@ DEPENDENCIES
|
||||
jquery-rails
|
||||
kaminari-bootstrap
|
||||
mysql2
|
||||
net-ssh (~> 2.7.0)
|
||||
rails (= 4.2.0)
|
||||
rmagick
|
||||
rvm-capistrano (= 1.4.1)
|
||||
sass-rails (~> 5.0)
|
||||
sdoc (~> 0.4.0)
|
||||
spring
|
||||
sshkit-sudo
|
||||
therubyracer
|
||||
turbolinks
|
||||
twitter-bootstrap-rails
|
||||
uglifier (>= 1.3.0)
|
||||
unicorn
|
||||
web-console (~> 2.0)
|
||||
|
||||
BUNDLED WITH
|
||||
1.16.1
|
||||
|
199
config/deploy.rb
199
config/deploy.rb
@ -1,173 +1,144 @@
|
||||
# config valid only for current version of Capistrano
|
||||
lock '3.4.0'
|
||||
set :application, 'blog_perso_app'
|
||||
set :domain, 'quartz-www02.sysnove.net'
|
||||
|
||||
application = "blog_perso_app"
|
||||
set :application, application
|
||||
|
||||
set :stages, ["production"]
|
||||
|
||||
scm_user = "git"
|
||||
scm_host = "quartz.snlab.fr"
|
||||
set :user, 'web'
|
||||
set :scm_user, "git"
|
||||
set :scm_host, "quartz.snlab.fr"
|
||||
|
||||
set :scm_user, scm_user
|
||||
set :scm_host, scm_host
|
||||
|
||||
set :pty, true
|
||||
|
||||
set :rvm_ruby_version, 'ruby-2.1.2'
|
||||
#set :rvm_autolibs_flag, "read-only"
|
||||
set :rvm_ruby_string, 'ruby-2.1.2'
|
||||
set :rvm_autolibs_flag, "read-only"
|
||||
|
||||
#set :bundle_cmd, "/srv/www/web/.rvm/gems/#{rvm_ruby_string}@global/bin/bundle"
|
||||
#set :bundle_dir, "/srv/www/web/.rvm/gems/#{rvm_ruby_string}"
|
||||
#set :use_sudo, false
|
||||
set :bundle_cmd, "/srv/www/#{user}/.rvm/gems/#{rvm_ruby_string}@global/bin/bundle"
|
||||
set :bundle_dir, "/srv/www/#{user}/.rvm/gems/#{rvm_ruby_string}"
|
||||
set :use_sudo, false
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
set :deploy_to, "/srv/www/web/#{application}/"
|
||||
set :deploy_to, "/srv/www/#{user}/#{application}/"
|
||||
set :deploy_via, :remote_cache
|
||||
|
||||
set :deploy_via, :remote_cache
|
||||
set :normalize_asset_timestamps, false
|
||||
|
||||
set :normalize_asset_timestamps, false
|
||||
set :rails_env, "production"
|
||||
|
||||
set :rails_env, "production"
|
||||
role :app, domain
|
||||
role :web, domain
|
||||
role :db, domain, :primary => true
|
||||
|
||||
set :scm, :git
|
||||
|
||||
set :repository, "#{scm_user}@#{scm_host}:nicolas/#{application}.git"
|
||||
|
||||
set :branch, "master"
|
||||
|
||||
default_run_options[:pty] = true
|
||||
|
||||
|
||||
set :scm, :git
|
||||
|
||||
set :repo_url, "#{scm_user}@#{scm_host}:nicolas/#{application}.git"
|
||||
|
||||
set :branch, "master"
|
||||
|
||||
|
||||
set :shared_path, "#{deploy_to}shared"
|
||||
|
||||
#default_run_options[:pty] = true
|
||||
require "rvm/capistrano"
|
||||
require 'bundler/capistrano'
|
||||
|
||||
|
||||
|
||||
|
||||
load 'deploy/assets'
|
||||
|
||||
namespace :deploy do
|
||||
|
||||
# namespace :assets do
|
||||
# task :precompile, :roles => :web, :except => { :no_release => true } do
|
||||
# from = source.next_revision(current_revision)
|
||||
# if releases.length <= 1 || capture("cd #{latest_release} && #{source.local.log(from)} vendor/assets/ app/assets/ | wc -l").to_i > 0
|
||||
# run %Q{cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile}
|
||||
# else
|
||||
# logger.info "Skipping asset pre-compilation because there were no asset changes"
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
|
||||
|
||||
|
||||
namespace :deploy do
|
||||
desc "Symlink shared config files"
|
||||
task :symlink_config_files do
|
||||
|
||||
|
||||
desc "Symlink shared config files"
|
||||
task :symlink_config_files do
|
||||
run "ln -s #{deploy_to}shared/storage/private #{current_path}/private_medias"
|
||||
|
||||
on roles(:app) do
|
||||
execute :ln, "-s #{shared_path}/storage/private #{current_path}/private_medias"
|
||||
execute :ln, "-s #{shared_path}/storage/public #{current_path}/public/public_medias"
|
||||
execute :ln, "-s #{shared_path}/production.sqlite3 #{current_path}/db/production.sqlite3"
|
||||
execute :ln, "-s #{shared_path}/env_init #{current_path}/config/env_init"
|
||||
run "ln -s #{deploy_to}shared/storage/public #{current_path}/public/public_medias"
|
||||
|
||||
|
||||
run "ln -s #{deploy_to}shared/production.sqlite3 #{current_path}/db/production.sqlite3"
|
||||
|
||||
|
||||
sudo :cp, "#{current_path}/config/unicorn_init_d /etc/init.d/#{application}"
|
||||
|
||||
sudo "cp #{current_path}/config/env_init #{deploy_to}env_init"
|
||||
|
||||
sudo "sudo systemctl enable quartz_app@#{application}"
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
desc 'Restart application'
|
||||
task :restart do
|
||||
on roles(:app) do
|
||||
|
||||
task :start do
|
||||
sudo "systemctl start quartz_app@#{application}"
|
||||
end
|
||||
task :stop do
|
||||
sudo "systemctl stop quartz_app@#{application}"
|
||||
end
|
||||
task :restart do
|
||||
sudo "systemctl stop quartz_app@#{application}"
|
||||
sudo "systemctl start quartz_app@#{application}"
|
||||
end
|
||||
|
||||
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"
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
task :seeds do
|
||||
run "cd #{deploy_to}current && rake db:seed RAILS_ENV=#{rails_env}"
|
||||
|
||||
end
|
||||
|
||||
|
||||
task :create_files_folders do
|
||||
|
||||
run "mkdir #{deploy_to}shared/storage"
|
||||
run "mkdir #{deploy_to}shared/storage/private"
|
||||
run "mkdir #{deploy_to}shared/storage/public"
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
after :publishing, :symlink_config_files
|
||||
|
||||
after :symlink_config_files, :restart
|
||||
|
||||
after :restart, :clear_cache do
|
||||
on roles(:web), in: :groups, limit: 3, wait: 10 do
|
||||
#nothing here
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
#before 'deploy:setup', 'rvm:install_rvm' # install RVM
|
||||
#before 'deploy:setup', 'rvm:install_ruby' # install Ruby and create gemset, OR:
|
||||
#before 'deploy:setup', 'rvm:create_gemset' # only create gemset
|
||||
#before 'deploy:setup', 'rvm:install_rvm' # install RVM
|
||||
#before 'deploy:setup', 'rvm:install_ruby' # install Ruby and create gemset, OR:
|
||||
#before 'deploy:setup', 'rvm:create_gemset' # only create gemset
|
||||
|
||||
|
||||
#after "deploy:setup", "deploy:create_files_folders"
|
||||
|
||||
#after "deploy:restart", "deploy:cleanup"
|
||||
after "deploy:setup", "deploy:create_files_folders"
|
||||
|
||||
#after "deploy:restart", "deploy:cleanup"
|
||||
|
||||
|
||||
#before "deploy:restart", "deploy:symlink_config_files"
|
||||
before "deploy:restart", "deploy:symlink_config_files"
|
||||
|
||||
#after "deploy", "deploy:cleanup"
|
||||
after "deploy", "deploy:cleanup"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Default branch is :master
|
||||
# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp
|
||||
|
||||
# Default deploy_to directory is /var/www/my_app_name
|
||||
# set :deploy_to, '/var/www/my_app_name'
|
||||
|
||||
# Default value for :scm is :git
|
||||
# set :scm, :git
|
||||
|
||||
# Default value for :format is :pretty
|
||||
# set :format, :pretty
|
||||
|
||||
# Default value for :log_level is :debug
|
||||
# set :log_level, :debug
|
||||
|
||||
# Default value for :pty is false
|
||||
# set :pty, true
|
||||
|
||||
# Default value for :linked_files is []
|
||||
# set :linked_files, fetch(:linked_files, []).push('config/database.yml', 'config/secrets.yml')
|
||||
|
||||
# Default value for linked_dirs is []
|
||||
# set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system')
|
||||
|
||||
# Default value for default_env is {}
|
||||
# set :default_env, { path: "/opt/ruby/bin:$PATH" }
|
||||
|
||||
# Default value for keep_releases is 5
|
||||
# set :keep_releases, 5
|
||||
|
||||
#namespace :deploy do
|
||||
|
||||
# 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user