cs161047
5 years ago
3 changed files with 153 additions and 0 deletions
@ -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 |
@ -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 |
@ -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 |
Loading…
Reference in new issue