This repository contains:
- Docker images with pre-populated data for integration testing
As part of standard QA process, we test different types of database setups:
- Single schema, single user access
- Multi schema, single user access
- Multi schema, multi user access
What this looks like in practice, is we have the following configurations:
- Metabase Sample Database with a single
metabase
user - Metabase Sample Database + second schema with other random sample data
- Custom sample data that may or may not be database dependent
- e.g. Postgres JSON types
Use Docker images of the form: metabase/qa-databases:{DATABASE}-{QA_TYPE}-{VERSION}
Currently the only supported databases are mongo
, postgres
and mysql
and the only supported "QA type" is sample
.
Supported database versions have their own Dockerfile in each directory.
We use a standard set of database names and users for our sample images:
- Database name:
sample
- Username:
metabase
- Password:
metasample123
Listed below are the examples for running each of the supported databases in Docker.
docker run --rm -p 27017:27017 --name meta-mongo4-sample metabase/qa-databases:mongo-sample-4.0
docker run --rm -p 5432:5432 --name meta-postgres12-sample metabase/qa-databases:postgres-sample-12
docker run --rm -p 3306:3306 --name meta-mysql8-sample metabase/qa-databases:mysql-sample-8
These images are currently pushed to the public metabase/qa-databases repository:
metabase/qa-databases:mongo-sample-4.0
metabase/qa-databases:mysql-sample-5.7
metabase/qa-databases:mysql-sample-8
metabase/qa-databases:postgres-sample-11
metabase/qa-databases:postgres-sample-12
Building is manual for now until we support more databases.
For Postgres, sample_data.sql.gz
contains the Metabase Sample Database.
For Mongo, we extract the sample data from Postgres into files that are then loaded with mongoimport
.
To build either the mongo
or postgres
images, change into the respective directory and execute the build.sh
script.
cd dbs/postgres
./build.sh
WARNING: This currently also tries to push the image to Docker Hub, so if you don't have access that part will fail.
If the Sample Database has changed in Postgres, you can run ./update_data.sh
in dbs/mongo
to update the data files.
- Saving a Postgres Database in a Docker Image
- eksctl has a good example of committing an intermediate image.
- A couple other good Docker/Makefile tooling examples