Run as a Service (Linux)
To keep a manual installation running across reboots, run it as a systemd service. If you already use PM2, see below. With Docker you do not need any of this: the container restarts on its own.
Using systemd
-
Create the Service
Create
/etc/systemd/system/planka.service:[Unit]Description=PLANKAAfter=network-online.target postgresql.serviceWants=network-online.target[Service]User=plankaWorkingDirectory=/var/www/plankaEnvironment=NODE_ENV=productionExecStartPre=/usr/bin/node db/init.jsExecStart=/usr/bin/node app.js --prodRestart=on-failureRestartSec=5[Install]WantedBy=multi-user.targetFor the nightly version, set
WorkingDirectoryto/var/www/planka/server.db/init.jsapplies pending database migrations on every start, so an update only needs a restart. -
Enable and Start It
sudo systemctl daemon-reloadsudo systemctl enable --now planka -
Check It
systemctl status plankajournalctl -u planka -f
Does your existing service use npm start --prod and fail after an npm update? npm 12 rejects that flag. Replace the ExecStart line with the one above, then run sudo systemctl daemon-reload and sudo systemctl restart planka.
Using PM2
-
Install PM2 Globally
sudo npm install pm2@latest -g -
Start PLANKA as the
plankaUsersudo -i -u plankacd /var/www/plankapm2 start --name planka "npm run db:init && npm run start:prod" -
Save the Process List
pm2 save -
Launch on Boot
pm2 startup systemdThis prints a
sudocommand. Run it from an account that can usesudo.