-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathMakefile
More file actions
103 lines (83 loc) · 2.98 KB
/
Makefile
File metadata and controls
103 lines (83 loc) · 2.98 KB
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
# Define filename references
DEV_FOLDER := docker/dev
DEV_COMPOSE_FILE := docker/dev/docker-compose.yml
# Set target lists
.PHONE: help
help:
@echo ''
@echo 'Usage:'
@echo '${YELLOW} make ${RESET} ${GREEN}<target> [options]${RESET}'
@echo ''
@echo 'Targets:'
@awk '/^[a-zA-Z\-\_0-9]+:/ { \
message = match(lastLine, /^## (.*)/); \
if (message) { \
command = substr($$1, 0, index($$1, ":")-1); \
message = substr(lastLine, RSTART + 3, RLENGTH); \
printf " ${YELLOW}%-$(TARGET_MAX_CHAR_NUM)s${RESET} %s\n", command, message; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)
@echo ''
build:
@ echo "Building converge..."
@ docker-compose -f ${DEV_COMPOSE_FILE} up -d
@ docker-compose -f ${DEV_COMPOSE_FILE} exec app ${DEV_FOLDER}/start_app.sh
status:
@ echo "Checking status..."
@ docker-compose -f ${DEV_COMPOSE_FILE} ps
create:
@ echo 'Creating $(service) service...'
@ docker-compose -f ${DEV_COMPOSE_FILE} create $(service)
start:
@ echo 'Starting $(service) service...'
@ docker-compose -f ${DEV_COMPOSE_FILE} start $(service)
run-app:
@ echo 'Running mrm_api on port 8000...'
@ docker-compose -f ${DEV_COMPOSE_FILE} exec app ${DEV_FOLDER}/start_app.sh
stop:
@ echo 'Stopping $(service) service...'
@ docker-compose -f ${DEV_COMPOSE_FILE} stop $(service)
restart:
@ echo 'restarting $(service) service...'
@ docker-compose -f ${DEV_COMPOSE_FILE} stop $(service)
@ docker-compose -f ${DEV_COMPOSE_FILE} rm -f -v $(service)
@ docker-compose -f ${DEV_COMPOSE_FILE} create --force-recreate $(service)
@ docker-compose -f ${DEV_COMPOSE_FILE} start $(service)
migrate-initial:
@ echo 'Running initial migrations...'
@ docker-compose -f ${DEV_COMPOSE_FILE} exec app ${DEV_FOLDER}/start_initial_migrations.sh "$(message)"
migrate:
@ echo 'Running migrations...'
@ docker-compose -f ${DEV_COMPOSE_FILE} exec app ${DEV_FOLDER}/start_migrations.sh "$(message)"
import:
@ echo "importing database..."
@ docker cp ${DEV_FOLDER}/start_db_import.sh mrm_database:/
@ docker cp $(dump) mrm_database:/
@ docker-compose -f ${DEV_COMPOSE_FILE} exec database /start_db_import.sh $(dump)
create-test-database:
@ echo 'create test database...'
@ docker cp ${DEV_FOLDER}/create_test_db.sh mrm_database:/
@ docker-compose -f ${DEV_COMPOSE_FILE} exec -u root database /create_test_db.sh
test:
@ echo 'start tests...'
@ docker-compose -f ${DEV_COMPOSE_FILE} exec app ${DEV_FOLDER}/start_tests.sh "$(test)"
ssh:
@ echo 'ssh...'
@ docker-compose -f ${DEV_COMPOSE_FILE} exec $(service) /bin/bash
down:
@ echo "Converge going down..."
@ docker-compose -f ${DEV_COMPOSE_FILE} down
services:
@ echo "Getting services..."
@ docker-compose -f ${DEV_COMPOSE_FILE} ps --services
remove:
@ echo "Removing $(service) container"
@ docker-compose -f ${DEV_COMPOSE_FILE} rm -f -v $(service)
clean: down
@ echo "Removing containers..."
@ docker stop mrm_database mrm_api mrm_redis
@ docker rm mrm_database mrm_api mrm_redis
kill:
@ echo "killing..."
@ docker-compose -f ${DEV_COMPOSE_FILE} kill -s SIGINT