Merge branch 'r-1902001-01' of gitlab.com:code2lab/SXRestaurant into r-1902001-01-dev

This commit is contained in:
NyanLinHtut
2019-11-13 13:34:29 +06:30
34 changed files with 930 additions and 1009 deletions

View File

@@ -1,20 +1,106 @@
lock "3.10.1"
# config valid only for current version of Capistrano
lock '3.11.2'
set :application, "zsai"
set :repo_url, 'git@bitbucket.org:code2lab/sxrestaurant.git'
set :application, 'SmartsalesSX'
set :deploy_user, 'deploy'
set :deploy_to, '/home/deploy/apps/SmartsalesSX'
set :rbenv_type, :global
# setup repo details
#set :scm, :git
set :repo_url, 'git@gitlab.com:code2lab/SXRestaurant.git'
# setup rbenv.
set :rbenv_prefix, "RBENV_ROOT=#{fetch(:rbenv_path)} RBENV_VERSION=#{fetch(:rbenv_ruby)} #{fetch(:rbenv_path)}/bin/rbenv exec"
set :rbenv_map_bins, %w{rake gem bundle ruby rails}
# how many old releases do we want to keep, not much
set :keep_releases, 5
set :linked_files, %w{config/database.yml config/secrets.yml config/puma.rb config/sidekiq.yml config/shops.json config/cable.yml}
# files we want symlinking to specific entries in shared
set :linked_files, %w{config/database.yml config/secrets.yml}
set :linked_dirs, %w{bin log tmp/puma tmp/pids tmp/cache tmp/sockets vendor/bundle public/system pids sockets}
# dirs we want symlinking to shared
set :linked_dirs, %w{log tmp/pids tmp/puma tmp/cache tmp/sockets vendor/bundle public/system}
# what specs should be run before deployment is allowed to
# continue, see lib/capistrano/tasks/run_tests.cap
set :tests, []
set :pty, true
set :puma_jungle_conf, '/etc/puma.conf'
set :puma_run_path, '/usr/local/bin/run-puma'
set :puma_bind, %w(tcp://0.0.0.0:9393)
#set :enable_ssl, true
# which config files should be copied by deploy:setup_config
# see documentation in lib/capistrano/tasks/setup_config.cap
# for details of operations
set(:config_files, %w(
database.yml
log_rotation
monit.conf
sidekiq_init.sh
sidekiq.yml
))
# which config files should be made executable after copying
# by deploy:setup_config
set(:executable_config_files, %w(
sidekiq_init.sh
))
# files which need to be symlinked to other parts of the
# filesystem. For example nginx virtualhosts, log rotation
# init scripts etc. The full_app_name variable isn't
# available at this point so we use a custom template {{}}
# tag and then add it at run time.
set(:symlinks, [
{
source: "sidekiq_init.sh",
link: "/etc/init.d/sidekiq_{{full_app_name}}"
},
{
source: "log_rotation",
link: "/etc/logrotate.d/{{full_app_name}}"
},
{
source: "monit",
link: "/etc/monit/conf.d/{{full_app_name}}.conf"
}
])
# this:
# http://www.capistranorb.com/documentation/getting-started/flow/
# is worth reading for a quick overview of what tasks are called
# and when for `cap stage deploy`
namespace :deploy do
# make sure we're deploying what we think we're deploying
before :deploy, "deploy:check_revision"
# only allow a deploy with passing tests to deployed
before :deploy, "deploy:run_tests"
# compile assets locally then rsync
after 'deploy:symlink:shared', 'deploy:compile_assets_locally'
Rake::Task["deploy:assets:precompile"].clear_actions
after :finishing, 'deploy:cleanup'
#nginx will be install in the Load Balancer - No need to deploy there
# remove the default nginx configuration as it will tend
# to conflict with our configs.
#before 'deploy:setup_config', 'nginx:remove_default_vhost'
# reload nginx to it will pick up any modified vhosts from
# setup_config
#after 'deploy:setup_config', 'nginx:reload'
# Restart monit so it will pick up any monit configurations
# we've added
#after 'deploy:setup_config', 'monit:restart'
# As of Capistrano 3.1, the `deploy:restart` task is not called
# automatically.
after 'finishing', 'puma:jungle:restart'
end

View File

@@ -1,9 +1,20 @@
# set :stage, :production
# set :server_name, "svr.sxrestaurant.host"
# set :full_app_name, "#{fetch(:application)}_#{fetch(:stage)}"
# server '192.168.1.27', user: 'deploy', roles: %w{web app db}, primary: true
# set :deploy_to, "/home/#{fetch(:deploy_user)}/apps/#{fetch(:full_app_name)}"
# set :rbenv_ruby, '2.4.1'
# set :rails_env, :production
set :stage, :production
set :server_name, "svr.sxrestaurant.host"
set :server_name, "a.c2l.shop"
set :branch, "r-1902001-01"
set :full_app_name, "#{fetch(:application)}_#{fetch(:stage)}"
server '192.168.1.27', user: 'deploy', roles: %w{web app db}, primary: true
server '167.71.194.57', user: 'deploy', roles: %w{web app db}, primary: true
set :deploy_to, "/home/#{fetch(:deploy_user)}/apps/#{fetch(:full_app_name)}"
set :rbenv_ruby, '2.4.1'
set :rbenv_ruby, '2.6.5'
set :rails_env, :production

View File

@@ -1,6 +1,8 @@
if File.exist?("config/license.yml")
if File.exist?("config/license.yml")
config = YAML.load_file(Rails.root.join("config/license.yml"))
config.fetch(Rails.env, {}).each do |key, value|
ENV[key.upcase] = value.to_s
end
end
else
ENV["SERVER_MODE"] = "cloud"
end