Editing
Docker-harbor-backup
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
Harbor Backup & Restore Guide '''π Overview''' This document outlines the steps to '''backup''' and '''restore''' a Harbor registry setup on the server. It includes a custom backup script, storage paths, S3 upload details, and a step-by-step restore process. '''π Backup Process''' '''π Script Location''' The backup script is located at: /home/pheonix/harbor/backup_harbor.sh '''π What the Script Does''' * Dumps the Harbor PostgreSQL database using pg_dumpall. * Archives the following essential files and directories: ** /root/harbor/harbor.yml ** /root/harbor/install.sh ** /root/harbor/docker-compose.yml ** /root/harbor/prepare ** /root/harbor/common/ ** /data/ β Contains Harbor image layers, configurations, and certificates. ** The SQL dump file generated. '''π Backup Output''' After running the script, the following files are generated locally: /opt/harbor/backups/ βββ harbor_backup_<timestamp>.tar.gz βββ harbor_backup_<timestamp>_db.sql '''βοΈ Upload Destinations''' Backup files are uploaded to: * '''Local Directory''': /opt/harbor/backups/ * '''AWS S3 Bucket''': s3://docker-harbor-pheonix/ (docker-harbor-pheonix) '''β»οΈ Harbor Restore Procedure''' '''π Step 1: Download Backup Files''' Use the following commands to download the latest backup files from S3: aws s3 cp s3://docker-harbor-pheonix/harbor_backup_<timestamp>.tar.gz /tmp/ aws s3 cp s3://docker-harbor-pheonix/harbor_backup_<timestamp>_db.sql /tmp/ '''π¦ Step 2: Extract Archive''' β οΈ '''Important:''' Untar the archive at the root "/" directory. Do not extract in /tmp, /home, or other directories β this could break path structure. cd / tar -xzf /tmp/harbor_backup_<timestamp>.tar.gz This will restore: * /root/harbor/ β Harbor installation files * /data/ β Registry data, configs, certs * /var/log/harbor/ β Harbor logs * /opt/harbor/backups/ β DB dump file '''π οΈ Step 3: Restore the Database''' Start the database container: cd /root/harbor ./prepare docker-compose up -d harbor-db sleep 10 Restore the database: cat /opt/harbor/backups/harbor_backup_<timestamp>_db.sql | docker exec -i harbor-db psql -U postgres '''π Step 4: Start All Harbor Services''' cd /root/harbor & ./prepare docker-compose up -d '''β Step 5: Access and Verify''' Open your browser and visit: https://dockerhub.pheonixsolutions.com Check if: * Harbor UI loads correctly * Project and image data are intact * Logs show normal activity '''π Notes''' * Ensure the S3 credentials used by the script have write permissions to the harbor-backups/ folder. * Backup script should be scheduled via cron for regular automated backups. * Always verify space availability on /opt and /data before starting a restore.
Summary:
Please note that all contributions to PheonixSolutions may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
PheonixSolutions:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
British English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Tools
What links here
Related changes
Page information