I'm trying to deploy a Laravel application on AWS using Elastic Beanstalk CLI. I have created an application and an environment, and created an RDS instance. I have added some .ebextension scripts to run migrations and seed the database.
All works fine when I zip the entire application directory and upload the zip-file, however, when I write "eb deploy", it doesn't work. The deployment works and has green health, but I get two "Whoops, it didn't work"-errors when I try to access the site.
I think composer isn't running on beanstalk as it should, it should run automatically, right? I've made sure that /vendor is in the gitignore and that composer.json isn't in gitignore.
How can I run composer as a script on deployment? Maybe that could fix it.
Any other ideas about this?
I recently did a Laravel migration from digital ocean to AWS elastic beanstalk. With regard to your error did you set the software configuration variables in AWS prior to running eb deploy?
When it comes to composer I have a file in the .ebextensions folder called 00composer.config and here's the contents:
Yeah! Just make sure that you zip all the files in the directory that has your application by selecting them all, and not the entire directory. This way, you will have composer.json in the root directory and it will run upon deployment. I.e, that your zip-file has /composer.json and not /projectname/composer.json.
I also had this file in .ebextensions for migrations: