We are deploying a Laravel application on aws opsworks, everything is running great, however we need to do two other things:
1) On each deployment we want to run php artisan migrate
to install the database updates.
2) We have a file (app/database/run.list) which contains a list of class names, for each line in the file we want to run php artisan db:seed --class={line from file}
.
e.g.
run.list contains
NewSystemSeed
NewUserSeed
CreateDefaultTemplatesSeed
we want to run
php artisan db:seed --class=NewSystemSeed
php artisan db:seed --class=NewUserSeed
php artisan db:seed --class=CreateDefaultTemplatesSeed
That parts not exactly difficult (although I am a bit stuck on the last one). The part that I am stuck on is, we only want to do this on the first instance in a specific layer (the php-app layer).
We obviously don't want to end up seeding the database for every instance!
Is there a way to automate this, or must we create another recipe, then after deployment manually trigger this recipe on the instance?