Add workers property, script and service file.

This commit is contained in:
Andrew Lalis 2023-07-23 19:05:54 -04:00
parent a8400b2796
commit 59e60885a8
3 changed files with 27 additions and 0 deletions

11
build-and-deploy.sh Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env bash
dub clean
rm -f web-logbook
dub build --build=release
echo "Stopping web-logbook service."
ssh -f root@andrewlalis.com 'systemctl stop web-logbook'
echo "Uploading new binary."
scp web-logbook root@andrewlalis.com:/opt/web-logbook/
echo "Starting web-logbook service."
ssh -f root@andrewlalis.com 'systemctl start web-logbook'

View File

@ -19,6 +19,9 @@ void main() {
if (props.has("port")) {
config.port = props.get("port").to!ushort;
}
if (props.has("workers")) {
config.workerPoolSize = props.get("workers").to!size_t;
}
}
initDb();
HttpServer server = new HttpServer((ref HttpRequestContext ctx) {

13
web-logbook.service Normal file
View File

@ -0,0 +1,13 @@
[Unit]
Description=web-logbook
After=network.target
[Service]
Type=simple
User=root
WorkingDirectory=/opt/web-logbook
ExecStart=/opt/web-logbook/web-logbook
Restart=always
[Install]
WantedBy=multi-user.target