console.error("The {{match}} helper is not available. The Match helper flag must be enabled in labs if you wish to use the {{match}} helper. See https://ghost.org/docs/themes/");> k8, migrate Gogs from Docker to K8 ">
">
">

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:

  1. Create volume in GlusterFs, with the persistent volume and volume claim to use in the k8-Gogs container:
  2. Create and launch yml file for deploy, service and Ing
  3. Connection to http://gogs_url and configure access on install page
  4. This install fresh database schema
  5. 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 COLUMN created_unix BIGINT(20) NULL AFTER updated;
ALTER TABLE gogs.repository
ADD COLUMN updated_unix BIGINT(20) NULL AFTER created_unix;

update gogs.repository
set created_unix = UNIX_TIMESTAMP(created) where id < 10000
update gogs.repository
set updated_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. :-)