I know that you can run tasks as part of each deploy, but I only want to bootstrap the database once.
to do commands on your elastic beanstalk instance, you can setup custom commands configurations that will get run when you do update your application. (In fact, there is a whole docs page dedicated to the different types of container commands you can do).
.ebextensions
directory in the root of your application, create one..config
" -- I arbitrarily named mine seed.config
borrowing from what hfogel wrote, you can put something in there like this:
container_commands:
01seed:
command: rake db:seed
add this new code to your repo: git add .
then git commit -m 'added seed config script'
then git push
git aws.push
To verify that your command actually ran, go into your elastic beanstalk console and expand the details for your environment, and navigate to the logs
tab, and refresh your logs and view them. Inside there, simply do a ctrl + f
for "seed" until you see your seed command was run. If you don't see it in there somewhere, then it didn't run.