Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

agnos.is Forums

  1. Home
  2. Selfhosted
  3. How do I manage docker&Traefik behind a reverse proxy not on docker.

How do I manage docker&Traefik behind a reverse proxy not on docker.

Scheduled Pinned Locked Moved Selfhosted
selfhosted
19 Posts 9 Posters 0 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N This user is from outside of this forum
    N This user is from outside of this forum
    [email protected]
    wrote last edited by [email protected]
    #1

    Fors off: I am a total beginner when it comes to docker. I do have some self hosting experience, but run pretty much everything in its on lxc and treat it like a full linux system.

    Recently I installed immich in a container and was surprised to see how well it worked.

    This lead my to finally tackle something I have been putting off for way to long; installing nightscout (a self hosten glucose monitoring&reporting utility).

    For that I followed their guide. Everything worked well up untill the point where I wanted to connect to the web interface.
    I started of by entering my domain into the nightscout containers arguments (in the form subdomain.domain.tld). Then I used my reverse proxy (nginx, not inside docker) to forward the subdomain to the docker IP on Ports 443, then 80 and lastly the one displayed at the container when listing them with docker ps. None of those worked (I was not able to get a certificate using letsEncrypt and got a 404 when connecting without tls).

    I then entered nighscout.[docker-IP] and tried to access it dkrectly which did not work either.

    When googling I only find comparisons on how to set up nginx in Docker, or comparisons between the two.

    ::: spoiler docker-compose file

      GNU nano 7.2                                                                                                 docker-compose.yml                                                                                                          
    version: '3'
    
    x-logging:
      &default-logging
      options:
        max-size: '10m'
        max-file: '5'
      driver: json-file
    
    services:
      mongo:
        image: mongo:4.4
        volumes:
          - ${NS_MONGO_DATA_DIR:-./mongo-data}:/data/db:cached
        logging: *default-logging
    
      nightscout:
        image: nightscout/cgm-remote-monitor:latest
        container_name: nightscout
        restart: always
        depends_on:
          - mongo
        labels:
          - 'traefik.enable=true'
          # Change the below Host from `localhost` to be the web address where Nightscout is running.
          # Also change the email address in the `traefik` service below.
          - 'traefik.http.routers.nightscout.rule=Host(`localhost`)'
          - 'traefik.http.routers.nightscout.entrypoints=websecure'
          - 'traefik.http.routers.nightscout.tls.certresolver=le'
        logging: *default-logging
        environment:
          ### Variables for the container
          NODE_ENV: production
          TZ: [removed]
    
          ### Overridden variables for Docker Compose setup
          # The `nightscout` service can use HTTP, because we use `traefik` to serve the HTTPS
          # and manage TLS certificates
          INSECURE_USE_HTTP: 'true'
    
          # For all other settings, please refer to the Environment section of the README
          ### Required variables
          # MONGO_CONNECTION - The connection string for your Mongo database.
          # Something like mongodb://sally:[email protected]:99999/nightscout
          # The default connects to the `mongo` included in this docker-compose file.
          # If you change it, you probably also want to comment out the entire `mongo` service block
          # and `depends_on` block above.
          MONGO_CONNECTION: mongodb://mongo:27017/nightscout
    
          # API_SECRET - A secret passphrase that must be at least 12 characters long.
          API_SECRET: [removed]
    
          ### Features
          # ENABLE - Used to enable optional features, expects a space delimited list, such as: careportal rawbg iob
          # See https://github.com/nightscout/cgm-remote-monitor#plugins for details
          ENABLE: careportal rawbg iob
    
          # AUTH_DEFAULT_ROLES (readable) - possible values readable, denied, or any valid role name.
          # When readable, anyone can view Nightscout without a token. Setting it to denied will require
          # a token from every visit, using status-only will enable api-secret based login.
          AUTH_DEFAULT_ROLES: denied
    
          # For all other settings, please refer to the Environment section of the README
          # https://github.com/nightscout/cgm-remote-monitor#environment
    
      traefik:
        image: traefik:latest
        container_name: 'traefik'
        command:
          - '--providers.docker=true'
          - '--providers.docker.exposedbydefault=false'
          - '--entrypoints.web.address=:80'
          - '--entrypoints.web.http.redirections.entrypoint.to=websecure'
          - '--entrypoints.websecure.address=:443'
          - "--certificatesresolvers.le.acme.httpchallenge=true"
          - "--certificatesresolvers.le.acme.httpchallenge.entrypoint=web"
          - '--certificatesresolvers.le.acme.storage=/letsencrypt/acme.json'
          # Change the below to match your email address
          - '--certificatesresolvers.le.acme.email=[removed]'
        ports:
          - '443:443'
          - '80:80'
        volumes:
          - './letsencrypt:/letsencrypt'
          - '/var/run/docker.sock:/var/run/docker.sock:ro'
        logging: *default-logging
    
    

    :::

    mhzawadi@lemmy.horwood.cloudM S J 3 Replies Last reply
    7
    • N [email protected]

      Fors off: I am a total beginner when it comes to docker. I do have some self hosting experience, but run pretty much everything in its on lxc and treat it like a full linux system.

      Recently I installed immich in a container and was surprised to see how well it worked.

      This lead my to finally tackle something I have been putting off for way to long; installing nightscout (a self hosten glucose monitoring&reporting utility).

      For that I followed their guide. Everything worked well up untill the point where I wanted to connect to the web interface.
      I started of by entering my domain into the nightscout containers arguments (in the form subdomain.domain.tld). Then I used my reverse proxy (nginx, not inside docker) to forward the subdomain to the docker IP on Ports 443, then 80 and lastly the one displayed at the container when listing them with docker ps. None of those worked (I was not able to get a certificate using letsEncrypt and got a 404 when connecting without tls).

      I then entered nighscout.[docker-IP] and tried to access it dkrectly which did not work either.

      When googling I only find comparisons on how to set up nginx in Docker, or comparisons between the two.

      ::: spoiler docker-compose file

        GNU nano 7.2                                                                                                 docker-compose.yml                                                                                                          
      version: '3'
      
      x-logging:
        &default-logging
        options:
          max-size: '10m'
          max-file: '5'
        driver: json-file
      
      services:
        mongo:
          image: mongo:4.4
          volumes:
            - ${NS_MONGO_DATA_DIR:-./mongo-data}:/data/db:cached
          logging: *default-logging
      
        nightscout:
          image: nightscout/cgm-remote-monitor:latest
          container_name: nightscout
          restart: always
          depends_on:
            - mongo
          labels:
            - 'traefik.enable=true'
            # Change the below Host from `localhost` to be the web address where Nightscout is running.
            # Also change the email address in the `traefik` service below.
            - 'traefik.http.routers.nightscout.rule=Host(`localhost`)'
            - 'traefik.http.routers.nightscout.entrypoints=websecure'
            - 'traefik.http.routers.nightscout.tls.certresolver=le'
          logging: *default-logging
          environment:
            ### Variables for the container
            NODE_ENV: production
            TZ: [removed]
      
            ### Overridden variables for Docker Compose setup
            # The `nightscout` service can use HTTP, because we use `traefik` to serve the HTTPS
            # and manage TLS certificates
            INSECURE_USE_HTTP: 'true'
      
            # For all other settings, please refer to the Environment section of the README
            ### Required variables
            # MONGO_CONNECTION - The connection string for your Mongo database.
            # Something like mongodb://sally:[email protected]:99999/nightscout
            # The default connects to the `mongo` included in this docker-compose file.
            # If you change it, you probably also want to comment out the entire `mongo` service block
            # and `depends_on` block above.
            MONGO_CONNECTION: mongodb://mongo:27017/nightscout
      
            # API_SECRET - A secret passphrase that must be at least 12 characters long.
            API_SECRET: [removed]
      
            ### Features
            # ENABLE - Used to enable optional features, expects a space delimited list, such as: careportal rawbg iob
            # See https://github.com/nightscout/cgm-remote-monitor#plugins for details
            ENABLE: careportal rawbg iob
      
            # AUTH_DEFAULT_ROLES (readable) - possible values readable, denied, or any valid role name.
            # When readable, anyone can view Nightscout without a token. Setting it to denied will require
            # a token from every visit, using status-only will enable api-secret based login.
            AUTH_DEFAULT_ROLES: denied
      
            # For all other settings, please refer to the Environment section of the README
            # https://github.com/nightscout/cgm-remote-monitor#environment
      
        traefik:
          image: traefik:latest
          container_name: 'traefik'
          command:
            - '--providers.docker=true'
            - '--providers.docker.exposedbydefault=false'
            - '--entrypoints.web.address=:80'
            - '--entrypoints.web.http.redirections.entrypoint.to=websecure'
            - '--entrypoints.websecure.address=:443'
            - "--certificatesresolvers.le.acme.httpchallenge=true"
            - "--certificatesresolvers.le.acme.httpchallenge.entrypoint=web"
            - '--certificatesresolvers.le.acme.storage=/letsencrypt/acme.json'
            # Change the below to match your email address
            - '--certificatesresolvers.le.acme.email=[removed]'
          ports:
            - '443:443'
            - '80:80'
          volumes:
            - './letsencrypt:/letsencrypt'
            - '/var/run/docker.sock:/var/run/docker.sock:ro'
          logging: *default-logging
      
      

      :::

      mhzawadi@lemmy.horwood.cloudM This user is from outside of this forum
      mhzawadi@lemmy.horwood.cloudM This user is from outside of this forum
      [email protected]
      wrote last edited by
      #2

      Hello

      could you update this with your compose file please?

      my first guess is that maybe traefik does not know about nightscout or nightscout is still listening on its own ports

      N 1 Reply Last reply
      3
      • mhzawadi@lemmy.horwood.cloudM [email protected]

        Hello

        could you update this with your compose file please?

        my first guess is that maybe traefik does not know about nightscout or nightscout is still listening on its own ports

        N This user is from outside of this forum
        N This user is from outside of this forum
        [email protected]
        wrote last edited by [email protected]
        #3

        I Updated the post.

              - 'traefik.http.routers.nightscout.rule=Host(`localhost`)'
        
        

        is my current attempt. I used my domain before.

        mhzawadi@lemmy.horwood.cloudM 2 Replies Last reply
        2
        • N [email protected]

          Fors off: I am a total beginner when it comes to docker. I do have some self hosting experience, but run pretty much everything in its on lxc and treat it like a full linux system.

          Recently I installed immich in a container and was surprised to see how well it worked.

          This lead my to finally tackle something I have been putting off for way to long; installing nightscout (a self hosten glucose monitoring&reporting utility).

          For that I followed their guide. Everything worked well up untill the point where I wanted to connect to the web interface.
          I started of by entering my domain into the nightscout containers arguments (in the form subdomain.domain.tld). Then I used my reverse proxy (nginx, not inside docker) to forward the subdomain to the docker IP on Ports 443, then 80 and lastly the one displayed at the container when listing them with docker ps. None of those worked (I was not able to get a certificate using letsEncrypt and got a 404 when connecting without tls).

          I then entered nighscout.[docker-IP] and tried to access it dkrectly which did not work either.

          When googling I only find comparisons on how to set up nginx in Docker, or comparisons between the two.

          ::: spoiler docker-compose file

            GNU nano 7.2                                                                                                 docker-compose.yml                                                                                                          
          version: '3'
          
          x-logging:
            &default-logging
            options:
              max-size: '10m'
              max-file: '5'
            driver: json-file
          
          services:
            mongo:
              image: mongo:4.4
              volumes:
                - ${NS_MONGO_DATA_DIR:-./mongo-data}:/data/db:cached
              logging: *default-logging
          
            nightscout:
              image: nightscout/cgm-remote-monitor:latest
              container_name: nightscout
              restart: always
              depends_on:
                - mongo
              labels:
                - 'traefik.enable=true'
                # Change the below Host from `localhost` to be the web address where Nightscout is running.
                # Also change the email address in the `traefik` service below.
                - 'traefik.http.routers.nightscout.rule=Host(`localhost`)'
                - 'traefik.http.routers.nightscout.entrypoints=websecure'
                - 'traefik.http.routers.nightscout.tls.certresolver=le'
              logging: *default-logging
              environment:
                ### Variables for the container
                NODE_ENV: production
                TZ: [removed]
          
                ### Overridden variables for Docker Compose setup
                # The `nightscout` service can use HTTP, because we use `traefik` to serve the HTTPS
                # and manage TLS certificates
                INSECURE_USE_HTTP: 'true'
          
                # For all other settings, please refer to the Environment section of the README
                ### Required variables
                # MONGO_CONNECTION - The connection string for your Mongo database.
                # Something like mongodb://sally:[email protected]:99999/nightscout
                # The default connects to the `mongo` included in this docker-compose file.
                # If you change it, you probably also want to comment out the entire `mongo` service block
                # and `depends_on` block above.
                MONGO_CONNECTION: mongodb://mongo:27017/nightscout
          
                # API_SECRET - A secret passphrase that must be at least 12 characters long.
                API_SECRET: [removed]
          
                ### Features
                # ENABLE - Used to enable optional features, expects a space delimited list, such as: careportal rawbg iob
                # See https://github.com/nightscout/cgm-remote-monitor#plugins for details
                ENABLE: careportal rawbg iob
          
                # AUTH_DEFAULT_ROLES (readable) - possible values readable, denied, or any valid role name.
                # When readable, anyone can view Nightscout without a token. Setting it to denied will require
                # a token from every visit, using status-only will enable api-secret based login.
                AUTH_DEFAULT_ROLES: denied
          
                # For all other settings, please refer to the Environment section of the README
                # https://github.com/nightscout/cgm-remote-monitor#environment
          
            traefik:
              image: traefik:latest
              container_name: 'traefik'
              command:
                - '--providers.docker=true'
                - '--providers.docker.exposedbydefault=false'
                - '--entrypoints.web.address=:80'
                - '--entrypoints.web.http.redirections.entrypoint.to=websecure'
                - '--entrypoints.websecure.address=:443'
                - "--certificatesresolvers.le.acme.httpchallenge=true"
                - "--certificatesresolvers.le.acme.httpchallenge.entrypoint=web"
                - '--certificatesresolvers.le.acme.storage=/letsencrypt/acme.json'
                # Change the below to match your email address
                - '--certificatesresolvers.le.acme.email=[removed]'
              ports:
                - '443:443'
                - '80:80'
              volumes:
                - './letsencrypt:/letsencrypt'
                - '/var/run/docker.sock:/var/run/docker.sock:ro'
              logging: *default-logging
          
          

          :::

          S This user is from outside of this forum
          S This user is from outside of this forum
          [email protected]
          wrote last edited by
          #4

          Why are you using both nginx and traefik?

          N 1 Reply Last reply
          2
          • N [email protected]

            Fors off: I am a total beginner when it comes to docker. I do have some self hosting experience, but run pretty much everything in its on lxc and treat it like a full linux system.

            Recently I installed immich in a container and was surprised to see how well it worked.

            This lead my to finally tackle something I have been putting off for way to long; installing nightscout (a self hosten glucose monitoring&reporting utility).

            For that I followed their guide. Everything worked well up untill the point where I wanted to connect to the web interface.
            I started of by entering my domain into the nightscout containers arguments (in the form subdomain.domain.tld). Then I used my reverse proxy (nginx, not inside docker) to forward the subdomain to the docker IP on Ports 443, then 80 and lastly the one displayed at the container when listing them with docker ps. None of those worked (I was not able to get a certificate using letsEncrypt and got a 404 when connecting without tls).

            I then entered nighscout.[docker-IP] and tried to access it dkrectly which did not work either.

            When googling I only find comparisons on how to set up nginx in Docker, or comparisons between the two.

            ::: spoiler docker-compose file

              GNU nano 7.2                                                                                                 docker-compose.yml                                                                                                          
            version: '3'
            
            x-logging:
              &default-logging
              options:
                max-size: '10m'
                max-file: '5'
              driver: json-file
            
            services:
              mongo:
                image: mongo:4.4
                volumes:
                  - ${NS_MONGO_DATA_DIR:-./mongo-data}:/data/db:cached
                logging: *default-logging
            
              nightscout:
                image: nightscout/cgm-remote-monitor:latest
                container_name: nightscout
                restart: always
                depends_on:
                  - mongo
                labels:
                  - 'traefik.enable=true'
                  # Change the below Host from `localhost` to be the web address where Nightscout is running.
                  # Also change the email address in the `traefik` service below.
                  - 'traefik.http.routers.nightscout.rule=Host(`localhost`)'
                  - 'traefik.http.routers.nightscout.entrypoints=websecure'
                  - 'traefik.http.routers.nightscout.tls.certresolver=le'
                logging: *default-logging
                environment:
                  ### Variables for the container
                  NODE_ENV: production
                  TZ: [removed]
            
                  ### Overridden variables for Docker Compose setup
                  # The `nightscout` service can use HTTP, because we use `traefik` to serve the HTTPS
                  # and manage TLS certificates
                  INSECURE_USE_HTTP: 'true'
            
                  # For all other settings, please refer to the Environment section of the README
                  ### Required variables
                  # MONGO_CONNECTION - The connection string for your Mongo database.
                  # Something like mongodb://sally:[email protected]:99999/nightscout
                  # The default connects to the `mongo` included in this docker-compose file.
                  # If you change it, you probably also want to comment out the entire `mongo` service block
                  # and `depends_on` block above.
                  MONGO_CONNECTION: mongodb://mongo:27017/nightscout
            
                  # API_SECRET - A secret passphrase that must be at least 12 characters long.
                  API_SECRET: [removed]
            
                  ### Features
                  # ENABLE - Used to enable optional features, expects a space delimited list, such as: careportal rawbg iob
                  # See https://github.com/nightscout/cgm-remote-monitor#plugins for details
                  ENABLE: careportal rawbg iob
            
                  # AUTH_DEFAULT_ROLES (readable) - possible values readable, denied, or any valid role name.
                  # When readable, anyone can view Nightscout without a token. Setting it to denied will require
                  # a token from every visit, using status-only will enable api-secret based login.
                  AUTH_DEFAULT_ROLES: denied
            
                  # For all other settings, please refer to the Environment section of the README
                  # https://github.com/nightscout/cgm-remote-monitor#environment
            
              traefik:
                image: traefik:latest
                container_name: 'traefik'
                command:
                  - '--providers.docker=true'
                  - '--providers.docker.exposedbydefault=false'
                  - '--entrypoints.web.address=:80'
                  - '--entrypoints.web.http.redirections.entrypoint.to=websecure'
                  - '--entrypoints.websecure.address=:443'
                  - "--certificatesresolvers.le.acme.httpchallenge=true"
                  - "--certificatesresolvers.le.acme.httpchallenge.entrypoint=web"
                  - '--certificatesresolvers.le.acme.storage=/letsencrypt/acme.json'
                  # Change the below to match your email address
                  - '--certificatesresolvers.le.acme.email=[removed]'
                ports:
                  - '443:443'
                  - '80:80'
                volumes:
                  - './letsencrypt:/letsencrypt'
                  - '/var/run/docker.sock:/var/run/docker.sock:ro'
                logging: *default-logging
            
            

            :::

            J This user is from outside of this forum
            J This user is from outside of this forum
            [email protected]
            wrote last edited by
            #5

            There is no need to run Traefik if you already have a working reverse proxy. Also, unless your nginx is running on non-standard ports, the ports 80 and 443 should not be available for traefik, which will prevent it from working correctly.

            N 2 Replies Last reply
            4
            • J [email protected]

              There is no need to run Traefik if you already have a working reverse proxy. Also, unless your nginx is running on non-standard ports, the ports 80 and 443 should not be available for traefik, which will prevent it from working correctly.

              N This user is from outside of this forum
              N This user is from outside of this forum
              [email protected]
              wrote last edited by
              #6

              How do I connect to the container without traefik (from my local network)?

              When I remove all the traefic references and then run docker ps I get

              CONTAINER ID   IMAGE                                                            COMMAND                  CREATED         STATUS                  PORTS                                         NAMES
              [removed]   nightscout/cgm-remote-monitor:latest                             "docker-entrypoint.s…"   6 seconds ago   Up 5 seconds            1337/tcp                                      nightscout
              [removed]   mongo:4.4                                                        "docker-entrypoint.s…"   37 hours ago    Up 5 seconds            27017/tcp                                     docker-mongo-1
              
              

              But I can't reach it under dockerIP:1337.

              With Immich it had 0.0.0.0:port as its IP and I was able to reach it that way.

              C M 2 Replies Last reply
              0
              • J [email protected]

                There is no need to run Traefik if you already have a working reverse proxy. Also, unless your nginx is running on non-standard ports, the ports 80 and 443 should not be available for traefik, which will prevent it from working correctly.

                N This user is from outside of this forum
                N This user is from outside of this forum
                [email protected]
                wrote last edited by [email protected]
                #7

                My Nginx is running in the same local network but on a different IP so there should not be a collision with the traefik ports.

                1 Reply Last reply
                0
                • S [email protected]

                  Why are you using both nginx and traefik?

                  N This user is from outside of this forum
                  N This user is from outside of this forum
                  [email protected]
                  wrote last edited by
                  #8

                  Because I don't know how docker works, the .yaml given by nightscout is using traefik and I don't know how to remove it without breakting the nightscout container.

                  S H 2 Replies Last reply
                  1
                  • N [email protected]

                    How do I connect to the container without traefik (from my local network)?

                    When I remove all the traefic references and then run docker ps I get

                    CONTAINER ID   IMAGE                                                            COMMAND                  CREATED         STATUS                  PORTS                                         NAMES
                    [removed]   nightscout/cgm-remote-monitor:latest                             "docker-entrypoint.s…"   6 seconds ago   Up 5 seconds            1337/tcp                                      nightscout
                    [removed]   mongo:4.4                                                        "docker-entrypoint.s…"   37 hours ago    Up 5 seconds            27017/tcp                                     docker-mongo-1
                    
                    

                    But I can't reach it under dockerIP:1337.

                    With Immich it had 0.0.0.0:port as its IP and I was able to reach it that way.

                    C This user is from outside of this forum
                    C This user is from outside of this forum
                    [email protected]
                    wrote last edited by
                    #9

                    Your ports are not mapped so the host system doesn’t know about them. You only have them exposed, which is for docker communication.

                    Map your ports and then you’ll be able to access them by host-ip:mapped-port.

                    Then you can use nginx to proxy to that.

                    1 Reply Last reply
                    4
                    • N [email protected]

                      Because I don't know how docker works, the .yaml given by nightscout is using traefik and I don't know how to remove it without breakting the nightscout container.

                      S This user is from outside of this forum
                      S This user is from outside of this forum
                      [email protected]
                      wrote last edited by
                      #10

                      Then drop nginx and just use traefik.

                      N 1 Reply Last reply
                      0
                      • S [email protected]

                        Then drop nginx and just use traefik.

                        N This user is from outside of this forum
                        N This user is from outside of this forum
                        [email protected]
                        wrote last edited by
                        #11

                        Thats what all my other services use though and I don't know how I'd connect them to traefic.

                        S D maggiwuerze@feddit.orgM 3 Replies Last reply
                        1
                        • N [email protected]

                          I Updated the post.

                                - 'traefik.http.routers.nightscout.rule=Host(`localhost`)'
                          
                          

                          is my current attempt. I used my domain before.

                          mhzawadi@lemmy.horwood.cloudM This user is from outside of this forum
                          mhzawadi@lemmy.horwood.cloudM This user is from outside of this forum
                          [email protected]
                          wrote last edited by
                          #12

                          'traefik.http.routers.nightscout.rule=Host(localhost)'

                          so traefik will be looking for the host header localhost and only route requests to the service if it matches, sh when you use your real domain that should be what you use as the host header from nginx

                          1 Reply Last reply
                          0
                          • N [email protected]

                            I Updated the post.

                                  - 'traefik.http.routers.nightscout.rule=Host(`localhost`)'
                            
                            

                            is my current attempt. I used my domain before.

                            mhzawadi@lemmy.horwood.cloudM This user is from outside of this forum
                            mhzawadi@lemmy.horwood.cloudM This user is from outside of this forum
                            [email protected]
                            wrote last edited by
                            #13

                            side note, I would expose traefik on 127.0.0.1 if its on the same host as nginx. as traefik is visible on all network interfaces.

                            1 Reply Last reply
                            0
                            • N [email protected]

                              Because I don't know how docker works, the .yaml given by nightscout is using traefik and I don't know how to remove it without breakting the nightscout container.

                              H This user is from outside of this forum
                              H This user is from outside of this forum
                              [email protected]
                              wrote last edited by
                              #14

                              To run it with Nginx instead of Traefik, you need to figure out what port Nightscout’s web server runs on, then expose that port, e.g.,

                              services:
                                nightscout:
                                  ports:
                                    - 3000:3000
                              

                              You can remove the labels as those are used by Traefik, as well as the Traefik service itself.

                              Then just point Nginx to that port (e.g., 3000) on your local machine.

                              —-

                              Traefik has to know the port, too, but it will auto detect the port that a local Docker service is running on. It looks like your config is relying on that feature as I don’t see the label that explicitly specifies the port.

                              H 1 Reply Last reply
                              0
                              • H [email protected]

                                To run it with Nginx instead of Traefik, you need to figure out what port Nightscout’s web server runs on, then expose that port, e.g.,

                                services:
                                  nightscout:
                                    ports:
                                      - 3000:3000
                                

                                You can remove the labels as those are used by Traefik, as well as the Traefik service itself.

                                Then just point Nginx to that port (e.g., 3000) on your local machine.

                                —-

                                Traefik has to know the port, too, but it will auto detect the port that a local Docker service is running on. It looks like your config is relying on that feature as I don’t see the label that explicitly specifies the port.

                                H This user is from outside of this forum
                                H This user is from outside of this forum
                                [email protected]
                                wrote last edited by
                                #15

                                This is what I would try first. It looks like 1337 is the exposed port, per https://github.com/nightscout/cgm-remote-monitor/blob/master/Dockerfile

                                x-logging:
                                  &default-logging
                                  options:
                                    max-size: '10m'
                                    max-file: '5'
                                  driver: json-file
                                
                                services:
                                  mongo:
                                    image: mongo:4.4
                                    volumes:
                                      - ${NS_MONGO_DATA_DIR:-./mongo-data}:/data/db:cached
                                    logging: *default-logging
                                
                                  nightscout:
                                    image: nightscout/cgm-remote-monitor:latest
                                    container_name: nightscout
                                    restart: always
                                    depends_on:
                                      - mongo
                                    logging: *default-logging
                                    ports:
                                      - 1337:1337
                                    environment:
                                      ### Variables for the container
                                      NODE_ENV: production
                                      TZ: [removed]
                                
                                      ### Overridden variables for Docker Compose setup
                                      # The `nightscout` service can use HTTP, because we use `nginx` to serve the HTTPS
                                      # and manage TLS certificates
                                      INSECURE_USE_HTTP: 'true'
                                
                                      # For all other settings, please refer to the Environment section of the README
                                      ### Required variables
                                      # MONGO_CONNECTION - The connection string for your Mongo database.
                                      # Something like mongodb://sally:[email protected]:99999/nightscout
                                      # The default connects to the `mongo` included in this docker-compose file.
                                      # If you change it, you probably also want to comment out the entire `mongo` service block
                                      # and `depends_on` block above.
                                      MONGO_CONNECTION: mongodb://mongo:27017/nightscout
                                
                                      # API_SECRET - A secret passphrase that must be at least 12 characters long.
                                      API_SECRET: [removed]
                                
                                      ### Features
                                      # ENABLE - Used to enable optional features, expects a space delimited list, such as: careportal rawbg iob
                                      # See https://github.com/nightscout/cgm-remote-monitor#plugins for details
                                      ENABLE: careportal rawbg iob
                                
                                      # AUTH_DEFAULT_ROLES (readable) - possible values readable, denied, or any valid role name.
                                      # When readable, anyone can view Nightscout without a token. Setting it to denied will require
                                      # a token from every visit, using status-only will enable api-secret based login.
                                      AUTH_DEFAULT_ROLES: denied
                                
                                      # For all other settings, please refer to the Environment section of the README
                                      # https://github.com/nightscout/cgm-remote-monitor#environment
                                
                                
                                1 Reply Last reply
                                0
                                • N [email protected]

                                  Thats what all my other services use though and I don't know how I'd connect them to traefic.

                                  S This user is from outside of this forum
                                  S This user is from outside of this forum
                                  [email protected]
                                  wrote last edited by
                                  #16

                                  There's no time to learn like the present! Your existing compose file has an example, but if that doesn't work, the traefik docs are useful too.

                                  1 Reply Last reply
                                  0
                                  • N [email protected]

                                    Thats what all my other services use though and I don't know how I'd connect them to traefic.

                                    D This user is from outside of this forum
                                    D This user is from outside of this forum
                                    [email protected]
                                    wrote last edited by [email protected]
                                    #17

                                    I recently posted most of my traefik configs, you can use it as a base to learn how traefik works:

                                    https://lemmy.ca/comment/17702205

                                    Note that I might not be much help with troubleshooting, as this took me a lot of trial and error and googling to make work.

                                    1 Reply Last reply
                                    0
                                    • N [email protected]

                                      How do I connect to the container without traefik (from my local network)?

                                      When I remove all the traefic references and then run docker ps I get

                                      CONTAINER ID   IMAGE                                                            COMMAND                  CREATED         STATUS                  PORTS                                         NAMES
                                      [removed]   nightscout/cgm-remote-monitor:latest                             "docker-entrypoint.s…"   6 seconds ago   Up 5 seconds            1337/tcp                                      nightscout
                                      [removed]   mongo:4.4                                                        "docker-entrypoint.s…"   37 hours ago    Up 5 seconds            27017/tcp                                     docker-mongo-1
                                      
                                      

                                      But I can't reach it under dockerIP:1337.

                                      With Immich it had 0.0.0.0:port as its IP and I was able to reach it that way.

                                      M This user is from outside of this forum
                                      M This user is from outside of this forum
                                      [email protected]
                                      wrote last edited by
                                      #18

                                      You need to add a ports section to your compose file like ports: - "1337:1337" - the container exposes 1337 internally but you haven't mapped it to the host so it's not accessible from outside the container.

                                      1 Reply Last reply
                                      0
                                      • N [email protected]

                                        Thats what all my other services use though and I don't know how I'd connect them to traefic.

                                        maggiwuerze@feddit.orgM This user is from outside of this forum
                                        maggiwuerze@feddit.orgM This user is from outside of this forum
                                        [email protected]
                                        wrote last edited by [email protected]
                                        #19

                                        If they all run on docker, you just have to add labels to them, telling them what domain and port they use, etc (look at the labels from your compose). Then you add the traefik base network to them and presto. Traefik recognizes the labels and automatically routes incoming requests to them and creates certificates for them.

                                        I would recommend a single compose stack for traefik and then one compose file per context (e.g. NextCloud, its DB, documentServer in one stack)

                                        1 Reply Last reply
                                        0
                                        Reply
                                        • Reply as topic
                                        Log in to reply
                                        • Oldest to Newest
                                        • Newest to Oldest
                                        • Most Votes


                                        • Login

                                        • Login or register to search.
                                        • First post
                                          Last post
                                        0
                                        • Categories
                                        • Recent
                                        • Tags
                                        • Popular
                                        • World
                                        • Users
                                        • Groups