Skip to main content

Migrate Installation

Migrate your ParkPow OnPremise Installation from machine A to a new machine B, which can have limited Internet access.

To upgrade offline installation
  1. Migrate ParkPow from the offline to an online server
  2. Perfom the upgrade process on the online server
  3. Migrate ParkPow from the online to an offline server
warning

Although the term "offline" is used, the machine must have at least temporary Internet access to activate, and periodically check for, the license after migration. Please look at Addresses and Certificates for more details.

An offline machine is defined as a machine that cannot reach the Plate Recognizer API endpoints at all times, or has restricted Internet access or bandwidth.

Backup ParkPow on Machine A​

Successfully install ParkPow​

Install ParkPow on an online machine, following the instructions from here. Ensure to sign up a user on the online machine server then stop ParkPow.

Docker compose creates docker resources prefixed by name of the folder containing the docker-compose.yml. This can be overriden by setting the COMPOSE_PROJECT_NAME enviroment variable.

Resources created if the folder name is parkpow or env COMPOSE_PROJECT_NAME=parkpow :

Containers:

  1. parkpow-db-1
  2. parkpow-web-1
  3. parkpow-jobq-1

Volumes:

  1. parkpow_app_volume
  2. parkpow_postgres_data
  3. parkpow_media_volume

Networks:

  1. parkpow_default

Resources to be migrated:​

Images:

  1. platerecognizer/parkpow-postgres
  2. platerecognizer/parkpow-app:install - A new image to be created from web service container
  3. platerecognizer/parkpow-mqtt-broker
  4. platerecognizer/parkpow-nginx-onpremise

Volumes:

  1. parkpow_app_volume
  2. parkpow_postgres_data
note
  1. We recommend creating an empty folder to hold all the resources for easy copying to machine B.
  2. Later steps in this guide assumes the empty folder path is parkpow-export.
  3. If you use a different empty folder path, ensure to change it in all later commands where it's referenced.

Backup ParkPow Images​

Backup Docker Images required by compose.

Database​

Export postgres image as a tar archive

docker save platerecognizer/parkpow-postgres > parkpow-export/db-i.tar
note

Optionally compress the archive for a reduced size:

docker save platerecognizer/parkpow-postgres | xz -9 -T4 > parkpow-export/db-i.tar

Please note that compressing and decompressing the image will take additional time. Make sure to match the number of threads (-T4 in the example) to the number of CPU cores available for optimal performance. Also, ensure that the machine has sufficient memory to handle the compression process.

Web App​

Create a new app image from successfully running web service

docker commit parkpow-web-1 platerecognizer/parkpow-app:install

Export newly created image as a tar archive.

docker save platerecognizer/parkpow-app:install > parkpow-export/app-i.tar

Helper ParkPow Images​

Export the required MQTT and Nginx images used by ParkPow:

docker save platerecognizer/parkpow-mqtt-broker > parkpow-export/mqtt-i.tar
docker save platerecognizer/parkpow-nginx-onpremise > parkpow-export/nginx-i.tar

Backup ParkPow Volumes​

Export the docker volumes used by Parkpow as tar archives

Database​

Ensure --volumes-from container is the db container created when initially running ParkPow.

docker run --rm \
--user root \
--volumes-from parkpow-db-1 \
-v "$(pwd)/parkpow-export:/backup" \
platerecognizer/parkpow-app tar cvf /backup/db-v.tar /var/lib/postgresql/data

Web Application​

Ensure --volumes-from container is the web container created when initially running ParkPow.

docker run --rm \
--user root \
--volumes-from parkpow-web-1 \
-v "$(pwd)/parkpow-export:/backup" \
platerecognizer/parkpow-app tar cvf /backup/app-v.tar /app

Copy Backup folder to Machine B​

tip
  • You'll need the docker-compose.yml when restoring on Machine B, Include it in the folder before copy.
  • For a smaller folder size to copy, compress the archived images.

The backup folder should contain the following files, Copy it to machine B:

  1. app-i.tar
  2. app-v.tar
  3. db-i.tar
  4. db-v.tar

Restore Backup on Machine B​

note
  1. Later steps in this guide assume the backup files were all copied to /home/<user>/parkpow/parkpow-export. Working directory is ~/parkpow.
  2. If you copy to a different path, ensure to change it in all later commands where it's referenced.

Restore ParkPow images​

Restore ParkPow images.

Database​

docker load < parkpow-export/db-i.tar

If the image was compressed: xz -dc parkpow-export/db-i.tar.xz | docker load

Web Application​

docker load < parkpow-export/app-i.tar

Helper ParkPow images​

docker load < parkpow-export/mqtt-i.tar
docker load < parkpow-export/nginx-i.tar

Change image tag to latest for Compose to use it.

docker tag platerecognizer/parkpow-app:install platerecognizer/parkpow-app:latest

Initialize ParkPow​

Attempt starting ParkPow so that Compose creates the necessary volumes for restoring data into. Copy the docker-compose.yml to a folder named parkpow or set env COMPOSE_PROJECT_NAME=parkpow. Run below command in the folder containing the docker-compose.yml:

docker compose up

Because volumes are not yet restored, Startup logs will show errors from web service:

parkpow-web-1   | Traceback (most recent call last):
parkpow-web-1 | File "/data/unarchive_project.py", line 88, in <module>
parkpow-web-1 | main()
parkpow-web-1 | File "/data/unarchive_project.py", line 45, in main
parkpow-web-1 | raise Exception("project data is not found")
parkpow-web-1 | Exception: project data is not found

Stop ParkPow then go the next step to restore volumes.

Restore ParkPow Volumes​

Database​

Ensure --volumes-from container is the db container created when initially running ParkPow.

docker run --rm \
--user root \
--volumes-from parkpow-db-1 \
-v "$(pwd)/parkpow-export:/backup" \
platerecognizer/parkpow-app bash -c "cd /var && tar xvf /backup/db-v.tar --strip 1"

Web Application​

Ensure --volumes-from container is the web container created when initially running ParkPow.

docker run --rm \
--user root \
--volumes-from parkpow-web-1 \
-v "$(pwd)/parkpow-export:/backup" \
platerecognizer/parkpow-app bash -c "cd /app && tar xvf /backup/app-v.tar --strip 1"

Run ParkPow​

Switch into the compose folder and start ParkPow using this command:

docker compose up
Floating button icon
CTRL + .