mirror of
https://github.com/goharbor/harbor.git
synced 2024-09-06 11:08:11 +02:00
Merge branch 'master' of https://github.com/saga92/harbor
This commit is contained in:
commit
bcc51d685c
@ -1,10 +1,12 @@
|
|||||||
# migration
|
# Migration guide
|
||||||
Migration is a module for migrating database schema between different version of project [harbor](https://github.com/vmware/harbor)
|
Migration is a module for migrating database schema between different version of project [Harbor](https://github.com/vmware/harbor)
|
||||||
|
|
||||||
|
This module is for those machine running Harbor's old version, such as 0.1.0. If your harbor' version is up to date, please ignore this module.
|
||||||
|
|
||||||
**WARNING!!** You must backup your data before migrating
|
**WARNING!!** You must backup your data before migrating
|
||||||
|
|
||||||
###installation
|
###Installation
|
||||||
- step 1: modify migration.cfg
|
- step 1: change `db_username`, `db_password`, `db_port`, `db_name` in migration.cfg
|
||||||
- step 2: build image from dockerfile
|
- step 2: build image from dockerfile
|
||||||
```
|
```
|
||||||
cd harbor-migration
|
cd harbor-migration
|
||||||
@ -12,43 +14,52 @@ Migration is a module for migrating database schema between different version of
|
|||||||
docker build -t your-image-name .
|
docker build -t your-image-name .
|
||||||
```
|
```
|
||||||
|
|
||||||
###migration operation
|
|
||||||
- show instruction of harbor-migration
|
|
||||||
|
|
||||||
```docker run your-image-name help```
|
|
||||||
|
|
||||||
- test mysql connection in harbor-migration
|
|
||||||
|
|
||||||
```docker run -v /data/database:/var/lib/mysql your-image-name test```
|
|
||||||
|
|
||||||
- create backup file in `/path/to/backup`
|
|
||||||
|
|
||||||
```
|
|
||||||
docker run -ti -v /data/database:/var/lib/mysql -v /path/to/backup:/harbor-migration/backup your-image-name backup
|
|
||||||
```
|
|
||||||
|
|
||||||
- restore from backup file in `/path/to/backup`
|
|
||||||
|
|
||||||
```
|
|
||||||
docker run -ti -v /data/database:/var/lib/mysql -v /path/to/backup:/harbor-migration/backup your-image-name restore
|
|
||||||
```
|
|
||||||
|
|
||||||
- perform database schema upgrade
|
|
||||||
|
|
||||||
```docker run -ti -v /data/database:/var/lib/mysql your-image-name up head```
|
|
||||||
|
|
||||||
you can use `-v /etc/localtime:/etc/localtime` to sync container timezone with host timezone.
|
|
||||||
|
|
||||||
you may change `/data/database` to the mysql volumes path you set in docker-compose.yml.
|
you may change `/data/database` to the mysql volumes path you set in docker-compose.yml.
|
||||||
###migration step
|
###Migrate Step
|
||||||
- step 1: stop and remove harbor service
|
- step 1: stop and remove harbor service
|
||||||
|
|
||||||
```
|
```
|
||||||
docker-compose down
|
docker-compose down
|
||||||
```
|
```
|
||||||
- step 2: perform migration operation
|
- step 2: create backup file in `/path/to/backup`
|
||||||
- step 3: rebuild newest harbor images and restart service
|
|
||||||
|
```
|
||||||
|
docker run -ti -v /data/database:/var/lib/mysql -v /path/to/backup:/harbor-migration/backup migrate-tool backup
|
||||||
|
```
|
||||||
|
|
||||||
|
- step 3: perform database schema upgrade
|
||||||
|
|
||||||
|
```docker run -ti -v /data/database:/var/lib/mysql migrate-tool up head```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- step 4: rebuild newest harbor images and restart service
|
||||||
|
|
||||||
```
|
```
|
||||||
docker-compose build && docker-compose up -d
|
docker-compose build && docker-compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
|
###All migration operation
|
||||||
|
- show instruction of harbor-migration
|
||||||
|
|
||||||
|
```docker run migrate-tool help```
|
||||||
|
|
||||||
|
- test mysql connection in harbor-migration
|
||||||
|
|
||||||
|
```docker run -v /data/database:/var/lib/mysql migrate-tool test```
|
||||||
|
|
||||||
|
- create backup file in `/path/to/backup`
|
||||||
|
|
||||||
|
```
|
||||||
|
docker run -ti -v /data/database:/var/lib/mysql -v /path/to/backup:/harbor-migration/backup migrate-tool backup
|
||||||
|
```
|
||||||
|
|
||||||
|
- restore from backup file in `/path/to/backup`
|
||||||
|
|
||||||
|
```
|
||||||
|
docker run -ti -v /data/database:/var/lib/mysql -v /path/to/backup:/harbor-migration/backup migrate-tool restore
|
||||||
|
```
|
||||||
|
|
||||||
|
- perform database schema upgrade
|
||||||
|
|
||||||
|
```docker run -ti -v /data/database:/var/lib/mysql migrate-tool up head```
|
||||||
|
Loading…
Reference in New Issue
Block a user