ItsEcholot / ContainerNursery

Puts Docker Containers to sleep and wakes them back up when they're needed
MIT License
135 stars 7 forks source link

Exanmple NPM config and compose #59

Open GamerClassN7 opened 2 months ago

GamerClassN7 commented 2 months ago

hello, i am trying to setup ContainerNursery but i was not able to setup it correctly with NPM can anyone help me ?

My configs are following and only think i get is 502 Bad Gateway.

version: "3.8"
services:
  app:
    image: jc21/nginx-proxy-manager:latest
    restart: unless-stopped
    ports:
      # These ports are in format <host-port>:<container-port>
      - 80:80 # Public HTTP Port
      - 443:443 # Public HTTPS Port
      - 81:81 # Admin Web Port
      # Add any other Stream port you want to expose
      # - '21:21' # FTP
      # Uncomment the next line if you uncomment anything in the section
      # environment:
      # Uncomment this if you want to change the location of
      # the SQLite DB file within the container
      # DB_SQLITE_FILE: "/data/database.sqlite"

      # Uncomment this if IPv6 is not enabled on your host
      # DISABLE_IPV6: 'true'

    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
networks:
  app_default:
    external: true
version: "3.3"
services:
  containernursery:
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./config:/usr/src/app/config
    image: ghcr.io/itsecholot/containernursery:latest
networks:
  app_default:
    external: true
proxyListeningPort: 80
proxyHosts:
  - domain: dev.localhost
    containerName: dozzle-dozzle-1
    proxyHost: localhost
    proxyPort: 8080
    timeoutSeconds: 20
version: "3.8"
services:
  dozzle:
    ports:
      - 8080:8080
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    image: amir20/dozzle:latest
networks:
  app_default:
    external: true

Can anyone try to point any issues in docker files or in config, since i tryed everything i could, without any sucess thank you

ItsEcholot commented 1 month ago

We need more information from you here, please set the CN_LOG_LEVEL environment variable to debug for the ContainerNursery container and check the logs for more information about what's going wrong here.

dragosdmc commented 3 weeks ago

Same configuration here and I'm able to get CN to stop said container, but unable to start it. Did you find amy fix for this?

I enabled debug as well and I could clearly see all the steps involved in stopping, but after that nothing else is written in the logs when accessing the domain address.

ItsEcholot commented 3 weeks ago

Same configuration here and I'm able to get CN to stop said container, but unable to start it. Did you find amy fix for this?

I enabled debug as well and I could clearly see all the steps involved in stopping, but after that nothing else is written in the logs when accessing the domain address.

That usually means that the traffic isn’t routed through CN in the first place. Thus CN doesn’t know when you want to access the container and can’t start it.

dragosdmc commented 3 weeks ago

Figured as much, but I can't find the mistake in the configuration:

version: "3.8"
services:
  nginx:
    image: jc21/nginx-proxy-manager:latest
    restart: unless-stopped
    ports:
      - 80:80
      - 443:443
      - 81:81
services:
  prowlarr:
    image: lscr.io/linuxserver/prowlarr:latest
    container_name: prowlarr
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Etc/UTC
    volumes:
      - /srv/dockerdata/prowlarr:/config
    ports:
      - 9001:9696
    restart: unless-stopped

Tried using CN both with a bridge between containers and with the local IP as well, but same result.

1.

root@docker:/srv/dockerdata/containernursery$ cat config.yml 
proxyListeningPort: 80
proxyHosts:
  - domain: prowlarr.domain.com
    containerName: prowlarr
    displayName: Prowlarr
    proxyHost: prowlarr
    proxyPort: 9696
    timeoutSeconds: 15
    stopOnTimeoutIfCpuUsageBelow: 50
    proxyUseHttps: false
    proxyUseCustomMethod: GET

2.

root@docker:/srv/dockerdata/containernursery$ cat config.yml 
proxyListeningPort: 80
proxyHosts:
  - domain: prowlarr.domain.com
    containerName: prowlarr
    displayName: Prowlarr
    proxyHost: 192.168.0.50
    proxyPort: 9001
    timeoutSeconds: 15
    stopOnTimeoutIfCpuUsageBelow: 50
    proxyUseHttps: false
    proxyUseCustomMethod: GET

Am I doing something wrong here?

dragosdmc commented 3 weeks ago

here?

Solved by redeploying the container using the host network.