Dan Anglin
0490fc6568
- Add templates for the Caddy installation. - Replace Traefik with Caddy for both dev and prod.
205 lines
6.2 KiB
Go Template
205 lines
6.2 KiB
Go Template
{{- define "defaultVolumes" }}
|
|
- type: "bind"
|
|
source: "/etc/timezone"
|
|
target: "/etc/timezone"
|
|
read_only: true
|
|
- type: "bind"
|
|
source: "/etc/localtime"
|
|
target: "/etc/localtime"
|
|
read_only: true
|
|
{{- end -}}
|
|
---
|
|
version: "3.9"
|
|
|
|
networks:
|
|
flow:
|
|
name: "{{ .Docker.Network.Name }}"
|
|
ipam:
|
|
driver: "default"
|
|
config:
|
|
- subnet: "{{ .Docker.Network.Subnet }}"
|
|
|
|
services:
|
|
# -- Edge flow --
|
|
caddy:
|
|
container_name: "{{ .Caddy.ContainerName }}"
|
|
image: "localhost/flow/caddy:{{ .Caddy.Version }}"
|
|
build:
|
|
context: "../caddy"
|
|
networks:
|
|
flow:
|
|
ipv4_address: "{{ .Caddy.ContainerIpv4Address }}"
|
|
ports:
|
|
- target: 80
|
|
published: 80
|
|
protocol: "tcp"
|
|
mode: "host"
|
|
- target: 443
|
|
published: 443
|
|
protocol: "tcp"
|
|
mode: "host"
|
|
- target: 443
|
|
published: 443
|
|
protocol: "udp"
|
|
mode: "host"
|
|
restart: "always"
|
|
volumes:
|
|
{{- template "defaultVolumes" }}
|
|
# Caddy data volume
|
|
- type: "bind"
|
|
source: "{{ .Caddy.DataHostDirectory }}"
|
|
target: "{{ .Caddy.DataContainerDirectory }}"
|
|
# Caddy config volume
|
|
- type: "bind"
|
|
source: "{{ .Caddy.ConfigHostDirectory }}"
|
|
target: "{{ .Caddy.ConfigContainerDirectory }}"
|
|
{{- if .Caddy.TLS.UseCustomCertificates -}}
|
|
{{ print "" }}
|
|
# Caddy TLS volume
|
|
- type: "bind"
|
|
source: "{{ .Caddy.TLS.HostDirectory }}"
|
|
target: "{{ .Caddy.TLS.ContainerDirectory }}"
|
|
{{- end -}}
|
|
{{ print "" }}
|
|
# -- Traffic flow --
|
|
traefik:
|
|
container_name: "{{ .Traefik.ContainerName }}"
|
|
image: "localhost/flow/traefik:{{ .Traefik.Version }}"
|
|
build:
|
|
context: "../traefik"
|
|
networks:
|
|
flow:
|
|
ipv4_address: "{{ .Traefik.ContainerIpv4Address }}"
|
|
ports:
|
|
- target: 80
|
|
published: 80
|
|
protocol: "tcp"
|
|
mode: "host"
|
|
- target: 443
|
|
published: 443
|
|
protocol: "tcp"
|
|
mode: "host"
|
|
- target: {{ .Traefik.ExternalSSHPort }}
|
|
published: {{ .Traefik.ExternalSSHPort }}
|
|
protocol: "tcp"
|
|
mode: "host"
|
|
restart: "always"
|
|
volumes:
|
|
{{- template "defaultVolumes" }}
|
|
# Traefik TLS volume
|
|
- type: "bind"
|
|
source: "{{ .Traefik.TlsHostDirectory }}"
|
|
target: "{{ .Traefik.TlsContainerDirectory }}"
|
|
# -- Code flow --
|
|
forgejo:
|
|
container_name: "{{ .Forgejo.ContainerName }}"
|
|
image: "localhost/flow/forgejo:{{ .Forgejo.Version }}"
|
|
build:
|
|
context: "../forgejo"
|
|
{{- if eq .Forgejo.ContainerRunMode "backup" }}
|
|
command:
|
|
- forgejo
|
|
- dump
|
|
- --config
|
|
- {{ .Forgejo.AppIni }}
|
|
- --file
|
|
- {{ .Forgejo.Backups.ContainerDirectory }}/forgejo-backup-v{{ .Forgejo.Version }}-{{ timestamp }}.tar.gz
|
|
- --type
|
|
- tar.gz
|
|
{{- end }}
|
|
expose:
|
|
- "{{ .Forgejo.HttpPort }}"
|
|
{{- if .Forgejo.StartSSHServer -}}
|
|
{{ print "" }}
|
|
- "{{ .Forgejo.SshPort }}"
|
|
{{- end -}}
|
|
{{ print "" }}
|
|
networks:
|
|
flow:
|
|
ipv4_address: "{{ .Forgejo.ContainerIpv4Address }}"
|
|
{{- if eq .Forgejo.ContainerRunMode "backup" }}
|
|
restart: "no"
|
|
{{- else }}
|
|
restart: "always"
|
|
{{- end }}
|
|
volumes:
|
|
{{- template "defaultVolumes" }}
|
|
# Forgejo data volume
|
|
- type: "bind"
|
|
source: "{{ .Forgejo.DataHostDirectory }}"
|
|
target: "{{ .Forgejo.DataContainerDirectory }}"
|
|
# -- Free Flow --
|
|
gotosocial:
|
|
container_name: "{{ .GoToSocial.ContainerName }}"
|
|
image: "localhost/flow/gotosocial:{{ .GoToSocial.Version }}"
|
|
build:
|
|
context: "../gotosocial"
|
|
environment:
|
|
TZ: {{ .GoToSocial.TZ }}
|
|
expose:
|
|
- "{{ .GoToSocial.Port }}"
|
|
networks:
|
|
flow:
|
|
ipv4_address: "{{ .GoToSocial.ContainerIpv4Address }}"
|
|
restart: "always"
|
|
volumes:
|
|
{{- template "defaultVolumes" }}
|
|
# Go To Social data volume
|
|
- type: "bind"
|
|
source: "{{ .GoToSocial.DataHostDirectory }}"
|
|
target: "{{ .GoToSocial.DataContainerDirectory }}"
|
|
# -- Work Flow --
|
|
woodpecker:
|
|
container_name: "{{ .Woodpecker.ContainerName }}"
|
|
image: "localhost/flow/woodpecker:{{ .Woodpecker.Version }}"
|
|
build:
|
|
context: "../woodpecker"
|
|
environment:
|
|
WOODPECKER_LOG_LEVEL: "{{ .Woodpecker.LogLevel }}"
|
|
WOODPECKER_HOST: "https://{{ .Woodpecker.Subdomain }}.{{ .RootDomain }}"
|
|
WOODPECKER_SERVER_ADDR: "{{ .Woodpecker.ContainerIpv4Address }}:{{ .Woodpecker.HttpPort }}"
|
|
WOODPECKER_GRPC_ADDR: "{{ .Woodpecker.ContainerIpv4Address }}:{{ .Woodpecker.GrpcPort }}"
|
|
WOODPECKER_LETS_ENCRYPT: "false"
|
|
WOODPECKER_ADMIN: "{{ .Woodpecker.Admin }}"
|
|
WOODPECKER_OPEN: "{{ .Woodpecker.Open }}"
|
|
WOODPECKER_AGENT_SECRET: "{{ .Woodpecker.AgentSecret }}"
|
|
WOODPECKER_DATABASE_DRIVER: "sqlite3"
|
|
WOODPECKER_DATABASE_DATASOURCE: "{{ .Woodpecker.DataContainerDirectory }}/woodpecker.db"
|
|
WOODPECKER_GITEA: "true"
|
|
WOODPECKER_GITEA_URL: "https://{{ .Forgejo.Subdomain }}.{{ .RootDomain }}"
|
|
WOODPECKER_GITEA_CLIENT: "{{ .Woodpecker.ForgejoClientID }}"
|
|
WOODPECKER_GITEA_SECRET: "{{ .Woodpecker.ForgejoClientSecret }}"
|
|
WOODPECKER_GITEA_SKIP_VERIFY: "false"
|
|
expose:
|
|
- "{{ .Woodpecker.HttpPort }}"
|
|
- "{{ .Woodpecker.GrpcPort }}"
|
|
networks:
|
|
flow:
|
|
ipv4_address: "{{ .Woodpecker.ContainerIpv4Address }}"
|
|
restart: "always"
|
|
volumes:
|
|
{{- template "defaultVolumes" }}
|
|
# Woodpecker data volume
|
|
- type: "bind"
|
|
source: "{{ .Woodpecker.DataHostDirectory }}"
|
|
target: "{{ .Woodpecker.DataContainerDirectory }}"
|
|
# -- Landing Page --
|
|
landing:
|
|
container_name: "{{ .Landing.ContainerName }}"
|
|
command:
|
|
- --address={{ .Landing.ContainerIpv4Address }}:{{ .Landing.Port }}
|
|
{{ range .Landing.Services -}}
|
|
- --service=title={{ .Title }},url={{ .URL }}{{ if gt (len .Rel) 0 }},rel={{ .Rel }}{{ end }}
|
|
{{ end -}}
|
|
{{ range .Landing.Profiles -}}
|
|
- --profile=title={{ .Title }},url={{ .URL }}{{ if gt (len .Rel) 0 }},rel={{ .Rel }}{{ end }}
|
|
{{ end -}}
|
|
image: "codeflow.dananglin.me.uk/flow/landing:v{{ .Landing.Version }}@{{ .Landing.ImageDigest }}"
|
|
expose:
|
|
- "{{ .Landing.Port }}"
|
|
networks:
|
|
flow:
|
|
ipv4_address: "{{ .Landing.ContainerIpv4Address }}"
|
|
restart: "always"
|
|
volumes:
|
|
{{- template "defaultVolumes" }}
|