harbor/migration
2016-06-04 10:10:22 +08:00
..
migration_harbor fix bugs 2016-06-04 10:10:22 +08:00
alembic.sql add data migration module 2016-05-09 14:41:28 +08:00
alembic.tpl add data migration module 2016-05-09 14:41:28 +08:00
changelog.md Update changelog.md 2016-05-18 14:47:57 +08:00
db_meta.py fix bugs 2016-06-04 10:10:22 +08:00
Dockerfile fill sysadmin_flag&update_time&add test function 2016-05-13 17:57:10 +08:00
migration.cfg add data migration module 2016-05-09 14:41:28 +08:00
prepare.sh fix bugs 2016-05-09 18:50:04 +08:00
README.md Update README.md 2016-06-03 18:31:59 +08:00
run.sh fill sysadmin_flag&update_time&add test function 2016-05-13 17:57:10 +08:00

Migration guide

Migration is a module for migrating database schema between different version of project 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

###Installation

  • step 1: change db_username, db_password, db_port, db_name in migration.cfg
  • step 2: build image from dockerfile
    cd harbor-migration
    
    docker build -t migrate-tool .
    

###Migrate Step

  • step 1: stop and remove Harbor service

    docker-compose down
    
  • step 2: create backup file in /path/to/backup

    docker run -ti --rm -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 --rm -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
    

You may change /data/database to the mysql volumes path you set in docker-compose.yml.

###Migration operation reference

  • You can use help to show instruction of Harbor migration

    docker run migrate-tool help

  • You can use test to test mysql connection in Harbor migration

    docker run --rm -v /data/database:/var/lib/mysql migrate-tool test

  • You can restore from backup file in /path/to/backup

    docker run -ti --rm -v /data/database:/var/lib/mysql -v /path/to/backup:/harbor-migration/backup migrate-tool restore