Run traefik as dockeruser, and without host networking
This required port forwarding, a docker proxy, and a docker network, but the end result should be much more secure!
This commit is contained in:
parent
1348eb8b1c
commit
d5c7d94ac8
17 changed files with 150 additions and 6 deletions
|
@ -19,12 +19,17 @@ services:
|
||||||
- ./sites:/sites:ro
|
- ./sites:/sites:ro
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
user: "{{ docker_user.id }}"
|
user: "{{ docker_user.id }}"
|
||||||
ports:
|
|
||||||
- 127.0.0.1:5000:5000
|
|
||||||
environment:
|
environment:
|
||||||
- SITES_ROOT=/sites
|
- SITES_ROOT=/sites
|
||||||
- TRAEFIK_SERVICE=traefik-pages-pages@docker
|
- TRAEFIK_SERVICE=traefik-pages-pages@docker
|
||||||
- AUTH_PASSWORD={{ traefik_pages_password }}
|
- AUTH_PASSWORD={{ traefik_pages_password }}
|
||||||
- TRAEFIK_CERT_RESOLVER=le
|
- TRAEFIK_CERT_RESOLVER=le
|
||||||
|
networks:
|
||||||
|
- default
|
||||||
|
- traefik
|
||||||
labels:
|
labels:
|
||||||
- traefik.enable=true
|
- traefik.enable=true
|
||||||
|
|
||||||
|
networks:
|
||||||
|
traefik:
|
||||||
|
external: true
|
||||||
|
|
|
@ -8,6 +8,9 @@ services:
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
- clickhouse
|
- clickhouse
|
||||||
|
networks:
|
||||||
|
- default
|
||||||
|
- traefik
|
||||||
labels:
|
labels:
|
||||||
- traefik.enable=true
|
- traefik.enable=true
|
||||||
- traefik.http.routers.plausible.rule=Host(`plausible.theorangeone.net`)
|
- traefik.http.routers.plausible.rule=Host(`plausible.theorangeone.net`)
|
||||||
|
@ -52,3 +55,7 @@ services:
|
||||||
environment:
|
environment:
|
||||||
- POSTGRES_PASSWORD=plausible
|
- POSTGRES_PASSWORD=plausible
|
||||||
- POSTGRES_USER=plausible
|
- POSTGRES_USER=plausible
|
||||||
|
|
||||||
|
networks:
|
||||||
|
traefik:
|
||||||
|
external: true
|
||||||
|
|
|
@ -12,3 +12,10 @@ services:
|
||||||
labels:
|
labels:
|
||||||
- traefik.enable=true
|
- traefik.enable=true
|
||||||
- traefik.http.routers.privatebin.rule=Host(`bin.theorangeone.net`)
|
- traefik.http.routers.privatebin.rule=Host(`bin.theorangeone.net`)
|
||||||
|
networks:
|
||||||
|
- default
|
||||||
|
- traefik
|
||||||
|
|
||||||
|
networks:
|
||||||
|
traefik:
|
||||||
|
external: true
|
||||||
|
|
|
@ -13,3 +13,10 @@ services:
|
||||||
labels:
|
labels:
|
||||||
- traefik.enable=true
|
- traefik.enable=true
|
||||||
- traefik.http.routers.calibre.rule=Host(`calibre.jakehoward.tech`)
|
- traefik.http.routers.calibre.rule=Host(`calibre.jakehoward.tech`)
|
||||||
|
networks:
|
||||||
|
- default
|
||||||
|
- traefik
|
||||||
|
|
||||||
|
networks:
|
||||||
|
traefik:
|
||||||
|
external: true
|
||||||
|
|
|
@ -14,3 +14,10 @@ services:
|
||||||
- traefik.http.routers.librespeed.rule=Host(`speed.jakehoward.tech`)
|
- traefik.http.routers.librespeed.rule=Host(`speed.jakehoward.tech`)
|
||||||
- traefik.http.routers.librespeed.middlewares=librespeed-auth@docker
|
- traefik.http.routers.librespeed.middlewares=librespeed-auth@docker
|
||||||
- traefik.http.middlewares.librespeed-auth.basicauth.users={{ librespeed_basicauth }}
|
- traefik.http.middlewares.librespeed-auth.basicauth.users={{ librespeed_basicauth }}
|
||||||
|
networks:
|
||||||
|
- default
|
||||||
|
- traefik
|
||||||
|
|
||||||
|
networks:
|
||||||
|
traefik:
|
||||||
|
external: true
|
||||||
|
|
|
@ -26,6 +26,9 @@ services:
|
||||||
- traefik.http.services.nextcloud-nextcloud.loadbalancer.server.scheme=https
|
- traefik.http.services.nextcloud-nextcloud.loadbalancer.server.scheme=https
|
||||||
- traefik.http.middlewares.nextcloud-hsts.headers.stsseconds=15552000
|
- traefik.http.middlewares.nextcloud-hsts.headers.stsseconds=15552000
|
||||||
- traefik.http.routers.nextcloud.middlewares=nextcloud-hsts@docker
|
- traefik.http.routers.nextcloud.middlewares=nextcloud-hsts@docker
|
||||||
|
networks:
|
||||||
|
- default
|
||||||
|
- traefik
|
||||||
|
|
||||||
mariadb:
|
mariadb:
|
||||||
image: mariadb:10.5
|
image: mariadb:10.5
|
||||||
|
@ -43,3 +46,7 @@ services:
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
- /mnt/tank/dbs/redis/nextcloud:/data
|
- /mnt/tank/dbs/redis/nextcloud:/data
|
||||||
|
|
||||||
|
networks:
|
||||||
|
traefik:
|
||||||
|
external: true
|
||||||
|
|
|
@ -18,6 +18,9 @@ services:
|
||||||
labels:
|
labels:
|
||||||
- traefik.enable=true
|
- traefik.enable=true
|
||||||
- traefik.http.routers.synapse.rule=Host(`matrix.jakehoward.tech`)
|
- traefik.http.routers.synapse.rule=Host(`matrix.jakehoward.tech`)
|
||||||
|
networks:
|
||||||
|
- default
|
||||||
|
- traefik
|
||||||
|
|
||||||
db:
|
db:
|
||||||
image: postgres:14-alpine
|
image: postgres:14-alpine
|
||||||
|
@ -43,3 +46,10 @@ services:
|
||||||
- traefik.http.routers.synapse-admin.rule=Host(`matrix.jakehoward.tech`) && PathPrefix(`/admin`)
|
- traefik.http.routers.synapse-admin.rule=Host(`matrix.jakehoward.tech`) && PathPrefix(`/admin`)
|
||||||
- traefik.http.middlewares.synapse-admin-path.stripprefix.prefixes=/admin
|
- traefik.http.middlewares.synapse-admin-path.stripprefix.prefixes=/admin
|
||||||
- traefik.http.routers.synapse-admin.middlewares=synapse-admin-path@docker
|
- traefik.http.routers.synapse-admin.middlewares=synapse-admin-path@docker
|
||||||
|
networks:
|
||||||
|
- default
|
||||||
|
- traefik
|
||||||
|
|
||||||
|
networks:
|
||||||
|
traefik:
|
||||||
|
external: true
|
||||||
|
|
|
@ -27,6 +27,9 @@ services:
|
||||||
- db
|
- db
|
||||||
tmpfs:
|
tmpfs:
|
||||||
- /config/log
|
- /config/log
|
||||||
|
networks:
|
||||||
|
- default
|
||||||
|
- traefik
|
||||||
|
|
||||||
db:
|
db:
|
||||||
image: postgres:14-alpine
|
image: postgres:14-alpine
|
||||||
|
@ -36,3 +39,7 @@ services:
|
||||||
environment:
|
environment:
|
||||||
- POSTGRES_PASSWORD=tt-rss
|
- POSTGRES_PASSWORD=tt-rss
|
||||||
- POSTGRES_USER=tt-rss
|
- POSTGRES_USER=tt-rss
|
||||||
|
|
||||||
|
networks:
|
||||||
|
traefik:
|
||||||
|
external: true
|
||||||
|
|
|
@ -15,9 +15,16 @@ services:
|
||||||
- traefik.http.routers.wallabag.rule=Host(`wallabag.jakehoward.tech`)
|
- traefik.http.routers.wallabag.rule=Host(`wallabag.jakehoward.tech`)
|
||||||
depends_on:
|
depends_on:
|
||||||
- redis
|
- redis
|
||||||
|
networks:
|
||||||
|
- default
|
||||||
|
- traefik
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis:6-alpine
|
image: redis:6-alpine
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
- /mnt/tank/dbs/redis/wallabag:/data
|
- /mnt/tank/dbs/redis/wallabag:/data
|
||||||
|
|
||||||
|
networks:
|
||||||
|
traefik:
|
||||||
|
external: true
|
||||||
|
|
|
@ -7,3 +7,10 @@ services:
|
||||||
labels:
|
labels:
|
||||||
- traefik.enable=true
|
- traefik.enable=true
|
||||||
- traefik.http.routers.whoami.rule=Host(`whoami.theorangeone.net`) || Host(`who.0rng.one`)
|
- traefik.http.routers.whoami.rule=Host(`whoami.theorangeone.net`) || Host(`who.0rng.one`)
|
||||||
|
networks:
|
||||||
|
- default
|
||||||
|
- traefik
|
||||||
|
|
||||||
|
networks:
|
||||||
|
traefik:
|
||||||
|
external: true
|
||||||
|
|
|
@ -3,7 +3,7 @@ version: "2.3"
|
||||||
services:
|
services:
|
||||||
traefik:
|
traefik:
|
||||||
image: traefik:v2.5
|
image: traefik:v2.5
|
||||||
network_mode: host
|
user: "{{ docker_user.id }}"
|
||||||
environment:
|
environment:
|
||||||
- CF_DNS_API_TOKEN={{ cloudflare_api_token }}
|
- CF_DNS_API_TOKEN={{ cloudflare_api_token }}
|
||||||
volumes:
|
volumes:
|
||||||
|
@ -11,3 +11,30 @@ services:
|
||||||
- /tmp/traefik-logs:/var/log/traefik
|
- /tmp/traefik-logs:/var/log/traefik
|
||||||
- ./traefik:/etc/traefik
|
- ./traefik:/etc/traefik
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- 80:80
|
||||||
|
- 443:443
|
||||||
|
- "{{ private_ip }}:8080:8080"
|
||||||
|
depends_on:
|
||||||
|
- docker_proxy
|
||||||
|
networks:
|
||||||
|
- default
|
||||||
|
- traefik
|
||||||
|
- proxy_private
|
||||||
|
|
||||||
|
docker_proxy:
|
||||||
|
image: tecnativa/docker-socket-proxy:latest
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
- CONTAINERS=1
|
||||||
|
- INFO=1
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||||
|
networks:
|
||||||
|
- proxy_private
|
||||||
|
|
||||||
|
networks:
|
||||||
|
traefik:
|
||||||
|
external: true
|
||||||
|
proxy_private:
|
||||||
|
internal: true
|
||||||
|
|
|
@ -32,21 +32,22 @@ entryPoints:
|
||||||
- "{{ pve_hosts.internal_cidr }}"
|
- "{{ pve_hosts.internal_cidr }}"
|
||||||
- "{{ nebula.cidr }}"
|
- "{{ nebula.cidr }}"
|
||||||
traefik:
|
traefik:
|
||||||
address: "{{ private_ip }}:8080"
|
address: :8080
|
||||||
|
|
||||||
ping: {}
|
ping: {}
|
||||||
|
|
||||||
providers:
|
providers:
|
||||||
docker:
|
docker:
|
||||||
endpoint: unix:///var/run/docker.sock
|
endpoint: tcp://docker_proxy:2375
|
||||||
watch: true
|
watch: true
|
||||||
exposedByDefault: false
|
exposedByDefault: false
|
||||||
|
network: traefik
|
||||||
file:
|
file:
|
||||||
directory: /etc/traefik/conf
|
directory: /etc/traefik/conf
|
||||||
{% if with_traefik_pages %}
|
{% if with_traefik_pages %}
|
||||||
http:
|
http:
|
||||||
endpoint:
|
endpoint:
|
||||||
- "http://{{ traefik_pages_password }}@127.0.0.1:5000/.traefik-pages/provider"
|
- "http://{{ traefik_pages_password }}@traefik-pages:5000/.traefik-pages/provider"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
api:
|
api:
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
- name: Create network
|
||||||
|
docker_network:
|
||||||
|
name: traefik
|
||||||
|
internal: true
|
||||||
|
become: true
|
||||||
|
|
||||||
- name: Create install directory
|
- name: Create install directory
|
||||||
file:
|
file:
|
||||||
path: /opt/traefik
|
path: /opt/traefik
|
||||||
|
@ -11,6 +17,7 @@
|
||||||
path: /opt/traefik/traefik/
|
path: /opt/traefik/traefik/
|
||||||
state: directory
|
state: directory
|
||||||
mode: "{{ docker_compose_directory_mask }}"
|
mode: "{{ docker_compose_directory_mask }}"
|
||||||
|
owner: "{{ docker_user.name }}"
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: Create file provider directory
|
- name: Create file provider directory
|
||||||
|
@ -18,6 +25,7 @@
|
||||||
path: /opt/traefik/traefik/conf
|
path: /opt/traefik/traefik/conf
|
||||||
state: directory
|
state: directory
|
||||||
mode: "{{ docker_compose_directory_mask }}"
|
mode: "{{ docker_compose_directory_mask }}"
|
||||||
|
owner: "{{ docker_user.name }}"
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: Install compose file
|
- name: Install compose file
|
||||||
|
|
|
@ -12,6 +12,9 @@ services:
|
||||||
labels:
|
labels:
|
||||||
- traefik.enable=true
|
- traefik.enable=true
|
||||||
- traefik.http.routers.upload.rule=Host(`upload.theorangeone.net`)
|
- traefik.http.routers.upload.rule=Host(`upload.theorangeone.net`)
|
||||||
|
networks:
|
||||||
|
- default
|
||||||
|
- traefik
|
||||||
|
|
||||||
img:
|
img:
|
||||||
image: ghcr.io/realorangeone/static-server:latest
|
image: ghcr.io/realorangeone/static-server:latest
|
||||||
|
@ -23,6 +26,9 @@ services:
|
||||||
labels:
|
labels:
|
||||||
- traefik.enable=true
|
- traefik.enable=true
|
||||||
- traefik.http.routers.img.rule=Host(`img.theorangeone.net`) || Host(`img.0rng.one`)
|
- traefik.http.routers.img.rule=Host(`img.theorangeone.net`) || Host(`img.0rng.one`)
|
||||||
|
networks:
|
||||||
|
- default
|
||||||
|
- traefik
|
||||||
|
|
||||||
bg:
|
bg:
|
||||||
image: ghcr.io/realorangeone/static-server:latest
|
image: ghcr.io/realorangeone/static-server:latest
|
||||||
|
@ -35,6 +41,9 @@ services:
|
||||||
labels:
|
labels:
|
||||||
- traefik.enable=true
|
- traefik.enable=true
|
||||||
- traefik.http.routers.bg.rule=Host(`bg.theorangeone.net`)
|
- traefik.http.routers.bg.rule=Host(`bg.theorangeone.net`)
|
||||||
|
networks:
|
||||||
|
- default
|
||||||
|
- traefik
|
||||||
|
|
||||||
dl:
|
dl:
|
||||||
image: ghcr.io/realorangeone/static-server:latest
|
image: ghcr.io/realorangeone/static-server:latest
|
||||||
|
@ -46,3 +55,10 @@ services:
|
||||||
labels:
|
labels:
|
||||||
- traefik.enable=true
|
- traefik.enable=true
|
||||||
- traefik.http.routers.dl.rule=Host(`dl.theorangeone.net`) || Host(`dl.0rng.one`)
|
- traefik.http.routers.dl.rule=Host(`dl.theorangeone.net`) || Host(`dl.0rng.one`)
|
||||||
|
networks:
|
||||||
|
- default
|
||||||
|
- traefik
|
||||||
|
|
||||||
|
networks:
|
||||||
|
traefik:
|
||||||
|
external: true
|
||||||
|
|
|
@ -8,8 +8,15 @@ services:
|
||||||
- PUID={{ docker_user.id }}
|
- PUID={{ docker_user.id }}
|
||||||
- PGID={{ docker_user.id }}
|
- PGID={{ docker_user.id }}
|
||||||
- TZ={{ timezone }}
|
- TZ={{ timezone }}
|
||||||
|
networks:
|
||||||
|
- default
|
||||||
|
- traefik
|
||||||
volumes:
|
volumes:
|
||||||
- ./data:/app/data
|
- ./data:/app/data
|
||||||
labels:
|
labels:
|
||||||
- traefik.enable=true
|
- traefik.enable=true
|
||||||
- traefik.http.routers.uptime-kuma.rule=Host(`status.theorangeone.net`)
|
- traefik.http.routers.uptime-kuma.rule=Host(`status.theorangeone.net`)
|
||||||
|
|
||||||
|
networks:
|
||||||
|
traefik:
|
||||||
|
external: true
|
||||||
|
|
|
@ -35,6 +35,9 @@ services:
|
||||||
- INVITATIONS_ALLOWED=false
|
- INVITATIONS_ALLOWED=false
|
||||||
- ROCKET_WORKERS={{ ansible_processor_nproc // 2 }}
|
- ROCKET_WORKERS={{ ansible_processor_nproc // 2 }}
|
||||||
- WEBSOCKET_ENABLED=true
|
- WEBSOCKET_ENABLED=true
|
||||||
|
networks:
|
||||||
|
- default
|
||||||
|
- traefik
|
||||||
|
|
||||||
db:
|
db:
|
||||||
image: postgres:14-alpine
|
image: postgres:14-alpine
|
||||||
|
@ -44,3 +47,7 @@ services:
|
||||||
environment:
|
environment:
|
||||||
- POSTGRES_PASSWORD={{ vaultwarden_database_password }}
|
- POSTGRES_PASSWORD={{ vaultwarden_database_password }}
|
||||||
- POSTGRES_USER=vaultwarden
|
- POSTGRES_USER=vaultwarden
|
||||||
|
|
||||||
|
networks:
|
||||||
|
traefik:
|
||||||
|
external: true
|
||||||
|
|
|
@ -18,6 +18,9 @@ services:
|
||||||
labels:
|
labels:
|
||||||
- traefik.enable=true
|
- traefik.enable=true
|
||||||
- traefik.http.routers.yourls.rule=Host(`0rng.one`)
|
- traefik.http.routers.yourls.rule=Host(`0rng.one`)
|
||||||
|
networks:
|
||||||
|
- default
|
||||||
|
- traefik
|
||||||
|
|
||||||
mariadb:
|
mariadb:
|
||||||
image: mariadb:10.7
|
image: mariadb:10.7
|
||||||
|
@ -29,3 +32,7 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- /mnt/tank/dbs/mariadb/yourls:/var/lib/mysql
|
- /mnt/tank/dbs/mariadb/yourls:/var/lib/mysql
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
|
networks:
|
||||||
|
traefik:
|
||||||
|
external: true
|
||||||
|
|
Loading…
Reference in a new issue