forked from Kong/kong
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
82 lines (67 loc) · 1.94 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
PWD = `pwd`
# Dev environment variables
export DAEMON ?= off
export LUA_LIB ?= lua_package_path \"$(PWD)/src/?.lua\;\;\"\;
export LUA_CODE_CACHE ?= off
export APENODE_PORT ?= 8000
export APENODE_WEB_PORT ?= 8001
export DIR ?= $(PWD)/tmp
export APENODE_CONF ?= $(DIR)/apenode.conf
export SILENT ?=
.PHONY: build global test test-web test-all run migrate populate drop
global:
@luarocks make apenode-*.rockspec
test:
@busted spec/unit
test-web:
@$(MAKE) build DAEMON=on
@$(MAKE) migrate SILENT=-s
@$(MAKE) run
@$(MAKE) seed SILENT=-s
@busted spec/web/ || (make stop;make drop; exit 1)
@$(MAKE) stop
@$(MAKE) drop SILENT=-s
test-proxy:
@$(MAKE) build DAEMON=on
@$(MAKE) migrate SILENT=-s
@$(MAKE) run
@$(MAKE) seed SILENT=-s
@busted spec/proxy/ || (make stop;make drop; exit 1)
@$(MAKE) stop
@$(MAKE) drop SILENT=-s
test-all:
@$(MAKE) build DAEMON=on
@$(MAKE) migrate SILENT=-s
@$(MAKE) run
@sleep 2 # Wait for the nginx process to start
@$(MAKE) seed SILENT=-s
@busted spec/ || (make stop;make drop; exit 1)
@$(MAKE) stop
@$(MAKE) drop SILENT=-s
migrate:
@scripts/migrate migrate $(SILENT) --conf=$(APENODE_CONF)
reset:
@scripts/migrate reset $(SILENT) --conf=$(APENODE_CONF)
seed:
@scripts/seed seed $(SILENT) --conf=$(APENODE_CONF)
drop:
@scripts/seed drop $(SILENT) --conf=$(APENODE_CONF)
run:
@nginx -p $(DIR)/nginx -c nginx.conf
stop:
@nginx -p $(DIR)/nginx -c nginx.conf -s stop
build:
@mkdir -p $(DIR)/nginx/logs
@cp templates/apenode.conf $(APENODE_CONF)
@echo "" > $(DIR)/nginx/logs/error.log
@echo "" > $(DIR)/nginx/logs/access.log
@sed \
-e "s/{{DAEMON}}/$(DAEMON)/g" \
-e "s@{{LUA_LIB_PATH}}@$(LUA_LIB)@g" \
-e "s/{{LUA_CODE_CACHE}}/$(LUA_CODE_CACHE)/g" \
-e "s/{{PORT}}/$(APENODE_PORT)/g" \
-e "s/{{WEB_PORT}}/$(APENODE_WEB_PORT)/g" \
-e "s@{{APENODE_CONF}}@$(APENODE_CONF)@g" \
templates/nginx.conf > $(DIR)/nginx/nginx.conf;
@cp -R src/apenode/web/static $(DIR)/nginx
@cp -R src/apenode/web/admin $(DIR)/nginx