以下、環境となります。
環境 | バージョン |
---|---|
Rails | 7.0.0 |
Ruby | 3.0.0 |
capistrano | 3.16.0 |
本番環境 | Amazon EC2 Linux |
capistranoでデプロイをしているとinvoke 'puma:stop'
の項目から以下のログが出力されてデプロイが先に進みません。
INFO [41bfeeb4] Running /usr/bin/env sudo /bin/systemctl stop puma_〇〇_production as deploy@〇〇 DEBUG [41bfeeb4] Command: ( export RBENV_ROOT="/usr/local/src/rbenv" RBENV_VERSION="3.0.0" ; /usr/bin/env sudo /bin/systemctl stop puma_〇〇_production ) DEBUG [41bfeeb4] あなたはシステム管理者から通常の講習を受けたはずです。 これは通常、以下の3点に要約されます: #1) 他人のプライバシーを尊重すること。 #2) タイプする前に考えること。 #3) 大いなる力には大いなる責任が伴うこと。 DEBUG [41bfeeb4] [sudo] deploy のパスワード:
見た感じ権限系のエラーかなと思うのですが、誰か解決方法をご存知ないでしょうか?
どうかよろしくお願いいたします。
deploy.rb
set :application, '〇〇' set :repo_url, '〇〇' # ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp } set :deploy_to, '/var/www/〇〇' set :puma_threads, [4, 16] set :puma_workers, 0 set :pty, true set :use_sudo, false set :stage, :staging set :deploy_via, :remote_cache set :deploy_to, "/var/www/#{fetch(:application)}" 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.access.log" set :puma_error_log, "#{release_path}/log/puma.error.log" set :puma_preload_app, true set :puma_worker_timeout, nil set :puma_init_active_record, true set :puma_restart_command, 'bundle exec puma' set :rbenv_type, :system set :rbenv_path, '/usr/local/src/rbenv' set :rbenv_ruby, '3.0.0' set :linked_dirs, fetch(:linked_dirs, []).push( 'log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system', 'public/uploads', ) set :linked_files, fetch(:linked_files, []).push( 'config/database.yml', 'config/secrets.yml', 'config/puma.rb', '.env', ) namespace :puma do Rake::Task[:restart].clear_actions desc 'Overwritten puma:restart task' task :restart do puts 'Overwriting puma:restart to ensure that puma is running. Effectively, we are just starting Puma.' puts 'A solution to this should be found.' invoke 'puma:stop' invoke 'puma:start' end desc 'Create Directories for Puma Pids and Socket' task :make_dirs do on roles(:app) do execute "mkdir #{shared_path}/tmp/sockets -p" execute "mkdir #{shared_path}/tmp/pids -p" end end before :start, :make_dirs end namespace :deploy do desc 'Make sure local git is in sync with remote.' task :check_revision do on roles(:app) do unless `git rev-parse HEAD` == `git rev-parse origin/master` puts 'WARNING: HEAD is not the same as origin/master' puts 'Run `git push` to sync changes.' exit end end end desc 'Restart application' task :restart do on roles(:app), in: :sequence, wait: 5 do invoke 'puma:restart' end end before :starting, :check_revision after :finishing, :compile_assets after :finishing, :cleanup end after 'deploy', 'sitemap:refresh'
Capfile
# Load DSL and Setup Up Stages require 'capistrano/setup' # Includes default deployment tasks require 'capistrano/deploy' # Includes tasks from other gems included in your Gemfile # # For documentation on these, see for example: # # https://github.com/capistrano/rvm # https://github.com/capistrano/rbenv # https://github.com/capistrano/chruby # https://github.com/capistrano/bundler # https://github.com/capistrano/rails/tree/master/assets # https://github.com/capistrano/rails/tree/master/migrations # # require 'capistrano/rvm' # require 'capistrano/rbenv' # require 'capistrano/chruby' # require 'capistrano/bundler' require 'capistrano/scm/git' install_plugin Capistrano::SCM::Git require 'capistrano/rails' require 'capistrano/rbenv' require 'capistrano/rails/assets' require 'capistrano/rails/migrations' require 'capistrano/bundler' require 'capistrano/puma' require 'capistrano/sitemap_generator' require 'whenever/capistrano' require 'dotenv' Dotenv.load install_plugin Capistrano::Puma install_plugin Capistrano::Puma::Systemd # Loads custom tasks from `lib/capistrano/tasks' if you have any defined. Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。