0
我已經使用這個部署選項通過Capistrano的部署我的應用程序到VPS:Capistrano的,禁用部署生產應用
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生產應用程序?