-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
127 lines (104 loc) · 3.17 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
PHP ?= 81
.DEFAULT_GOAL := help
TAG=${git describe --tags}
## -- Container Launch --
## Launch docker-compose as background daemon
.PHONY: up
up: build init
.PHONY: build
build:
docker-compose -f docker-compose.yml -f docker/${PHP}.yml up -d
## Shut down docker-compose services
.PHONY: down
down:
docker-compose -f docker-compose.yml -f docker/${PHP}.yml down
## Initialise repository - run install-magento
.PHONY: init
init:
docker-compose exec -T web dockerize -wait tcp://db:3306 -wait tcp://elasticsearch:9200 -timeout 60m /usr/local/bin/install-magento
## -- Development Methods --
## Run magento upgrade
.PHONY: upgrade
upgrade:
docker-compose exec web /usr/local/bin/upgrade-magento
## Deploy static content
.PHONY: static_deploy
static_deploy:
docker-compose exec web /usr/local/bin/compile-magento
## Launch bash shell into magento container
.PHONY: shell
shell:
docker-compose exec web bash
.PHONY: shell-db
shell-db:
docker-compose exec db bash
## Enable magento cache. Should be disabled to load extensions
.PHONY: cache-enable
cache-enable:
docker-compose exec web /var/www/html/bin/magento cache:enable
## Disable magento cache
.PHONY: cache-disable
cache-disable:
docker-compose exec web /var/www/html/bin/magento cache:disable
## Flush cache
.PHONY: cache-flush
cache-flush:
docker-compose exec -T web /var/www/html/bin/magento cache:flush
## Set base URL as 127.0.0.1 instead of localhost - fixes session expirey issue
.PHONY: set-base-url
set-base-url:
docker-compose exec -T db mysql -u magento -pmagento -D magento -e 'UPDATE `core_config_data` SET `value`="http://127.0.0.1:3000/" WHERE path="web/secure/base_url"'
## Fix for session expired error in development
.PHONY: fix-session-expire
fix-session-expire: set-base-url cache-flush
## Tail logs
.PHONY: logs
logs:
docker-compose logs -f
## Tail magento logs only
.PHONY: logs-magento
logs-magento:
docker-compose logs -f web
## -- Misc --
## Prepare a bundle for submission to Magento marketplace
.PHONY: bundle
bundle:
zip -r idealpostcodes_magento-$$(git describe --tags --abbrev=0).zip . -x '.git/*' -x '.github/*' -x 'test/*' -x 'lib/*' -x 'node_modules/*' -x 'docker/*' -x '*.zip' -x '.gitignore' -x ".gitattributes"
## 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)