librenms / docker

LibreNMS Docker image
MIT License
693 stars 281 forks source link

Docker compose - librenms container does not start - #448

Open ryanrudak opened 4 months ago

ryanrudak commented 4 months ago

Support guidelines

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

Description

I try a new installation with the docker compose example files.

Expected behaviour

a new fresh installation with an accessable webui. I just want to test it.

Actual behaviour

crash of the docker container 'librenms'. librenms exited with code 1

Steps to reproduce

docker desktop for windows - info --> Docker info field (Output of docker info command) download the docker compose example files docker compose up -d

Docker info

Client:
 Version:    27.1.1
 Context:    desktop-linux
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.16.1-desktop.1
    Path:     C:\Program Files\Docker\cli-plugins\docker-buildx.exe
  compose: Docker Compose (Docker Inc.)
    Version:  v2.29.1-desktop.1
    Path:     C:\Program Files\Docker\cli-plugins\docker-compose.exe
  debug: Get a shell into any image or container (Docker Inc.)
    Version:  0.0.34
    Path:     C:\Program Files\Docker\cli-plugins\docker-debug.exe
  desktop: Docker Desktop commands (Alpha) (Docker Inc.)
    Version:  v0.0.14
    Path:     C:\Program Files\Docker\cli-plugins\docker-desktop.exe
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.2
    Path:     C:\Program Files\Docker\cli-plugins\docker-dev.exe
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.25
    Path:     C:\Program Files\Docker\cli-plugins\docker-extension.exe
  feedback: Provide feedback, right in your terminal! (Docker Inc.)
    Version:  v1.0.5
    Path:     C:\Program Files\Docker\cli-plugins\docker-feedback.exe
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v1.3.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-init.exe
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-sbom.exe
  scout: Docker Scout (Docker Inc.)
    Version:  v1.11.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-scout.exe

Server:
 Containers: 27
  Running: 7
  Paused: 0
  Stopped: 20
 Images: 17
 Server Version: 27.1.1
 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: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 2bf793ef6dc9a18e00cb12efb64355c2c9d5eb41
 runc version: v1.1.13-0-g58aa920
 init version: de40ad0
 Security Options:
  seccomp
   Profile: unconfined
 Kernel Version: 5.15.146.1-microsoft-standard-WSL2
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 15.5GiB
 Name: docker-desktop
 ID: 70fa826b-8161-479a-be25-52b2769b3d42
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Labels:
  com.docker.desktop.address=npipe://\\.\pipe\docker_cli
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5555
  127.0.0.0/8
 Live Restore Enabled: false

Docker Compose config

