-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
294 lines (236 loc) · 8.45 KB
/
Makefile
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
.DEFAULT_GOAL := help
## -- Container Launch --
## Launch services and run initialisation scripts
.PHONY: bootstrap
bootstrap: up init-db init-wp init-wc seed init-ip
## Launch docker-compose as background daemon
.PHONY: up
up:
docker-compose up -d
## Launch docker-compose as background daemon
.PHONY: down
down:
docker-compose down --volumes
## -- Test Container Launch --
## Bootstrap 4.2 WooCommerce environment
.PHONY: bootstrap-42
bootstrap-42: up-42 init-db init-wp init-wc seed init-ip
## Bootstrap 4.3 WooCommerce environment
.PHONY: bootstrap-43
bootstrap-43: up-43 init-db init-wp init-wc seed init-ip
## Bootstrap 4.5 WooCommerce environment
.PHONY: bootstrap-45
bootstrap-45: up-45 init-db init-wp init-wc seed init-ip
## Bootstrap 4.6 WooCommerce environment
.PHONY: bootstrap-46
bootstrap-46: up-46 init-db init-wp init-wc seed init-ip
## Bootstrap 4.7 WooCommerce environment
.PHONY: bootstrap-47
bootstrap-47: up-47 init-db init-wp init-wc seed init-ip
## Bootstrap 4.8 WooCommerce environment
.PHONY: bootstrap-48
bootstrap-48: up-48 init-db init-wp init-wc seed init-ip
## Bootstrap 4.9 WooCommerce environment
.PHONY: bootstrap-49
bootstrap-49: up-49 init-db init-wp init-wc seed init-ip
## Bootstrap 5.0 WooCommerce environment
.PHONY: bootstrap-50
bootstrap-50: up-50 init-db init-wp init-wc seed init-ip
## Bootstrap 5.1 WooCommerce environment
.PHONY: bootstrap-51
bootstrap-51: up-51 init-db init-wp init-wc seed init-ip
## Bootstrap 5.2 WooCommerce environment
.PHONY: bootstrap-52
bootstrap-52: up-52 init-db init-wp init-wc seed init-ip
## Bootstrap 5.4 WooCommerce environment
.PHONY: bootstrap-54
bootstrap-54: up-54 init-db init-wp init-wc seed init-ip
## Bootstrap 5.5 WooCommerce environment
.PHONY: bootstrap-55
bootstrap-55: up-55 init-db init-wp init-wc seed init-ip
## Bootstrap 5.6 WooCommerce environment
.PHONY: bootstrap-56
bootstrap-56: up-56 init-db init-wp init-wc seed init-ip
## Bootstrap 5.9 WooCommerce environment
.PHONY: bootstrap-59
bootstrap-59: up-59 init-db init-wp init-wc seed init-ip
## Bootstrap 5.9 WooCommerce environment
.PHONY: bootstrap-59-6
bootstrap-59-6: up-59-6 init-db init-wp init-wc seed init-ip
## Bootstrap 6.0 WooCommerce environment
.PHONY: bootstrap-60
bootstrap-60: up-60 init-db init-wp init-wc seed init-ip
## Bootstrap 7.0 WooCommerce environment
.PHONY: bootstrap-70
bootstrap-70: up-70 init-db init-wp init-wc seed init-ip
## Bootstrap 7.0 WooCommerce environment
.PHONY: bootstrap-80
bootstrap-80: up-80 init-db init-wp init-wc seed init-ip
## Bootstrap 8.8.3 WooCommerce environment
.PHONY: bootstrap-82
bootstrap-82: up-82 init-db init-wp init-wc seed init-ip
## Launch WC 4.2
.PHONY: up-42
up-42:
docker-compose -f docker-compose.yml -f docker/42.yml up -d
## Launch WC 4.3
.PHONY: up-43
up-43:
docker-compose -f docker-compose.yml -f docker/43.yml up -d
## Launch WC 4.5
.PHONY: up-45
up-45:
docker-compose -f docker-compose.yml -f docker/45.yml up -d
## Launch WC 4.6
.PHONY: up-46
up-46:
docker-compose -f docker-compose.yml -f docker/46.yml up -d
## Launch WC 4.7
.PHONY: up-47
up-47:
docker-compose -f docker-compose.yml -f docker/47.yml up -d
## Launch WC 4.8
.PHONY: up-48
up-48:
docker-compose -f docker-compose.yml -f docker/48.yml up -d
## Launch WC 4.9
.PHONY: up-49
up-49:
docker-compose -f docker-compose.yml -f docker/49.yml up -d
## Launch WC 5.0
.PHONY: up-50
up-50:
docker-compose -f docker-compose.yml -f docker/50.yml up -d
## Launch WC 5.1
.PHONY: up-51
up-51:
docker-compose -f docker-compose.yml -f docker/51.yml up -d
## Launch WC 5.2
.PHONY: up-52
up-52:
docker-compose -f docker-compose.yml -f docker/52.yml up -d
## Launch WC 5.4
.PHONY: up-54
up-54:
docker-compose -f docker-compose.yml -f docker/54.yml up -d
## Launch WC 5.5
.PHONY: up-55
up-55:
docker-compose -f docker-compose.yml -f docker/55.yml up -d
## Launch WC 5.6
.PHONY: up-56
up-56:
docker-compose -f docker-compose.yml -f docker/56.yml up -d
## Launch WC 5.9
.PHONY: up-59
up-59:
docker-compose -f docker-compose.yml -f docker/59.yml up -d
## Launch WC 5.9 with WP 6
.PHONY: up-59-6
up-59-6:
docker-compose -f docker-compose.yml -f docker/59-6.yml up -d
## Launch WC 6.0 with WP 6
.PHONY: up-60
up-60:
docker-compose -f docker-compose.yml -f docker/60.yml up -d
## Launch WC 6.0 with WP 6
.PHONY: up-70
up-70:
docker-compose -f docker-compose.yml -f docker/70.yml up -d
## Launch WC 6.0 with WP 6
.PHONY: up-80
up-80:
docker-compose -f docker-compose.yml -f docker/80.yml up -d
## Launch WC 8.8.3 with WP 6
.PHONY: up-82
up-82:
docker-compose -f docker-compose.yml -f docker/82.yml up -d
## -- Development Methods --
## Shell into Wordpress container
.PHONY: shell
shell:
docker-compose exec web bash
## Tail logs
.PHONY: logs
logs:
docker-compose logs -f
## Initialise DB
.PHONY: init-db
init-db:
docker-compose exec -T web dockerize -wait tcp://db:3306 -timeout 1m
docker-compose exec -T db mysql -u root -ppassword -e "create database if not exists woocommerce"
docker-compose exec -T db mysql -u root -ppassword -e "create user if not exists 'woocommerce'@'localhost' identified by 'woocommerce'"
docker-compose exec -T db mysql -u root -ppassword -e "GRANT ALL PRIVILEGES ON woocommerce.* TO woocommerce@localhost"
docker-compose exec -T db mysql -u root -ppassword -e "FLUSH PRIVILEGES"
## Initialise WP
.PHONY: init-wp
init-wp:
docker-compose exec -T web find ! -name uk-address-postcode-validation -type d -exec chmod 777 {} \;
docker-compose exec -T web find ! -name uk-address-postcode-validation -type f -exec chmod 666 {} \;
docker-compose exec -T -u 33 web wp core install --url=http://localhost:8000 --title=test --admin_user=admin [email protected] --admin_password=password
## Initialise woocommerce
.PHONY: init-wc
init-wc:
docker-compose exec -T -u 33 web wp theme install storefront --activate
docker-compose exec -T -u 33 web wp plugin activate woocommerce
docker-compose exec -T -u 33 web wp option set woocommerce_store_address "10 Foo Street"
docker-compose exec -T -u 33 web wp option set woocommerce_store_address_2 ""
docker-compose exec -T -u 33 web wp option set woocommerce_store_city "London"
docker-compose exec -T -u 33 web wp option set woocommerce_default_country "GB"
docker-compose exec -T -u 33 web wp option set woocommerce_store_postalcode "EC1A 2BN"
docker-compose exec -T -u 33 web wp option set woocommerce_store_postcode "EC1A 2BN"
docker-compose exec -T -u 33 web wp option set woocommerce_currency "GBP"
docker-compose exec -T -u 33 web wp option set woocommerce_product_type "physical"
docker-compose exec -T -u 33 web wp option set woocommerce_allow_tracking "no"
docker-compose exec -T -u 33 web wp option set --format=json woocommerce_stripe_settings '{"enabled":"no","create_account":false,"email":false}'
docker-compose exec -T -u 33 web wp option set --format=json woocommerce_ppec_paypal_settings '{"reroute_requests":false,"email":false}'
docker-compose exec -T -u 33 web wp option set --format=json woocommerce_cheque_settings '{"enabled":"no"}'
docker-compose exec -T -u 33 web wp option set --format=json woocommerce_bacs_settings '{"enabled":"no"}'
docker-compose exec -T -u 33 web wp option set --format=json woocommerce_cod_settings '{"enabled":"yes"}'
## Seed ample data
.PHONY: seed
seed:
docker-compose exec -T -u 33 web wp wc product create --name='Test' --type='simple' --sku='WCCLITESTP' --regular_price='20' --user=admin
## Initialise Ideal Postcodes extension
.PHONY: init-ip
init-ip:
docker-compose exec -T -u 33 web wp plugin activate uk-address-postcode-validation
## -- Misc --
## Update repository against origin/master
.PHONY: update
update:
git fetch
git merge --ff-only origin/master
## How to use this Makefile
.PHONY: help
help:
@printf "Usage\n";
@awk '{ \
if ($$0 ~ /^.PHONY: [a-zA-Z\-\_0-9]+$$/) { \
helpCommand = substr($$0, index($$0, ":") + 2); \
if (helpMessage) { \
printf "\033[36m%-20s\033[0m %s\n", \
helpCommand, helpMessage; \
helpMessage = ""; \
} \
} else if ($$0 ~ /^[a-zA-Z\-\_0-9.]+:/) { \
helpCommand = substr($$0, 0, index($$0, ":")); \
if (helpMessage) { \
printf "\033[36m%-20s\033[0m %s\n", \
helpCommand, helpMessage; \
helpMessage = ""; \
} \
} else if ($$0 ~ /^##/) { \
if (helpMessage) { \
helpMessage = helpMessage"\n "substr($$0, 3); \
} else { \
helpMessage = substr($$0, 3); \
} \
} else { \
if (helpMessage) { \
print "\n "helpMessage"\n" \
} \
helpMessage = ""; \
} \
}' \
$(MAKEFILE_LIST)