Skip to content

Commit cbd31ec

Browse files
committed
fix: update DNS token script to work with Docker Compose profiles
- Check if certbot/zabbix-agent are running before recreating them - Use profile-specific commands to recreate services with new AUTH_KEY - Replace restart with up -d to ensure env_file changes are picked up - Only affect services that are actually running, preserving profile setup
1 parent f644c60 commit cbd31ec

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

scripts/update-dns-token.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,13 @@ set -e -u
33

44
# write down new token
55
sed -i "s/.*\AUTH_KEY.*/\AUTH_KEY=$($HOME/yandex-cloud/bin/yc iam create-token)/" "./private/environment/dnsrobocert.env"
6-
# make certbot and zabbix-agent read new AUTH_KEY
7-
docker compose up -d
6+
# recreate services that use the AUTH_KEY only if they are running
7+
if docker compose ps -q certbot | grep -q .; then
8+
echo "Recreating certbot to pick up new AUTH_KEY..."
9+
docker compose --profile certs up -d certbot
10+
fi
11+
12+
if docker compose ps -q zabbix-agent | grep -q .; then
13+
echo "Recreating zabbix-agent to pick up new AUTH_KEY..."
14+
docker compose --profile monitoring up -d zabbix-agent
15+
fi

0 commit comments

Comments
 (0)