name: librenms
services:
  db:
    command:
      - mysqld
      - --innodb-file-per-table=1
      - --lower-case-table-names=2
      - --character-set-server=utf8mb4
      - --collation-server=utf8mb4_unicode_ci
    container_name: librenms_db
    environment:
      MARIADB_RANDOM_ROOT_PASSWORD: "yes"
      MYSQL_DATABASE: librenms
      MYSQL_PASSWORD: librenms
      MYSQL_USER: librenms
      TZ: Europe/Berlin
    image: mariadb:10
    networks:
      default: null
    restart: always
    volumes:
      - type: bind
        source: C:\Users\user\libeNMS\db
        target: /var/lib/mysql
        bind:
          create_host_path: true
  dispatcher:
    cap_add:
      - NET_ADMIN
      - NET_RAW
    container_name: librenms_dispatcher
    depends_on:
      librenms:
        condition: service_started
        required: true
      redis:
        condition: service_started
        required: true
    environment:
      CACHE_DRIVER: redis
      DB_HOST: db
      DB_NAME: librenms
      DB_PASSWORD: librenms
      DB_TIMEOUT: "60"
      DB_USER: librenms
      DISPATCHER_NODE_ID: dispatcher1
      LIBRENMS_SNMP_COMMUNITY: librenmsdocker
      LIBRENMS_WEATHERMAP: "false"
      LIBRENMS_WEATHERMAP_SCHEDULE: '*/5 * * * *'
      LOG_IP_VAR: remote_addr
      MAX_INPUT_VARS: "1000"
      MEMORY_LIMIT: 256M
      OPCACHE_MEM_SIZE: "128"
      PGID: "1000"
      PUID: "1000"
      REAL_IP_FROM: 0.0.0.0/32
      REAL_IP_HEADER: X-Forwarded-For
      REDIS_HOST: redis
      RRDCACHED_SERVER: rrdcached:42217
      SESSION_DRIVER: redis
      SIDECAR_DISPATCHER: "1"
      TZ: Europe/Berlin
      UPLOAD_MAX_SIZE: 16M
    hostname: librenms-dispatcher
    image: librenms/librenms:latest
    networks:
      default: null
    restart: always
    volumes:
      - type: bind
        source: C:\Users\user\libeNMS\librenms
        target: /data
        bind:
          create_host_path: true
  librenms:
    cap_add:
      - NET_ADMIN
      - NET_RAW
    container_name: librenms
    depends_on:
      db:
        condition: service_started
        required: true
      msmtpd:
        condition: service_started
        required: true
      redis:
        condition: service_started
        required: true
      rrdcached:
        condition: service_started
        required: true
    environment:
      CACHE_DRIVER: redis
      DB_HOST: db
      DB_NAME: librenms
      DB_PASSWORD: librenms
      DB_TIMEOUT: "60"
      DB_USER: librenms
      LIBRENMS_SNMP_COMMUNITY: librenmsdocker
      LIBRENMS_WEATHERMAP: "false"
      LIBRENMS_WEATHERMAP_SCHEDULE: '*/5 * * * *'
      LOG_IP_VAR: remote_addr
      MAX_INPUT_VARS: "1000"
      MEMORY_LIMIT: 256M
      OPCACHE_MEM_SIZE: "128"
      PGID: "1000"
      PUID: "1000"
      REAL_IP_FROM: 0.0.0.0/32
      REAL_IP_HEADER: X-Forwarded-For
      REDIS_HOST: redis
      RRDCACHED_SERVER: rrdcached:42217
      SESSION_DRIVER: redis
      TZ: Europe/Berlin
      UPLOAD_MAX_SIZE: 16M
    hostname: librenms
    image: librenms/librenms:24.4.1
    networks:
      default: null
    ports:
      - mode: ingress
        target: 8000
        published: "8000"
        protocol: tcp
    restart: always
    volumes:
      - type: bind
        source: C:\Users\user\libeNMS\librenms
        target: /data
        bind:
          create_host_path: true
  msmtpd:
    container_name: librenms_msmtpd
    environment:
      SMTP_AUTH: "on"
      SMTP_FROM: foo@gmail.com
      SMTP_HOST: smtp.gmail.com
      SMTP_PASSWORD: bar
      SMTP_PORT: "587"
      SMTP_STARTTLS: "on"
      SMTP_TLS: "on"
      SMTP_TLS_CHECKCERT: "on"
      SMTP_USER: foo
    image: crazymax/msmtpd:latest
    networks:
      default: null
    restart: always
  redis:
    container_name: librenms_redis
    environment:
      TZ: Europe/Berlin
    image: redis:7.2-alpine
    networks:
      default: null
    restart: always
  rrdcached:
    container_name: librenms_rrdcached
    environment:
      FLUSH_DEAD_DATA_INTERVAL: "3600"
      LOG_LEVEL: LOG_INFO
      PGID: "1000"
      PUID: "1000"
      TZ: Europe/Berlin
      WRITE_JITTER: "1800"
      WRITE_THREADS: "4"
      WRITE_TIMEOUT: "1800"
    image: crazymax/rrdcached
    networks:
      default: null
    restart: always
    volumes:
      - type: bind
        source: C:\Users\user\libeNMS\rrd\db
        target: /data/db
        bind:
          create_host_path: true
      - type: bind
        source: C:\Users\user\libeNMS\rrd\journal
        target: /data/journal
        bind:
          create_host_path: true
  snmptrapd:
    cap_add:
      - NET_ADMIN
      - NET_RAW
    container_name: librenms_snmptrapd
    depends_on:
      librenms:
        condition: service_started
        required: true
      redis:
        condition: service_started
        required: true
    environment:
      CACHE_DRIVER: redis
      DB_HOST: db
      DB_NAME: librenms
      DB_PASSWORD: librenms
      DB_TIMEOUT: "60"
      DB_USER: librenms
      LIBRENMS_SNMP_COMMUNITY: librenmsdocker
      LIBRENMS_WEATHERMAP: "false"
      LIBRENMS_WEATHERMAP_SCHEDULE: '*/5 * * * *'
      LOG_IP_VAR: remote_addr
      MAX_INPUT_VARS: "1000"
      MEMORY_LIMIT: 256M
      OPCACHE_MEM_SIZE: "128"
      PGID: "1000"
      PUID: "1000"
      REAL_IP_FROM: 0.0.0.0/32
      REAL_IP_HEADER: X-Forwarded-For
      REDIS_HOST: redis
      RRDCACHED_SERVER: rrdcached:42217
      SESSION_DRIVER: redis
      SIDECAR_SNMPTRAPD: "1"
      TZ: Europe/Berlin
      UPLOAD_MAX_SIZE: 16M
    hostname: librenms-snmptrapd
    image: librenms/librenms:latest
    networks:
      default: null
    ports:
      - mode: ingress
        target: 162
        published: "162"
        protocol: tcp
      - mode: ingress
        target: 162
        published: "162"
        protocol: udp
    restart: always
    volumes:
      - type: bind
        source: C:\Users\user\libeNMS\librenms
        target: /data
        bind:
          create_host_path: true
  syslogng:
    cap_add:
      - NET_ADMIN
      - NET_RAW
    container_name: librenms_syslogng
    depends_on:
      librenms:
        condition: service_started
        required: true
      redis:
        condition: service_started
        required: true
    environment:
      CACHE_DRIVER: redis
      DB_HOST: db
      DB_NAME: librenms
      DB_PASSWORD: librenms
      DB_TIMEOUT: "60"
      DB_USER: librenms
      LIBRENMS_SNMP_COMMUNITY: librenmsdocker
      LIBRENMS_WEATHERMAP: "false"
      LIBRENMS_WEATHERMAP_SCHEDULE: '*/5 * * * *'
      LOG_IP_VAR: remote_addr
      MAX_INPUT_VARS: "1000"
      MEMORY_LIMIT: 256M
      OPCACHE_MEM_SIZE: "128"
      PGID: "1000"
      PUID: "1000"
      REAL_IP_FROM: 0.0.0.0/32
      REAL_IP_HEADER: X-Forwarded-For
      REDIS_HOST: redis
      RRDCACHED_SERVER: rrdcached:42217
      SESSION_DRIVER: redis
      SIDECAR_SYSLOGNG: "1"
      TZ: Europe/Berlin
      UPLOAD_MAX_SIZE: 16M
    hostname: librenms-syslogng
    image: librenms/librenms:latest
    networks:
      default: null
    ports:
      - mode: ingress
        target: 514
        published: "514"
        protocol: tcp
      - mode: ingress
        target: 514
        published: "514"
        protocol: udp
    restart: always
    volumes:
      - type: bind
        source: C:\Users\user\libeNMS\librenms
        target: /data
        bind:
          create_host_path: true
