forked from AnubisLMS/Anubis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
129 lines (103 loc) · 3.81 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# Debug
DEBUG_PERSISTENT_SERVICES := db traefik redis-master
DEBUG_RESTART_ALWAYS_SERVICES := api web-dev rpc-default rpc-theia rpc-regrade
# docker-compose settings
DOCKER_COMPOSE_PUSH_SERVICES := api web theia-init theia-sidecar theia-proxy
# K8S
K8S_RESTART_DEPLOYMENTS := \
anubis-api anubis-web anubis-pipeline-api anubis-theia-proxy anubis-rpc-default anubis-rpc-theia \
anubis-rpc-regrade anubis-theia-poller anubis-discord-bot
# Theia IDES
THEIA_BASE_IDE := \
theia-base-38 theia-base-39 theia-base-310 \
theia-base-38-bare theia-base-39-bare theia-base-310-bare \
webtop-base-ubuntu
THEIA_IDES := \
theia-xv6 theia-admin theia-devops theia-jepst theia-golang \
theia-flask-39 theia-flask-310 \
theia-mysql-39 theia-mysql-310
help:
@echo 'For convenience'
@echo
@echo 'Available make targets:'
@grep PHONY: Makefile | cut -d: -f2 | sed '1d;s/^/make/'
startup-links:
@echo ''
@echo 'seed: http://localhost/api/admin/seed/'
@echo 'auth: http://localhost/api/admin/auth/token/superuser'
@echo 'auth: http://localhost/api/admin/auth/token/professor'
@echo 'auth: http://localhost/api/admin/auth/token/ta'
@echo 'auth: http://localhost/api/admin/auth/token/student'
@echo 'site: http://localhost/'
.PHONY: context # Grab kubectl and registry login from doctl
context:
doctl kubernetes cluster kubeconfig save anubis --context anubis
doctl registry login --context anubis
.PHONY: upgrade # Helm upgrade Anubis k8s cluster
upgrade:
helm upgrade --install anubis ./k8s/chart -n anubis
.PHONY: restart # Restart Anubis k8s cluster
restart:
kubectl rollout restart -n anubis deploy \
$(K8S_RESTART_DEPLOYMENTS)
.PHONY: deploy # Deploy Anubis k8s cluster
deploy: build push upgrade restart
.PHONY: build # Build all docker images
build:
docker-compose build --parallel --pull $(DOCKER_COMPOSE_PUSH_SERVICES)
.PHONY: push # Push images to registry.digitalocean.com (requires vpn)
push: build
docker-compose push $(DOCKER_COMPOSE_PUSH_SERVICES)
.PHONY: build-base-ides # Build base ide images
build-base-ides:
@echo 'building base images'
docker-compose build --parallel --pull $(THEIA_BASE_IDE)
.PHONY: build-ides # Build all ide docker images
build-ides:
@echo 'building ide image'
docker-compose build --parallel $(THEIA_IDES)
.PHONY: push-base-ides # Push base ide images to registry.digitalocean.com
push-base-ides:
docker-compose push $(THEIA_BASE_IDE)
.PHONY: push-ides # Push ide images to registry.digitalocean.com
push-ides:
docker-compose push $(THEIA_IDES)
.PHONY: prop-ides # Create theia-prop daemonset to propagate latest ide images
prop-ides:
kubectl rollout restart ds anubis-theia-prop -n anubis
.PHONY: debug # Start the cluster in debug mode
debug:
docker-compose up -d $(DEBUG_PERSISTENT_SERVICES)
docker-compose up \
-d --force-recreate \
$(DEBUG_RESTART_ALWAYS_SERVICES)
@echo 'Waiting for db'
@until mysqladmin -h 127.0.0.1 ping &> /dev/null; do sleep 1; done
@echo 'running migrations'
docker-compose exec api alembic upgrade head
make startup-links
.PHONY: mindebug # Setup mindebug environment
mindebug:
@echo ''
@echo 'seed: http://localhost:3000/api/admin/seed/'
@echo 'auth: http://localhost:3000/api/admin/auth/token/superuser'
@echo 'auth: http://localhost:3000/api/admin/auth/token/professor'
@echo 'auth: http://localhost:3000/api/admin/auth/token/ta'
@echo 'auth: http://localhost:3000/api/admin/auth/token/student'
@echo 'site: http://localhost:3000/'
make -j2 apirun webrun
.PHONY: mkdebug # Start minikube debug
mkdebug:
./k8s/debug/provision.sh
apirun:
make -C api run
webrun:
make -C web run
# Reset local docker-compose db
yeetdb:
docker-compose kill db
docker-compose rm -f
docker volume rm anubis_db_data
docker-compose up -d --force-recreate db
theia-%:
docker-compose build $@