From 59e60885a87a0eea449100c74344eb5f11f73157 Mon Sep 17 00:00:00 2001 From: andrewlalis Date: Sun, 23 Jul 2023 19:05:54 -0400 Subject: [PATCH] Add workers property, script and service file. --- build-and-deploy.sh | 11 +++++++++++ source/app.d | 3 +++ web-logbook.service | 13 +++++++++++++ 3 files changed, 27 insertions(+) create mode 100755 build-and-deploy.sh create mode 100644 web-logbook.service diff --git a/build-and-deploy.sh b/build-and-deploy.sh new file mode 100755 index 0000000..8e2c64c --- /dev/null +++ b/build-and-deploy.sh @@ -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' diff --git a/source/app.d b/source/app.d index 8059366..6886497 100644 --- a/source/app.d +++ b/source/app.d @@ -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) { diff --git a/web-logbook.service b/web-logbook.service new file mode 100644 index 0000000..96293d3 --- /dev/null +++ b/web-logbook.service @@ -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