I have a Rails 4.2.1 application using Ruby 2.2. I try to use Whenever Gem updates cron tasks on my Elastic Beanstalk from my code base. I followed several resources from AWS where you can add files to a folder .ebextensionsand use the DB2 deployment hook through shell files. Here are some resources:
After the blog articles, I added the file below, uncommented the gitignore line about the files in the folder, .ebextensionsand deployed my application. Unfortunatley, I was able to see any changes. I checked the log files ( log/eb-tools.log, log/cronetc.) and grepped all the log files for the shell file that I create, each time, etc. No luck though.
commands:
create-post-dir:
command: "mkdir /opt/elasticbeanstalk/hooks/appdeploy/post"
ignoreErrors: true
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/99_update_cron.sh"
mode: "000755"
owner: root
group: root
content: |
EB_SCRIPT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k script_dir)
EB_SUPPORT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k support_dir)
EB_APP_USER=$(/opt/elasticbeanstalk/bin/get-config container -k app_user)
EB_APP_CURRENT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_deploy_dir)
EB_APP_PIDS_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_pid_dir)
. $EB_SUPPORT_DIR/envvars
. $EB_SCRIPT_DIR/use-app-ruby.sh
su -c "cd $EB_APP_CURRENT_DIR; bundle exec whenever --update-cron --set='environment=$RACK_ENV'" - $EB_APP_USER
How can I make sure this shell file is called? Can I test it without a new deployment every time? In addition, I am open to other options if every time a gem is not the best option. Basically, I want my cron tasks to be managed in code and under version control.
Thanks in advance!
UPDATE:
.ebextensions, - . cron script, crontab, Whenever.