Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Main container fails to start #422

Open
3 tasks done
florentin68 opened this issue Jan 29, 2024 · 2 comments
Open
3 tasks done

Main container fails to start #422

florentin68 opened this issue Jan 29, 2024 · 2 comments

Comments

@florentin68
Copy link

florentin68 commented Jan 29, 2024

Support guidelines

I've found a bug and checked that ...

  • ... the documentation does not mention anything about my problem
  • ... there are no open or closed issues that are related to my problem

Description

I try to install LibreNMS on Docker.
I've followed the compose example script but the main container don't start successfully:
image
I've tried with or without DB_NAME et DB_USER environment variables.
Loading stack via Portainer, environment variables seem to be correct (no trailing spaces, etc).

Expected behaviour

Start container

Actual behaviour

Start and stop with these errors:

The environment file is invalid!
Failed to parse dotenv file. Encountered an invalid name at [In StreamHandler.php line 159:].

Steps to reproduce

Follow example given in the docs

Docker info

Client: Docker Engine - Community
 Version:    24.0.5
 Context:    default
 Debug Mode: false

Server:
 Containers: 32
  Running: 22
  Paused: 0
  Stopped: 10
 Images: 21
 Server Version: 24.0.5
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: active
  NodeID: *****
  Is Manager: true
  ClusterID: *****
  Managers: 1
  Nodes: 3
  Default Address Pool: 10.0.0.0/8  
  SubnetSize: 24
  Data Path Port: 4789
  Orchestration:
   Task History Retention Limit: 5
  Raft:
   Snapshot Interval: 10000
   Number of Old Snapshots to Retain: 0
   Heartbeat Tick: 1
   Election Tick: 10
  Dispatcher:
   Heartbeat Period: 5 seconds
  CA Configuration:
   Expiry Duration: 3 months
   Force Rotate: 0
  Autolock Managers: false
  Root Rotation In Progress: false
  Node Address: *.*.*.*
  Manager Addresses:
   *.*.*.*:2377
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 3dce8eb055cbb6872793272b4f20ed16117344f8
 runc version: 
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.1.70-1.ph5-esx
 Operating System: VMware Photon OS/Linux
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 31.37GiB
 Name: *****
 ID: *****
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine

Docker Compose config

version: "3.9"

# LIBRENMS DOCKER-COMPOSE

########################### NETWORKS
# There is no need to create any networks outside this docker-compose file.
# Docker Compose version 3.5 or higher required to define networks this way.

networks:
  t2_proxy:
    external: true

########################### SECRETS

secrets:
  smtp_user:
    file: $DOCKERDIR/secrets/smtp_user
  smtp_password:
    file: $DOCKERDIR/secrets/smtp_password
  librenms_db_database:
    file: $DOCKERDIR/secrets/librenms_db_database
  librenms_db_user:
    file: $DOCKERDIR/secrets/librenms_db_user
  librenms_db_password:
    file: $DOCKERDIR/secrets/librenms_db_password

########################### SERVICES

