Merge branch 'r-1902001-01' of gitlab.com:code2lab/SXRestaurant into r-1902001-01
This commit is contained in:
@@ -28,9 +28,24 @@ set :linked_dirs, %w{log tmp/pids tmp/puma tmp/cache tmp/sockets vendor/bundle p
|
|||||||
set :tests, []
|
set :tests, []
|
||||||
set :pty, true
|
set :pty, true
|
||||||
|
|
||||||
set :puma_jungle_conf, '/etc/puma.conf'
|
#set :puma_state, "#{shared_path}/tmp/pids/puma.state"
|
||||||
set :puma_run_path, '/usr/local/bin/run-puma'
|
#set :puma_pid, "#{shared_path}/tmp/pids/puma.pid"
|
||||||
set :puma_bind, %w(tcp://0.0.0.0:9393)
|
set :puma_bind, %w(tcp://0.0.0.0:9393)
|
||||||
|
#set :puma_conf, "#{shared_path}/puma.rb"
|
||||||
|
#set :puma_access_log, "#{shared_path}/log/puma_access.log"
|
||||||
|
#set :puma_error_log, "#{shared_path}/log/puma_error.log"
|
||||||
|
#set :puma_role, :app
|
||||||
|
set :puma_env, fetch(:rack_env, fetch(:rails_env, 'production'))
|
||||||
|
set :puma_threads, [0, 16]
|
||||||
|
set :puma_workers, 2
|
||||||
|
#set :puma_worker_timeout, nil
|
||||||
|
#set :puma_init_active_record, false
|
||||||
|
#set :puma_preload_app, false
|
||||||
|
#set :puma_daemonize, false
|
||||||
|
#set :puma_plugins, [] #accept array of plugins
|
||||||
|
#set :puma_tag, fetch(:application)
|
||||||
|
#set :puma_restart_command, 'bundle exec puma'
|
||||||
|
|
||||||
|
|
||||||
#set :enable_ssl, true
|
#set :enable_ssl, true
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ set :server_name, "doemal.app"
|
|||||||
set :branch, "r-1902001-01"
|
set :branch, "r-1902001-01"
|
||||||
|
|
||||||
set :full_app_name, "#{fetch(:application)}_#{fetch(:stage)}"
|
set :full_app_name, "#{fetch(:application)}_#{fetch(:stage)}"
|
||||||
server '167.71.194.57', user: 'deploy', roles: %w{web app db}, primary: true
|
server '178.128.58.251', user: 'deploy', roles: %w{web app db}, primary: true
|
||||||
|
|
||||||
set :deploy_to, "/home/#{fetch(:deploy_user)}/apps/#{fetch(:full_app_name)}"
|
set :deploy_to, "/home/#{fetch(:deploy_user)}/apps/#{fetch(:full_app_name)}"
|
||||||
set :rbenv_ruby, '2.6.5'
|
set :rbenv_ruby, '2.6.5'
|
||||||
|
|||||||
1
config/deploy/shared/.rbenv-vars
Normal file
1
config/deploy/shared/.rbenv-vars
Normal file
@@ -0,0 +1 @@
|
|||||||
|
SECRET_KEY_BASE=33c956cc0e41623bf4e0aedbb16061fa7460a993452b58311d07009782dc242925a52dbb79b506c35308e65cda7cb07b014f78daea0a7ea883a535dc14b33a09
|
||||||
6
config/deploy/shared/database.yml.erb
Normal file
6
config/deploy/shared/database.yml.erb
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
production:
|
||||||
|
adapter: postgresql
|
||||||
|
host: localhost
|
||||||
|
database: iticket
|
||||||
|
username: wathon
|
||||||
|
password: root
|
||||||
11
config/deploy/shared/log_rotation.erb
Normal file
11
config/deploy/shared/log_rotation.erb
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<%= fetch(:deploy_to) %>/shared/log/*.log {
|
||||||
|
daily
|
||||||
|
missingok
|
||||||
|
rotate 52
|
||||||
|
compress
|
||||||
|
delaycompress
|
||||||
|
notifempty
|
||||||
|
sharedscripts
|
||||||
|
endscript
|
||||||
|
copytruncate
|
||||||
|
}
|
||||||
2
config/deploy/shared/monit.conf.erb
Normal file
2
config/deploy/shared/monit.conf.erb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<% application = fetch(:application) %>
|
||||||
|
set mail-format { subject: <%= "#{fetch(:full_app_name)} - #{fetch(:rails_env)}" %> $SERVICE $EVENT at $DATE }
|
||||||
40
config/deploy/shared/nginx.conf.erb
Normal file
40
config/deploy/shared/nginx.conf.erb
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
server {
|
||||||
|
server_name <%= fetch(:server_name) %>;
|
||||||
|
listen 80;
|
||||||
|
passenger_enabled on;
|
||||||
|
rails_env production;
|
||||||
|
root <%= fetch(:deploy_to) %>/current/public;
|
||||||
|
|
||||||
|
location ^~ /assets/ {
|
||||||
|
gzip_static on;
|
||||||
|
expires max;
|
||||||
|
add_header Cache-Control public;
|
||||||
|
}
|
||||||
|
|
||||||
|
error_page 500 502 503 504 /500.html;
|
||||||
|
client_max_body_size 4G;
|
||||||
|
keepalive_timeout 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
<% if fetch(:enable_ssl) %>
|
||||||
|
server {
|
||||||
|
server_name <%= fetch(:server_name) %>;
|
||||||
|
listen 443;
|
||||||
|
passenger_enabled on;
|
||||||
|
rails_env production;
|
||||||
|
root <%= fetch(:deploy_to) %>/current/public;
|
||||||
|
|
||||||
|
location ^~ /assets/ {
|
||||||
|
gzip_static on;
|
||||||
|
expires max;
|
||||||
|
add_header Cache-Control public;
|
||||||
|
}
|
||||||
|
|
||||||
|
error_page 500 502 503 504 /500.html;
|
||||||
|
client_max_body_size 4G;
|
||||||
|
keepalive_timeout 10;
|
||||||
|
ssl on;
|
||||||
|
ssl_certificate <%= fetch(:deploy_to) %>/shared/ssl_cert.crt;
|
||||||
|
ssl_certificate_key <%= fetch(:deploy_to) %>/shared/ssl_private_key.key;
|
||||||
|
}
|
||||||
|
<% end %>
|
||||||
4
config/deploy/shared/redis.yml.erb
Normal file
4
config/deploy/shared/redis.yml.erb
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<%= fetch(:rails_env) %>:
|
||||||
|
host: data.myapp.com
|
||||||
|
port: 6379
|
||||||
|
db: 0
|
||||||
2
config/deploy/shared/sidekiq.yml.erb
Normal file
2
config/deploy/shared/sidekiq.yml.erb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<%= fetch(:rails_env) %>:
|
||||||
|
:concurrency: <%= fetch(:sidekiq_concurrency, 5) %>
|
||||||
48
config/deploy/shared/sidekiq_init.sh.erb
Normal file
48
config/deploy/shared/sidekiq_init.sh.erb
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
APP_ROOT=<%= current_path %>
|
||||||
|
PID=$APP_ROOT/tmp/pids/sidekiq.pid
|
||||||
|
CMD="cd $APP_ROOT; RAILS_ENV=<%= "#{fetch(:rails_env)}" %> nohup bundle exec sidekiq -e <%= "#{fetch(:rails_env)}" %> -C $APP_ROOT/config/sidekiq.yml -i 0 -P $PID >> $APP_ROOT/log/sidekiq.log 2>&1 &"
|
||||||
|
STOP_CMD="cd $APP_ROOT; RAILS_ENV=<%= "#{fetch(:rails_env)}" %> bundle exec sidekiqctl stop $APP_ROOT/tmp/pids/sidekiq.pid 10"
|
||||||
|
AS_USER=<%= fetch(:deploy_user) %>
|
||||||
|
|
||||||
|
run () {
|
||||||
|
if [ "$(id -un)" = "$AS_USER" ]; then
|
||||||
|
eval $1
|
||||||
|
else
|
||||||
|
su -c "$1" - $AS_USER
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
sig () {
|
||||||
|
test -s "$PID" && kill -$1 `cat $PID`
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
sig 0 && echo >&2 "Already Running" && exit 0
|
||||||
|
run "$CMD"
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
if test -s "$PID" && kill -0 `cat $PID`
|
||||||
|
then
|
||||||
|
echo "stopping...."
|
||||||
|
run "$STOP_CMD"
|
||||||
|
else
|
||||||
|
echo "not running"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
restart|reload)
|
||||||
|
if test -s "$PID" && kill -0 `cat $PID`
|
||||||
|
then
|
||||||
|
echo "stopping...."
|
||||||
|
run "$STOP_CMD"
|
||||||
|
fi
|
||||||
|
run "$CMD"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo >&2 "Usage: $0 <start|stop|restart>"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
Reference in New Issue
Block a user