From 7174f91ffc0db8a9e58f55d54c5387e381038c8a Mon Sep 17 00:00:00 2001 From: Stephan Porada Date: Wed, 28 Apr 2021 12:13:46 +0200 Subject: [PATCH] remote_branch initial push --- .gitignore | 14 +++ gitea/docker-compose.yml | 72 +++++++++++ nextcloud/collabora/loolwsd.xml.tpl | 183 ++++++++++++++++++++++++++++ nextcloud/docker-compose.yml | 151 +++++++++++++++++++++++ nextcloud/mariadb-conf/docker.cnf | 6 + nginx-rtmp/docker-compose.yml | 8 ++ traefik/docker-compose.yml | 159 ++++++++++++++++++++++++ traefik/live.env.tpl | 4 + ts3/docker-compose.yml | 43 +++++++ ts3/live.env.tpl | 15 +++ wordpress/docker-compose.yml | 46 +++++++ 11 files changed, 701 insertions(+) create mode 100644 .gitignore create mode 100644 gitea/docker-compose.yml create mode 100644 nextcloud/collabora/loolwsd.xml.tpl create mode 100644 nextcloud/docker-compose.yml create mode 100644 nextcloud/mariadb-conf/docker.cnf create mode 100644 nginx-rtmp/docker-compose.yml create mode 100644 traefik/docker-compose.yml create mode 100644 traefik/live.env.tpl create mode 100644 ts3/docker-compose.yml create mode 100644 ts3/live.env.tpl create mode 100644 wordpress/docker-compose.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dad0abf --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +# Environment files +*.env + +# Nextcloud collabora file +loolwsd.xml + +# Service folders +**/bundesdata_web_app/ +**/data/ +**/db/ +**/mariadb/ +**/redis/ +**/html/ +**/volumes/ diff --git a/gitea/docker-compose.yml b/gitea/docker-compose.yml new file mode 100644 index 0000000..cfda5c1 --- /dev/null +++ b/gitea/docker-compose.yml @@ -0,0 +1,72 @@ +version: '3.5' + +networks: + default: + external: + name: traefik_default + +services: + gitea-db: + image: mariadb:10 + container_name: gitea-db + restart: unless-stopped + env_file: live.env + labels: + # Watchtower + - "com.centurylinklabs.watchtower.enable=true" + networks: + - default + volumes: + - /etc/localtime:/etc/localtime:ro + - /etc/timezone:/etc/timezone:ro + - ${GITEA_ROOT}/db:/var/lib/mysql + environment: + - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} + - MYSQL_USER=${MYSQL_USER} + - MYSQL_PASSWORD=${MYSQL_PASSWORD} + - MYSQL_DATABASE=gitea + + gitea-app: + image: gitea/gitea:latest + container_name: gitea-app + restart: unless-stopped + volumes: + - /etc/localtime:/etc/localtime:ro + - /etc/timezone:/etc/timezone:ro + - ${GITEA_ROOT}/data:/data + #- /home/git/.ssh/:/data/git/.ssh + + env_file: live.env + environment: + - USER_UID=1000 + - USER_GID=1000 + - DB_TYPE=mysql + - DB_HOST=gitea-db:3306 + - DB_NAME=gitea + - DB_USER=${MYSQL_USER} + - DB_PASSWD=${MYSQL_PASSWORD} + - DOMAIN=gitea.${DOMAIN} + #- SSH_PORT=2222 + - DISABLE_SSH=true + - DISABLE_REGISTRATION=true + - ROOT_URL=https://gitea.${DOMAIN}/ + - "APP_NAME=Gitea: Git Gud!" + labels: + # Watchtower + - "com.centurylinklabs.watchtower.enable=true" + # Routes + - "traefik.enable=true" + - "traefik.http.routers.gitea.entrypoints=websecure" + - "traefik.http.routers.gitea.rule=Host(`gitea.${DOMAIN}`)" + - "traefik.http.routers.gitea.tls=true" + - "traefik.http.routers.gitea.tls.certresolver=myresolver" + - "traefik.http.services.gitea.loadbalancer.server.port=3000" + # SSH + #- "traefik.tcp.routers.gitea-ssh.rule=HostSNI(`*`)" + #- "traefik.tcp.routers.gitea-ssh.entrypoints=ssh" + #- "traefik.tcp.routers.gitea-ssh.service=gitea-ssh-svc" + #- "traefik.tcp.services.gitea-ssh-svc.loadbalancer.server.port=2222" + depends_on: + - gitea-db + networks: + - default diff --git a/nextcloud/collabora/loolwsd.xml.tpl b/nextcloud/collabora/loolwsd.xml.tpl new file mode 100644 index 0000000..f8551e4 --- /dev/null +++ b/nextcloud/collabora/loolwsd.xml.tpl @@ -0,0 +1,183 @@ + + + + + + de_DE en_GB en_US es_ES fr_FR it nl pt_BR pt_PT ru + + + + + + collabora.domain.com + + + + 1 + + 4 + 5 + + false + 3600 + + + 30 + 300 + false + 0 + 8000 + 0 + 0 + 100 + 100 + + 10000 + 60 + 300 + 3072 + 85 + + + + + 120 + 900 + + + loleaflet.html + + + true + warning + false + + -INFO-WARN + + + /var/log/loolwsd.log + never + timestamp + true + 10 days + 10 + true + false + + + false + 82589933 + + + + false + + + + + + + + false + + + + + + all + any + + + + 192\.168\.[0-9]{1,3}\.[0-9]{1,3} + ::ffff:192\.168\.[0-9]{1,3}\.[0-9]{1,3} + 127\.0\.0\.1 + ::ffff:127\.0\.0\.1 + ::1 + 172\.17\.[0-9]{1,3}\.[0-9]{1,3} + ::ffff:172\.17\.[0-9]{1,3}\.[0-9]{1,3} + + + + + + + true + false + /etc/loolwsd/cert.pem + /etc/loolwsd/key.pem + /etc/loolwsd/ca-chain.cert.pem + + + 1000 + + + + + + + + + true + true + + + + + + + + + true + false + + + + + classic + + + + + + nextcloud\\.domain\\.com + 10\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3} + 172\.1[6789]\.[0-9]{1,3}\.[0-9]{1,3} + 172\.2[0-9]\.[0-9]{1,3}\.[0-9]{1,3} + 172\.3[01]\.[0-9]{1,3}\.[0-9]{1,3} + 192\.168\.[0-9]{1,3}\.[0-9]{1,3} + 192\.168\.1\.1 + 0 + false + + 900 + + + + nextcloud.domain.com + + + true + + + + + + + + + true + + + true + false + username + test + + + + + + diff --git a/nextcloud/docker-compose.yml b/nextcloud/docker-compose.yml new file mode 100644 index 0000000..0949c70 --- /dev/null +++ b/nextcloud/docker-compose.yml @@ -0,0 +1,151 @@ +version: '3.5' + +networks: + default: + external: + name: traefik_default + +services: + nextcloud-db: + env_file: live.env + image: mariadb:10 + container_name: nextcloud-db + command: --transaction-isolation=READ-COMMITTED --log-bin=ROW + labels: + - "com.centurylinklabs.watchtower.enable=true" + networks: + - default + ports: + - 3306:3306 + restart: unless-stopped + volumes: + - /etc/localtime:/etc/localtime:ro + - /etc/timezone:/etc/timezone:ro + - ${NEXTCLOUD_ROOT}/mariadb:/var/lib/mysql + - ${NEXTCLOUD_ROOT}/mariadb-conf/docker.cnf:/etc/mysql/conf.d/docker.cnf:ro + + nextcloud-redis: + image: redis:6-alpine + container_name: nextcloud-redis + command: redis-server --requirepass ${REDIS_HOST_PASSWORD} + labels: + - "com.centurylinklabs.watchtower.enable=true" + networks: + - default + restart: unless-stopped + volumes: + - ${NEXTCLOUD_ROOT}/redis:/data + - /etc/localtime:/etc/localtime:ro + - /etc/timezone:/etc/timezone:ro + + + nextcloud-app: + depends_on: + - nextcloud-db + - nextcloud-redis + container_name: nextcloud-app + env_file: live.env + environment: + - NEXTCLOUD_TRUSTED_DOMAINS='${NEXTCLOUD_FQDN}' + extra_hosts: + - "${NEXTCLOUD_FQDN}:${TRAEFIK_CONTAINER_IP}" + - "${COLLABORA_FQDN}:${TRAEFIK_CONTAINER_IP}" + image: nextcloud:21 + labels: + # Watchtower + - "com.centurylinklabs.watchtower.enable=true" + # Routes + - "traefik.enable=true" + - "traefik.http.routers.nextcloud.entrypoints=websecure" + - "traefik.http.routers.nextcloud.rule=Host(`nextcloud.${DOMAIN}`)" + - "traefik.http.routers.nextcloud.tls=true" + - "traefik.http.routers.nextcloud.tls.certresolver=myresolver" + - "traefik.http.services.nextcloud.loadbalancer.server.port=80" + # HSTS and Cal Dav + - "traefik.http.middlewares.nc-rep.redirectregex.regex=https://(.*)/.well-known/(card|cal)dav" + - "traefik.http.middlewares.nc-rep.redirectregex.replacement=https://$$1/remote.php/dav/" + - "traefik.http.middlewares.nc-rep.redirectregex.permanent=true" + - "traefik.http.middlewares.nc-header.headers.referrerPolicy=no-referrer" + - "traefik.http.middlewares.nc-header.headers.stsSeconds=31536000" + - "traefik.http.middlewares.nc-header.headers.forceSTSHeader=true" + - "traefik.http.middlewares.nc-header.headers.stsPreload=true" + - "traefik.http.middlewares.nc-header.headers.stsIncludeSubdomains=true" + - "traefik.http.middlewares.nc-header.headers.browserXssFilter=true" + - "traefik.http.middlewares.nc-header.headers.customRequestHeaders.X-Forwarded-Proto=https" + - "traefik.http.routers.nextcloud.middlewares=nc-rep,nc-header" + networks: + - default + restart: unless-stopped + volumes: + - ${NEXTCLOUD_ROOT}/html:/var/www/html + - ${NEXTCLOUD_ROOT}/data:/srv/nextcloud/data + + nextcloud-cron: + image: nextcloud:21 + container_name: nextcloud-cron + labels: + - "com.centurylinklabs.watchtower.enable=true" + restart: unless-stopped + volumes: + - ${NEXTCLOUD_ROOT}/html:/var/www/html + - ${NEXTCLOUD_ROOT}/data:/srv/nextcloud/data + entrypoint: /cron.sh + depends_on: + - nextcloud-db + - nextcloud-redis + - nextcloud-collabora + + nextcloud-coturn: + image: instrumentisto/coturn + container_name: nextcloud-coturn + restart: unless-stopped + ports: + - "3478:3478/tcp" + - "3478:3478/udp" + networks: + - default + command: + - -n + - --log-file=stdout + - --min-port=49160 + - --max-port=49200 + - --realm=${NEXTCLOUD_FQDN} + - --use-auth-secret + - --static-auth-secret=${COTURN_SECRET} + + nextcloud-collabora: + image: collabora/code:6.4.2.2 + container_name: nextcloud-collabora + env_file: live.env + extra_hosts: + - "${NEXTCLOUD_FQDN}:${TRAEFIK_CONTAINER_IP}" + - "${COLLABORA_FQDN}:${TRAEFIK_CONTAINER_IP}" + hostname: collabora.sporada.eu + labels: + # Watchtower + - "com.centurylinklabs.watchtower.enable=true" + # Routes + - "traefik.enable=true" + - "traefik.http.routers.collabora.entrypoints=websecure" + - "traefik.http.routers.collabora.rule=Host(`collabora.${DOMAIN}`)" + - "traefik.http.routers.collabora.tls.certresolver=myresolver" + - "traefik.http.services.collabora.loadbalancer.server.port=9980" + restart: unless-stopped + networks: + - default + ports: + - "9980:9980" + environment: + - domain=${COLLABORA_DOMAIN} + - server_name=${COLLABORA_FQDN} + - username=${COLLABORA_USERNAME} + - password=${COLLABORA_PASSWORD} + - extra_params=--o:ssl.enable=false --o:ssl.termination=true + cap_add: + - MKNOD + volumes: + - /etc/localtime:/etc/localtime:ro + - /etc/timezone:/etc/timezone:ro + - ./collabora/loolwsd.xml:/etc/loolwsd/loolwsd.xml + + diff --git a/nextcloud/mariadb-conf/docker.cnf b/nextcloud/mariadb-conf/docker.cnf new file mode 100644 index 0000000..aae35ff --- /dev/null +++ b/nextcloud/mariadb-conf/docker.cnf @@ -0,0 +1,6 @@ +[mysqld] +innodb_buffer_pool_size=2G +innodb_io_capacity=4000 +innodb_io_capacity_max=4000 +skip-host-cache +skip-name-resolve diff --git a/nginx-rtmp/docker-compose.yml b/nginx-rtmp/docker-compose.yml new file mode 100644 index 0000000..20a9630 --- /dev/null +++ b/nginx-rtmp/docker-compose.yml @@ -0,0 +1,8 @@ +version: "3.7" +services: + streaming: + image: tiangolo/nginx-rtmp + container_name: nginx-rtmp + ports: + - "1935:1935" + restart: unless-stopped diff --git a/traefik/docker-compose.yml b/traefik/docker-compose.yml new file mode 100644 index 0000000..d1ad106 --- /dev/null +++ b/traefik/docker-compose.yml @@ -0,0 +1,159 @@ +version: '3.5' + +networks: + default: + driver: bridge + socket_proxy: + external: + name: socket_proxy + + +services: + # Only accept needed incoming docker API calls + socket-proxy: + container_name: socket-proxy + environment: + - LOG_LEVEL=info # debug,info,notice,warning,err,crit,alert,emerg + ## Variables match the URL prefix (i.e. AUTH blocks access to /auth/* parts of the API, etc.). + # 0 to revoke access. + # 1 to grant access. + ## Granted by Default + - EVENTS=1 + - PING=1 + - VERSION=1 + ## Revoked by Default + # Security critical + - AUTH=0 + - SECRETS=0 + - POST=1 # Watchtower + - DELETE=1 # Watchtower + # GET Optons + - BUILD=0 + - COMMIT=0 + - CONFIGS=0 + - CONTAINERS=1 # Traefik, portainer, etc. + - DISTRIBUTION=0 + - EXEC=0 + - IMAGES=1 # Portainer, Watchtower + - INFO=1 # Portainer + - NETWORKS=1 # Portainer, Watchtower + - NODES=0 + - PLUGINS=0 + - SERVICES=1 # Portainer + - SESSION=0 + - SWARM=0 + - SYSTEM=0 + - TASKS=1 # Portaienr + - VOLUMES=1 # Portainer + # POST Options + - CONTAINERS_CREATE=1 # WatchTower + - CONTAINERS_START=1 # WatchTower + - CONTAINERS_UPDATE=1 # WatchTower + # DELETE Options + - CONTAINERS_DELETE=1 # WatchTower + - IMAGES_DELETE=1 # WatchTower + image: fluencelabs/docker-socket-proxy + labels: + - "com.centurylinklabs.watchtower.enable=true" + networks: + - socket_proxy + ports: + - "127.0.0.1:2375:2375" + # Always restart if server restart etc. + restart: unless-stopped + volumes: + - "/var/run/docker.sock:/var/run/docker.sock" + + # watchtower keeps docker iamges automatically up to date + watchtower: + container_name: watchtower + depends_on: + - socket-proxy + environment: + WATCHTOWER_CLEANUP: "true" + WATCHTOWER_REMOVE_VOLUMES: "true" + WATCHTOWER_INCLUDE_STOPPED: "true" + WATCHTOWER_NO_STARTUP_MESSAGE: "false" + WATCHTOWER_SCHEDULE: "0 30 12 * * *" # Everyday at 12:30 + DOCKER_HOST: tcp://socket-proxy:2375 + image: containrrr/watchtower + labels: + - "com.centurylinklabs.watchtower.enable=true" + networks: + - default + - socket_proxy + restart: unless-stopped + + traefik: + depends_on: + - watchtower + # Always restart also at boot unless manually stopped + restart: unless-stopped + # The official v2 Traefik docker image + image: traefik:v2.3 + networks: + - socket_proxy + - default + env_file: live.env + container_name: "traefik" + # Enables the web UI and tells Traefik to listen to docker + command: + # logging + - "--log.filePath=/logs/traefik.log" + - "--log.level=DEBUG" + # API and Dashboard + #- "--api.insecure=true" + - "--api=true" + - "--api.dashboard=true" + # Docker as provider + - "--providers.docker=true" + - "--providers.docker.exposedbydefault=false" + # Entrypoints (not HTTPS) + - "--entrypoints.web.address=:80" + # HTTPS (websecure entrypoint) + - "--entrypoints.websecure.address=:443" + # TS3 entrypoints + - "--entrypoints.ts-udp.address=:9987/udp" + - "--entrypoints.ts-tcp.address=:30033" + # Use this CA server for testing + # - "--certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory" + - "--certificatesresolvers.myresolver.acme.email=${EMAIL}" + - "--certificatesresolvers.myresolver.acme.httpchallenge=true" + - "--certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web" + - "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json" + # Docker socket proxy cli commands + - "--providers.docker.endpoint=tcp://socket-proxy:2375" + labels: + # enable watchtower for traefik + - "com.centurylinklabs.watchtower.enable=true" + # Dashboard stuff + - "traefik.enable=true" + - "traefik.http.routers.traefik-https.rule=Host(`traefik.${DOMAIN}`)" + - "traefik.http.routers.traefik-https.entrypoints=websecure" + - "traefik.http.routers.traefik-https.middlewares=auth" + - "traefik.http.routers.traefik-https.service=api@internal" + - "traefik.http.routers.traefik-https.tls=true" + - "traefik.http.routers.traefik-https.tls.certresolver=myresolver" + - "traefik.http.middlewares.auth.basicauth.users=${TRAEFIK_USER}:${TRAEFIK_PASSWORD_HASH}" + # http to https redirect + - "traefik.http.middlewares.https-redirect.redirectscheme.scheme=https" + - "traefik.http.middlewares.https-redirect.redirectscheme.permanent=true" + - "traefik.http.routers.http_catchall.rule=HostRegexp(`{any:.+}`)" + - "traefik.http.routers.http_catchall.entrypoints=web" + - "traefik.http.routers.http_catchall.middlewares=https-redirect" + ports: + # The HTTP port + - "80:80" + # The HTTPS port + - "443:443" + # The Web UI (enabled by --api.insecure=true) + #- "8080:8080" + # TS3 ports + - "9987:9987/udp" + - "10011:10011" + - "30033:30033" + volumes: + # For certificate + - "./volumes/letsencrypt/acme.json:/letsencrypt/acme.json" + # For logging + - "./volumes/logs/traefik.log:/logs/traefik.log" diff --git a/traefik/live.env.tpl b/traefik/live.env.tpl new file mode 100644 index 0000000..ad303db --- /dev/null +++ b/traefik/live.env.tpl @@ -0,0 +1,4 @@ +TRAEFIK_USER=sporada +TRAEFIK_PASSWORD_HASH=hash +DOMAIN=sporada.eu +EMAIL=porada@posteo.de diff --git a/ts3/docker-compose.yml b/ts3/docker-compose.yml new file mode 100644 index 0000000..867e2ec --- /dev/null +++ b/ts3/docker-compose.yml @@ -0,0 +1,43 @@ +version: '3.5' + +networks: + default: + external: + name: traefik_default + +services: + teamspeak-app: + networks: + - default + image: teamspeak:latest + env_file: live.env + container_name: ts3-service + restart: unless-stopped + volumes: + - ./data:/var/ts3server + depends_on: + - teamspeak-db + labels: + # Watchtower + - "com.centurylinklabs.watchtower.enable=true" + # Traefik + - "traefik.enable=true" + # tcp + - "traefik.tcp.routers.teamspeak-tcp.entrypoints=ts-tcp" + - "traefik.tcp.routers.teamspeak-tcp.service=teamspeak-tcp" + - "traefik.tcp.routers.teamspeak-tcp.rule=HostSNI(`ts3.${DOMAIN}`)" + - "traefik.tcp.services.teamspeak-tcp.loadbalancer.server.port=30033" + # udp + - "traefik.udp.routers.teamspeak-udp.entrypoints=ts-udp" + - "traefik.udp.routers.teamspeak-udp.service=teamspeak-udp" + - "traefik.udp.services.teamspeak-udp.loadbalancer.server.port=9987" + + teamspeak-db: + networks: + - default + image: mariadb:10 + env_file: live.env + container_name: ts3-db + restart: unless-stopped + volumes: + - ./db:/var/lib/mysql diff --git a/ts3/live.env.tpl b/ts3/live.env.tpl new file mode 100644 index 0000000..e31acd9 --- /dev/null +++ b/ts3/live.env.tpl @@ -0,0 +1,15 @@ +DOMAIN=sporada.eu + +### TS3 Server ### +TS3SERVER_DB_PLUGIN=ts3db_mariadb +TS3SERVER_DB_SQLCREATEPATH=create_mariadb +TS3SERVER_DB_HOST=db +TS3SERVER_DB_USER=root +TS3SERVER_DB_PASSWORD=password +TS3SERVER_DB_NAME=teamspeak +TS3SERVER_DB_WAITUNTILREADY=30 +TS3SERVER_LICENSE=accept + +### Mariadb ### +MYSQL_ROOT_PASSWORD=password +MYSQL_DATABASE=teamspeak diff --git a/wordpress/docker-compose.yml b/wordpress/docker-compose.yml new file mode 100644 index 0000000..968bd9d --- /dev/null +++ b/wordpress/docker-compose.yml @@ -0,0 +1,46 @@ +version: '3.5' + +networks: + default: + external: + name: traefik_default + +services: + wordpress: + env_file: live.env + image: wordpress + container_name: wordpress-app + restart: unless-stopped + labels: + # Watchtower + - "com.centurylinklabs.watchtower.enable=true" + - "traefik.enable=true" + ### ### + - "traefik.http.routers.wordpress.entrypoints=websecure" + #- "traefik.http.routers.wordpress.middlewares=hsts-header@file" + - "traefik.http.routers.wordpress.rule=Host(`${DOMAIN}`)" + - "traefik.http.routers.wordpress.tls=true" + - "traefik.http.routers.wordpress.tls.certresolver=myresolver" + #- "traefik.http.routers.wordpress.tls.options=intermediate@file" + ### ### + networks: + - default + volumes: + - ${WORDPRESS_ROOT}/data/wordpress/usr/local/etc/php/conf.d/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini + - ${WORDPRESS_ROOT}/data/wordpress/var/www/html:/var/www/html + - /etc/localtime:/etc/localtime:ro + - /etc/timezone:/etc/timezone:ro + + db: + env_file: live.env + image: mysql:5.7 + restart: unless-stopped + container_name: wordpress-db + labels: + # Watchtower + - "com.centurylinklabs.watchtower.enable=true" + networks: + - default + volumes: + - ${WORDPRESS_ROOT}/db/var/lib/mysql:/var/lib/mysql +