forked from databrary/databrary.org
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
75 lines (67 loc) · 2.15 KB
/
Makefile
File metadata and controls
75 lines (67 loc) · 2.15 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
include .env
UNAME := $(shell uname -s)
# Need to find platform and export docker host ip
# https://nickjanetakis.com/blog/docker-tip-65-get-your-docker-hosts-ip-address-from-in-a-container
# if Mac/Win use host.docker.internal
# if linux find the ip of docker0 when running ip a
.PHONY: server client cleardb migrate install setup_minio setup_migrations
is_hasura_running:
docker-compose ps | grep -q "graphql-engine"
is_minio_running:
docker-compose ps | grep -q "minio"
start_docker:
ifeq ($(UNAME),Linux)
docker-compose -f docker-compose.gnu.yml up -d
else
docker-compose up -d
endif
stop_docker:
ifeq ($(UNAME),Linux)
docker-compose -f docker-compose.gnu.yml down
else
docker-compose down
endif
cleardb:
ifeq ($(UNAME),Linux)
docker-compose -f docker-compose.gnu.yml down -v
else
docker-compose down -v
endif
server:
cd server && ts-node-dev src/index.ts && cd ..
client:
cd client && yarn run dev && cd ..
migrate:
cd hasura && hasura migrate apply && hasura console && cd ..
queue:
cd server && ts-node-dev bin/worker.ts && cd ..
docker:
ifeq ($(UNAME),Linux)
docker-compose -f docker-compose.gnu.yml up
else
docker-compose up
endif
install_docker_compose:
sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose &&
sudo chmod +x /usr/local/bin/docker-compos;
install_hasura_cli:
curl -L https://github.com/hasura/graphql-engine/raw/master/cli/get.sh | bash
install_minio_cli:
sudo curl -L https://dl.min.io/client/mc/release/linux-amd64/mc -o /usr/local/bin/ &&
sudo chmod +x /usr/local/bin/mc;
install: install_docker_compose install_hasura_cli install_minio_cli
npm install -g yarn;
npm install -g typescript;
npm install -g ts-node-dev;
npm install -g @quasar/cli;
cd server && yarn && cd ..;
cd client && yarn && cd ..;
setup_migrations:
cd hasura && hasura migrate apply && cd ..
setup_minio:
mc config host add minio ${MINIO_URL} ${MINIO_ACCESS_KEY} ${MINIO_SECRET_KEY};
mc admin config set minio < minio/minioconfig;
mc admin service restart minio;
mc mb minio/uploads;
mc mb minio/cas;
mc event add minio/uploads arn:minio:sqs::1:webhook --event put;