Persistence of resources.ini for icingaweb

  • Icinga Web 2 version : 2.12.1

Here is my doker compose service :

icingaweb:
    image: icinga/icingaweb2
    container_name: icingaweb
    depends_on:
      - mysql
      - icinga2
    environment:
      icingaweb.enabledModules: director, icingadb, incubator
      <<: [*icinga-db-web-config, *icinga-director-config, *icinga-web-config]
      ICINGADB_MYSQL_PASSWORD: ${ICINGADB_MYSQL_PASSWORD:-icingadb}
      ICINGAWEB_MYSQL_PASSWORD: ${ICINGAWEB_MYSQL_PASSWORD:-icingaweb}
      ICINGA_DIRECTOR_MYSQL_PASSWORD: ${ICINGA_DIRECTOR_MYSQL_PASSWORD:-director}
    logging: *default-logging
    ports:
      - 8080:8080
    volumes:
      - icingaweb:/data
    restart: on-failure

Hi all,
when I create an ldap or a new resource from the interface Configuration/Application/Resources. When I restart the container all is gone. how to make this config persisitent?
I already tested the modification by hand of the resources.ini in both /etc/icinagaweb2/ and /data/etc/icinagaweb2, nothing! config disappears once the container restarts!

Please only use /data/etc/icingaweb2 for storage within the container, as /etc/icingaweb2 is ephemeral. Following the (a bit short) documentation in GitHub - Icinga/docker-icingaweb2, you need to manually populate the configuration files.

From the README of GitHub - Icinga/docker-icingaweb2

  • Run the setup wizard as usual. It will store all configuration in /data/etc/icingaweb2. Hint: docker run --rm -v icingaweb:/data icinga/icingaweb2 icingacli setup token create
  • Provide configuration files in /data/etc/icingaweb2 by yourself. Consult the Icinga Web 2 configuration documentation on which .ini files there are.
  • Provide environment variables as shown above.

Hi, Thank you for your response.
I still have the problem : when I edit resource.ini in /data/etc/icingaweb/ inside the icingaweb conatainer, when I restart the conatiner, the config I made in resource.ini is gone.

In the logs I don’t undertnad that it keeps regeneragting /data/etc/icingaweb/ when the container restart.

[aaitouahman.SEC@besces-p01-monitoring icinga-compose]$ sudo docker logs icingaweb
[docker_entrypoint:info] [pid 1] DOCKERE: Initializing /data as we’re the init process
[docker_entrypoint:debug] [pid 1] DOCKERE: Creating “/data/etc/icingaweb2/enabledModules”
[docker_entrypoint:debug] [pid 1] DOCKERE: Creating “/data/var/lib/icingaweb2”
[docker_entrypoint:debug] [pid 1] DOCKERE: Translating env vars to .ini config
[Mon Aug 19 08:20:21.377457226 2024] [docker_entrypoint:trace1] [pid 1] DOCKERE: Writing “/data/etc/icingaweb2/modules/director/config.ini”
[Mon Aug 19 08:20:21.377850441 2024] [docker_entrypoint:trace1] [pid 1] DOCKERE: Writing “/data/etc/icingaweb2/modules/icingadb/commandtransports.ini”
[docker_entrypoint:trace1] [pid 1] DOCKERE: Writing “/data/etc/icingaweb2/modules/icingadb/redis.ini”
[docker_entrypoint:trace1] [pid 1] DOCKERE: Writing “/data/etc/icingaweb2/roles.ini”
[docker_entrypoint:trace1] [pid 1] DOCKERE: Writing “/data/etc/icingaweb2/authentication.ini”
[docker_entrypoint:trace1] [pid 1] DOCKERE: Writing “/data/etc/icingaweb2/resources.ini”
[docker_entrypoint:trace1] [pid 1] DOCKERE: Writing “/data/etc/icingaweb2/config.ini”
[docker_entrypoint:trace1] [pid 1] DOCKERE: Writing “/data/etc/icingaweb2/modules/director/kickstart.ini”
[docker_entrypoint:trace1] [pid 1] DOCKERE: Writing “/data/etc/icingaweb2/groups.ini”
[docker_entrypoint:trace1] [pid 1] DOCKERE: Writing “/data/etc/icingaweb2/modules/icingadb/config.ini”
[docker_entrypoint:debug] [pid 1] DOCKERE: Enabling/disabling modules
[docker_entrypoint:info] [pid 1] DOCKERE: Checking database resources used as backends
[docker_entrypoint:debug] [pid 1] DOCKERE: Checking database resource “icingaweb-mysql”
[docker_entrypoint:info] [pid 1] DOCKERE: Ensuring database authentication backend “icingaweb2” to have a user “icingaadmin” with the password “***”

Solve it!
to configure icingaweb resource.ini or auth.ini or role.ini (the files under /data/etc/icingaweb/) you need to use the config in the docker compose file. like this for creating an ldap resource for exemple :
icingaweb.resources.ldap-res.type: “ldap”
icingaweb.resources.ldap-res.hostname: “111.111.111.111”
icingaweb.resources.ldap-res.port: “389”
icingaweb.resources.ldap-res.encryption: “none”
icingaweb.resources.ldap-res.root_dn: “dc=dda”
icingaweb.resources.ldap-res.bind_dn: “uid=svg.SEC,ou=client,o=security,o=level2,dc=dda”
icingaweb.resources.ldap-res.bind_pw: “blabla”
icingaweb.resources.ldap-res.timeout: “5”