2
我知道這裏有一些關於此的文章,但我試圖在Elastic Beanstalk上部署Rails應用程序,並在部署過程中啓動delayed_job,但我沒有設法得到這個工作呢。部署Rails應用程序與delayed_job作爲守護程序任務運行
我試過設置在.ebextensions文件夾中的配置文件:
命令: 創建,-DIR後: 命令: 「MKDIR的/ opt/elasticbeanstalk /鉤/ appdeploy /後」 ignoreErrors :真
文件: 「/opt/elasticbeanstalk/hooks/appdeploy/post/restart_delayed_job.sh」: 模式: 「000755」 老闆:根 組:根 內容:| #!的/ usr/bin中/ env的慶典
# Loading environment data
EB_APP_USER=$(/opt/elasticbeanstalk/bin/get-config container -k app_user)
EB_APP_DEPLOY_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_deploy_dir)
EB_APP_PID_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_pid_dir)
EB_SCRIPT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k script_dir)
EB_SUPPORT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k support_dir)
# Export EB_APP_LOG_DIR so we can access it when running bin/delayed_job below,
# which accesses config/initializers/delayed_job.rb, which uses EB_APP_LOG_DIR.
export EB_APP_LOG_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_log_dir)
# Make sure the delayed_job.log exists and is owned by $EB_APP_USER
touch $EB_APP_LOG_DIR/delayed_job.log
chown $EB_APP_USER:$EB_APP_USER $EB_APP_LOG_DIR/delayed_job.log
# Setting up correct environment and ruby version so that bundle can load all gems
. $EB_SUPPORT_DIR/envvars
. $EB_SCRIPT_DIR/use-app-ruby.sh
# Now we can do the actual restart of the worker. Make sure to have double quotes when using env vars in the command.
# For Rails 4, replace script/delayed_job with bin/delayed_job
cd $EB_APP_DEPLOY_DIR
su -s /bin/bash -c "bundle exec bin/delayed_job --pid-dir=$EB_APP_PID_DIR restart" $EB_APP_USER
su -s /bin/bash -c "bundle exec bin/delayed_job --pid-dir=$EB_APP_PID_DIR status" $EB_APP_USER
與得到這個工作的任何幫助,不勝感激!
任何這方面的運氣? –