Skip to content

Installation des paquets nécessaires

apt install curl wget postgresql

Installation de nodejs

curl -sL https://deb.nodesource.com/setup_12.x | bash -
apt-get install -y nodejs

Installation de yarn et de node-gyp

curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg |  apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" |  tee /etc/apt/sources.list.d/yarn.list
apt-get update &&  apt-get install yarn
npm install -g node-gyp

Création de la base et de l'utilisateur

Plusieurs sont compatibles (PostgreSQL, MySQL, MariaDB, SQLite, MSSQL)

  • postgres (ici pour l'exemple)
sudo -u postgres createuser -d -P hedgedoc
sudo -u postgres createdb -O hedgedoc hedgedoc

Installation de hedgedoc

cd /opt/
wget https://github.com/hedgedoc/hedgedoc/archive/1.7.0.tar.gz
tar xavf 1.7.0.tar.gz 
rm -rf 1.7.0.tar.gz 
ln -s hedgedoc-1.6.0 hedgedoc 
cd hedgedoc/
bin/setup

Personnalisation des fichiers de configuration

  • config.json

ne garder que l'essentiel, pensez à mettre l'utilisateur et son mdp dans "db"

  • .sequelizerc

choisir parmi la db qu'on a installé

postgres://username:password@localhost:5432/hedgedoc
mysql://username:password@localhost:3306/hedgedoc
sqlite:///opt/hedgedoc/hedgedoc.sqlite
* et modifier le change this ici :

'url':             'change this'
  • Puis on lance yarn

yarn run build

On lance une première fois pour voir les erreurs

NODE_ENV=production yarn start --production
# puis ctr+c pour quitter

On créé l'unité systemD

  • /etc/systemd/system/hedgedoc.service
[Unit]
Description=CodiMD collaborative markdown notes
After=network.target
After=syslog.socket
After=postgresql.service

[Service]
User=root
Environment=NODE_ENV=production
WorkingDirectory=/opt/hedgedoc/
ExecStart=/usr/bin/yarn start --production
Type=exec
RestartSec=2s
Restart=always
StandardOutput=journal
StandardError=inherit
#PrivateTmp=true
PrivateDevices=true

[Install]
WantedBy=multi-user.target
  • systemctl enable --now hedgedoc