Compare commits

...

2 commits

Author SHA1 Message Date
f8c43f9709
chore: remove shared volume
Now that the shared volume is no longer needed it is removed from the
docker compose file.
2023-08-26 13:36:01 +01:00
ba9a865b55
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.
2023-08-26 13:25:41 +01:00
6 changed files with 19 additions and 76 deletions

2
config

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

View file

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

View file

@ -19,10 +19,6 @@ networks:
config: config:
- subnet: "{{ .DockerNetworkSubnet }}" - subnet: "{{ .DockerNetworkSubnet }}"
volumes:
traefik-shared:
name: "traefik-config-shared-volume"
services: services:
# -- Traffic flow -- # -- Traffic flow --
traefik: traefik:
@ -49,10 +45,6 @@ services:
restart: "always" restart: "always"
volumes: volumes:
{{- template "defaultVolumes" }} {{- template "defaultVolumes" }}
# Shared volume
- type: "volume"
source: "traefik-shared"
target: "{{ .Traefik.SharedMountPoint }}"
# Traefik TLS volume # Traefik TLS volume
- type: "bind" - type: "bind"
source: "{{ .Traefik.TlsHostDirectory }}" source: "{{ .Traefik.TlsHostDirectory }}"
@ -72,10 +64,6 @@ services:
restart: "always" restart: "always"
volumes: volumes:
{{- template "defaultVolumes" }} {{- template "defaultVolumes" }}
# Shared volume
- type: "volume"
source: "traefik-shared"
target: "{{ .Traefik.SharedMountPoint }}"
# Forgejo data volume # Forgejo data volume
- type: "bind" - type: "bind"
source: "{{ .Forgejo.DataHostDirectory }}" source: "{{ .Forgejo.DataHostDirectory }}"
@ -96,10 +84,6 @@ services:
restart: "always" restart: "always"
volumes: volumes:
{{- template "defaultVolumes" }} {{- template "defaultVolumes" }}
# Shared volume
- type: "volume"
source: "traefik-shared"
target: "{{ .Traefik.SharedMountPoint }}"
# Go To Social data volume # Go To Social data volume
- type: "bind" - type: "bind"
source: "{{ .GoToSocial.DataHostDirectory }}" source: "{{ .GoToSocial.DataHostDirectory }}"
@ -135,10 +119,6 @@ services:
restart: "always" restart: "always"
volumes: volumes:
{{- template "defaultVolumes" }} {{- template "defaultVolumes" }}
# Shared volume
- type: "volume"
source: "traefik-shared"
target: "{{ .Traefik.SharedMountPoint }}"
# Woodpecker data volume # Woodpecker data volume
- type: "bind" - type: "bind"
source: "{{ .Woodpecker.DataHostDirectory }}" source: "{{ .Woodpecker.DataHostDirectory }}"

View file

@ -1,18 +1,9 @@
# syntax=docker/dockerfile:1 # syntax=docker/dockerfile:1
FROM traefik:{{ .Traefik.Version }} 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 CMD ["--configfile={{ .Traefik.StaticConfigDirectory }}/traefik.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"]

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: providers:
file: file:
watch: true watch: true
directory: "{{ .Traefik.SharedMountPoint }}/dynamic" directory: "{{ .Traefik.DynamicConfigDirectory }}"
certificatesResolvers: certificatesResolvers:
resolver: resolver:
acme: acme: