Data loss on every upgrade

Viewed 23

I've grown used to it, but I just wanted to check with others here:
Is it normal to have all my data wiped every time I update chirpstack in docker?
My credentials get reset to admin:admin, I lose all gateways and all devices, but I've made a guide for myself on how to re-add everything. It just seems a bit weird that I have to do this every time I update chirpstack.

Here is my docker compose:

services:
  chirpstack-nginx:
    container_name: chirpstack-nginx
    image: nginx:latest
    restart: always
    ports:
      - "8420:8420"
    volumes:
      - /home/user/docker/chirpstack-nginx/nginx.conf:/etc/nginx/nginx.conf:ro
      - /home/user/docker/chirpstack-nginx/certs:/etc/nginx/certs:ro
    networks:
      - chirpstack-nginx

  chirpstack:
    container_name: chirpstack
    hostname: chirpstack
    image: chirpstack/chirpstack:latest
    command: -c /etc/chirpstack
    restart: unless-stopped
    volumes:
      - /home/user/docker/chirpstack/configuration:/etc/chirpstack
      - /home/user/docker/chirpstack/lorawan-devices:/opt/lorawan-devices
    depends_on:
      - chirpstack-postgres
      - chirpstack-redis
    environment:
      - MQTT_BROKER_HOST=[MY_IP]
      - REDIS_HOST=chirpstack-redis
      - POSTGRESQL_HOST=chirpstack-postgres
    networks:
      - chirpstack
      - chirpstack-nginx

  chirpstack-postgres:
    container_name: chirpstack-postgres
    hostname: chirpstack-postgres
    image: postgres:14-alpine
    restart: unless-stopped
    volumes:
      - /home/user/docker/chirpstack-postgres/initdb:/docker-entrypoint-initdb.d
      - /home/user/docker/chirpstack-postgres/data:/var/lib/posgresql/data
    environment:
      - POSTGRES_PASSWORD=root
    networks:
      - chirpstack

  chirpstack-redis:
    container_name: chirpstack-redis
    hostname: chirpstack-redis
    image: redis:7-alpine
    restart: unless-stopped
    command: redis-server --save 300 1 --save 60 100 --appendonly no
    volumes:
      - /home/user/docker/chirpstack-redis/data:/data
    networks:
      - chirpstack

networks:
  chirpstack:
  chirpstack-nginx:

EDIT: There was a typo in - /home/user/docker/chirpstack-postgres/data:/var/lib/posgresql/data. I wrote posgresql instead of postgresql. This is the solution to my problem, but I'll confirm on the next update.

1 Answers

I have not inspected your specific configuration, but please note that all important state is stored in PostgreSQL and data like metrics are cached in Redis.

When after an upgrade all data is lost (and you need to re-login using admin:admin) it means your PostgreSQL data was wiped. This could be caused by not correctly mounting a volume for storing the PostgreSQL data or because the volume used to store the data was removed during the upgrade.