+++
title = "hedgedoc"
taxonomies.categories = [ "services" ]
+++


hegedoc was once called codiMD, so container, config and users are still called codimd.

**Do NOT change this** unless you're sure what you're doing.

We have two instances:
 - `pad-hacc`/pad.hacc.space is connected to our SSO/uffd
 - `pad-i4f`/pad.infra4future.de is not connected to our SSO and meant to be more public

## Basic Troubleshooting

Usually if hedgedoc dies, it's because postgresql wasn't there yet. Just restart
hedgedoc.

## More Troubles
log into the container and take a look at the logs

~~~shell
sudo nixos-container root-login codimd
journalctl -e
~~~

### fixing failed database upgrades

see https://docs.hedgedoc.org/guides/migration-troubleshooting/ (copied below
for convenience?):

In some cases, HedgeDoc might apply migrations without correctly saving the
progress. It will then refuse to start with "already exists"-errors like
ERROR: type "enum_Notes_permission" already exists.

Get the name of the failing migration and append .js to it. For example, if
you encounter this error:

~~~
== 20180306150303-fix-enum: migrating =======

ERROR: type "enum_Notes_permission" already exists
~~~

the name of the failed migration would be 20180306150303-fix-enum.js.

The SQL-statement may look like this:

~~~
INSERT INTO "SequelizeMeta" (name) VALUES ('20180306150303-fix-enum.js');
~~~

Make sure HedgeDoc does not run and insert the name into the SequelizeMeta table.
Enter the container switch to the postgres user, open psql and commect to the
codimd database:

~~~shell
su postgres
psql
\l
\c codimd
UN adjusted SQL STAMEMENT from above ]
\q
~~~

Start HedgeDoc again and observe if it starts correctly. It may be necessary to
repeat this process and insert multiple migrations into the SequelizeMeta table.