-
-
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.
Switching ssl-auto-request service to Nu
- Loading branch information
Showing
9 changed files
with
46 additions
and
70 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
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 |
---|---|---|
|
@@ -130,4 +130,3 @@ export def generate_conf_json__does_not_output_custom [] { | |
|
||
assert equal null $result | ||
} | ||
|
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 |
---|---|---|
@@ -1,11 +1,8 @@ | ||
#!/command/with-contenv bash | ||
#!/usr/bin/nu | ||
|
||
set -euo pipefail | ||
export BF_E="${PWD##*/}/$(basename ${0})" | ||
use bf | ||
use bf-s6 | ||
bf env load -x ssl-auto-request | ||
|
||
|
||
#====================================================================================================================== | ||
# Show helpful log message. | ||
#====================================================================================================================== | ||
|
||
bf-svc-finish | ||
# Bring service down without terminating container | ||
def main [...args] { bf-s6 svc finish } |
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,38 +1,28 @@ | ||
#!/command/with-contenv bash | ||
|
||
set -euo pipefail | ||
export BF_E="${PWD##*/}/$(basename ${0})" | ||
|
||
|
||
#====================================================================================================================== | ||
# Run request executable and then disable the service. | ||
# First, wait until the Nginx service is running. | ||
#====================================================================================================================== | ||
|
||
if [ "${PROXY_AUTO-}" = "1" ] ; then | ||
|
||
if [ -n "$(pidof nginx)" ]; then | ||
|
||
# run upgrade executable | ||
bf-echo "Requesting SSL certificates using auto-generated conf.json." | ||
ssl-request -a | ||
|
||
#!/usr/bin/nu | ||
|
||
use bf | ||
use bf/nginx/proxy auto | ||
bf env load -x ssl-auto-request | ||
|
||
# Request SSL certificates and then disable the service | ||
def main [...args] { | ||
if (auto is_enabled) { | ||
# get the pid of the nginx process - if the pid is empty, nginx is not running | ||
let pid = { ^pidof nginx } | bf handle | ||
if $pid == "" { | ||
# wait 2s before exiting the service - S6 will keep restarting it until Nginx comes online | ||
# on first run, it will disable this upgrade service itself | ||
let sleep_for = 2sec | ||
bf write debug $"Waiting ($sleep_for) for Nginx to come online." | ||
sleep $sleep_for | ||
} else { | ||
# request SSL certificates for all configured domains | ||
|
||
# disable the auto request service | ||
auto disable_svc | ||
} | ||
} else { | ||
# disable the auto request service | ||
ssl-auto-request-disable | ||
|
||
else | ||
|
||
# wait 2s before exiting the service - S6 will keep restarting it until Nginx comes online | ||
# on first run, it will disable this upgrade service itself | ||
SLEEP=2 | ||
bf-debug "Waiting ${SLEEP}s for Nginx to come online..." | ||
sleep ${SLEEP} | ||
|
||
fi | ||
|
||
else | ||
|
||
# disable the auto request service | ||
ssl-auto-request-disable | ||
|
||
fi | ||
auto disable_svc | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.