How to get systemd to restart Rails App with Puma

后端 未结 2 1756
闹比i
闹比i 2021-02-08 00:20

I\'ve been struggling with this a week now and really can\'t seem to find an answer. I\'ve deployed my Rails App with Capistrano. I use Puma as a server.

When I deploy,

2条回答
  •  青春惊慌失措
    2021-02-08 00:58

    At the end the problem was twofold: 1) rvm wasn't installed properly for all users, which meant the deployer user didn't have ruby/bundle/etc available and secondarily the script was also wrong. For reference below is the revised script that worked for me:

    [Unit]
    Description=Puma HTTP Server
    After=network.target
    
    [Service]
    Type=simple
    
    User=deployer
    
    WorkingDirectory=/var/www/apps/MRCbe/current
    
    ExecStart=/bin/bash -lc 'bundle exec puma -C /var/www/apps/MRCbe/shared/puma.rb'
    
    Restart=always
    
    [Install]
    WantedBy=multi-user.target
    

提交回复
热议问题