Route Nextcloud through Traefik
This commit is contained in:
parent
c630af67cd
commit
d851c852d6
@ -1,3 +1,10 @@
|
|||||||
|
# docker
|
||||||
|
docker_user: vagrant
|
||||||
|
|
||||||
|
# traefik
|
||||||
|
traefik_domain: traefik.vm.krislamo.org
|
||||||
|
traefik_auth: admin:$apr1$T1l.BCFz$Jyg8msXYEAUi3LLH39I9d1 # admin:admin
|
||||||
|
|
||||||
# container settings
|
# container settings
|
||||||
nextcloud_version: stable
|
nextcloud_version: stable
|
||||||
nextcloud_admin: admin
|
nextcloud_admin: admin
|
||||||
|
@ -6,4 +6,5 @@
|
|||||||
roles:
|
roles:
|
||||||
- base
|
- base
|
||||||
- docker
|
- docker
|
||||||
|
- traefik
|
||||||
- nextcloud
|
- nextcloud
|
||||||
|
@ -4,12 +4,19 @@
|
|||||||
"{{ nextcloud_dbroot }}"]
|
"{{ nextcloud_dbroot }}"]
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
|
- name: Create Nextcloud network
|
||||||
|
docker_network:
|
||||||
|
name: "{{ nextcloud_container }}"
|
||||||
|
|
||||||
- name: Start Nextcloud's database container
|
- name: Start Nextcloud's database container
|
||||||
docker_container:
|
docker_container:
|
||||||
name: "{{ nextcloud_dbcontainer }}"
|
name: "{{ nextcloud_dbcontainer }}"
|
||||||
image: mariadb:{{ nextcloud_dbversion }}
|
image: mariadb:{{ nextcloud_dbversion }}
|
||||||
restart_policy: always
|
restart_policy: always
|
||||||
volumes: "{{ nextcloud_dbroot }}:/var/lib/mysql"
|
volumes: "{{ nextcloud_dbroot }}:/var/lib/mysql"
|
||||||
|
networks_cli_compatible: true
|
||||||
|
networks:
|
||||||
|
- name: "{{ nextcloud_container }}"
|
||||||
env:
|
env:
|
||||||
MYSQL_RANDOM_ROOT_PASSWORD: "true"
|
MYSQL_RANDOM_ROOT_PASSWORD: "true"
|
||||||
MYSQL_DATABASE: "{{ nextcloud_dbname }}"
|
MYSQL_DATABASE: "{{ nextcloud_dbname }}"
|
||||||
@ -22,8 +29,14 @@
|
|||||||
image: nextcloud:{{ nextcloud_version }}
|
image: nextcloud:{{ nextcloud_version }}
|
||||||
restart_policy: always
|
restart_policy: always
|
||||||
volumes: "{{ nextcloud_root }}:/var/www/html"
|
volumes: "{{ nextcloud_root }}:/var/www/html"
|
||||||
ports: 80:80
|
networks_cli_compatible: true
|
||||||
links: "{{ nextcloud_dbcontainer }}:mysql"
|
networks:
|
||||||
|
- name: "{{ nextcloud_container }}"
|
||||||
|
- name: traefik
|
||||||
|
labels:
|
||||||
|
traefik.http.routers.nextcloud.rule: "Host(`{{ nextcloud_domain }}`)"
|
||||||
|
traefik.docker.network: traefik
|
||||||
|
traefik.enable: "true"
|
||||||
|
|
||||||
- name: Grab Nextcloud container information
|
- name: Grab Nextcloud container information
|
||||||
docker_container_info:
|
docker_container_info:
|
||||||
@ -32,7 +45,7 @@
|
|||||||
|
|
||||||
- name: Wait for Nextcloud to become available
|
- name: Wait for Nextcloud to become available
|
||||||
wait_for:
|
wait_for:
|
||||||
host: "{{ nextcloud_info.container.NetworkSettings.IPAddress }}"
|
host: "{{ nextcloud_info.container.NetworkSettings.Networks.traefik.IPAddress }}"
|
||||||
port: 80
|
port: 80
|
||||||
|
|
||||||
- name: Check Nextcloud status
|
- name: Check Nextcloud status
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
- name: Create Traefik network
|
- name: Create Traefik network
|
||||||
docker_network:
|
docker_network:
|
||||||
name: traefik-net
|
name: traefik
|
||||||
|
|
||||||
- name: Start Traefik container
|
- name: Start Traefik container
|
||||||
docker_container:
|
docker_container:
|
||||||
@ -18,13 +18,13 @@
|
|||||||
ports: "{{ traefik_ports }}"
|
ports: "{{ traefik_ports }}"
|
||||||
networks_cli_compatible: "false"
|
networks_cli_compatible: "false"
|
||||||
networks:
|
networks:
|
||||||
- name: "traefik-net"
|
- name: traefik
|
||||||
labels:
|
labels:
|
||||||
traefik.http.routers.traefik.rule: "Host(`{{ traefik_domain }}`)"
|
traefik.http.routers.traefik.rule: "Host(`{{ traefik_domain }}`)"
|
||||||
traefik.http.middlewares.auth.basicauth.users: "{{ traefik_auth }}"
|
traefik.http.middlewares.auth.basicauth.users: "{{ traefik_auth }}"
|
||||||
traefik.http.routers.traefik.middlewares: "auth@docker"
|
traefik.http.routers.traefik.middlewares: "auth@docker"
|
||||||
traefik.http.routers.traefik.service: "api@internal"
|
traefik.http.routers.traefik.service: "api@internal"
|
||||||
traefik.docker.network: "proxy_traefik-net"
|
traefik.docker.network: traefik
|
||||||
traefik.enable: "true"
|
traefik.enable: "true"
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
Loading…
Reference in New Issue
Block a user