I have a multi-server laravel php application running behind a load balancer and I deploy the code using aws codebuild and codepipeline. The approach is to deploy my application one server at the time.

Also, the application uses a postgresql database that was manually generated without any sort of migration script. Therefore, I introduced a database migration scheme.

The pipeline for the production goes as follows:

  1. Fetch the code from master branch. (Master is the production branch)
  2. Install dependencies and run tests.
  3. Deploy to the servers, one at a time.

So I want to add the step that databases are being migrated but I do not know where this step should be executed. Should be executed before deployment to the servers or during server deployment once code successfully has been deployed to one server?

Because the schema previously had no migration scripts I want to ensure that no data corruption will occur during deployment and the downtime will be minimal as possible.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.