How to automatically restart delayed_job when deploying a rails project on Amazon Elastic Beanstalk?

后端 未结 4 1038
走了就别回头了
走了就别回头了 2020-12-05 05:42

I\'m hosting a rails project on Amazon Elastic Beanstalk and I try to configure a container command to automatically restart my delayed_job worker on the server after each d

4条回答
  •  感动是毒
    2020-12-05 06:05

    I got mine working like so with the "daemons" gem:

    commands:
      create_post_dir:
        command: "mkdir /opt/elasticbeanstalk/hooks/appdeploy/post"
        ignoreErrors: true
      webapp_pids:
        command: "mkdir /home/webapp/pids"
        ignoreErrors: true
    files:
      "/opt/elasticbeanstalk/hooks/appdeploy/post/99_restart_delayed_job.sh":
        mode: "000755"
        owner: root
        group: root
        content: |
          #!/usr/bin/env bash
          . /opt/elasticbeanstalk/support/envvars
          chown webapp:webapp /home/webapp/pids
          su -l -c "$EB_CONFIG_APP_CURRENT/bin/delayed_job --pid-dir=/home/webapp/pids restart" $EB_CONFIG_APP_USER
          echo "worker starting" >> /var/log/directory-hooks-executor.log
    

提交回复
热议问题