我正在使用mina
deploy部署源,但是puma
服务器没有启动,并且pumactl.sock
这个文件没有创建。
deploy.rb
require 'mina/bundler'
require 'mina/puma'
require 'mina/rails'
require 'mina/git'
require 'mina/rbenv'
set :rails_env, 'production'
set :application_name, 'testapp'
set :domain, ENV['DOMAIN']
set :deploy_to, '/var/www/html/testapp'
set :repository, 'git@example.com/test.git'
set :branch, 'working_code'
set :user, ENV['DEPLOY_USER']
set :shared_dirs, fetch(:shared_dirs, []).push('log', 'tmp/pids', 'tmp/sockets', 'public/uploads','tmp/log')
set :shared_files, fetch(:shared_files, []).push('config/master.key')
task :remote_environment do
invoke :'rbenv:load'
end
# Put any custom commands you need to run at setup
# All paths in `shared_dirs` and `shared_paths` will be created on their own.
desc "Deploys the current version to the server."
task :deploy do
deploy do
comment "Deploying to #{fetch(:application_name)} to #{fetch(:domain)}: #{fetch(:deploy_to)}"
invoke :'git:clone'
invoke :'deploy:link_shared_paths'
invoke :'bundle:install'
invoke :'rails:db_migrate'
invoke :'rails:assets_precompile'
invoke :'deploy:cleanup'
on :launch do
in_path(fetch(:current_path)) do
command %{mkdir -p tmp/}
command %{touch tmp/restart.txt}
#invoke :'puma:phased_restart'
invoke :'puma:restart'
end
end
end
end
puma.rb
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i
threads threads_count, threads_count
# Specifies the `port` that Puma will listen on to receive requests, default is 3000.
#
port ENV.fetch("PORT") { 3000 }
# Specifies the `environment` that Puma will run in.
#
environment ENV.fetch("RAILS_ENV") { "development" }
# Allow puma to be restarted by `rails restart` command.
plugin :tmp_restart
if ENV.fetch('RAILS_ENV') == 'production'
bind "unix:///var/www/html/testapp/shared/tmp/sockets/puma.sock"
pidfile "/var/www/html/testapp/shared/tmp/pids/puma.pid"
state_path "/var/www/html/testapp/shared/tmp/sockets/puma.state"
directory "/var/www/html/testapp/current"
daemonize true
activate_control_app 'unix:///var/www/html/testapp/shared/tmp/sockets/pumactl.sock'
stdout_redirect "/home/ubuntu/var/www/html/testapp/shared/tmp/log/stdout", "/home/ubuntu/var/www/html/testapp/shared/tmp/log/stderr"
prune_bundler
end