Ruby on rails Capistrano,禁用已部署的生产应用程序

Ruby on rails Capistrano,禁用已部署的生产应用程序,ruby-on-rails,nginx,capistrano,Ruby On Rails,Nginx,Capistrano,我已使用以下部署选项通过capistrano将我的应用程序部署到VPS: lock '3.4.1' set :application, 'my-production-app' set :repo_url, 'https://path.to.my.repo/my-production-app.git' set :linked_dirs, %w( bin log vendor/bundle public/system tmp/pids tmp/cache tmp/sockets ) s

我已使用以下部署选项通过capistrano将我的应用程序部署到VPS:

lock '3.4.1'

set :application, 'my-production-app'
set :repo_url, 'https://path.to.my.repo/my-production-app.git'

set :linked_dirs, %w(
  bin log vendor/bundle public/system
  tmp/pids tmp/cache tmp/sockets
)

set :puma_threads,    [4, 16]
set :puma_workers,    0

# This for carrierwave
set :linked_dirs, fetch(:linked_dirs) + %w{public/system public/uploads}

set :pty, true

set :use_sudo, true

set :puma_bind, "unix://#{shared_path}/tmp/sockets/#{fetch(:application)}-puma.sock"
set :puma_state,      "#{shared_path}/tmp/pids/puma.state"
set :puma_pid,        "#{shared_path}/tmp/pids/puma.pid"
set :puma_access_log, "#{release_path}/log/puma.error.log"
set :puma_error_log,  "#{release_path}/log/puma.access.log"

set :puma_preload_app, true
set :puma_worker_timeout, nil
然后我有一个
nginx.conf
文件,它将作为web服务器工作:

upstream puma_powerwifi {
  server unix:///var/www/my-production-app/shared/tmp/sockets/my-production-app-puma.sock;
}

server {
  listen 8888;
  # server_name example.com;

  root /var/www/my-production-app/current/public;
  access_log /var/www/my-production-app/current/log/nginx.access.log;
  error_log /var/www/my-production-app/current/log/nginx.error.log info;

  location ^~ /assets/ {
    gzip_static on;
    expires max;
    add_header Cache-Control public;
  }

  try_files $uri/index.html $uri @puma;
  location @puma {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;

  proxy_pass http://puma_my_production;
  }

  error_page 500 502 503 504 /500.html;
  client_max_body_size 10M;
  keepalive_timeout 10;
}
当我将应用程序部署到服务器时,它工作正常。现在我想把它关掉,我不知道该怎么办


如何安全地禁用通过capistrano部署的rails生产应用程序?

停止Puma服务器将禁用该应用程序

您可以使用部署(本地)计算机上的
bundle exec cap production puma:stop
执行此操作

使用
bundle exec cap production puma:Start重新启动它


这假设您使用的是
capistrano puma
gem,它看起来是基于您发布的配置。请注意,这只会禁用Rails应用程序,并且您的VPS和Nginx将继续运行。

停止Puma服务器将禁用该应用程序

您可以使用部署(本地)计算机上的
bundle exec cap production puma:stop
执行此操作

使用
bundle exec cap production puma:Start重新启动它

这假设您使用的是
capistrano puma
gem,它看起来是基于您发布的配置。请注意,这只会禁用Rails应用程序,并且您的VPS和Nginx会继续运行