This project intends to facilitate the task of developing a production ready environment for Metabase.
This document does not explain how to use Metabase, please refer to the official documentation for usage instructions.
The Compose uses the following images:
The database images (
mysql,postgres) are created via dockerfiles that a wrap the official images.
Container configurations depend on environment variables defined in an .env file.
- Copy the
.env.examplefile and rename it to.env - Replace the environment values to your desire. See environment explanatory chart below
Database environment:
DB_TYPE:can be eitherpostgresormysqlDB_NAME:the name of the databaseDB_USER:a database user different than rootDB_PASSWORD:a password forDB_USERDB_ROOT_PASSWORD:a password for the root user (only for MySQL)DB_PORT:use3306for mysql or5432for postgres. This value is used for the metabase container.DB_OUTSIDE_VOLUME:a name for the database volume. Defaults todb-data. If you change this you'll have to modify thevolumessection in thedocker-composefile.DB_INSIDE_VOLUME:use/var/lib/mysqlfor mysql or/var/lib/postgresql/datafor postgres. This values are used by the official images inside the container.
Adminer environment:
ADMINER_PORT:the port where Adminer will be available
Metabase environment:
MB_DB_FILE:directory where the metabase file will be writtenMB_PORT:the port where Metabase will be availableMB_VOLUME:a name for the metabase volume. Defaults tomb-data. If you change this you'll have to modify thevolumessection in thedocker-composefile.MB_JAVA_TIMEZONE:timezone to match the timezone reports. More info about the Metabase environment. List of available timezone IDs
- Run
docker-compose buildto create a database image (mysqlorpostgres) - Run
docker-compose upto run the applications - Use
docker-compose downto shutdown all services - Use
docker-compose upto re-run all services whenever you want - There is no need to re-run
docker-compose buildunless you change the database strategy, database name, database credentials or the volumes.
Whenever you run a configuration, a docker volume is created for that persistence strategy (postgres, mysql). The init command in either the postgres or the mysql image try to create a database in the given volume, if the volume exists the initialisation command will fail.
If you later decide to use another database strategy (postgres, mysql) you will have to either change the DB_OUTSIDE_VOLUME value or delete the current volume. Renaming the value also implies modifying the docker-compose file in the volumes section. You can achieve a volume removal by searching your volume with docker volume ls, then remove it docker volume rm <volume-name>. Or use simply run this:
docker volume rm $(docker volume ls | grep db-data | awk '{print $2}')
db-datais the default volume name assigned in.env.example. Replace that with your volume name, if you used another value in.env.
If you can't remove the volume, then it's probably it's in use. Use docker-compose down to shut the application down.
Only then you are be able to repeat the instructions to re-run the applications using: docker-compose build, then docker-compose up.
If you'd like to improve or add features on this project feel free to open an issue.
GNU General Public License version 3
👩💻 with 💚 💜 ❤️ by cambá.coop 🌎 Buenos Aires, Argentina
