Backing up Postgres and Redis DBs

@Dr_Vivek_Gupta, I would not use the API backup for this because it does not include the data in the Redis DB which is very helpful for a complete restoration. I would...

  1. Restore the VM snapshot to another machine and see if you can upgrade that machine without any problems. If you can do this, you've confirmed you can have a smooth upgrade which is ultimately what you need to.

  2. If you want to be extra safe, dump the Postgres DB and the Redis DBs (as @KagundaJM suggested) from the old machine and store it somewhere safe.

    # stop nginx and service to prevent new incoming data
    docker stop central-nginx-1
    docker stop central-service-1
    # export secrets
    docker cp service:/etc/secrets ~/;
    # export redis dbs
    docker exec -it central-enketo_redis_main-1 redis-cli -p 6379 save
    docker cp central-enketo_redis_main-1:/data/enketo-main.rdb ~/enketo-main.rdb
    docker exec -it central-enketo_redis_cache-1 redis-cli -p 6380 save
    docker cp central-enketo_redis_cache-1:/data/enketo-cache.rdb ~/enketo-cache.rdb
    # export postgres db
    docker exec central-postgres14-1 pg_dump -Fc -U odk odk > ~/central.bin
    # start nginx and service
    docker start central-service-1
    docker start central-nginx-1
    
2 Likes