https-portal icon indicating copy to clipboard operation
https-portal copied to clipboard

Configure https-portal and Streamlit - web app

Open dan-adi opened this issue 3 years ago • 3 comments

Hello, I am having trouble configuring https-portal to work with a Streamlit web app deployed with docker. This is my attempt at a docker-compose.yaml:

version: '3'
services:
  https-portal:
    image: steveltn/https-portal:1
    ports:
      - '80:80'
      - '443:443'
    links:
      - streamlit_app
    restart: always
    environment:
      WEBSOCKET: 'true'
      DOMAINS: 'http://example.go.ro/ -> http://streamlit_app:8501'
      STAGE: production # mantenha em staging até o total funcionamento
    volumes:
      - https-portal-data:/var/lib/https-portal
      
  streamlit_app:
    build:
      dockerfile: ./Dockerfile
      context: ./ 
    volumes:
      - .:/ETCWebApp
    ports:
      - 8501:8501
    restart: always

On my router I have the external ports 80,443 forwarded to internal 8501 port. Using the docker-compose up, I get no errors, but I can only access my webapp on HTTP not HTTPS. Any ideas how to make it work? Thank you

dan-adi avatar Jan 24 '23 17:01 dan-adi

This is the error it gives:

Failed to sign clearskies.go.ro.
https-portal_1   | Make sure your DNS is configured correctly and is propagated to this host
https-portal_1   | machine. Sometimes that takes a while.

Any idea how to solve it?

dan-adi avatar Jan 24 '23 23:01 dan-adi

Hi!

1.) I think, your docker-compose.yaml should look like this:

services:

  streamlit_app:
    build:
      dockerfile: ./Dockerfile
      context: ./ 
    volumes:
      - .:/ETCWebApp
    restart: unless-stopped

  https-portal:
    image: steveltn/https-portal:1.22
    depends_on:
      - streamlit_app
    ports:
      - '80:80'
      - '443:443'
    restart: unless-stopped
    environment:
      WEBSOCKET: 'true'
      DOMAINS: 'example.go.ro -> streamlit_app:8501'
      STAGE: production # mantenha em staging até o total funcionamento
    volumes:
      - https-portal-data:/var/lib/https-portal
      

2.) Your router must forward the ports 80 and 443 to your computer, directly. Not the Port 8501.

Router 80 --> Computer 80
Router 443 --> Computer 443

Maybe it helps.

gerold-penz avatar Jan 25 '23 02:01 gerold-penz

Hi!

1.) I think, your docker-compose.yaml should look like this:

services:

  streamlit_app:
    build:
      dockerfile: ./Dockerfile
      context: ./ 
    volumes:
      - .:/ETCWebApp
    restart: unless-stopped

  https-portal:
    image: steveltn/https-portal:1.22
    depends_on:
      - streamlit_app
    ports:
      - '80:80'
      - '443:443'
    restart: unless-stopped
    environment:
      WEBSOCKET: 'true'
      DOMAINS: 'example.go.ro -> streamlit_app:8501'
      STAGE: production # mantenha em staging até o total funcionamento
    volumes:
      - https-portal-data:/var/lib/https-portal
      

2.) Your router must forward the ports 80 and 443 to your computer, directly. Not the Port 8501.

Router 80 --> Computer 80
Router 443 --> Computer 443

Maybe it helps.

Thank you, it works now.! The yaml file looks like this:

services:
  streamlit_app:
    build:
      dockerfile: ./Dockerfile
      context: ./ 
    volumes:
      - .:/ETCWebApp
    ports:
      - 8501:8501
    restart: unless-stopped
    
  https-portal:
    image: steveltn/https-portal:1.22
    depends_on:
      - streamlit_app
    ports:
      - '80:80'
      - '443:443'
    restart: unless-stopped
    environment:
      WEBSOCKET: 'true'
      DOMAINS: 'example.go.ro -> streamlit_app:8501'

I also made the router changes you provided.

dan-adi avatar Jan 25 '23 09:01 dan-adi