Skip to content

Deployment lifecycle hooks #205

Closed as not planned
Closed as not planned
@davidthor

Description

Containers are able to perform a number of operations on startup, but they lack hooks that would apply to environments outside their runtime. Scripts run on container start are run a) for each replica of a service on startup, b) whenever the container cycles, and c) whenever a container is service is updated. This startup scripting lacks the granularity needed to run scripts only once on service creation, update, or deletion instead of once per replica.

Proposal

We'd like to introduce lifecycle hooks for service creators to attach scripts to. These lifecycle hooks are great places for developers to seed or migrate attached databases, register themselves as client applications of 3rd party services, and more:

name: architect/api
hooks:
  # Runs whenever a new version of the service is deployed to an environment
  on_update:
    command: sql migrate
  # Runs when the service is introduced to an environment for the first time. 
  on_create:
    # In order to keep our primary service containers lean, we may choose to
    # put scripts like these into a different container
    image: architect/api-db-migrator:1.0.0
    command: sql migrate && sql seed
  # Runs when the service is removed from the environment
  on_delete:
    command: sql migrate down

Metadata

Assignees

No one assigned

    Labels

    discussionQuestions regarding ideal spec syntaxproposalNot yet accepted proposal for a feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions