Deploy Metabase Container:
In this setup, we have configured Metabase to run through the same Nginx server on port 3000.
download docker image: docker pull metabase/metabase:latest
Run Docker Container: docker run -d -p 3000:3000 -e MB_SITE_URL=https://www.xxxx.xx/metabase/ -e MB_DB_TYPE=postgres -e MB_DB_DBNAME=metabaseappdb -e MB_DB_PORT=5432 -e MB_DB_USER=postgres -e MB_DB_PASS=XXX-e MB_DB_HOST=XXXX.\XXXX.ap-southeast-1.rds.xxxx.com –name metabase metabase/metabase
All containers that need to run through the same Nginx server must be added to the same Docker network.
- Create a new network:
- docker network create uwms-net
- Add to the network:
- docker network connect uwms-net metabase <– Add the container to the network
- docker network connect uwms-net nginx <– Add the container to the network
- Add the other containers also to the same networks (Ex: backend services)
- Modify the nginx server 443 section in the nginx.conf file:
server {
listen 443 ssl;
server_name "domain name" _;
.. other navigation info:
# Redirect missing slash
location = /metabase {
return 301 https://$host$request_uri/;
}
location /metabase/ {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://metabase:3000/;
}
}
Once you added the metabase to the same network, “metabase” which is the container name manages like a domain name for your access.
Now you can access the metabase through the same domain name.
https://www.yourdomain.com/metabase/