mirror of
https://github.com/KevinMidboe/schleppe-pulumi.git
synced 2026-01-07 18:05:53 +00:00
docker-compose resource definitions for web servers
This commit is contained in:
74
docker-compose/00_traefik/docker-compose.yml
Normal file
74
docker-compose/00_traefik/docker-compose.yml
Normal file
@@ -0,0 +1,74 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
traefik:
|
||||
image: "traefik:latest"
|
||||
container_name: traefik
|
||||
restart: unless-stopped
|
||||
|
||||
# PORTS
|
||||
ports:
|
||||
# HTTP entrypoint
|
||||
# Exposed on all external addresses (0.0.0.0:80)
|
||||
- "80:80"
|
||||
|
||||
# Traefik API & Dashboard
|
||||
# Accessible on http://<host>:8080
|
||||
- "8080:8080"
|
||||
|
||||
# COMMAND (STATIC CONFIGURATION)
|
||||
command:
|
||||
# Enable Traefik API & Dashboard
|
||||
- "--api.dashboard=true"
|
||||
- "--api.insecure=true"
|
||||
|
||||
# Log settings
|
||||
- "--log.level=INFO"
|
||||
- "--accesslog=true"
|
||||
|
||||
# EntryPoints
|
||||
- "--entrypoints.web.address=:80"
|
||||
- "--entrypoints.traefik.address=:8080"
|
||||
|
||||
# Docker provider
|
||||
- "--providers.docker=true"
|
||||
- "--providers.docker.exposedbydefault=false"
|
||||
|
||||
# Optional: file provider for dynamic config
|
||||
- "--providers.file.directory=/etc/traefik/dynamic"
|
||||
- "--providers.file.watch=true"
|
||||
|
||||
# Global settings
|
||||
- "--global.checknewversion=true"
|
||||
- "--global.sendanonymoususage=false"
|
||||
|
||||
# VOLUMES
|
||||
volumes:
|
||||
# Docker socket (required for Docker provider)
|
||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||
|
||||
# Dynamic configuration directory (middlewares, routers, TLS, etc.)
|
||||
- ./dynamic:/etc/traefik/dynamic:ro
|
||||
|
||||
# Logs (optional)
|
||||
- ./logs:/logs
|
||||
|
||||
# NETWORKS
|
||||
networks:
|
||||
- traefik
|
||||
|
||||
# LABELS (OPTIONAL SELF-ROUTING)
|
||||
labels:
|
||||
# Enable Traefik for this container
|
||||
- "traefik.enable=true"
|
||||
|
||||
# Router for dashboard (via Traefik itself)
|
||||
- "traefik.http.routers.traefik.rule=Host(`traefik.localhost`)"
|
||||
- "traefik.http.routers.traefik.entrypoints=web"
|
||||
- "traefik.http.routers.traefik.service=api@internal"
|
||||
|
||||
# NETWORK DEFINITIONS
|
||||
networks:
|
||||
traefik:
|
||||
name: traefik
|
||||
driver: bridge
|
||||
62
docker-compose/compose-all.sh
Normal file
62
docker-compose/compose-all.sh
Normal file
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
########################################
|
||||
# CONFIG
|
||||
########################################
|
||||
COMPOSE_FILE_NAME="docker-compose.yml"
|
||||
|
||||
########################################
|
||||
# ARGUMENT CHECK
|
||||
########################################
|
||||
if [[ $# -ne 1 ]]; then
|
||||
echo "Usage: $0 {up|down}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ACTION="$1"
|
||||
|
||||
if [[ "$ACTION" != "up" && "$ACTION" != "down" ]]; then
|
||||
echo "Invalid action: $ACTION"
|
||||
echo "Allowed actions: up, down"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
########################################
|
||||
# SAVE STARTING DIRECTORY
|
||||
########################################
|
||||
START_DIR="$(pwd)"
|
||||
|
||||
########################################
|
||||
# FIND COMPOSE FILES
|
||||
########################################
|
||||
mapfile -t COMPOSE_DIRS < <(
|
||||
find . -type f -name "$COMPOSE_FILE_NAME" -print0 \
|
||||
| xargs -0 -n1 dirname | sort
|
||||
)
|
||||
|
||||
########################################
|
||||
# LOOP THROUGH DIRECTORIES
|
||||
########################################
|
||||
for DIR in "${COMPOSE_DIRS[@]}"; do
|
||||
echo "----------------------------------------"
|
||||
echo "Processing: $DIR"
|
||||
echo "Action: docker-compose $ACTION"
|
||||
echo "----------------------------------------"
|
||||
|
||||
cd "$DIR"
|
||||
|
||||
if [[ "$ACTION" == "up" ]]; then
|
||||
docker-compose up -d
|
||||
else
|
||||
docker-compose down
|
||||
fi
|
||||
|
||||
cd "$START_DIR"
|
||||
done
|
||||
|
||||
echo "========================================"
|
||||
echo "Completed docker-compose $ACTION for all stacks"
|
||||
echo "========================================"
|
||||
|
||||
28
docker-compose/k9e/docker-compose.yml
Normal file
28
docker-compose/k9e/docker-compose.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
k9e:
|
||||
image: kevinmidboe/k9e.no:latest
|
||||
container_name: k9e
|
||||
restart: unless-stopped
|
||||
|
||||
# NETWORK
|
||||
networks:
|
||||
- traefik
|
||||
|
||||
# TRAEFIK LABELS
|
||||
labels:
|
||||
# Enable Traefik for this container
|
||||
- "traefik.enable=true"
|
||||
|
||||
# Router definition
|
||||
- "traefik.http.routers.k9e.rule=Host(`k9e.no`)"
|
||||
- "traefik.http.routers.k9e.entrypoints=web"
|
||||
|
||||
# Service definition
|
||||
- "traefik.http.services.k9e.loadbalancer.server.port=80"
|
||||
|
||||
# NETWORK DEFINITIONS
|
||||
networks:
|
||||
traefik:
|
||||
external: true
|
||||
28
docker-compose/planetposen/docker-compose.yml
Normal file
28
docker-compose/planetposen/docker-compose.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
planetposen-original:
|
||||
image: kevinmidboe/planetposen-original:latest
|
||||
container_name: planetposen
|
||||
restart: unless-stopped
|
||||
|
||||
# NETWORK
|
||||
networks:
|
||||
- traefik
|
||||
|
||||
# TRAEFIK LABELS
|
||||
labels:
|
||||
# Enable Traefik for this container
|
||||
- "traefik.enable=true"
|
||||
|
||||
# Router definition
|
||||
- "traefik.http.routers.planetposen-original.rule=Host(`planetposen.no`)"
|
||||
- "traefik.http.routers.planetposen-original.entrypoints=web"
|
||||
|
||||
# Service definition
|
||||
- "traefik.http.services.planetposen-original.loadbalancer.server.port=80"
|
||||
|
||||
# NETWORK DEFINITIONS
|
||||
networks:
|
||||
traefik:
|
||||
external: true
|
||||
29
docker-compose/whoami/docker-compose.yml
Normal file
29
docker-compose/whoami/docker-compose.yml
Normal file
@@ -0,0 +1,29 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
whoami:
|
||||
image: traefik/whoami
|
||||
container_name: whoami
|
||||
restart: unless-stopped
|
||||
|
||||
# NETWORK
|
||||
networks:
|
||||
- traefik
|
||||
|
||||
# TRAEFIK LABELS
|
||||
labels:
|
||||
# Enable Traefik for this container
|
||||
- "traefik.enable=true"
|
||||
|
||||
# Router definition
|
||||
- "traefik.http.routers.whoami.rule=Host(`whoami.example.com`)"
|
||||
- "traefik.http.routers.whoami.entrypoints=web"
|
||||
|
||||
# Service definition
|
||||
- "traefik.http.services.whoami.loadbalancer.server.port=80"
|
||||
|
||||
# NETWORK DEFINITIONS
|
||||
networks:
|
||||
traefik:
|
||||
external: true
|
||||
|
||||
Reference in New Issue
Block a user