Metabase.
This project intends to facilitate the task of developing a production ready environment forMetabase Compose
About
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.
Development
Requirements
Configuration
Container configurations depend on environment variables defined in an .env
file.
- Copy the
.env.example
file and rename it to.env
- Replace the environment values to your desire. See environment explanatory chart below
Environment variables
Database environment:
DB_TYPE:
can be eitherpostgres
ormysql
DB_NAME:
the name of the databaseDB_USER:
a database user different than rootDB_PASSWORD:
a password forDB_USER
DB_ROOT_PASSWORD:
a password for the root user (only for MySQL)DB_PORT:
use3306
for mysql or5432
for 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 thevolumes
section in thedocker-compose
file.DB_INSIDE_VOLUME:
use/var/lib/mysql
for mysql or/var/lib/postgresql/data
for 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 thevolumes
section in thedocker-compose
file.MB_JAVA_TIMEZONE:
timezone to match the timezone reports. More info about the Metabase environment. List of available timezone IDs
Get started
- Run
docker-compose build
to create a database image (mysql
orpostgres
) - Run
docker-compose up
to run the applications - Use
docker-compose down
to shutdown all services - Use
docker-compose up
to re-run all services whenever you want - There is no need to re-run
docker-compose build
unless you change the database strategy, database name, database credentials or the volumes.
Change database
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-data
is 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
.
Documentation Reference
Contributing
If you'd like to improve or add features on this project feel free to open an issue.
License
GNU General Public License version 3
๐ฉโ๐ป with ๐ ๐ โค๏ธ by cambรก.coop ๐ Buenos Aires, Argentina