-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
143 lines (112 loc) · 4.73 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
# Grab environment information (OSX vs Linux)
UNAME := $(shell uname)
DOCKER_COMPOSE_FILE := docker-compose.yml
DOCKER_COMPOSE_PROD_FILE := docker-compose.prod.overrides.yml
DOCKER_COMPOSE_DEV_FILE := docker-compose.dev.overrides.yml
ifeq ($(UNAME), Linux)
DOCKER_COMPOSE_FILE := docker-compose.linux.yml
endif
# This should always be the first target so that we know running make without any
# arguments is going to be nondestructive. The @ is to silence the normal make
# behavior of echo'ing commands before running them.
faketarget:
@echo "Please specify a target. See README for information about targets."
@grep Makefile -oe '^[a-z-]*:' | \
tr -d ':' | \
grep -v 'fake' | \
sed -e 's/^/\o033[32m->\o033[0m /'
init: salt composer-install docker-start ready init-drupal docker-status
init-drupal: drupal-install config-init config-import clear-cache
update: docker-stop composer-install docker-rebuild ready config-import clear-cache
safe-update: docker-stop composer-install docker-rebuild ready clear-cache
docker-rebuild:
docker-compose -f ${DOCKER_COMPOSE_FILE} -f ${DOCKER_COMPOSE_DEV_FILE} up -d --build
docker-compose -f ${DOCKER_COMPOSE_FILE} ps
@sleep 10
docker-status:
docker-compose -f ${DOCKER_COMPOSE_FILE} ps
docker-start:
docker-compose -f ${DOCKER_COMPOSE_FILE} -f ${DOCKER_COMPOSE_DEV_FILE} up -d
docker-compose -f ${DOCKER_COMPOSE_FILE} ps
@sleep 10
docker-start-production:
docker-compose -f ${DOCKER_COMPOSE_FILE} -f ${DOCKER_COMPOSE_PROD_FILE} up -d
docker-compose -f ${DOCKER_COMPOSE_FILE} ps
@sleep 10
docker-stop:
docker-compose -f ${DOCKER_COMPOSE_FILE} down
composer-install:
composer install --ignore-platform-reqs --no-interaction --no-progress
composer-update:
composer update --ignore-platform-reqs --no-interaction --no-progress --prefer-dist
drupal-upgrade:
composer update drupal/core --with-dependencies
drupal-install:
./bin/drush --root=/var/www/web site-install minimal -vv --account-name=admin --account-pass=admin --yes \
install_configure_form.enable_update_status_module=NULL \
install_configure_form.enable_update_status_emails=NULL
config-init:
@if [ -e ./config/system.site.yml ]; then \
echo "Config found. Processing setting uuid..."; \
cat ./config/system.site.yml | \
grep uuid | tail -c +7 | head -c 36 | \
docker exec -i cms sh -c "/var/www/vendor/bin/drush \
--root=/var/www/web config-set -y system.site uuid - ";\
else \
echo "Config is empty. Skipping uuid init..."; \
fi;
config-import:
@if [ -e ./config/system.site.yml ]; then \
echo "Config found. Importing config..."; \
./bin/drush config-import sync --yes ;\
./bin/drush config-import sync --yes ;\
else \
echo "Config is empty. Skipping import..."; \
fi;
config-export:
./bin/drush config-export sync --yes
config-validate:
./bin/drush config-export sync --no
config-refresh: config-init config-import
salt:
cat /dev/urandom | LC_CTYPE=C tr -dc 'a-zA-Z0-9' | fold -w 64 | head -n 1 > salt.txt
clear-cache:
./bin/drush cr
destroy:
docker-compose -f ${DOCKER_COMPOSE_FILE} down -v
sudo rm -rf ./web/sites/default/files/*
sudo rm -rf ./web/core/*
sudo rm -rf ./web/libraries/*
sudo rm -rf ./web/modules/contrib/*
sudo rm -rf ./web/profiles/contrib/*
sudo rm -rf ./web/themes/contrib/*
sudo rm -rf ./drush/contrib/*
sudo rm -rf ./vendor/*
rebuild: destroy init
ready:
@echo "Waiting for files to sync between host and Docker...";
@bash ./docker-src/cms/ready.sh;
lint:
./vendor/bin/parallel-lint -e php,module,inc,install,test,profile,theme ./web/modules/custom ./web/themes/custom
sniff:
./vendor/bin/phpcs --config-set installed_paths vendor/drupal/coder/coder_sniffer
./vendor/bin/phpcs -n --standard=Drupal,DrupalPractice \
--extensions=php,module,inc,install,test,profile,theme,info \
--ignore=*/node_modules/* web/modules/custom web/themes/custom
code-test: lint sniff
code-fix:
vendor/bin/phpcs --config-set installed_paths vendor/drupal/coder/coder_sniffer
-vendor/bin/phpcbf --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,info web/modules/custom
-vendor/bin/phpcbf --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,info --ignore=*/node_modules/* web/themes/custom
fix-permissions:
sudo chown $(USER) ./
sudo chmod u=rwx,g=rwxs,o=rx ./
sudo find ./ -not -path "web/sites/default/files*" -exec chown $(USER) {} \;
sudo find ./ -not -path "web/sites/default/files*" -exec chmod u=rwX,g=rwX,o=rX {} \;
sudo find ./ -type d -not -path "web/sites/default/files*" -exec chmod g+s {} \;
sudo chmod -R u=rwx,g=rwxs,o=rwx ./web/sites/default/files;
# This command will open a shell in the specified container as root
# usage: make shell cn=<container name>
#make shell cn=cms once a docker instance is running.
shell:
docker exec -it --user root ${cn} /bin/bash