-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Makefile
99 lines (75 loc) · 2.65 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
# Allow using a different docker binary
DOCKER ?= docker
# Force BuildKit mode for builds
# See https://docs.docker.com/buildx/working-with-buildx/
DOCKER_BUILDKIT=1
IMAGE ?= docksal/vhost-proxy
BUILD_IMAGE_TAG ?= $(IMAGE):build
NAME = docksal-vhost-proxy
DOCKSAL_VHOST_PROXY_ACCESS_LOG ?= 1
DOCKSAL_VHOST_PROXY_DEBUG_LOG ?= 1
DOCKSAL_VHOST_PROXY_STATS_LOG ?= 1
PROJECT_AUTOSTART ?= 1
PROJECT_INACTIVITY_TIMEOUT ?= 30s
PROJECT_DANGLING_TIMEOUT ?= 60s
# A delay necessary for container and supervisord inside to initialize all services
INIT_DELAY = 10
# A delay necessary for docker-gen to reload configuration when containers start/stop
RELOAD_DELAY = 2
# Do not allow to override the value (?=) to prevent possible data loss on the host system
PROJECTS_ROOT = $(PWD)/tests/projects_mount
-include tests/env_make
# Make it possible to pass arguments to Makefile from command line
# https://stackoverflow.com/a/6273809/1826109
ARGS = $(filter-out $@,$(MAKECMDGOALS))
.EXPORT_ALL_VARIABLES:
.PHONY: build exec test push shell run start stop logs debug clean release
default: build
build:
$(DOCKER) build -t $(BUILD_IMAGE_TAG) .
test:
# Create test projects before starting tests. This allows using "fin @project" aliases in tests.
tests/create_test_projects.sh
IMAGE=$(BUILD_IMAGE_TAG) tests/test.bats
push:
$(DOCKER) push $(BUILD_IMAGE_TAG)
conf-vhosts:
make exec -e CMD='cat /etc/nginx/conf.d/vhosts.conf'
# This is the only place where fin is used/necessary
start: clean
# Create PROJECTS_ROOT directory used in cleanup tests
mkdir -p $(PROJECTS_ROOT)
# Copy custom certs used in cert tets
cp -R tests/certs ~/.docksal
IMAGE_VHOST_PROXY=$(BUILD_IMAGE_TAG) fin system reset vhost-proxy
# Give vhost-proxy a bit of time to initialize
sleep $(INIT_DELAY)
# Stop crond, so it does not interfere with tests
make exec -e CMD='supervisorctl stop crond'
exec:
$(DOCKER) exec $(NAME) bash -lc "$(CMD)"
exec-it:
@$(DOCKER) exec -it $(NAME) bash -lic "$(CMD)"
shell:
@make exec-it -e CMD=bash
stop:
$(DOCKER) stop $(NAME)
logs:
$(DOCKER) logs $(NAME)
logs-follow:
$(DOCKER) logs -f $(NAME)
debug: build start logs-follow
clean:
fin @project1 rm -f &>/dev/null || true
fin @project2 rm -f &>/dev/null || true
fin @project3 rm -f &>/dev/null || true
$(DOCKER) rm -vf $(NAME) &>/dev/null || true
$(DOCKER) rm -vf standalone &>/dev/null || true
$(DOCKER) rm -vf standalone-cert1 &>/dev/null || true
$(DOCKER) rm -vf standalone-cert2 &>/dev/null || true
rm -rf $(PROJECTS_ROOT) &>/dev/null || true
rm -f ~/.docksal/certs/example.com.* &>/dev/null || true
# Make it possible to pass arguments to Makefile from command line
# https://stackoverflow.com/a/6273809/1826109
%:
@: