seuros / capistrano-puma

Puma integration for Capistrano
https://github.com/seuros/capistrano-puma
MIT License
615 stars 299 forks source link

Unit puma_app_production.service has a bad unit file setting #335

Closed vkalach closed 2 years ago

vkalach commented 2 years ago

Hey guys! When I start manually puma on the server - everything works as expected. But when I try to do it within Capistrano - I receive this error. Failed to restart puma_app_production.service: Unit puma_app_production.service has a bad unit file setting

to start puma I use also rbenv

these are my files puma_app_production.service

[Unit]
Description=Puma HTTP Server for app (production)
After=network.target

[Service]
Type=simple
User=rails_api
WorkingDirectory=/home/rails_api/apps/app/current
# Support older bundler versions where file descriptors weren't kept
# See https://github.com/rubygems/rubygems/issues/3254
ExecStart=RBENV_ROOT=/home/rails_api/.rbenv RBENV_VERSION=3.0.2 /home/rails_api/.rbenv/bin/rbenv exec bundle exec --keep-file-descriptors puma -C /home/rails_api/apps/app/shared/puma.rb
ExecReload=/bin/kill -USR1 $MAINPID
StandardOutput=append:/home/rails_api/apps/app/current/log/puma.access.log
StandardError=append:/home/rails_api/apps/app/current/log/puma.error.log

Restart=always
RestartSec=1

SyslogIdentifier=puma

[Install]
WantedBy=multi-user.target

I was trying to deal with this problem so I also added this line to deploy.rb file: append :rbenv_map_bins, 'puma', 'pumactl'

Any suggestions?

vkalach commented 2 years ago

okay, I moved RBENV_ROOT=/home/rails_api/.rbenv RBENV_VERSION=3.0.2 to Environment= and it works

anyway, this file is generated by this gem, I guess