From f969e03904d682dfbcaccb3acd1831134a853037 Mon Sep 17 00:00:00 2001 From: Marcel Date: Sat, 13 Apr 2024 23:42:47 +0200 Subject: [PATCH] Remove hard coded values from SystemD Unit and installation (#1874) Removes hardcoded values form our supplied SystemD Unit file and the installation script. Users, prior to installation, will need to ensure that their user, group, and permissions settings of where Athens stores data are correct. Co-authored-by: Manu Gupta Co-authored-by: Matt --- scripts/service/athens.service | 2 -- scripts/systemd.sh | 9 +++------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/scripts/service/athens.service b/scripts/service/athens.service index 06de46a39..7d39bb264 100644 --- a/scripts/service/athens.service +++ b/scripts/service/athens.service @@ -14,8 +14,6 @@ Nice=5 User=www-data Group=www-data -Environment=ATHENS_DISK_STORAGE_ROOT=/var/run/athens - ; The full path and the arguments of the command to be executed to start the process. ExecStart=/usr/local/bin/athens -config_file=/etc/athens/config.toml diff --git a/scripts/systemd.sh b/scripts/systemd.sh index 7bb4c2dd4..a877825e5 100755 --- a/scripts/systemd.sh +++ b/scripts/systemd.sh @@ -41,12 +41,6 @@ function doInstallConfig fi sudo mkdir -p /etc/athens sudo install -v -o root -g root -m 644 config.toml /etc/athens - - # if storage is on disk, this is where the database goes (see scripts/service/athens.service) - ATHENS_DISK_STORAGE_ROOT=/var/run/athens - sudo mkdir -p $ATHENS_DISK_STORAGE_ROOT - sudo chown www-data $ATHENS_DISK_STORAGE_ROOT - sudo chgrp www-data $ATHENS_DISK_STORAGE_ROOT } # doInstallBinary copies the Athens binary to /usr/local/bin with the necessary settings. @@ -69,6 +63,9 @@ function doInstallBinary # doInstallSystemd sets up the SystemD service unit. function doInstallSystemd { + local rootPath=$(sed -nr 's/(RootPath) = (".*")/\2/p' /etc/athens/config.toml | xargs) + sed -i "/ReadWritePaths/ s|=.*|=$rootPath|" scripts/service/athens.service + sudo install -v -o root -g root -m 644 scripts/service/athens.service /etc/systemd/system sudo systemctl daemon-reload sudo systemctl enable athens