Make a built-in docker-composed metabase dataviz with a permanent postgresql db integrated with pgadmin for GUI managing
Docker | Docker Compose | Metabase | PostgreSQL | PgAdmin
- Build a metabase data viz
- Build a PSQL db to persist local data
- Integrade PSQL db with pgadmin to have a friendly interface
-
Fork the repo
-
Clone It
-
Push the example .env file (modify it as you see fit)
curl -o .env https://raw.githubusercontent.com/leonballoni/Metabase-psql-dockercomposed/main/.env.example
- Enter the cloned repo and run the composed file
docker-compose up -d
- 1 Alternatively:
docker-compose -f docker-compose.yml up -d
Requirements
1. Docker
2. environment variables
3. RDBMs
4. (opt) Some knowledge of docker is helpful
5. (opt) Some knowledge of data viz
If you don`t have it already, this is a must have for this to work.
Use this link to install and test it -> Read it carefully before begining
There is a way to check it the docker-compose script is working (not necessarily without running errors) and not building due to sintax errors
docker-compose -f docker-compose.yml config
- This is very useful when building container that are complex and time consuming
- Download the example .env at your project folder and redefine it if needed.
curl -o .env https://raw.githubusercontent.com/leonballoni/Metabase-psql-dockercomposed/main/.env.example
After everything above, you can setup you own metabase, psql and pgadmin using the following command
docker-compose up --build -d
Start
Build
After building and runnin, check it using
docker ps
enter a browser and insert the following
0.0.0.0:5050
(localhost:port given by PGADM_SERVER_PORT_IN)
Use the user and password defined by PGADM_EMAIL and PGADM_PSWD env variables
The entrance panel
Register the psql server you want to directly access the data
Enter the server name
define the host or ip and enter the db user. Use psql_db to define the host (this is the internal psql container DSN)
0.0.0.0:3000
(localhost:port given by MB_PORT)
The admin user is created by the first access
Add a database (internal as shown below or else) Only admin can do this
This one is a little more complicated. This is because you will need to enter the docker psql_db and run psql command to enter it. You must use a terminal for this.
Get the container ID of the psql_db container:
docker exec -it [Container_ID] bash
exec -> execute a direct command in a container
-i -> have interactivity
-t -> with pseudo terminal
bash -> enter the bash or container terminal
After entering the container, execute the command to access the psql application giving the user you defined in PSQL_USER
psql -d postgres -U postgres -W
-d -> specifc database to enter (by standard, every psql starts with a postgres db)
-U -> User
-W -> ask for password
Free dataviz to build and share analytical dashboards
Relational DB useful for storing data as well as serve as building block for analytics or prototyping with SQL
Visual interface integrated with PSQL DB
Useful links for you own project
[1] https://www.automacaodedados.com.br/stories/configurando-metabase-e-postgresql-no-docker/
[2] https://dev.to/stefanopassador/docker-compose-with-python-and-posgresql-33kk
[3] https://www.dabbleofdevops.com/blog/setup-a-postgres-python-docker-dev-stack
[6] https://towardsdatascience.com/how-to-build-slim-docker-images-fast-ecc246d7f4a7