From 76b0c083fb7f4d3c93f8a9fb9458c90e11f814d1 Mon Sep 17 00:00:00 2001 From: cs161047 Date: Mon, 8 Jun 2020 16:20:22 +0000 Subject: [PATCH] Upload files to 'yml files' --- yml files/maria.yml | 39 +++++++++++++++++++++++++++++ yml files/next.yml | 56 +++++++++++++++++++++++++++++++++++++++++ yml files/traefik.yml | 58 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 153 insertions(+) create mode 100644 yml files/maria.yml create mode 100644 yml files/next.yml create mode 100644 yml files/traefik.yml diff --git a/yml files/maria.yml b/yml files/maria.yml new file mode 100644 index 0000000..9022e2d --- /dev/null +++ b/yml files/maria.yml @@ -0,0 +1,39 @@ +version: "3.7" + +services: + mariadb: + image: mariadb:latest + volumes: + - /mnt/mariadata:/var/lib/mysql + secrets: + - wp_db_password + - mysql_root_password + environment: + - MYSQL_USER=testuser + - MYSQL_DATABASE=testdb + - MYSQL_PASSWORD_FILE=/run/secrets/wp_db_password + - MYSQL_ROOT_PASSWORD_FILE=/run/secrets/mysql_root_password + networks: + - private + deploy: + placement: + constraints: [node.role == manager] + replicas: 1 + update_config: + parallelism: 2 + delay: 10s + restart_policy: + condition: on-failure + labels: + - "traefik.enable=false" +secrets: + wp_db_password: + external: true + mysql_root_password: + external: true +volumes: + mariadata: + driver: "local" +networks: + private: + external: false diff --git a/yml files/next.yml b/yml files/next.yml new file mode 100644 index 0000000..2fe13e9 --- /dev/null +++ b/yml files/next.yml @@ -0,0 +1,56 @@ +version: "3.7" + +services: + nextcloud: + image: nextcloud:latest + depends_on: + - maindb + secrets: + - mysql_root_password + environment: + - MYSQL_HOST=maindb:3306 + - MYSQL_DATABASE=nextcloud + - MYSQL_USER=root + - MYSQL_ROOT_PASSWORD_FILE=/home/user/mysql_root_password + volumes: + - /mnt/nextcloud:/var/www/html:cached + - /mnt/nextapps:/var/www/html/custom_apps:cached + - /mnt/nextdata:/var/www/html/data:cached + - /mnt/nextconfig:/var/www/html/config:cached + networks: + - proxy + - private + deploy: + placement: + constraints: [node.role == worker] + replicas: 1 + update_config: + parallelism: 2 + delay: 10s + restart_policy: + condition: on-failure + labels: + - "traefik.enable=true" + - "traefik.docker.network=proxy" + - "traefik.http.routers.nextcloud.rule=Host(`nextcloud.cloudlab.gr`)" + - "traefik.http.routers.nextcloud.tls=true" + - "traefik.http.routers.nextcloud.tls.certresolver=default" + - "traefik.http.routers.nextcloud.entrypoints=websecure" + - "traefik.http.services.nextcloud.loadbalancer.server.port=80" +secrets: + mysql_root_password: + external: true +volumes: + nextcloud: + driver: "local" + nextapps: + driver: "local" + nextdata: + driver: "local" + nextconfig: + driver: "local" +networks: + proxy: + external: true + private: + external: true diff --git a/yml files/traefik.yml b/yml files/traefik.yml new file mode 100644 index 0000000..924e505 --- /dev/null +++ b/yml files/traefik.yml @@ -0,0 +1,58 @@ +version: "3.7" + +services: + traefik: + image: traefik:v2.0 + command: + - "--api=true" + - "--api.dashboard=true" + - "--providers.docker=true" + - "--providers.docker.exposedbydefault=false" + - "--providers.docker.swarmMode=true" + - "--providers.docker.network=http" + - "--entrypoints.web.address=:80" + - "--entrypoints.websecure.address=:443" + - "--certificatesresolvers.default.acme.email=cs151056@uniwa.gr" + - "--certificatesresolvers.default.acme.storage=/acme.json" + - "--certificatesresolvers.default.acme.tlschallenge=true" + ports: + - 80:80 + - 443:443 + deploy: + placement: + constraints: + - node.role == manager + replicas: 1 + update_config: + parallelism: 2 + delay: 10s + restart_policy: + condition: on-failure + labels: + # Dashboard + - "traefik.enable=true" + - "traefik.docker.network=proxy" + - "traefik.http.routers.traefik.rule=Host(`traefik.cloudlab.gr`)" + - "traefik.http.routers.traefik.service=api@internal" + - "traefik.http.routers.traefik.tls.certresolver=default" + - "traefik.http.routers.traefik.entrypoints=websecure" + - "traefik.http.routers.traefik.middlewares=authtraefik" + - "traefik.http.middlewares.authtraefik.basicauth.users=admin:$$apr1$$lz.2rxmD$$/KZ5J7TPKKKIrZ5u69J5O." + - "traefik.http.services.traefik.loadbalancer.server.port=8080" + # global redirect to https + - "traefik.http.routers.http-catchall.rule=hostregexp(`{host:.+}`)" + - "traefik.http.routers.http-catchall.entrypoints=web" + - "traefik.http.routers.http-catchall.middlewares=redirect-to-https" + + # middleware redirect + - "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https" + + volumes: + - /var/run/docker.sock:/var/run/docker.sock + - ./acme.json:/etc/traefik/acme.json + networks: + - proxy + +networks: + proxy: + external: true