File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 22require 'aws-sdk'
33require 'dotenv/environment'
44require 'fog'
5+ require 'erb'
56
67module EbFastDeploy
78
@@ -267,6 +268,28 @@ def print_env
267268
268269 end
269270
271+ desc "Set eb extension to run whenever on all instances"
272+ task :whenever_ebextension do
273+ set_vars
274+ if @eb_ruby_container_options [ "WHENEVER_ALL" ] == "true"
275+ template = <<-EOF
276+ commands:
277+ 01whenever:
278+ command: bundle exec whenever --set environment=$RACK_ENV -u webapp --update-crontab >/tmp/whenever_command.log 2>&1
279+ leader_only: false
280+ EOF
281+ output_file = ".ebextensions/whenever_all.config"
282+ dir = File . dirname output_file
283+ unless File . directory? ( dir )
284+ FileUtils . mkdir_p ( dir )
285+ end
286+ File . delete output_file if File . exists? output_file
287+ output = File . open ( File . join ( Rails . root , output_file ) , "w" )
288+ output << ERB . new ( template ) . result ( binding )
289+ end
290+ end
291+
292+
270293 desc "print the current env status"
271294 task :print_current_status do
272295 set_vars
@@ -339,6 +362,7 @@ def print_env
339362 desc "deploy to elastic beanstalk"
340363 task :deploy => [
341364 :assets ,
365+ :whenever_ebextension ,
342366 :bundle_pack ,
343367 :upload ,
344368 :create_and_deploy_version
You can’t perform that action at this time.
0 commit comments