GithubHelp home page GithubHelp logo

cambalab / metabase-compose Goto Github PK

View Code? Open in Web Editor NEW
113.0 16.0 32.0 250 KB

A dockerized solution to run Metabase using compose

License: GNU General Public License v3.0

Shell 100.00%
metabase docker docker-compose postgres postgresql mysql analytics bi bussiness-intelligence database

metabase-compose's Introduction

Docker+Compose+Metabase

This project intends to facilitate the task of developing a production ready environment for Metabase.

License License

Metabase 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 either postgres or mysql
  • DB_NAME: the name of the database
  • DB_USER: a database user different than root
  • DB_PASSWORD: a password for DB_USER
  • DB_ROOT_PASSWORD: a password for the root user (only for MySQL)
  • DB_PORT: use 3306 for mysql or 5432 for postgres. This value is used for the metabase container.
  • DB_OUTSIDE_VOLUME: a name for the database volume. Defaults to db-data. If you change this you'll have to modify the volumes section in the docker-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 written
  • MB_PORT: the port where Metabase will be available
  • MB_VOLUME: a name for the metabase volume. Defaults to mb-data. If you change this you'll have to modify the volumes section in the docker-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 or postgres)
  • 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

metabase-compose's People

Contributors

sgobotta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

metabase-compose's Issues

MySQL database migration executed by Metabase fails.

I cloned the repository, copied the .env file & configured it so that it aligns with my wishes (i.e using MySQL instead of Postgresql), and I set up the DB_NAME, USER, PASSWORD & ROOT_PASSWORD.

  • Adminer and Metabase configurations were left unchanged.
  • DB_TYPE=mysel (commented out postgres)

Using cmd I went into MySQL and added a Metabase user and granted it all privileges (to avoid any issues) and I also checked the version of MySQL running on docker (Metabase's documentation clarified that creating a metabase account was required and that MySQL version 8.0.33 or higher is recommended. My version of MySQL is 8.3.0.

I then ran the required commands in cmd (docker-compose build & docker-compose up) both without any issues and 3/3 containers are running within the composer.

The issue is that I cannot seem to access Metabase (through http://localhost:3000/). The site loads but the set-up wizard does not start, instead it just continuously loads forever.

Specifically, I am running into an issue with the database migration processes executed by Metabase:
Migration failed for changeset migrations/001_update_migrations.yaml::v48.00-033::noahmoss:
Reason: liquibase.exception.DatabaseException: (conn=5) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'agg_recipients as ( [...]

The error seems to suggest that the SQL syntax used in the Metabase migration script is not compatible with my SQL version but I am using MySQL 8.3.0 which is supported. This is perplexing because the logs indicate an operation on MySQL 5.7.44?

The logs also read:
2024-02-08 13:53:43 db-1 | 2024-02-08 12:53:43+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.44-1.el7 started.

2024-02-08 13:53:44 db-1 | 2024-02-08 12:53:44+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'

2024-02-08 13:54:06 metabase-1 | Warning: environ value jdk-11.0.22+7 for key :java-version has been overwritten with 11.0.22

2024-02-08 13:53:44 db-1 | 2024-02-08 12:53:44+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.44-1.el7 started.

2024-02-08 13:53:44 adminer-1 | [Thu Feb 8 12:53:44 2024] PHP 7.4.33 Development Server (http://[::]:8080) started

2024-02-08 13:53:44 db-1 | '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'

2024-02-08 13:54:09 metabase-1 | 2024-02-08 09:54:09,842 INFO metabase.util :: Maximum memory available to JVM: 958.0 MB

2024-02-08 13:53:45 db-1 | 2024-02-08T12:53:45.618837Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

I have no idea why this is occurring. I am sure that I have not provided enough information to properly understand the error so please if any more information is required let me know what! I am very new to this so I don't know what other information may be of value.

I asked reddit for some advice and someone mentioned that the error indicates that a function called agg_recipients is trying to be called, which only exists in Postgres and not MySQL. Very strange that this function is trying to run since I've indicated that the database type is mysql and not postgres.

Is there anyway to skip the /setup?

I don't know if I'm doing something wrong but after running the containers and going to localhost:3000 it redirects me to /setup where I have to put my user name etc, and it asks me to configure the database

I don't know if is expected to have to go through /setup in the first docker-compose up.

I would like to automate the /setup too, if is possible

Mysql root password is initialized to root

Hi,

Thanks sharing this work !

For mysql this entry is missing in docker-compose.yml
db_root_password: ${DB_ROOT_PASSWORD}

So that Dockerfile-mysql is populated.

Thank you !

Metabase connection to DB

Hi there, first of all, thanks very much for sharing this. Super helpful.

I do have question. Upon initial set up of Metabase, it asks for the database connection.

I am getting the following error
Database name : Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.

I have set localhost and 5432 for host and port. Would the values be something else?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.