-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
162 lines (154 loc) · 4.58 KB
/
docker-compose.yml
File metadata and controls
162 lines (154 loc) · 4.58 KB
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# Subject: PSI
# HeadTeacher: mgr Karol Kornatka
#
# Project: WWW |HA Apache + HA Mariadb
# Author: Szymon Jakubowski
# Index number: 30786
# email: szymjak@wsinf.edu.pl
# private email: pasjajakub@gmail.com
# Docker-compose version
version: '3'
#Services
services:
#db - Used Mariadb
db:
image: hauptmedia/mariadb:10.1
build: ./mariadb
hostname: db
container_name: ${COMPOSE_PROJECT_NAME}_db_con
ports:
- 13306:3306
volumes:
- .mysql/db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=wordpress
- REPLICATION_PASSWORD=wordpress
- MYSQL_DATABASE=wordpress
- MYSQL_USER=wordpress
- MYSQL_PASSWORD=wordpress
- GALERA=On
- NODE_NAME=db
- CLUSTER_NAME=maria_cluster
- CLUSTER_ADDRESS=gcomm://
command: --wsrep-new-cluster
networks:
public_sj:
ipv4_address: ${db_IP}
db1:
image: hauptmedia/mariadb:10.1
build: ./mariadb
hostname: db1
container_name: ${COMPOSE_PROJECT_NAME}_db_con_1
links:
- db
ports:
- 23306:3306
volumes:
- .mysql/db1:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=wordpress
- REPLICATION_PASSWORD=wordpress
- MYSQL_DATABASE=wordpress
- MYSQL_USER=wordpress
- MYSQL_PASSWORD=wordpress
- GALERA=On
- NODE_NAME=db1
- CLUSTER_NAME=maria_cluster
- CLUSTER_ADDRESS=gcomm://db
networks:
public_sj:
ipv4_address: ${db_1_IP}
db2:
image: hauptmedia/mariadb:10.1
build: ./mariadb
hostname: db2
container_name: ${COMPOSE_PROJECT_NAME}_db_con_2
links:
- db
ports:
- 33306:3306
volumes:
- .mysql/db2:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=wordpress
- REPLICATION_PASSWORD=wordpress
- MYSQL_DATABASE=wordpress
- MYSQL_USER=wordpress
- MYSQL_PASSWORD=wordpress
- GALERA=On
- NODE_NAME=db2
- CLUSTER_NAME=maria_cluster
- CLUSTER_ADDRESS=gcomm://db
networks:
public_sj:
ipv4_address: ${db_2_IP}
# apache - used wordpress 4.5 image from official dockerhub repository
apache_img_1:
container_name: ${COMPOSE_PROJECT_NAME}_apache_con_1
build: ./apache/1
hostname: apache1
depends_on:
- db
- db1
- db2
links:
- db:mysql
- db1:myslq
- db2:myslq
expose:
- ${APACHE_EXPOSED_PORT}
volumes:
- ./wordpress:/var/www/html
networks:
public_sj:
ipv4_address: ${APACHE_1_IP}
environment:
- WORDPRESS_DB_HOST=${WORDPRESS_DB_HOST}
- WORDPRESS_DB_PASSWORD=${WORDPRESS_DB_PASSWORD}
- WORDPRESS_DB_USER=${WORDPRESS_DB_USER}
# apache - used wordpress 4.5 image from official dockerhub repository
apache_img_2:
container_name: ${COMPOSE_PROJECT_NAME}_apache_con_2
build: ./apache/2
hostname: apache2
depends_on:
- db
- db1
- db2
links:
- db:mysql
- db1:mysql
- db2:mysql
expose:
- ${APACHE_EXPOSED_PORT}
volumes:
- ./wordpress:/var/www/html
networks:
public_sj:
ipv4_address: ${APACHE_2_IP}
environment:
- WORDPRESS_DB_HOST=${WORDPRESS_DB_HOST}
- WORDPRESS_DB_PASSWORD=${WORDPRESS_DB_PASSWORD}
- WORDPRESS_DB_USER=${WORDPRESS_DB_USER}
# haproxy - used to crete Load Balance with apache serves * haproxy 1,7
haproxy_img:
build: ./haproxy
ports:
- 80:80
expose:
- 80
networks:
public_sj:
ipv4_address: ${HA_PROXY_IP}
environment:
- APACHE_1_IP=${APACHE_1_IP}
- APACHE_2_IP=${APACHE_2_IP}
- APACHE_EXPOSED_PORT=${APACHE_EXPOSED_PORT}
# used - own created network
networks:
public_sj:
driver: bridge
ipam:
driver: default
config:
- subnet: ${NETWORK_SUBNET}