k8, migrate Gogs from Docker to K8
I've just move Gogs from Docker to K8, It was pretty easy with some issues to migrate repository to a GlusterFs directory...
My steps:
- Create volume in GlusterFs, with the persistent volume and volume claim to use in the k8-Gogs container:
- Create and launch yml file for deploy, service and Ing
- Connection to http://gogs_url and configure access on install page
- This install fresh database schema
- This schema is not the same of my origin gogs (older). So I've to adapt schema and data before export-import
On origin schema I add target columns for timestamp
ALTER TABLE
gogs.repository
ADD COLUMNcreated_unixBIGINT(20) NULL AFTERupdated;
ALTER TABLEgogs.repository
ADD COLUMNupdated_unixBIGINT(20) NULL AFTERcreated_unix;
update
gogs.repository
setcreated_unix= UNIX_TIMESTAMP(created) where id < 10000
updategogs.repository
setupdated_unix= UNIX_TIMESTAMP(updated) where id < 10000
On target schema I add older columns, just used during import that I'll destroy after.
>ALTER TABLE gogs.repository
ADD COLUMN created DATETIME NULL AFTER updated_unix,
ADD COLUMN updated DATETIME NULL AFTER created;
I export data with full name column, that I import in new schema
ALTER TABLE gogs.repository
DROP COLUMN updated,
DROP COLUMN created;
idem for action table
Copy the git repository from source to the destination per user (GlusterFs) in git/gogs-repositories/.
After migrating repository on new server, we encountered some error during pushing new commit. We have to resync ssh keys in admin panel:
https://github.com/gogs/gogs/issues/1916

And voilà, all should be Ok. :-)