Skip to content
Snippets Groups Projects

Support db migration and initialization for Auto DevOps

Merged Thong Kuah requested to merge 48004-db-initialize-migrate into master

Pre-requisite

What does this MR do?

if $DB_INITIALIZE is present, deploy an initial release where only $DB_INITIALIZE is run in a special job (and deployments are not rendered/loaded). This is then followed by second release with deployments as usual.

if $DB_MIGRATE, set this value which will trigger a pre-upgrade helm hook.

Due to helm not supporting hook logs, this MR does not show the logs from the intialization and migration logs.

What are the relevant issue numbers?

https://gitlab.com/gitlab-org/gitlab-ce/issues/48004

Tasks

  • Document :

For an example Rails project :

  • We can set DB_INITIALIZE: cd /app && RAILS_ENV=production bin/setup and DB_MIGRATE: cd app && RAILS_ENV=production bin/update

  • /app is from herokuish buildpacks. Can use $APP_PATH too

  • Also, there is only one chance to run $DB_INITIALIZE. If the first deploy successfully completes, $DB_INITIALIZE will never be run again. If $DB_INITIALIZE is present during the first deploy though and it errors or fails, that doesn't cound as a successfully first deploy

Does this MR meet the acceptance criteria?

Closes #48004 (closed)

Edited by 🤖 GitLab Bot 🤖

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Author Maintainer
    • Document :

    What I had is DB_INITIALIZE: cd /app && RAILS_ENV=production bin/setup and

    DB_MIGRATE: cd app && RAILS_ENV=production bin/update

    /app is from herokuish buildpacks. Can use $APP_PATH too

    Edited by Thong Kuah
  • Thong Kuah changed the description

    changed the description

  • Thong Kuah changed the description

    changed the description

  • Thong Kuah changed the description

    changed the description

  • Thong Kuah marked the checklist item Document : as completed

    marked the checklist item Document : as completed

  • Thong Kuah marked the checklist item Documentation created/updated as completed

    marked the checklist item Documentation created/updated as completed

  • Thong Kuah marked the checklist item Conforms to the code review guidelines as completed

    marked the checklist item Conforms to the code review guidelines as completed

  • Thong Kuah marked the checklist item Conforms to the merge request performance guidelines as completed

    marked the checklist item Conforms to the merge request performance guidelines as completed

  • Thong Kuah marked the checklist item Conforms to the style guides as completed

    marked the checklist item Conforms to the style guides as completed

  • Thong Kuah added 1 commit

    added 1 commit

    • 681b7d7b - Document how to use DB_INITIALIZE and DB_MIGRATE

    Compare with previous version

  • Thong Kuah marked the checklist item Conforms to the database guides as completed

    marked the checklist item Conforms to the database guides as completed

  • assigned to @axil

  • @axil could you please do a review of the docs in this. Thanks.

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading