generated from kelin/Compose-Template
Initial commit
This commit is contained in:
39
.env.example
Normal file
39
.env.example
Normal file
@@ -0,0 +1,39 @@
|
||||
# Timezone
|
||||
TZ=America/New_York
|
||||
|
||||
# Source directories
|
||||
SOURCE_STACKS_DIR=/opt
|
||||
SOURCE_HOME_DIR=/~
|
||||
|
||||
# Backup location directory
|
||||
BACKUP_DIR=/mnt/restic-usb
|
||||
|
||||
# Server Details
|
||||
SERVER_NAME=
|
||||
SERVER_IP=
|
||||
|
||||
# Service Details
|
||||
DOCKER_IMAGE=
|
||||
CONTAINER_NAME=
|
||||
SERVICE_NAME=
|
||||
INTERNAL_PORT=
|
||||
EXTERNAL_PORT=
|
||||
LOCAL_URL=http://${SERVER_IP}.${EXTERNAL_PORT}
|
||||
|
||||
# Services that exist on multiple servers should include ${SERVER_NAME}
|
||||
# Services that exist on a single server can omit ${SERVER_NAME}
|
||||
PROXY_URL=${SERVICE_NAME}.${SERVER_NAME}.${SUBDOMAIN}.duckdns.org
|
||||
|
||||
CATEGORY_LABEL=
|
||||
DESCRIPTION_LABEL=
|
||||
HOST_LABEL='traefik.http.routers.${SERVICE_NAME}.rule=Host(`${PROXY_URL}`)'
|
||||
LOADBALANCER_LABEL='traefik.http.services.${SERVICE_NAME}.loadbalancer.server.port=${INTERNAL_PORT}'
|
||||
|
||||
# Enable Traefik label
|
||||
TRAEFIK_ENABLE_LABEL='traefik.enable=true'
|
||||
|
||||
# Enable Authelia label
|
||||
AUTHELIA_LABEL='traefik.http.routers.${SERVICE_NAME}.middlewares=authelia@docker'
|
||||
|
||||
# Enable Watchtower label
|
||||
WATCHTOWER_ENABLE_LABEL='com.centurylinklabs.watchtower.enable=true'
|
||||
12
README.md
Normal file
12
README.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# Docker Compose Template
|
||||
|
||||
## Instructions
|
||||
|
||||
* Create a new repository using this template
|
||||
* Modify the .env file as needed
|
||||
* Make changes to docker-compose.yml only if needed
|
||||
|
||||
### If Traefik is on a different server
|
||||
|
||||
* Delete all the labels, they will be ignored anyway
|
||||
* Use /traefik/dynamic/remote-host.yml to create a new or modify an existing remote host yml file
|
||||
54
compose.yml
Normal file
54
compose.yml
Normal file
@@ -0,0 +1,54 @@
|
||||
services:
|
||||
|
||||
${SERVICE_NAME}:
|
||||
image: ${DOCKER_IMAGE}
|
||||
container_name: ${CONTAINER_NAME}
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- homelab-network
|
||||
- traefik-network
|
||||
ports:
|
||||
- ${EXTERNAL_PORT}:${INTERNAL_PORT}
|
||||
|
||||
# Comment out volumes section if it is empty
|
||||
#volumes:
|
||||
|
||||
# Comment out environment section if it is empty
|
||||
# environment:
|
||||
|
||||
healthcheck:
|
||||
test: ['CMD', 'wget', '--quiet', '--tries=1', '--spider', 'http://localhost:${INTERNAL_PORT}/']
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 30s
|
||||
labels:
|
||||
# Labels in compose files are treated as literal strings, disallowing variable replacement in the string
|
||||
# However the string can be defined as a variable
|
||||
- ${HOST_LABEL}
|
||||
- $(AUTHELIA_LABEL)
|
||||
- ${TRAEFIK_ENABLE_LABEL}
|
||||
- ${WATCHTOWER_ENABLE_LABEL}
|
||||
- ${LOADBALANCER_LABEL}
|
||||
- ${CATEGORY_LABEL}
|
||||
- ${DESCRIPTION_LABEL}
|
||||
# All services being proxied by Traefik must be on this network
|
||||
- 'traefik.docker.network=traefik-network'
|
||||
# This enables https
|
||||
- 'traefik.http.routers.backrest.entrypoints=websecure'
|
||||
# This enables letsencrypt certificates
|
||||
- 'traefik.http.routers.backrest.tls.certresolver=letsencrypt'
|
||||
# Define the category and description of this service
|
||||
|
||||
|
||||
networks:
|
||||
homelab-network:
|
||||
external: true
|
||||
traefik-network:
|
||||
external: true
|
||||
|
||||
|
||||
x-dockge:
|
||||
urls:
|
||||
- https://${PROXY_URL}
|
||||
- https://${LOCAL_URL}
|
||||
46
traefik/dynamic/remote-host.yml
Normal file
46
traefik/dynamic/remote-host.yml
Normal file
@@ -0,0 +1,46 @@
|
||||
# Remote host yml file example
|
||||
# This file can not use env variables.
|
||||
# It contains placeholders indicated by ALL-CAPS that must be replaced by the values of the matching variables
|
||||
|
||||
# Must be http here, not https
|
||||
http:
|
||||
|
||||
# Define all routes in this section
|
||||
routers:
|
||||
|
||||
# Name of the Route
|
||||
SERVICE_NAME-SERVER_NAME:
|
||||
|
||||
# Url to proxy
|
||||
rule: "Host(`SERVICE_NAME.SERVER_NAME.SUBDOMIAN.duckdns.org`)"
|
||||
|
||||
# Name of the service (must match the service name in the services section)
|
||||
# example: 'service: arcane-server1-service
|
||||
service: SERVICE_NAME-SERVER_NAME-service
|
||||
|
||||
# Use https
|
||||
entrypoints:
|
||||
- websecure
|
||||
|
||||
# Use letsencrypt certificate
|
||||
tls:
|
||||
certResolver: letsencrypt
|
||||
|
||||
# middlewares section should be omittted if empty
|
||||
middlewares:
|
||||
# Use Authelia for login
|
||||
- authelia@docker
|
||||
|
||||
# Define all services in this section
|
||||
services:
|
||||
|
||||
# Name of the service (must match service name defined above)
|
||||
# example: 'service: arcane-server1-service
|
||||
SERVICE_NAME-SERVER_NAME-service:
|
||||
|
||||
# Define the load balancer using the ip and external port of the server
|
||||
loadBalancer:
|
||||
servers:
|
||||
- url: "http://SERVER_IP:EXTERNAL_PORT"
|
||||
passHostHeader: true
|
||||
|
||||
Reference in New Issue
Block a user