Skip to main content

Migrate Installation

Migrate your ParkPow OnPremise Installation from machine A to a new machine B which can be offline.

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

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

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 /home/user/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 > /home/user/parkpow-export/db-i.tar

Optionaly compress the archive for a reduced size: xz -9 db-i.tar

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 > /home/user/parkpow-export/app-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 /home/user/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 /home/user/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-export.
  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 < /home/user/parkpow-export/db-i.tar

If the image was compressed: docker load < /home/user/parkpow-export/db-i.tar.xz

Web Application​

docker load < /home/user/parkpow-export/app-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 necesarry 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 /home/user/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 /home/user/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 + .