architect-team / arcctl

Apache License 2.0
4 stars 0 forks source link

Database seeding #6

Open davidthor opened 1 year ago

davidthor commented 1 year ago

Database seeding is an important feature for on-demand environments to allow those environments to be loaded with data when booting up from scratch.

# component schema
databases:
  main:
    type: postgres:13
    seed:
      image: my-image:latest
      command: npm run seed
      environment:
        DB_ADDR: ${{ databases.main.url }}

Not all environments will want to run seed scripts. For this reason, you'll have to enable seed scripts in your environment configuration:

# environment schema

flags:
  database_seeding: true

components:
  architect/cloud:
    source: architect/cloud:latest

# ...
mueschm commented 1 year ago

Only odd part here is its not obvious how the image for the seed knows the connection credentials or what it has access too.

davidthor commented 1 year ago

Only odd part here is its not obvious how the image for the seed knows the connection credentials or what it has access too.

Totally forgot to add that part. I had assumed they would behave just like services and tasks and take in environments variables. See my edits to the original comment that now include an environment field on the migration task.