harbor/migration
2016-05-18 11:02:53 +08:00
..
migration_harbor fill sysadmin_flag&update_time&add test function 2016-05-13 17:57:10 +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 11:02:53 +08:00
db_meta.py fill sysadmin_flag&update_time&add test function 2016-05-13 17:57:10 +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-05-13 18:08:52 +08:00
run.sh fill sysadmin_flag&update_time&add test function 2016-05-13 17:57:10 +08:00

migration

Migration is a module for migrating database schema between different version of project harbor

WARNING!! You must backup your data before migrating

###installation

  • step 1: modify migration.cfg
  • step 2: build image from dockerfile
    cd harbor-migration
    
    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. ###migration step

  • step 1: stop and remove harbor service

    docker-compose down
    
  • step 2: perform migration operation

  • step 3: rebuild newest harbor images and restart service

    docker-compose build && docker-compose up -d