iTestee Uncategorized Deploy Metabase and access it through the same SSL certificate using Nginx.

Deploy Metabase and access it through the same SSL certificate using Nginx.

First, You must add your all containers into one docker network

Avoid using docker0 as your default network connection because it always attempts to connect through the host machine. Using it may lead to unexpected behavior. Instead, create and use your own custom Docker network.

docker network create xx-net

How to install Metabase

docker run -d -p 3000:3000 -e MB_SITE_URL=https://url/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=Password-e MB_DB_HOST=db_uri –network xx-net –name metabase metabase/metabase

This will download and deploy the container that you required.

Next, Add your containers to the network (If it s=is not).

docker network connect xx-net metabase

docker network connect xx-net container1

docker network connect xx-net container2

Otherwise you can build your containers as follows:

docker run -d -p 80:80 -p 443:443 –network xx-net –name uni-front226 container:1

This will add your container to the network that you already created

Now modify the nginx.conf file to access through the same url

       # HTTPS (port 443) server block
   server {
         listen 443 ssl;
            server_name uwms _;

       # 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/;
            }

    }

You can access your container within the Docker network using the URL: http://metabase:3000 (metabase = docker container that we created)

.

However, if you are using the docker0 bridge, this method will not work because the request will attempt to route globally rather than through the internal Docker network.

Leave a Reply

Your email address will not be published. Required fields are marked *

19 + = 29
Powered by MathCaptcha

Related Post