chore(traefik): remove mounted shared directory

The mounted shared directory is no longer needed for now so it will
removed from all containers that are mounting it.

Changes for Traefik:

- Build all dynamic configurations inside the Traefik container.
- Remove the mount point for the shared directory.
This commit is contained in:
Dan Anglin 2023-08-26 13:25:41 +01:00
parent 1758d5a85c
commit ba9a865b55
Signed by: dananglin
GPG key ID: 0C1D44CFBEE68638
6 changed files with 19 additions and 60 deletions

2
config

@ -1 +1 @@
Subproject commit a36055337246e8ddd83811c982769fab1d555748
Subproject commit 40b13ab1b1b52d617851f56d89c4017e0360c3b3

View file

@ -31,6 +31,8 @@ type traefikConfig struct {
SharedMountPoint string `json:"sharedMountPoint"`
TlsHostDirectory string `json:"tlsHostDirectory"`
TlsContainerDirectory string `json:"tlsContainerDirectory"`
StaticConfigDirectory string `json:"staticConfigDirectory"`
DynamicConfigDirectory string `json:"dynamicConfigDirectory"`
}
type forgejoConfig struct {

View file

@ -49,10 +49,6 @@ services:
restart: "always"
volumes:
{{- template "defaultVolumes" }}
# Shared volume
- type: "volume"
source: "traefik-shared"
target: "{{ .Traefik.SharedMountPoint }}"
# Traefik TLS volume
- type: "bind"
source: "{{ .Traefik.TlsHostDirectory }}"

View file

@ -1,18 +1,9 @@
# syntax=docker/dockerfile:1
FROM traefik:{{ .Traefik.Version }}
ADD traefik.yaml /flow/traefik/
RUN --mount=type=bind,source=.,target=/packages \
mkdir -p {{ .Traefik.StaticConfigDirectory }} {{ .Traefik.DynamicConfigDirectory }} \
&& cp /packages/traefik.yaml {{ .Traefik.StaticConfigDirectory }}/traefik.yaml \
&& cp /packages/dynamic_*.yaml {{ .Traefik.DynamicConfigDirectory }}/
ADD dynamic_landing_page.yaml /tmp/dynamic_landing_page.yaml
ADD dynamic_gotosocial.yaml /tmp/dynamic_gotosocial.yaml
ADD dynamic_woodpecker.yaml /tmp/dynamic_woodpecker.yaml
ADD dynamic_forgejo.yaml /tmp/dynamic_forgejo.yaml
ADD entrypoint.sh /
RUN chmod +x /entrypoint.sh
CMD ["--configfile=/flow/traefik/traefik.yaml"]
CMD ["--configfile={{ .Traefik.StaticConfigDirectory }}/traefik.yaml"]

View file

@ -1,30 +0,0 @@
#!/bin/sh
set -e
# Create the dynamic config directory in the shared volume.
mkdir -p {{ .Traefik.SharedMountPoint }}/dynamic
chgrp {{ .FlowGID }} {{ .Traefik.SharedMountPoint }}/dynamic
chmod a-rwx,u+rwx,g+rwx {{ .Traefik.SharedMountPoint }}/dynamic
# Move any dynamic config to the new directory.
for f in $( find /tmp -mindepth 1 -maxdepth 1 -type f -iname 'dynamic*.yaml' -exec basename {} \; ); do
echo "INFO: Moving /tmp/${f} to {{ .Traefik.SharedMountPoint }}/dynamic/${f}..."
mv -f /tmp/${f} {{ .Traefik.SharedMountPoint }}/dynamic/${f}
done
# first arg is `-f` or `--some-option`
if [ "${1#-}" != "$1" ]; then
set -- traefik "$@"
fi
# if our command is a valid Traefik subcommand, let's invoke it through Traefik instead
# (this allows for "docker run traefik version", etc)
if traefik "$1" --help >/dev/null 2>&1
then
set -- traefik "$@"
else
echo "= '$1' is not a Traefik command: assuming shell execution." 1>&2
fi
exec "$@"

View file

@ -22,7 +22,7 @@ entryPoints:
providers:
file:
watch: true
directory: "{{ .Traefik.SharedMountPoint }}/dynamic"
directory: "{{ .Traefik.DynamicConfigDirectory }}"
certificatesResolvers:
resolver:
acme: