-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathMakefile
84 lines (74 loc) · 1.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
ifeq ($(ENV),)
$(error ENV is not set)
endif
##
# Ensure: "Docker Desktop > Resources > WSL Integration"
##
ifeq ($(OS), Windows_NT)
$(error make.exe not supported, please try again within a WSL shell: https://docs.docker.com/desktop/wsl/#enabling-docker-support-in-wsl-2-distros)
endif
##
# ENV = { dev | prod | consumer }
##
ifeq ($(ENV), prod)
DOCKER_COMPOSE:= docker compose -f docker-compose.yml
else
DOCKER_COMPOSE:= docker compose -f docker-compose-$(ENV).yml
endif
G3W_SUITE:= docker compose exec g3w-suite
##
# SSH login
#
# make run-g3wsuite ENV=DEV
# make run-postgis ENV=DEV
##
run-%:
$(DOCKER_COMPOSE) start $*
docker exec -it $$(docker ps | grep $* | head -1 | awk '{print $$1}') bash
##
# Recreate g3w-suite containers
#
# make db-reset ENV=dev
##
db-reset:
$(DOCKER_COMPOSE) up -d
$(G3W_SUITE) bash -c 'rm -rf /shared-volume/cache'
$(G3W_SUITE) bash -c 'rm -rf /shared-volume/__pycache__'
$(G3W_SUITE) bash -c 'rm -f /shared-volume/build_done'
$(G3W_SUITE) bash -c 'rm -f /shared-volume/setup_done'
$(G3W_SUITE) bash -c 'rm -f /shared-volume/.secret_key'
$(DOCKER_COMPOSE) up -d --force-recreate
ID=demo ./scripts/makefile/db-restore.sh
##
# Backup databases
#
# make db-backup ID=name ENV=dev
##
db-backup:
./scripts/makefile/db-backup.sh
##
# Restore databases
#
# make db-restore ID=name ENV=dev
##
db-restore:
$(DOCKER_COMPOSE) up -d --force-recreate
./scripts/makefile/db-restore.sh
##
# Run certbot
#
# make renew-ssl ENV=dev
##
renew-ssl:
./scripts/makefile/renew-ssl.sh
$(DOCKER_COMPOSE) up -d --force-recreate
##
# Rebuild docker image
#
# make docker-image v=v3.8.x
##
docker-image:
ifeq ($(v),)
$(error v is not set)
endif
docker build -f Dockerfile.g3wsuite.dockerfile -t g3wsuite/g3w-suite:$(v) --no-cache .