Back to Template

Diff of Changes

Previous version at this commit

run "bundle install"
run "bundle add eb_deployer"
run "bundle add webrick"
run "bundle add rails-healthcheck"
run "bundle install"

generate("healthcheck:install")

# generate eb_deployer config file
run "eb_deploy"

# clone beanstalk_dotfiles
run "git clone https://github.com/jeremiahlukus/beanstalk_dotfiles.git"
# move files into root project
run "mv beanstalk_dotfiles/.ebextensions/ ."
run "mv beanstalk_dotfiles/.platform/ ."

# add stack to line 8 on eb_deployer.yaml
run "sed -i -e '8r beanstalk_dotfiles/stack.yaml' config/eb_deployer.yml"
# add db and redis env vars and instance profile to beanstalk env
run "sed -i -e '117r beanstalk_dotfiles/standard_setup.yaml' config/eb_deployer.yml"

run "sed -i -e '18r beanstalk_dotfiles/puma_config.rb' config/puma.rb"
# change to a bigger ec2
run "sed -i -e 's/m1.small/c3.large/g' config/eb_deployer.yml"
# latest supported aws ruby version 
run "echo '3.0.2' > .ruby-version"

if yes?("Do you want to setup an RDS? [y/n]")
   copy_file "./beanstalk_dotfiles/cf_rds.json", "./config/cf_rds.json"
  copy_file "./beanstalk_dotfiles/example_deploy.sh", "."
  run "sed -i -e '166r beanstalk_dotfiles/rds.yml' config/eb_deployer.yml"
  run "sed -i -e 's/dev/staging/g' config/eb_deployer.yml"
  run "sed -i -e '67r beanstalk_dotfiles/database.yml' config/database.yml"
  run "rm -f config/database.yml-e"
end

# clean up
run "rm -f config/puma.rb-e"
run "rm -rf beanstalk_dotfiles/"
run "rm -f config/eb_deployer.yml-e"

run "echo 'If you chose to create a database you will need to deploy two times, the first time will create the database, then you need to set the database creds as ENV vars so your app can connect to it'"