forked from SteveLTN/https-portal
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request SteveLTN#267 from MarcelWaldvogel/live-update
Allow on-the-fly reconfiguration
- Loading branch information
Showing
10 changed files
with
93 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/ruby | ||
require '/opt/certs_manager/certs_manager' | ||
|
||
CertsManager.new.setup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
#!/usr/bin/with-contenv ruby | ||
require '/opt/certs_manager/certs_manager' | ||
|
||
CertsManager.new.setup | ||
#!/usr/bin/with-contenv /usr/bin/execlineb | ||
/usr/bin/justc-envdir -I /var/lib/https-portal/dynamic-env /bin/setup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#!/usr/bin/with-contenv sh | ||
|
||
docker-gen -watch -only-exposed -notify-output -notify reconfig /etc/docker-gen/domains.tmpl /var/run/domains | ||
docker-gen -watch -only-exposed -notify-output -notify \ | ||
"justc-envdir -I /var/lib/https-portal/dynamic-env /bin/reconfig" \ | ||
/etc/docker-gen/domains.tmpl /var/run/domains |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/execlineb -S0 | ||
|
||
s6-svscanctl -t /var/run/s6/services |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/sh | ||
env=/var/lib/https-portal/dynamic-env | ||
dom=/var/lib/https-portal/dynamic-domains | ||
mkdir -p $env $dom | ||
|
||
# Remember when we started (tiny race condition window) | ||
touch $env.stamp # Outside of watched dirs! | ||
|
||
# Wait for a modification to an all-uppercase file (ignore temp/swp files) | ||
inotifywait -qm -e close_write,move,delete $env $dom | while read line | ||
do | ||
echo "[dynamic-env] read $line" | ||
if echo "$line" | egrep -q '( [_A-Z]*|\.dom)$' | ||
then | ||
echo "[dynamic-env] All-uppercase or .dom file modified" | ||
|
||
echo "[dynamic-env] Wait for activity to cease..." | ||
while inotifywait -qq -t 1 -e close_write,move,delete $env $dom | ||
do | ||
: | ||
done | ||
|
||
# Apply new configuration; but only, if anything actually | ||
# changed (top-level "while" loop will continue getting | ||
# potentially old events) | ||
if find $env $dom -newer $env.stamp | grep -q . | ||
then | ||
# Remember when we started (tiny race condition window) | ||
touch $env.stamp # Outside of watched dirs! | ||
|
||
echo "[dynamic-env] File changed since last run: Applying new configuration..." | ||
/usr/bin/justc-envdir $env /bin/reconfig | ||
echo "[dynamic-env] Configuration applied" >&2 | ||
else | ||
echo "[dynamic-env] No file changed since last run -- suppressing" | ||
fi | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters