Skip to content

GitLab Next

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • See what's new at GitLab
    • Help
    • Support
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
GitLab FOSS
GitLab FOSS
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • Requirements
    • Requirements
    • List
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Code Review
    • Insights
    • Issues
    • Repository
    • Value Stream
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
  • GitLab.org
  • GitLab FOSSGitLab FOSS
  • Issues
  • #48004

Closed
Open
Opened Jun 15, 2018 by Mark Pundsack@markpundsack
  • Report abuse
  • New issue
Report abuse New issue

Support PostgreSQL DB migration and initialization for Auto DevOps

Problem to solve

Apps need to have databases configured before they work, and migrations run when they're updated. Auto DevOps doesn't currently support methods to initialize or migrate databases.

Further details

When apps are first deployed, they sometimes need a database to be initialized before they'll even start running.

When apps are updated and migrations are needed, they'll sometimes fail until the migrations are performed

Proposal

Option 1
Implement support for db initilization and migration for auto devops.

On initialize:

  • Create post install hook
  • initialize
  • restart app

On migration:

  • Create pre-upgrade hook
  • run migration

Pseudocode:

  • if $DB_INITIALIZE

    • Create post-install hook:
      • run $DB_INITIALIZE
      • restart app pods
  • if $DB_MIGRATE

    • Create pre-upgrade hook:
      • run $DB_MIGRATE

Option 2
Split up the helm chart into a db chart and an app chart. This allows for separate deployment of db with a post-install hook to initialize. Application can then be started after db in configured.

Option 3
User kubernetes custom controllers (operators) to do this outside of helm. There seem to be already some existing postgres operators that could be leveraged.

What does success look like, and how can we measure that?

(If no way to measure success, link to an issue that will implement a way to measure this)

Notes/Questions

  • How can we know how to run database commands for every language? Some buildpacks have this built in, but some don't (notably Ruby/Rails buildpack). Ideally we'd just rely on Herokuish to configure this for us, but it doesn't work. Even if we have good defaults, some teams may need to customize their database initialization and migration commands.

  • Keep env variables generic (ie $initialize, $pre_deploy, $post_deploy

Links / references

  • Helm hooks
  • Heroku Release Phase
  • https://gitlab.com/gitlab-org/gitlab-ce/issues/33520
Edited Oct 10, 2018 by Daniel Gruesso

Linked issues

  • Discussion
  • Designs
Assignee
Assign to
11.4
Milestone
11.4
Assign milestone
Time tracking
None
Due date
None
8
Labels
Category:Auto DevOps Deliverable Product Vision 2018 application control panel devopsconfigure direction feature groupconfigure
Assign labels
  • View project labels
Reference: gitlab-org/gitlab-foss#48004