traefik_yourls/docker-compose.yml
2023-12-05 11:44:22 +01:00

90 lines
2.7 KiB
YAML

version: '3.8'
networks:
default:
name: "${PROJECT_NAME}_yourls_db_net"
external: false
be:
name: "${PROJECT_NAME}_yourls_net"
external: false
traefik:
name: "${TRAEFIK_NETWORK}"
external: true
services:
webserver:
image: "nginx:alpine"
depends_on:
- "yourls"
container_name: "${PROJECT_NAME}_yourls_web"
hostname: "${PROJECT_URL}"
restart: "unless-stopped"
volumes:
- "yourls:/var/www/html"
- "./plugins:/var/www/html/user/plugins"
- "./html/frontend:/var/www/html/frontend"
- "./html/index.php:/var/www/html/index.php"
- "./nginx-conf:/etc/nginx/conf.d"
- "./php-conf:/usr/local/etc/php"
networks:
- "traefik"
- "be"
labels:
# Watchtower add to auto update
- "com.centurylinklabs.watchtower.enable=true"
# traefik
- "traefik.enable=true"
- "traefik.docker.network=${TRAEFIK_NETWORK}"
- "traefik.http.routers.${PROJECT_NAME}_yourls.rule=Host(`${PROJECT_URL}`)"
- "traefik.http.routers.${PROJECT_NAME}_yourls.entrypoints=websecure"
- "traefik.http.routers.${PROJECT_NAME}_yourls.tls=true"
- "traefik.http.services.${PROJECT_NAME}_yourls.loadbalancer.server.port=80"
yourls:
image: "yourls:fpm-alpine"
container_name: "${PROJECT_NAME}_yourls_fpm"
restart: "unless-stopped"
networks:
- "be"
- "default"
volumes:
- "yourls:/var/www/html"
- "./plugins:/var/www/html/user/plugins"
- "./html/index.php:/var/www/html/index.php"
- "./html/frontend:/var/www/html/frontend"
- "./php-conf/php.ini:/usr/local/etc/php/php.ini:ro"
environment:
- "YOURLS_SITE=https://${PROJECT_URL}"
- "YOURLS_USER=${ADMIN_USERNAME}"
- "YOURLS_PASS=${ADMIN_PASSWORD}"
- "YOURLS_DB_HOST=${PROJECT_NAME}_yourls_db"
- "YOURLS_DB_USER=${MYSQL_USER}"
- "YOURLS_DB_PASS=${MYSQL_PASSWORD}"
- "YOURLS_DB_NAME=${MYSQL_DATABASE}"
- "YOURLS_PRIVATE=true"
- "YOURLS_COOKIEKEY=ae4bdjkDewdso7Ffio23893jUu"
labels:
# Watchtower add to auto update
- "com.centurylinklabs.watchtower.enable=true"
# traefik
- "traefik.enable=false"
db:
image: "mariadb:latest"
container_name: "${PROJECT_NAME}_yourls_db"
hostname: "${PROJECT_URL}"
restart: "unless-stopped"
command: '--default-authentication-plugin=mysql_native_password'
env_file: ".env"
networks:
- "default"
volumes:
- "${PROJECT_DATA}/${PROJECT_NAME}-yourls/db:/var/lib/mysql"
labels:
# Watchtower add to auto update
- "com.centurylinklabs.watchtower.enable=true"
# traefik
- "traefik.enable=false"
volumes:
yourls:
name: "${PROJECT_NAME}_yourls"