Skip to content

Commit

Permalink
feat: add new service hedgedoc
Browse files Browse the repository at this point in the history
  • Loading branch information
abhidg committed Dec 3, 2024
1 parent 554645a commit fea0566
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 0 deletions.
11 changes: 11 additions & 0 deletions installer/hedgedoc-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"production": {
"db": {
"dialect": "sqlite",
"storage": "./db.hedgedoc.sqlite"
},
"urlAddPort": true,
"domain": "carpentriesoffline.org",
"port": "4000"
}
}
39 changes: 39 additions & 0 deletions installer/hedgedoc.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[Unit]
Description=HedgeDoc - The best platform to write and share markdown.
Documentation=https://docs.hedgedoc.org/
After=network.target

[Service]
Type=exec
Environment=NODE_ENV=production
Restart=always
RestartSec=2s
ExecStart=yarn start
CapabilityBoundingSet=
NoNewPrivileges=true
PrivateDevices=true
RemoveIPC=true
LockPersonality=true
ProtectControlGroups=true
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectKernelLogs=true
ProtectClock=true
ProtectHostname=true
ProtectProc=noaccess
RestrictRealtime=true
RestrictSUIDSGID=true
RestrictNamespaces=true
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
ProtectSystem=strict
ProtectHome=true
PrivateTmp=true
SystemCallArchitectures=native
SystemCallFilter=@system-service

User=hedgedoc
Group=hedgedoc
WorkingDirectory="/home/hedgedoc/hedgedoc/"

[Install]
WantedBy=multi-user.target
4 changes: 4 additions & 0 deletions installer/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ echo "Setting up Gitea"
sudo ./setup_gitea.sh
clear

echo "Setting up Hedgedoc"
sudo ./setup_hedgedoc.sh
clear

echo "Setting up Access Point"
sudo ./setup_accesspoint.sh
clear
Expand Down
31 changes: 31 additions & 0 deletions installer/setup_hedgedoc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

HEDGEDOC_VERSION=1.10.0
HEDGEDOC_URL="https://github.com/hedgedoc/hedgedoc/releases/download/${HEDGEDOC_VERSION}/hedgedoc-${HEDGEDOC_VERSION}.tar.gz"

apt install -y npm
npm install -g corepack
corepack use yarn@4

adduser \
--system \
--shell /bin/bash \
--gecos 'HedgeDoc user' \
--group \
--disabled-password \
--home /home/hedgedoc \
hedgedoc

dir="$(mktemp -d)"

pushd "$dir"
wget "$HEDGEDOC_URL"
tar zxvf hedgedoc_${HEDGEDOC_VERSION}.tar.gz -C /home/hedgedoc
chown -R hedgedoc:hedgedoc /home/hedgedoc
popd

# copy configuration and service
cp ./hedgedoc-config.json /home/hedgedoc/hedgedoc/config.json
cp ./hedgedoc.service /etc/systemd/system/
systemctl enable hedgedoc
systemctl start hedgedoc

0 comments on commit fea0566

Please sign in to comment.