[Solved] Upgrade from dockerlized codimd

My version of CodiMD is: 2.2.0

What I expected to happen:

Upgrade to the latest hedgedoc release without data loss

Is this possible? I’m using the docker-compose method.

Ok, for Hedgedoc 1.6.0, just do this:

  1. edit the hackmd:2.2.0 to quay.io/hedgedoc/hedgedoc:1.6.0.
  2. add a 5432 port on CMD_DB_URL line.
1 Like

Hi

Here’s my story.

Facts about my system:

  • Running in a container, ported from 3000 to 3003
  • Reverse proxy from 3003 to my domain

Yesterday I manually jumped from nabo.codimd.dev/hackmdio/hackmd:2.0.0 to nabo.codimd.dev/hackmdio/hackmd:2.4.1, cause I’ve faced some issues in the jump to 2.0.0, and decided to lock the version. While looking for the newest version tag, I saw the news about HedgeDoc.

So, today, after moving from 2.0.0. to 2.4.1 yesterday, i changed the tag to quay.io/hedgedoc/hedgedoc:1.6.0.

I started the container, but nothing worked. I noticed that my configs was not impacting anything, so I used environment values to change each config.

I also needed to add CMD_URL_ADDPORT=false, which was added after 2.0.0, to my path’s are resolved as they should.

Remember to add the port to CMD_DB_URL, so it will ook a bit like this: CMD_DB_URL=postgres://codimd:PASSWORD@codimd_database:5432/codimd
(This is how it’s defined in my container-env).

I logged into the container, checked where the uploads where now located, and therefore, changed my upload-volume to me mapped to /hedgedoc/public/uploads.

I restarted the container, validated that everything worked as expected, and changed the tag to: quay.io/hedgedoc/hedgedoc:1.8.2

So… After a bit of time, everything works. I don’t get why there’s not that many details about the migration, but this is my tips and tricks. I can’t say if it’s was possible to jump directly to the newest version, but I took one jump at a time. Also, note that I’ve not added any new things after jumping to 2.0.0 of codimd… So… People using version > 2.0.0.0 of CodiMD, will maybe see other issues…

At least… It must be expected. Remember to backup both your CodiMD-files and DB before jumping int the migration :slight_smile:

2 Likes

Thanks for sharing that @exetico. I tried jumping from image hackmdio/hackmd:2.4.1 to quay.io/hedgedoc/hedgedoc:1.8.2 taking care to set the env vars as you suggested. The only addition for my deployment was adding CMD_URL_ADDPORT=false. I am running HedgeDoc on Kubernetes using ArgoCD for deployment control. When I pushed the updates, the server restarted without errors. The log claimed that the database migrations completed successfully. However, login did not work, nor did the guest note feature, due to a “bad cookie” and something about failed auth in the browser JavaScript console. This occurred even after I removed the config that restricted authentication to specific OIDC roles/groups.

Worked for me as well. Inclding OAUTH2. My migration was from CodiMD 2.4.1 to Hedgedoc 1.9.0. Thanks!

I had to change the upload path to: /hedgedoc/public/uploads
Furthermore I had to change the upload folder UID:GID with docker exec <container_name> chown -R 10000:10000 /hedgedoc/public/uploads. That was necessary because of broken image upload (download of existing images worked fine).

I blogged about the migration (in German language): https://eldshort.de/8jd9fp maybe will that be useful for German speaking users.

As a a little extra, I just crossgraded from docker.io/hackmd.io/hackmd:2.3.2 to quay.io/hedgedoc/hedgedoc:1.9.4 with @exetico’s hints about CMD_DB_URL and the uploads directory (caveat: I have no uploads) without any problems whatsoever.