services:
  msmtpd:
    image: crazymax/msmtpd:latest
    environment:
      - SMTP_HOST=$SMTP_HOST
      - SMTP_PORT=$SMTP_PORT
      - SMTP_TLS=$SMTP_TLS
      - SMTP_STARTTLS=$SMTP_STARTTLS
      - SMTP_TLS_CHECKCERT=$SMTP_TLS_CHECKCERT
      - SMTP_AUTH=$SMTP_AUTH
      - SMTP_USER=/run/secrets/smtp_user
      - SMTP_PASSWORD=/run/secrets/smtp_password
      - SMTP_FROM=/run/secrets/smtp_user
    secrets:
      - smtp_user
      - smtp_password
    deploy:
      labels:
        ## Diun
        - 'diun.enable=true'
        - 'diun.watch_repo=false'
      placement: 
        constraints: [node.hostname == *****]
      update_config:
        parallelism: 2
        delay: 10s
      restart_policy:
        condition: any
        delay: 5s
        max_attempts: 3
        window: 120s

  librenms:
    image: librenms/librenms:latest
    cap_add:
      - NET_ADMIN
      - NET_RAW
    networks:
      - t2_proxy
    volumes:
      - $DOCKERDIR/volumes/librenms:/data
    environment:
      - TZ=${TZ}
      - PUID=${UID}
      - PGID=${GID}
      - DB_HOST=$DB_HOST
      #- FILE__DB_NAME=/run/secrets/librenms_db_database
      #- FILE__DB_USER=/run/secrets/librenms_db_user
      - DB_PASSWORD_FILE=/run/secrets/librenms_db_password
      - DB_TIMEOUT=60
    secrets:
      - librenms_db_database
      - librenms_db_user
      - librenms_db_password
    deploy:
      labels:
        ## Traefik
        - 'traefik.enable=true'
        ## HTTP Routers
        - 'traefik.http.routers.librenms.entrypoints=https'
        - 'traefik.http.routers.librenms.rule=Host(`librenms.$DOMAINNAME`)'
        ## HTTP Services
        - 'traefik.http.routers.librenms.service=librenms'
        - 'traefik.http.services.librenms.loadbalancer.server.port=8000'
        ## Diun
        - 'diun.enable=true'
        - 'diun.watch_repo=false'
      placement: 
        constraints: [node.hostname == *****]
      update_config:
        parallelism: 2
        delay: 10s
      restart_policy:
        condition: any
        delay: 5s
        max_attempts: 3
        window: 120s

  dispatcher:
    image: librenms/librenms:latest
    cap_add:
      - NET_ADMIN
      - NET_RAW
    volumes:
      - $DOCKERDIR/volumes/librenms:/data
    environment:
      - TZ=${TZ}
      - PUID=${UID}
      - PGID=${GID}
      - DB_HOST=$DB_HOST
      #- FILE__DB_NAME=/run/secrets/librenms_db_database
      #- FILE__DB_USER=/run/secrets/librenms_db_user
      - DB_PASSWORD_FILE=/run/secrets/librenms_db_password
      - DB_TIMEOUT=60
      - DISPATCHER_NODE_ID=dispatcher1
      - SIDECAR_DISPATCHER=1
    secrets:
      - librenms_db_database
      - librenms_db_user
      - librenms_db_password
    deploy:
      labels:
        ## Diun
        - 'diun.enable=true'
        - 'diun.watch_repo=false'
      placement: 
        constraints: [node.hostname == *****]
      update_config:
        parallelism: 2
        delay: 10s
      restart_policy:
        condition: any
        delay: 5s
        max_attempts: 3
        window: 120s

[...]

Logs

librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | [s6-init] making user provided files available at /var/run/s6/etc...exited 0.
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | [s6-init] ensuring user provided files have correct perms...exited 0.
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | [fix-attrs.d] applying ownership & permissions fixes...
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | [fix-attrs.d] done.
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | [cont-init.d] executing container initialization scripts...
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | [cont-init.d] 00-fix-logs.sh: executing... 
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | [cont-init.d] 00-fix-logs.sh: exited 0.
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | [cont-init.d] 01-fix-uidgid.sh: executing... 
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | Switching to PGID 100...
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | Switching to PUID 900...
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | [cont-init.d] 01-fix-uidgid.sh: exited 0.
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | [cont-init.d] 02-fix-perms.sh: executing... 
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | Fixing perms...
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | [cont-init.d] 02-fix-perms.sh: exited 0.
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | [cont-init.d] 03-config.sh: executing... 
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | Setting timezone to Europe/Paris...
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | Setting PHP-FPM configuration...
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | Setting PHP INI configuration...
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | Setting OpCache configuration...
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | Setting Nginx configuration...
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | Updating SNMP community...
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | Initializing LibreNMS files / folders...
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | Setting LibreNMS configuration...
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | Checking LibreNMS plugins...
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | Fixing perms...
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | Checking additional Monitoring plugins...
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | Checking alert templates...
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | [cont-init.d] 03-config.sh: exited 0.
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | [cont-init.d] 04-svc-main.sh: executing... 
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | Waiting 60s for database to be ready...
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | Database ready!
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | Enabling First Run Wizard...
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | Updating database schema...
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | The environment file is invalid!
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | Failed to parse dotenv file. Encountered an invalid name at [In StreamHandler.php line 159:].
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | [cont-init.d] 04-svc-main.sh: exited 1.
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | [cont-finish.d] executing container finish scripts...
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | [cont-finish.d] done.
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | [s6-finish] waiting for services.
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | [s6-finish] sending all processes the TERM signal.
librenms_librenms.1.u7tp0edcwgpk@photon1-fm    | [s6-finish] sending all processes the KILL signal and exiting


### Additional info

_No response_
@blockedusername
Copy link

@florentin68 did you know that you specified the file "/run/secrets/librenms_db_password" as the password file variable, which will be searched inside the docker container?

@florentin68
Copy link
Author

florentin68 commented Sep 6, 2024

@florentin68 did you know that you specified the file "/run/secrets/librenms_db_password" as the password file variable, which will be searched inside the docker container?

Yes I'm doing so with other services, perhaps not possible here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants