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

Docker compose not set SESSION_SECURE_COOKIE #482

Open
evheniu opened this issue Jan 12, 2025 · 4 comments
Open

Docker compose not set SESSION_SECURE_COOKIE #482

evheniu opened this issue Jan 12, 2025 · 4 comments

Comments

@evheniu
Copy link

evheniu commented Jan 12, 2025

Description

When I add to .env variable SESSION_SECURE_COOKIE=true after creation compose containers it not implement.
In webUI validation present error "Set SESSION_SECURE_COOKIE=true and run lnms config:cache"
If try add it directly to container docker exec librenms echo "SESSION_SECURE_COOKIE=true" >> .env and run docker exec librenms lnms config:cache it also not working.

How it can be set in docekr compose instalation ?

@murrant
Copy link
Member

murrant commented Jan 15, 2025

  1. Make sure you have https access to your librenms web ui for that setting to work.
  2. just set it in your docker compose env, not sure why you are trying to put it into the .env file.

@evheniu
Copy link
Author

evheniu commented Jan 15, 2025

How it can be set in docker compose file ?

name: librenms

services:
  db:
    image: mariadb:10
    container_name: librenms_db
    command:
      - "mysqld"
      - "--innodb-file-per-table=1"
      - "--lower-case-table-names=0"
      - "--character-set-server=utf8mb4"
      - "--collation-server=utf8mb4_unicode_ci"
    volumes:
      - "./db:/var/lib/mysql"
    environment:
      - "TZ=${TZ}"
      - "MARIADB_RANDOM_ROOT_PASSWORD=yes"
      - "MYSQL_DATABASE=${MYSQL_DATABASE}"
      - "MYSQL_USER=${MYSQL_USER}"
      - "MYSQL_PASSWORD=${MYSQL_PASSWORD}"
    restart: always
    networks:
      nms:

  redis:
    image: redis:7.2-alpine
    container_name: librenms_redis
    environment:
      - "TZ=${TZ}"
    restart: always
    networks:
      nms:

  msmtpd:
    image: crazymax/msmtpd:latest
    container_name: librenms_msmtpd
    env_file:
      - "./msmtpd.env"
    restart: always
    networks:
      nms:

  librenms:
    image: librenms/librenms:latest
    container_name: librenms
    hostname: librenms
    cap_add:
      - NET_ADMIN
      - NET_RAW
    networks:
      proxy:
      nms:
    #ports:
    #  - target: 8000
    #    published: 8000
    #    protocol: tcp
    depends_on:
      - db
      - redis
      - msmtpd
    volumes:
      - "./librenms:/data"
    env_file:
      - "./librenms.env"
    environment:
      - "TZ=${TZ}"
      - "PUID=${PUID}"
      - "PGID=${PGID}"
      - "DB_HOST=db"
      - "DB_NAME=${MYSQL_DATABASE}"
      - "DB_USER=${MYSQL_USER}"
      - "DB_PASSWORD=${MYSQL_PASSWORD}"
      - "DB_TIMEOUT=60"
    restart: always
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.LibreNMS.entrypoints=https"
      - "traefik.http.routers.LibreNMS.rule=Host(`example.com`)"
      - "traefik.http.routers.LibreNMS.tls=true"
      - "traefik.http.services.LibreNMS.loadbalancer.server.port=8000"
      - "traefik.docker.network=proxy"
  
  dispatcher:
    image: librenms/librenms:latest
    container_name: librenms_dispatcher
    hostname: librenms-dispatcher
    cap_add:
      - NET_ADMIN
      - NET_RAW
    depends_on:
      - librenms
      - redis
    volumes:
      - "./librenms:/data"
    env_file:
      - "./librenms.env"
    environment:
      - "TZ=${TZ}"
      - "PUID=${PUID}"
      - "PGID=${PGID}"
      - "DB_HOST=db"
      - "DB_NAME=${MYSQL_DATABASE}"
      - "DB_USER=${MYSQL_USER}"
      - "DB_PASSWORD=${MYSQL_PASSWORD}"
      - "DB_TIMEOUT=60"
      - "DISPATCHER_NODE_ID=dispatcher1"
      - "SIDECAR_DISPATCHER=1"
    restart: always
    networks:
      nms:

  syslogng:
    image: librenms/librenms:latest
    container_name: librenms_syslogng
    hostname: librenms-syslogng
    cap_add:
      - NET_ADMIN
      - NET_RAW
    depends_on:
      - librenms
      - redis
    ports:
      - target: 514
        published: 514
        protocol: tcp
      - target: 514
        published: 514
        protocol: udp
    volumes:
      - "./librenms:/data"
    env_file:
      - "./librenms.env"
    environment:
      - "TZ=${TZ}"
      - "PUID=${PUID}"
      - "PGID=${PGID}"
      - "DB_HOST=db"
      - "DB_NAME=${MYSQL_DATABASE}"
      - "DB_USER=${MYSQL_USER}"
      - "DB_PASSWORD=${MYSQL_PASSWORD}"
      - "DB_TIMEOUT=60"
      - "SIDECAR_SYSLOGNG=1"
    restart: always
    networks:
      nms:

  snmptrapd:
    image: librenms/librenms:latest
    container_name: librenms_snmptrapd
    hostname: librenms-snmptrapd
    cap_add:
      - NET_ADMIN
      - NET_RAW
    depends_on:
      - librenms
      - redis
    ports:
      - target: 162
        published: 162
        protocol: tcp
      - target: 162
        published: 162
        protocol: udp
    volumes:
      - "./librenms:/data"
    env_file:
      - "./librenms.env"
    environment:
      - "TZ=${TZ}"
      - "PUID=${PUID}"
      - "PGID=${PGID}"
      - "DB_HOST=db"
      - "DB_NAME=${MYSQL_DATABASE}"
      - "DB_USER=${MYSQL_USER}"
      - "DB_PASSWORD=${MYSQL_PASSWORD}"
      - "DB_TIMEOUT=60"
      - "SIDECAR_SNMPTRAPD=1"
    restart: always
    networks:
      nms:

networks:
  proxy:
    external: true
  nms:
    external: true

@murrant
Copy link
Member

murrant commented Jan 16, 2025

environment:
 - "SESSSION_SECURE_COOKIE=true"

@evheniu
Copy link
Author

evheniu commented Jan 17, 2025

I don't know why but environment not apply parameter.

I fix it with next steps:

1 docker exec -it librenms /bin/bash
2 apk add nano
3 nano .env

Than I add missing parameter:

librenms:/opt/librenms# cat .env
APP_URL=/
DB_HOST=db
DB_PORT=3306
DB_DATABASE=librenms
DB_USERNAME=librenms
DB_PASSWORD="SuperStrongPasswd"
APP_KEY=base64:hfdjkshgjkdfhlgkjhduKA6rrjOTYY/6DXs=
NODE_ID=4545f45454271
SESSSION_SECURE_COOKIE=true

4 lnms config:cache

This solved issue.

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