Skip to content

Commit

Permalink
chore(scripts): more script related updates btw
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei Jiroh Halili (RecapTime.dev) <ajhalili2006@crew.recaptime.dev>
  • Loading branch information
ajhalili2006 committed Sep 15, 2024
1 parent b67cf7d commit 07eb429
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion config/systemd/caddy.service
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ User=caddy
Group=caddy
WorkingDirectory=/var/lib/caddy/src
RuntimeDirectory=caddyserver
ExecStart=/usr/local/bin/caddy run --envfile ./decrypted.env --environ --resume
ExecStart=/usr/local/bin/caddy run --environ --resume
ExecReload=CADDY_ADMIN=localhost:20241 /var/lib/caddy/src/scripts/apply
TimeoutStopSec=5s
LimitNOFILE=1048576
Expand Down
15 changes: 6 additions & 9 deletions scripts/setup-server
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ fi
set -xe
CADDY_CONFIG_HOME=${CADDY_CONFIG_HOME:-"/var/lib/caddy/src"}

# Copy configurations and then reload systemd
cp "${CADDY_CONFIG_HOME}/config/sudo_caddy.conf" "/etc/sudoers.d/caddy"

cp "${CADDY_CONFIG_HOME}/config/systemd/caddy.service" "/etc/systemd/system/caddy.service"
systemctl daemon-reload

if [[ "$(command -v caddy)" == "/usr/local/bin/caddy" ]]; then
if [[ -f /usr/local/bin/caddy ]]; then
caddy upgrade
else
if ! command -v caddy >> /dev/null; then
Expand All @@ -26,13 +26,10 @@ else
ln -s "$(command -v caddy)" /usr/local/bin/caddy
fi
fi
curl -fsS https://dotenvx.sh | sh

if [[ ${FF_ONLY_RELOAD_CONFIG} != "" ]]; then
exit 0
if [[ -L "/etc/systemd/system/multi-user.target.wants/caddy.service" ]]; then
systemctl restart caddy.service
else
if [[ -L "/etc/systemd/system/multi-user.target.wants/caddy.service" ]]; then
systemctl restart caddy.service
else
systemctl enable caddy.service --now
fi
systemctl enable caddy.service --now
fi

0 comments on commit 07eb429

Please sign in to comment.