-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
85 lines (78 loc) · 2.89 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
version: "3.3"
name: "wordpress-stack"
# I define the name here to avoid name by folder which makes it hard to keep track with the compose network name.
services:
traefik:
image: "traefik:v2.9"
restart: always
command:
- "--log.level=ERROR"
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--certificatesresolvers.myresolver.acme.tlschallenge=true"
#- "--certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
- "--certificatesresolvers.myresolver.acme.email=<<< PLEASE ADD YOUR E-MAIL ADRESS >>>"
- "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
ports:
- "80:80"
- "443:443"
- "8080:8080"
volumes:
- "./letsencrypt:/letsencrypt"
- "/var/run/docker.sock:/var/run/docker.sock:ro"
networks:
- homepage
wordpress:
image: wordpress
restart: always
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: <<< PLEASE ADD >>>
WORDPRESS_DB_PASSWORD: <<< PLEASE ADD >>>
WORDPRESS_DB_NAME: <<< PLEASE ADD >>>
labels:
# The labels are usefull for Traefik only
- "traefik.enable=true"
# This flag was very imported for me to avoid 'bad gateway' issues due to network name problems.
# Thats why I changed the name of the project in the header, so that the network name always stays the same
- "traefik.docker.network=wordpress-stack_homepage"
# Get the routes from http
- "traefik.http.routers.wordpress.rule=Host(`<<< PLEASE ADD >>>`)"
#- "traefik.http.routers.wordpress.rule=Host(`${DOMAINE}`)"
- "traefik.http.routers.wordpress.entrypoints=web"
# Redirect these routes to https
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
- "traefik.http.routers.wordpress.middlewares=redirect-to-https@docker"
# Get the routes from https
- "traefik.http.routers.wordpress-secured.rule=Host(`<<< PLEASE ADD >>>`)"
- "traefik.http.routers.wordpress-secured.entrypoints=websecure"
# Apply autentificiation with http challenge
- "traefik.http.routers.wordpress-secured.tls=true"
#- "traefik.http.routers.wordpress-secured.tls.certresolver=myhttpchallenge"
- "traefik.http.routers.wordpress.tls.certresolver=myresolver"
volumes:
- wordpress:/var/www/html
networks:
- homepage
- db-network
db:
image: mysql:5.7
restart: always
environment:
MYSQL_DATABASE: <<< PLEASE ADD >>>
MYSQL_USER: <<< PLEASE ADD >>>
MYSQL_PASSWORD: <<< PLEASE ADD >>>
MYSQL_RANDOM_ROOT_PASSWORD: '1'
volumes:
- db:/var/lib/mysql
networks:
- db-network
volumes:
wordpress:
db:
networks:
homepage:
db-network: