====== md (Hedgedoc) ====== |Verantwortung |Malte | |Container |md | |W. Ports |keine | |OS |Debian 10.13 | |Server |[[infrastruktur:server:magrathea]] | |Zustand |Produktiv | {{tag>infrasystem container productive magrathea ldapconnected}} Dies ist die technische Doku zu unserem Container md. [[hackspace:infrastruktur:md|Nutzerinfos zu hedgedoc findest du hier]]. In diesem Container läuft Hedgedoc unter https://md.chaotikum.org Langfristig soll hiermit das veraltete CodiMD unter https://docs.chaotikum.org abgelöst werden. Eine Migration ist leider nicht möglich, da das CodiMD zu alt ist und mit SQLite aufgesetzt wurde. ===== Services ===== ^ Serviceübersicht^Version^ |nodejs| 16.18.0-deb-1nodesource1 | |postgresql| 15+244.pgdg100+1 | |Hedgedoc| 1.9.4 | ===== Updates ===== Da die gesamte Konfiguration über den systemd-Service erfolgt (siehe unten) kann für ein Update einfach ''/opt/hedgedoc'' komplett gelöscht und neu installiert werden: mv /opt/hedgedoc /opt/hedgedoc-old wget https://github.com/hedgedoc/hedgedoc/releases/download/1.9.0/hedgedoc-1.9.0.tar.gz tar xvf hedgedoc-1.9.0.tar.gz mv hedgedoc /opt/ chown -R hedgedoc:hedgedoc /opt/hedgedoc cd /opt/hedgedoc ./bin/setup Uploads migrieren: cp /opt/hedgedoc-old/public/uploads/* /opt/hedgedoc/public/uploads/ ===== Installation und Konfiguration ===== ==== Dependencies ==== === Node.js === Manuelle Installation über [[https://github.com/nodesource/distributions/blob/master/README.md#debinstall|NodeSource]], da Version aus Debian-Paketquellen zu alt: curl -fsSL https://deb.nodesource.com/setup_16.x | bash - apt-get install -y nodejs === PostgreSQL === [[https://www.postgresql.org/download/linux/debian/|Anleitung]] # Create the file repository configuration: echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list # Import the repository signing key: wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - # Update the package lists: apt-get update # Install the latest version of PostgreSQL. apt-get -y install postgresql In der Datei vim /etc/postgresql/13/main/pg_hba.conf den Eintrag ''%%local all postgres%%'' von ''%%peer%%'' auf ''%%md5%%'' ändern, damit auch über den lokalen Socket die internen Passwörter von PostgreSQL verwendet werden. systemctl restart postgresql Passwort vergeben: su postgres psql postgres \password postgres \q exit Datenbank anlegen: psql -U postgres CREATE DATABASE hedgedoc; \q === Yarn === npm install --global yarn apt install git ==== Installation ==== User anlegen: adduser hedgedoc [[https://docs.hedgedoc.org/setup/manual-setup/|Anleitung]] wget https://github.com/hedgedoc/hedgedoc/releases/download/1.8.2/hedgedoc-1.8.2.tar.gz tar xvf hedgedoc-1.8.2.tar.gz mv hedgedoc /opt/ chown -R hedgedoc:hedgedoc /opt/hedgedoc cd /opt/hedgedoc ./bin/setup Service anlegen: vim /etc/systemd/system/hedgedoc.service systemctl enable hedgedoc systemctl start hedgedoc ==== Konfiguration ==== Alles wird über den Service in ''%%/etc/systemd/system/hedgedoc.service%%'' konfiguriert: [Unit] Description=HedgeDoc - The best platform to write and share markdown. Documentation=https://docs.hedgedoc.org/ After=postgresql.service [Service] Type=exec Restart=always RestartSec=2s ExecStart=/usr/bin/yarn start --production User=hedgedoc Group=hedgedoc WorkingDirectory=/opt/hedgedoc Environment=CMD_DOMAIN=md.chaotikum.org Environment=CMD_PROTOCOL_USESSL=true Environment=CMD_HSTS_ENABLE=true Environment=CMD_DB_URL=postgres://postgres:PASSWORD_CHANGE_ME@localhost:5432/hedgedoc Environment=CMD_LINKIFY_HEADER_STYLE=gfm Environment=CMD_SESSION_SECRET=PASSWORD_CHANGE_ME Environment=CMD_HOST=:: Environment=CMD_PORT=8080 Environment=CMD_URL_ADDPORT=443 Environment=CMD_ALLOW_FREEURL=true Environment=CMD_ALLOW_ANONYMOUS=true Environment=CMD_ALLOW_ANONYMOUS_EDITS=true Environment=CMD_ALLOW_ANONYMOUS_VIEWS=true Environment=CMD_DEFAULT_PERMISSION=freely Environment=CMD_EMAIL=false Environment=CMD_ALLOW_EMAIL_REGISTER=false Environment=CMD_LDAP_URL=ldaps://ldap.chaotikum.net Environment=CMD_LDAP_BINDDN=uid=codi,ou=services,dc=chaotikum,dc=org Environment=CMD_LDAP_BINDCREDENTIALS=PASSWORD_CHANGE_ME Environment=CMD_LDAP_SEARCHBASE=dc=chaotikum,dc=org Environment=CMD_LDAP_SEARCHFILTER=(&(objectClass=OrganizationalPerson)(uid={{username}})(memberOf=cn=freigeschaltet,ou=groups,dc=chaotikum,dc=org)) Environment=CMD_LDAP_USERNAMEFIELD=displayName Environment=CMD_LDAP_USERIDFIELD=uid [Install] WantedBy=multi-user.target * Das Datenbankpassword muss das Passwort sein, dass man für den Postgres-User `postgres` in Postgres gesetzt hat. Der Linux-User `postgres` hat kein Password und darf auch keins bekommen! * Das Session-Secret ist einfach irgendwas. Zum Beispiel vier UUIDs in Kleinbuchstaben ohne Bindestriche hintereinander. Wenn sich das ändert, müssen sich alle User neu anmelden. Das ist nicht schlimm. * Die LDAP-Credentials sind das Passwort des Users `codi` in unserem LDAP. Der heißt aus historischen Gründen noch so und wird auch mindestens so lange weiter so heißen, wie das alte CodiMD noch existiert. ===== Wartung ===== In das Textfeld einfach das Datum der Wartung eintragen, am besten in der Form yyyy-mm-dd. {{NEWPAGE>infrastruktur:wartung#pagetemplates:wartungstemplate:md|md }} {{topic>:infrastruktur:wartung?wartungsfenster +md &nodate&nouser&desc&table}} ~~NOCACHE~~