This repository has been archived by the owner on Nov 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
87 lines (69 loc) · 1.86 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
SHELL := /bin/bash
include config.env
export
DC := docker-compose -f docker-compose.yml -f docker-compose.custom.yml
DC_RUN := ${DC} run --rm
.PHONY: confirmation
confirmation:
@echo -n 'Are you sure? [y|N] ' && read ans && [ $$ans == y ]
.PHONY: cmd
cmd:
@echo 'Docker-Compose command:'
@echo '${DC}'
.PHONY: install
install:
${DC_RUN} db-client mysql -h db -u ${MYSQL_USER} -p${MYSQL_PASSWORD} ${MYSQL_DATABASE} < sql/database-create.sql
.PHONY: mysql
mysql:
${DC_RUN} db-client mysql -h db -u ${MYSQL_USER} -p${MYSQL_PASSWORD} ${MYSQL_DATABASE}
.PHONY: mysql-cmd
mysql-cmd:
@echo '${DC_RUN} db-client mysql -h db -u ${MYSQL_USER} -p${MYSQL_PASSWORD} ${MYSQL_DATABASE}'
.PHONY: dump
dump:
${DC_RUN} db-client mysqldump -h db -u ${MYSQL_USER} -p${MYSQL_PASSWORD} ${MYSQL_DATABASE} --extended-insert=FALSE > dump.sql
@echo 'Database exported to dump.sql.'
.PHONY: import-db
import-db: confirmation
test -f dump.sql
@echo 'Replacing database with contents from file dump.sql...'
${DC_RUN} db-client mysqldump -h db -u ${MYSQL_USER} -p${MYSQL_PASSWORD} ${MYSQL_DATABASE} > previous_dump.sql
${DC_RUN} db-client mysql -h db -u ${MYSQL_USER} -p${MYSQL_PASSWORD} ${MYSQL_DATABASE} < dump.sql
@echo 'Database replaced. Previous contents in previous_dump.sql.'
.PHONY: up
up:
${DC} up -d web
ifeq ($(MODE),prod)
${DC} up -d timer
endif
${DC} ps
@echo
@echo 'Service is now up'
@echo
.PHONY: ps
ps:
${DC} ps
.PHONY: rs
rs:
${DC} restart
.PHONY: rebuild
rebuild:
${DC} rm -sf web
${DC} up -d --build web
.PHONY: process-donations
process-donations:
${DC} build donation-manager
${DC_RUN} donation-manager bash pre_launcher.sh
.PHONY: phpmyadmin
phpmyadmin:
@echo 'Running phpMyAdmin, terminate with CTRL+C...'
${DC} up database-manager
.PHONY: stop
stop:
${DC} stop
.PHONY: rm
rm rmc: stop
${DC} rm -f
.PHONY: logs
logs:
docker logs -f $(shell ${DC} ps -q web)