Skip to content

Commit

Permalink
Remove hard coded values from SystemD Unit and installation (#1874)
Browse files Browse the repository at this point in the history
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 <manugupt1@gmail.com>
Co-authored-by: Matt <matt.ouille@protonmail.com>
  • Loading branch information
3 people authored Apr 13, 2024
1 parent 8141583 commit f969e03
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
2 changes: 0 additions & 2 deletions scripts/service/athens.service
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 3 additions & 6 deletions scripts/systemd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit f969e03

Please sign in to comment.