Network Server migration

Hello,

about 100 end-devices are handled by the embedded network server of a gateway. I want to migrate them on a new ChirpStack network server.

How to proceed in a way that do not rely on the end-device build-in feature (Rejoin Mode) that sends a Join Request after (by default) 32 detection signals failure? Because this feature can not be set by any downlink frame and I can’t afford to set it through a NFC mobile application…

What is the best way to proceed?

Regards

You can copy the databases (including device-session keys) to your V4 instance.

Follow this guide:

https://www.chirpstack.io/docs/v3-v4-migration.html

I have the same challenge at the moment where I need to migrate some devices from a dev LNS over to the prod LNS.

There is an Activation API we can use to copy over the frame counters and keys to the new LNS. See here https://www.chirpstack.io/docs/chirpstack/api/api.html#deviceactivation
I believe the steps are:

  1. create the device in the new LNS - either via API or UI
  2. get the device activation details from the current LNS
  3. post the device activation details to the new LNS

Now that you’ve brought this back up, I think I misread the question. The v3-v4 migration does give the general backup process but OP doesn’t have a v3 instance (to my knowledge).

Your method is definitely optimal if you only want to move a portion of devices over, but if you want to move all devices, device profiles, session keys, etc… you could do something along these lines:

0) ssh to machine and enter the chirpstack-docker folder
$ ssh <user>@<chirpstack-server>
$ cd chirpstack-docker

1) Ensure Docker is down so no containers try to write while backup occurs. 
$ sudo docker compose down

2) Copy redis data dump
$ sudo cp /var/lib/docker/volumes/chirpstack-docker_redisdata/_data/dump.rdb redisbackup.rdb

3) Create a file for psql backup dump
$ touch postgresbackup

4) Start only the postgres container
$ sudo docker compose up postgres -d

5) dump all sql backup commands from container and pipe into backup file
$ sudo docker exec -it chirpstack-docker-postgres-1 pg_dumpall -c --no-password -h localhost -U postgres > postgresbackup


Restoral process

0) ssh to machine and enter chirpstack-docker folder
$ ssh <user>@<chirpstack-server>
$ cd chirpstack-docker

1) Ensure Docker is down so no containers try to write while backup occurs. 
$ sudo docker compose down

2) Make a copy of current redis database (As a safe measure)
$ sudo cp /var/lib/docker/volumes/chirpstack-docker_redisdata/_data/dump.rdb redisdatareplaced.rdb

3) Delete old data dump and copy backup into volume
$ sudo rm /var/lib/docker/volumes/chirpstack-docker_redisdata/_data/dump.rdb
$ sudo cp redisbackup.rdb /var/lib/docker/volumes/chirpstack-docker_redisdata/_data/dump.rdb

4) Change permissions of new dump file
$ sudo chown lxd:<user>l /var/lib/docker/volumes/chirpstack-docker_redisdata/_data/dump.rdb
$ sudo chmod 600 /var/lib/docker/volumes/chirpstack-docker_redisdata/_data/dump.rdb

5) Start only postgres containers
$ sudo docker compose up postgres -d

6) Rebuild SQL database from backup
$ sudo docker compose exec -T postgres psql -h localhost -U postgres < postgresbackup

I wrote this a while ago and it’s slightly sloppy, but that’s the idea.