Not able to run laravel migrations in the release build on build server #2745
-
We have a build server on we build a new build and store it under another directory on build server. After creating the build, we intent to run unit tests or manually test our new build on the build server before we deploy to many application servers at once. To accomplish this we need to run migrations and seeders, of course also need to generate application key every time we make a build. We are able to dynamically create a new database for each build, cp or touch the new .env file into
in deploy.php it does not pickup the new database we are creating, it rather run migrations into actual build project we are building from, which is We cleared cache and configuration before running the any of those commands but seems whatever we initiate it, the If we cd into
Any perspective or guidance is appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
Please show your deploy.php. |
Beta Was this translation helpful? Give feedback.
-
Thank you all for pointing to possible fix. To load the multiple hosts from the database we are using vlucas/phpdotenv to connect to database and for some reason deployer was keeping database connection from project we have installed it in. I am able to resolve the issue using createMutable instead of createImmutable method. Since we are interacting with multiple databases from the deploy.php we have to initiate the database connection each time we connect to a different database. We can pass the .env file like this and overwrite existing environment variables.
AND
|
Beta Was this translation helpful? Give feedback.
Thank you all for pointing to possible fix.
To load the multiple hosts from the database we are using vlucas/phpdotenv to connect to database and for some reason deployer was keeping database connection from project we have installed it in.
I am able to resolve the issue using createMutable instead of createImmutable method. Since we are interacting with multiple databases from the deploy.php we have to initiate the database connection each time we connect to a different database.
We can pass the .env file like this and overwrite existing environment variables.