forked from EGA-archive/LocalEGA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
102 lines (77 loc) · 2.67 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
100
101
102
SHELL := /bin/bash
ARGS=
SELECTED=
HOSTNAME_DOMAIN=
#HOSTNAME_DOMAIN=.localega
.PHONY: up down clean ps clean-volumes clean-all images erase purge preflight-check
up: .env private/lega.yml
@docker-compose up -d ${SELECTED}
private/lega.yml .env:
make -C bootstrap -s
clean-volumes:
docker volume rm lega_db lega_inbox lega_archive_db lega_vault lega_vault_bkp
ps:
@docker-compose ps
down:
@[[ -f private/lega.yml ]] && docker-compose down -v \
|| echo -e "No recipe to bring containers down\nHave you bootstrapped? (ie make bootstrap)"
preflight-check:
@echo "Ensure the system is up"
sleep 20
# Note: "sleep 20" will be replaced with a script that checks for open port, mq settings, etc.
# It might be a good idea to run it in the same network as the containers.
# docker run --rm -it --network=lega_lega \
# -v ${PWD}/bootstrap/ensure_system_up.sh:/ensure_system_up.sh \
# egarchive/lega-base /ensure_system_up.sh
#
# For the moment, we simply do sleep 20, because we need
# the rabbitmq shovel to CentralEGA (the federated queue can be late, it doesn't hurt)
logs:
@docker-compose logs -f $(SELECTED)
# @docker-compose logs -f logs
# Restart all but the CentralEGA stubs
restart: SELECTED=ingest backup1 backup2 cleanup dispatcher save2db db mq archive-db inbox
restart:
@docker-compose restart $(SELECTED)
####################################################
## Docker Images
####################################################
IMAGE_ARGS=
MQ_ARGS=
DB_ARGS=
# eg --no-cache, or --build-arg LEGA_GID=1000
.PHONY: images image mq-image db-image
images: image mq-image db-image
image:
cd ../ingestion && \
docker build -f Dockerfile \
--build-arg LEGA_UID=$(shell id -u) \
$(IMAGE_ARGS) \
--tag egarchive/lega-base:latest \
.
mq-image:
cd ../ingestion/mq && \
docker build -f Dockerfile \
$(MQ_ARGS) \
--tag egarchive/lega-mq:latest \
.
db-image:
cd ../ingestion/db && \
docker build -f Dockerfile \
$(DB_ARGS) \
--tag egarchive/lega-db:latest \
.
####################################################
# Cleaning docker images
define remove_dangling
docker images $(1) -f "dangling=true" -q | uniq | while read n; do docker rmi -f $$n; done
endef
erase:
@$(call remove_dangling,egarchive/lega-*)
purge:
@$(call remove_dangling,)
####################################################
# Checking the archive DB
dbshell:
chmod 600 $(CURDIR)/private/certs/save2db.sec.pem
psql "postgres://lega:----------------@localhost:15432/lega?sslmode=verify-ca&sslcert=$(CURDIR)/private/certs/save2db.cert.pem&sslkey=$(CURDIR)/private/certs/save2db.sec.pem&sslrootcert=$(CURDIR)/private/certs/CA.save2db.cert.pem"