-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
93 lines (72 loc) · 2.41 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
PYTHON=3.9
BASENAME=sam-remove-background
CONTAINER_NAME=ghcr.io/mrsyee/${BASENAME}
# Prerequisites for local execution
env:
conda create -n $(BASENAME) python=$(PYTHON) -y
setup:
pip install -r requirements.txt
model:
sh scripts/download_decoder_model.sh
sh scripts/download_encoder_model.sh
# Run
client:
python src/client/app.py
server:
PYTHONPATH=src/server uvicorn src.server.main:app --host 0.0.0.0 --port 8888
server-debug:
PYTHONPATH=src/server uvicorn src.server.main:app --host 0.0.0.0 --port 8888 --reload --reload-exclude "src/client/*"
# Docker
# Client
docker-build-client:
docker build -t ${CONTAINER_NAME}-client -f Dockerfiles/client.Dockerfile .
docker-push-client:
docker push ${CONTAINER_NAME}-client
docker-pull-client:
docker pull ${CONTAINER_NAME}-client
# Server
docker-build-server:
docker build -t ${CONTAINER_NAME}-server -f Dockerfiles/server.Dockerfile .
docker-push-server:
docker push ${CONTAINER_NAME}-server
# Dev
setup-dev:
pip install -r requirements-dev.txt
format:
black .
isort .
lint:
PYTHONPATH=src pytest src --flake8 --pylint --mypy
# k8s
cluster:
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION="v1.27.2+k3s1" K3S_KUBECONFIG_MODE="644" INSTALL_K3S_EXEC="server --disable=traefik" sh -s - --docker
mkdir -p ~/.kube
cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
kubectl apply -f https://raw.githubusercontent.com/NVIDIA/k8s-device-plugin/master/nvidia-device-plugin.yml
kubectl create -f https://raw.githubusercontent.com/NVIDIA/dcgm-exporter/master/dcgm-exporter.yaml
helm repo add minio https://helm.min.io/
helm repo add grafana https://grafana.github.io/helm-charts
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
finalize:
sh /usr/local/bin/k3s-killall.sh
sh /usr/local/bin/k3s-uninstall.sh
charts:
kubectl apply -f secrets/triton.yaml
helm install traefik charts/traefik
helm install minio charts/minio
helm install loki charts/loki
helm install promtail charts/promtail
helm install prometheus charts/prometheus
helm install triton charts/triton
helm install sam-remove-background-server charts/server
helm install sam-remove-background-client charts/client
remove-charts:
helm uninstall sam-remove-background-client
helm uninstall sam-remove-background-server
helm uninstall triton
helm uninstall prometheus
helm uninstall promtail
helm uninstall loki
helm uninstall minio
helm uninstall traefik