networks:
  default:
    name: librenms_default

Logs

librenms             | [s6-init] making user provided files available at /var/run/s6/etc...exited 0.
librenms             | [s6-init] ensuring user provided files have correct perms...exited 0.
librenms             | [fix-attrs.d] applying ownership & permissions fixes...
librenms             | [fix-attrs.d] done.
librenms             | [cont-init.d] executing container initialization scripts...
librenms             | [cont-init.d] 00-fix-logs.sh: executing...
librenms             | [cont-init.d] 00-fix-logs.sh: exited 0.
librenms             | [cont-init.d] 01-fix-uidgid.sh: executing...
librenms             | [cont-init.d] 01-fix-uidgid.sh: exited 0.
librenms             | [cont-init.d] 02-fix-perms.sh: executing...
librenms             | Fixing perms...
librenms             | [cont-init.d] 02-fix-perms.sh: exited 0.
librenms             | [cont-init.d] 03-config.sh: executing...
librenms             | Setting timezone to Europe/Paris...
librenms             | Setting PHP-FPM configuration...
librenms             | Setting PHP INI configuration...
librenms             | Setting OpCache configuration...
librenms             | Setting Nginx configuration...
librenms             | Updating SNMP community...
librenms             | Initializing LibreNMS files / folders...
librenms             | Setting LibreNMS configuration...
librenms             | Checking LibreNMS plugins...
librenms             | Fixing perms...
librenms             | Checking additional Monitoring plugins...
librenms             | Checking alert templates...
librenms             | [cont-init.d] 03-config.sh: exited 0.
librenms             | [cont-init.d] 04-svc-main.sh: executing...
librenms             | Waiting 60s for database to be ready...
librenms             | Database ready!
librenms             | Updating database schema...
librenms             |
librenms             |    INFO  Running migrations.
librenms             |
librenms             |   2023_12_08_081420_create_custom_map_node_table .................... 5ms FAIL
librenms             |
librenms             | In Connection.php line 829:
librenms             |
librenms             |   SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'custom_map_
librenms             |   nodes' already exists (Connection: mysql, SQL: create table `custom_map_nod
librenms             |   es` (`custom_map_node_id` int unsigned not null auto_increment primary key,
librenms             |    `custom_map_id` int unsigned not null, `device_id` int unsigned null, `lab
librenms             |   el` varchar(50) not null, `style` varchar(50) not null, `icon` varchar(8) n
librenms             |   ull, `size` int not null, `border_width` int not null, `text_face` varchar(
librenms             |   50) not null, `text_size` int not null, `text_colour` varchar(10) not null,
librenms             |    `colour_bg` varchar(10) null, `colour_bdr` varchar(10) null, `x_pos` int n
librenms             |   ot null, `y_pos` int not null, `created_at` timestamp null, `updated_at` ti
librenms             |   mestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')
librenms             |
librenms             |
librenms             | In Connection.php line 587:
librenms             |
librenms             |   SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'custom_map_
librenms             |   nodes' already exists
librenms             |
librenms             |
librenms             | [cont-init.d] 04-svc-main.sh: exited 1.
librenms             | [cont-finish.d] executing container finish scripts...
librenms             | [cont-finish.d] done.
librenms             | [s6-finish] waiting for services.
librenms             | [s6-finish] sending all processes the TERM signal.
librenms             | [s6-finish] sending all processes the KILL signal and exiting.
librenms exited with code 1

Additional info

No response

lexe commented 3 months ago

The image doesn't allow you to use the following setting in your DB config:

Change --lower-case-table-names=2

Back to --lower-case-table-names=0

Make sure you start from scratch.

Since you're on windows, value 0 is not possible. You could remove the volume mapped to the database container, this should be fine for testing purposes. This way the filesystem is case sensitive because the container is a linux environment.