Update all zones to update root
Some checks failed
Deploy to Fighter / Deploy (push) Failing after 1s
Deploy to Fighter / Notify (push) Successful in 1s

Also CNAME'd wildcard subdomains to root
This commit is contained in:
Joey Hafner 2024-05-28 13:15:48 -07:00
parent b3fbe645d3
commit 01351c20dc
2 changed files with 7 additions and 3 deletions

View File

@ -10,9 +10,13 @@ cd ~/homelab/fighter/config/ddns/ && \
export $(cat ddclient_secrets.env | xargs) && \ export $(cat ddclient_secrets.env | xargs) && \
envsubst < ./ddclient/ddclient.template > ./ddclient/ddclient.conf && \ envsubst < ./ddclient/ddclient.template > ./ddclient/ddclient.conf && \
unset $(grep -v '^#' ddclient_secrets.env | sed -E 's/(.*)=.*/\1/' | xargs) && \ unset $(grep -v '^#' ddclient_secrets.env | sed -E 's/(.*)=.*/\1/' | xargs) && \
docker-compose up -d --force-recreate docker compose up -d --force-recreate && docker compose logs -f
``` ```
If you want to check the differences between the previous and new config before updating, run:
`export $(cat ddclient_secrets.env | xargs) && envsubst < ./ddclient/ddclient.template | sdiff ddclient/ddclient.conf -`
First we export the variables in the `ddclient_secrets.env` file (which are all simple key-value pairs). Then, the [`envsubst`](https://www.baeldung.com/linux/envsubst-command) command looks for env variable references (like `$USER_Jafner_chat`) in the `ddclient.template` file (via stdin) and replaces them with the values from the current shell. We remove the secrets from the shell to preserve security. Finally, we recreate the container to apply the new settings. First we export the variables in the `ddclient_secrets.env` file (which are all simple key-value pairs). Then, the [`envsubst`](https://www.baeldung.com/linux/envsubst-command) command looks for env variable references (like `$USER_Jafner_chat`) in the `ddclient.template` file (via stdin) and replaces them with the values from the current shell. We remove the secrets from the shell to preserve security. Finally, we recreate the container to apply the new settings.
[StackOverflow - Set environment variables from file of ke/value pairs](https://stackoverflow.com/questions/19331497/set-environment-variables-from-file-of-key-value-pairs) [StackOverflow - Set environment variables from file of ke/value pairs](https://stackoverflow.com/questions/19331497/set-environment-variables-from-file-of-key-value-pairs)

View File

@ -16,11 +16,11 @@ protocol=cloudflare, \
zone=jafner.net, \ zone=jafner.net, \
ttl=1, \ ttl=1, \
password='$TOKEN_Jafner_net', \ password='$TOKEN_Jafner_net', \
jafner.net, *.jafner.net jafner.net
# jafner.chat # jafner.chat
protocol=cloudflare,\ protocol=cloudflare,\
zone=jafner.chat,\ zone=jafner.chat,\
ttl=1,\ ttl=1,\
password='$TOKEN_Jafner_chat',\ password='$TOKEN_Jafner_chat',\
jafner.chat, *.jafner.chat jafner.chat