Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database seeding #6

Open
davidthor opened this issue May 22, 2023 · 2 comments
Open

Database seeding #6

davidthor opened this issue May 22, 2023 · 2 comments
Labels
components Issues related to creating components enhancement New feature or request

Comments

@davidthor
Copy link
Member

davidthor commented May 22, 2023

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

# ...
@davidthor davidthor added this to the v0.2 - Lifecycle hooks milestone May 22, 2023
@mueschm
Copy link
Member

mueschm commented May 30, 2023

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
Copy link
Member Author

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.

@davidthor davidthor added enhancement New feature or request components Issues related to creating components labels Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
components Issues related to creating components enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants