mirror of
https://github.com/TrezOne/docker-mods-uptime-kuma-timeout-fix.git
synced 2026-06-18 14:23:07 -04:00
Merge pull request #314 from linuxserver/universal-cloudflared-params
make params required, disable service if not configured conrrectly
This commit is contained in:
@@ -14,29 +14,19 @@ Here an example snippet to help you get started using this docker mod.
|
||||
|
||||
```yaml
|
||||
swag:
|
||||
image: ghcr.io/linuxserver/swag
|
||||
container_name: swag
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
image: lscr.io/linuxserver/nginx
|
||||
container_name: nginx
|
||||
environment:
|
||||
PUID: 1000
|
||||
PGID: 1000
|
||||
TZ: Europe/London
|
||||
URL: yourdomain.url
|
||||
SUBDOMAINS: test,
|
||||
VALIDATION: dns
|
||||
DNSPLUGIN: cloudflare #optional
|
||||
ONLY_SUBDOMAINS: true #optional
|
||||
EMAIL: #optional
|
||||
EXTRA_DOMAINS: #optional
|
||||
STAGING: false #optional
|
||||
DOCKER_MODS: linuxserver/mods:universal-cloudflared
|
||||
CF_ZONE_ID: #optional
|
||||
CF_ACCOUNT_ID: #optional
|
||||
CF_API_TOKEN: #optional
|
||||
CF_TUNNEL_NAME: example #optional
|
||||
CF_TUNNEL_PASSWORD: pleasedontusethisexamplepassword #optional
|
||||
CF_TUNNEL_CONFIG: | #optional
|
||||
CF_ZONE_ID: zone_id
|
||||
CF_ACCOUNT_ID: acct_id
|
||||
CF_API_TOKEN: token
|
||||
CF_TUNNEL_NAME: example
|
||||
CF_TUNNEL_PASSWORD: pleasedontusethisexamplepassword
|
||||
CF_TUNNEL_CONFIG: |
|
||||
ingress:
|
||||
- hostname: test.yourdomain.url
|
||||
service: http://localhost:80
|
||||
@@ -54,7 +44,7 @@ Container images/mods are configured using parameters passed at runtime (such as
|
||||
| :----: | --- | --- |
|
||||
| `DOCKER_MODS` | Enable this docker mod with `linuxserver/mods:universal-cloudflared` | If adding multiple mods, enter them in an array separated by `\|`, such as `DOCKER_MODS: linuxserver/mods:universal-cloudflared\|linuxserver/mods:universal-mod2` |
|
||||
|
||||
### Optional tunnel parameters
|
||||
### Cloudflare tunnel parameters
|
||||
|
||||
| Parameter | Function | Notes |
|
||||
| :----: | --- | --- |
|
||||
@@ -72,7 +62,7 @@ Container images/mods are configured using parameters passed at runtime (such as
|
||||
|
||||
If you're using a method that doesn't allow you to enter a properly formatted yaml into an environment variable (e.g. `docker run`, or the compose yaml format we recommend in our samples, or a web gui manager) you can alternatively use a yaml file to set the `CF_TUNNEL_CONFIG` variable.
|
||||
|
||||
Create a properly formatted yaml file in the `/config` folder of your container (e.g. `/config/tunnelconfig.yaml`):
|
||||
Create a properly formatted yaml file in the `/config` folder of your container (e.g. `/config/tunnelconfig.yml`):
|
||||
|
||||
```shell
|
||||
ingress:
|
||||
|
||||
@@ -16,19 +16,6 @@ else
|
||||
fi
|
||||
echo "**** Linux architecture found: ${ARCH} ****"
|
||||
|
||||
UBUNTU=false
|
||||
ALPINE=false
|
||||
if [ -f /usr/bin/apt ]; then
|
||||
UBUNTU=true
|
||||
echo "**** Linux distro found: ubuntu ****"
|
||||
elif [ -f /sbin/apk ]; then
|
||||
ALPINE=true
|
||||
echo "**** Linux distro found: alpine ****"
|
||||
else
|
||||
echo "**** Unknown Linux distro, exiting... ****"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "**** Checking for cloudflared setup script dependencies... ****"
|
||||
YQARCH="${ARCH}"
|
||||
if [ "${YQ_ARCH}" = "armhf" ]; then
|
||||
@@ -38,21 +25,6 @@ echo "**** Temporarily installing /tmp/yq... ****"
|
||||
curl -sLo /tmp/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_${YQARCH}
|
||||
chmod +x /tmp/yq
|
||||
|
||||
declare -A CLEANUP=( [curl]=false [jq]=false )
|
||||
for PKG in "${!CLEANUP[@]}"; do
|
||||
if [ -x "$(command -v ${PKG})" ]; then
|
||||
echo "**** ${PKG} already installed, skipping... ****"
|
||||
else
|
||||
CLEANUP[$PKG]=true
|
||||
echo "**** Temporarily installing ${PKG}... ****"
|
||||
if $ALPINE; then
|
||||
apk add --no-cache ${PKG}
|
||||
elif $UBUNTU; then
|
||||
apt-get -qqy install --no-install-recommends ${PKG}
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
echo "**** Installing cloudflared...****"
|
||||
if [ -d "/cloudflared/" ]; then
|
||||
echo "**** Moving /cloudflared/cloudflared-${ARCH} to /usr/local/bin/cloudflared... ****"
|
||||
@@ -70,10 +42,11 @@ else
|
||||
fi
|
||||
cloudflared -v
|
||||
|
||||
echo "**** Checking for optional cloudflare tunnel parameters... ****"
|
||||
if [[ ${#CF_ACCOUNT_ID} -gt 0 ]] && [[ ${#CF_API_TOKEN} -gt 0 ]] && [[ ${#CF_TUNNEL_NAME} -gt 0 ]]; then
|
||||
echo "**** Checking for cloudflare tunnel parameters... ****"
|
||||
if [[ ${#CF_ZONE_ID} -gt 0 ]] && [[ ${#CF_ACCOUNT_ID} -gt 0 ]] && [[ ${#CF_API_TOKEN} -gt 0 ]] && [[ ${#CF_TUNNEL_NAME} -gt 0 ]] && [[ ${#CF_TUNNEL_CONFIG} -gt 0 ]]; then
|
||||
if [[ ${#CF_TUNNEL_PASSWORD} -le 32 ]]; then
|
||||
echo "**** Cloudflare tunnel password must be at least 32 characters long, exiting... ****"
|
||||
rm -rf /etc/services.d/cloudflared
|
||||
exit 1
|
||||
else
|
||||
echo "**** Cloudflare tunnel parameters found, starting cloudflare tunnel setup... ****"
|
||||
@@ -162,24 +135,8 @@ if [[ ${#CF_ACCOUNT_ID} -gt 0 ]] && [[ ${#CF_API_TOKEN} -gt 0 ]] && [[ ${#CF_TUN
|
||||
done
|
||||
fi
|
||||
else
|
||||
echo "**** Optional parameters blank or missing, skipped cloudflare tunnel setup ****"
|
||||
echo "**** Cloudflare parameters blank or missing, skipped cloudflare tunnel setup ****"
|
||||
rm -rf /etc/services.d/cloudflared
|
||||
fi
|
||||
|
||||
echo "**** Cleaning up cloudflared setup script dependencies if required... ****"
|
||||
for PKG in "${!CLEANUP[@]}"; do
|
||||
if [ "${CLEANUP[$PKG]}" = true ]; then
|
||||
CLEANUP[$PKG]=false
|
||||
echo "**** Uninstalling ${PKG}... ****"
|
||||
if $ALPINE; then
|
||||
apk del ${PKG}
|
||||
elif $UBUNTU; then
|
||||
apt-get -qqy remove ${PKG}
|
||||
apt-get -qqy autoremove
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
echo "**** Uninstalling /tmp/yq... ****"
|
||||
rm /tmp/yq
|
||||
|
||||
echo "**** Cloudflared setup script done, exiting... ****"
|
||||
Reference in New Issue
Block a user