简体   繁体   中英

Problem with executing laravel migrations on Elastic Beanstalk

I deployed my laravel application using Elastic beanstalk, and I need to execute php artisan:migrate command on the remote database. Based on Maximilian's tutorial I created init.config file inside.ebextensions with contents:

container_commands:
    01initdb:
        command: "php artisan migrate"

The status of the deployment is Healthy, but it didn't create any table, any clues? please?

运行php artisan config:cache然后运行migration命令

hello so first of all you run this command in your cmd

php artisan config:cache

then you run this commmand..

php artisan migrate

As you did not include any relevant logs. I am guessing you need to run your migration within the staging folder.

An example of how you can run migrations:

  04_run_migrations:
    command: "php artisan migrate --force"
    cwd: "/var/app/staging"
    leader_only: true
  • --force is needed cause php artisan migrate asks you if you are sure to run it on a production environment
  • leader_only is needed if you use horizontal scaling.

Source: https://github.com/rennokki/laravel-aws-eb/blob/master/.ebextensions/01_deploy.config

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM