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

Abstract away database settings #38

Open
davidsiaw opened this issue Jan 14, 2020 · 0 comments
Open

Abstract away database settings #38

davidsiaw opened this issue Jan 14, 2020 · 0 comments

Comments

@davidsiaw
Copy link
Collaborator

davidsiaw commented Jan 14, 2020

Current kaiserfiles have huge amounts of code to define how to database:


db 'postgres:alpine',
   port: 5432,
   data_dir: '/var/lib/postgresql/data',
   params: '-e POSTGRES_PASSWORD=example',
   waitscript_params: "
     -e PG_HOST=<%= db_container_name %>
     -e PG_USER=postgres
     -e PGPASSWORD=example
     -e PG_DATABASE=postgres",
   waitscript: <<~SCRIPT
     #!/bin/sh

     RETRIES=5

     until psql -h $PG_HOST -U $PG_USER -d $PG_DATABASE -c "select 1" > /dev/null 2>&1 || [ $RETRIES -eq 0 ]; do
       echo "Waiting for postgres server, $((RETRIES--)) remaining attempts..."
       sleep 1
     done
   SCRIPT

This is nice and general and suitable for a large family of databases that are in practical use today.

But need to make this easier for well-known databases, or make something like a Kaiser plugin repository where kaiser can simply retrieve them.

Something like

database :postgres

And if you want to specify an image

database :postgres, image: 'postgres:alpine'

If you want to add additional params (ala KOMOJU)

database :mysql, image: 'mysql:5.6', commands: <<~CMD
    --character-set-server=utf8mb4
    --collation-server=utf8mb4_unicode_ci
    --innodb-large-prefix
    --innodb-file-format=barracuda
CMD

And maybe some well known params for the database:

database :mysql, env: {
  MYSQL_ROOT_PASSWORD: 'qwerty'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant