Migrate Installation
Migrate your ParkPow OnPremise Installation from machine A to a new machine B which can be offline.
- Migrate ParkPow from the offline to an online server
- Perfom the upgrade process on the online server
- 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 :
- Compose
- Compose V2
Containers:
- parkpow_db_1
- parkpow_web_1
- parkpow_jobq_1
Containers:
- parkpow-db-1
- parkpow-web-1
- parkpow-jobq-1
Volumes:
- parkpow_app_volume
- parkpow_postgres_data
- parkpow_media_volume
Networks:
- parkpow_default
Resources to be migrated:​
Images:
- platerecognizer/parkpow-postgres
- platerecognizer/parkpow-app:install - A new image to be created from web service container
Volumes:
- parkpow_app_volume
- parkpow_postgres_data
- We recommend creating an empty folder to hold all the resources for easy copying to machine B.
- Later steps in this guide assumes the empty folder path is
/home/user/parkpow-export
. - 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
- Compose
- Compose V2
docker commit parkpow_web_1 platerecognizer/parkpow-app:install
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.
- Compose
- Compose V2
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
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.
- Compose
- Compose V2
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
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​
- 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:
- app-i.tar
- app-v.tar
- db-i.tar
- db-v.tar
Restore Backup on Machine B​
- Later steps in this guide assume the backup files were all copied to
/home/user/parkpow-export
. - 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
:
- Compose
- Compose V2
docker-compose up
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.
- Compose
- Compose V2
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"
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.
- Compose
- Compose V2
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"
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:
- Compose
- Compose V2
docker-compose up
docker compose up