suite
This commit is contained in:
parent
a083b44f7d
commit
0a9e54a482
4
Capfile
4
Capfile
@ -30,10 +30,12 @@ require "capistrano/rvm"
|
||||
# require "capistrano/rbenv"
|
||||
# require "capistrano/chruby"
|
||||
require "capistrano/rails/assets"
|
||||
require 'capistrano/nginx'
|
||||
#require 'capistrano/nginx'
|
||||
require "capistrano/bundler"
|
||||
require "capistrano/rails/migrations"
|
||||
# require "capistrano/passenger"
|
||||
|
||||
|
||||
|
||||
# Load custom tasks from `lib/capistrano/tasks` if you have any defined
|
||||
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }
|
||||
|
11
Gemfile
11
Gemfile
@ -8,7 +8,7 @@ gem 'rails', '~> 6.0.0.rc1'
|
||||
# Use sqlite3 as the database for Active Record
|
||||
gem 'mysql2'
|
||||
# Use Puma as the app server
|
||||
gem 'puma', '~> 3.11'
|
||||
|
||||
# Use SCSS for stylesheets
|
||||
gem 'sass-rails', '~> 5'
|
||||
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
|
||||
@ -36,9 +36,17 @@ gem 'bootsnap', '>= 1.4.2', require: false
|
||||
group :development, :test do
|
||||
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
||||
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
|
||||
|
||||
|
||||
end
|
||||
|
||||
group :production do
|
||||
gem 'unicorn'
|
||||
end
|
||||
|
||||
group :development do
|
||||
|
||||
gem 'puma', '~> 3.11'
|
||||
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
|
||||
gem 'web-console', '>= 3.3.0'
|
||||
gem 'listen', '>= 3.0.5', '< 3.2'
|
||||
@ -91,5 +99,6 @@ group :development do
|
||||
gem 'capistrano-bundler', '~> 1.1', require: false
|
||||
gem "capistrano-rvm", group: :development
|
||||
gem 'capistrano3-nginx', '~> 2.0', group: :development
|
||||
|
||||
end
|
||||
|
||||
|
@ -179,6 +179,7 @@ GEM
|
||||
kaminari (>= 0.13.0)
|
||||
rails
|
||||
kaminari-core (1.1.1)
|
||||
kgio (2.11.2)
|
||||
less (2.6.0)
|
||||
commonjs (~> 0.2.7)
|
||||
less-rails (4.0.0)
|
||||
@ -250,6 +251,7 @@ GEM
|
||||
method_source
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.20.3, < 2.0)
|
||||
raindrops (0.19.0)
|
||||
rake (12.3.2)
|
||||
rb-fsevent (0.10.3)
|
||||
rb-inotify (0.10.0)
|
||||
@ -313,6 +315,9 @@ GEM
|
||||
tzinfo (1.2.5)
|
||||
thread_safe (~> 0.1)
|
||||
unicode_utils (1.4.0)
|
||||
unicorn (5.5.1)
|
||||
kgio (~> 2.6)
|
||||
raindrops (~> 0.7)
|
||||
web-console (4.0.0)
|
||||
actionview (>= 6.0.0.a)
|
||||
activemodel (>= 6.0.0.a)
|
||||
@ -378,6 +383,7 @@ DEPENDENCIES
|
||||
turbolinks (~> 5)
|
||||
twitter-bootstrap-rails
|
||||
tzinfo-data
|
||||
unicorn
|
||||
web-console (>= 3.3.0)
|
||||
webdrivers
|
||||
webpacker (~> 4.0)
|
||||
|
@ -10,3 +10,6 @@ set :domain, 'quartz-www02.sysnove.net'
|
||||
|
||||
set :rvm_ruby_version, '2.6.0' # use the same ruby as used locally for deployment
|
||||
set :rvm_autolibs_flag, "read-only"
|
||||
|
||||
|
||||
#set :nginx_template, "#{stage_config_path}/nginx.conf.erb"
|
23
config/deploy/nginx.conf.erb
Normal file
23
config/deploy/nginx.conf.erb
Normal file
@ -0,0 +1,23 @@
|
||||
upstream qi6_app_unicorn {
|
||||
server unix:/srv/www/web/qi6_app/shared/unicorn.sock fail_timeout=0;
|
||||
}
|
||||
|
||||
server {
|
||||
listen [::]:80;
|
||||
server_name qi6_app.quartz.xyz ;
|
||||
root /srv/www/web/qi6_app/current/public;
|
||||
try_files $uri/index.html $uri @unicorn;
|
||||
|
||||
location @unicorn {
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_redirect off;
|
||||
proxy_pass http://qi6_app_unicorn;
|
||||
proxy_read_timeout 6000;
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /500.html;
|
||||
client_max_body_size 4G;
|
||||
keepalive_timeout 6000;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ server "quartz.snlab.fr", user: "web", roles: %w{web app db}
|
||||
|
||||
set :branch, ENV["REVISION"] || ENV["BRANCH_NAME"] || "master"
|
||||
puts stage_config_path
|
||||
set :nginx_template, "#{stage_config_path}/#{fetch :stage}/nginx.conf.erb"
|
||||
#set :nginx_template, "#{stage_config_path}/#{fetch :stage}/nginx.conf.erb"
|
||||
|
||||
# server-based syntax
|
||||
# ======================
|
||||
@ -72,3 +72,50 @@ append :linked_files, "config/master.key"
|
||||
# auth_methods: %w(publickey password)
|
||||
# # password: "please use keys"
|
||||
# }
|
||||
|
||||
set :pty, true
|
||||
set :ssh_options, {:forward_agent => true}
|
||||
|
||||
namespace :deploy do
|
||||
before :starting, :ensure_user do
|
||||
#on roles(:app) do
|
||||
# sudo "cp #{current_path}/config/env_init #{deploy_to}env_init"
|
||||
# end
|
||||
#puts "A"
|
||||
|
||||
|
||||
end
|
||||
|
||||
before :finishing, :make_unicorn do
|
||||
puts "FINISHIG"
|
||||
|
||||
on roles(:app) do
|
||||
sudo "cp #{current_path}/config/env_init #{deploy_to}env_init"
|
||||
|
||||
sudo "sudo systemctl enable quartz_app@#{fetch(:application)}"
|
||||
sudo "systemctl stop quartz_app@#{fetch(:application)}"
|
||||
sudo "systemctl start quartz_app@#{fetch(:application)}"
|
||||
|
||||
sudo "rm -rf /etc/nginx/sites-enabled/#{fetch(:application)}"
|
||||
sudo "ln -s #{current_path}/config/nginx.conf /etc/nginx/sites-enabled/#{fetch(:application)} "
|
||||
|
||||
sudo "service nginx reload"
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#sudo "sudo systemctl enable quartz_app@#{application}"
|
||||
|
||||
|
||||
|
||||
# sudo "systemctl stop quartz_app@#{application}"
|
||||
|
||||
# sudo "systemctl start quartz_app@#{application}"
|
||||
|
||||
|
||||
|
||||
end
|
||||
end
|
7
config/env_init
Normal file
7
config/env_init
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
APP_RUBY=2.6.0
|
||||
ENV=production
|
||||
APP_ROOT=/srv/www/web/qi6_app/current/
|
||||
GEM_HOME=/srv/www/web/.rvm/gems/ruby-$APP_RUBY
|
||||
UNICORN_OPTS="-D -E ${ENV} -c ${APP_ROOT}/config/unicorn.rb"
|
||||
|
10
config/unicorn.rb
Normal file
10
config/unicorn.rb
Normal file
@ -0,0 +1,10 @@
|
||||
@rails_app = "qi6_app"
|
||||
|
||||
working_directory "/srv/www/web/#{@rails_app}/current"
|
||||
pid "/srv/www/web/#{@rails_app}/shared/unicorn.pid"
|
||||
stderr_path "/srv/www/web/#{@rails_app}/shared/log/unicorn.log"
|
||||
stdout_path "/srv/www/web/#{@rails_app}/shared/log/unicorn.log"
|
||||
|
||||
listen "/srv/www/web/#{@rails_app}/shared/unicorn.sock"
|
||||
worker_processes 4
|
||||
timeout 9999
|
Loading…
x
Reference in New Issue
Block a user