-
Notifications
You must be signed in to change notification settings - Fork 7
/
makefile
70 lines (55 loc) · 1.69 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
include .env
.PHONY: build pull push dev down docker helm
BRANCH := ${shell git rev-parse --symbolic-full-name --abbrev-ref HEAD}
NAME_SPACE=tonywangcn
SRV_NAME=ten-million-domains
REPO=ghcr.io
TAG=$(shell date +%Y%m%d%H%M%S)
NAME=${REPO}/${NAME_SPACE}/${SRV_NAME}
export KUBECONFIG=./terraform/kubeconfig-ten-million-domains-iad.yaml
build:
echo build ${SRV_NAME}:latest
cp ./docker/Dockerfile .
docker build -t ${SRV_NAME}:latest .
rm Dockerfile
docker tag ${SRV_NAME}:latest ${NAME}:latest
docker tag ${SRV_NAME}:latest ${NAME}:${TAG}
docker push ${NAME}:latest
docker push ${NAME}:${TAG}
pull:
git pull origin ${BRANCH}
push:
git push origin ${BRANCH}
tf:
- terraform -chdir=./terraform init --upgrade
terraform -chdir=./terraform validate
terraform -chdir=./terraform plan
terraform -chdir=./terraform apply -auto-approve
del:
terraform -chdir=./terraform destroy -auto-approve
dev:
docker-compose up -d
down:
docker-compose down
log:
docker-compose logs -f
redis: helm
helm upgrade --install redis-cluster bitnami/redis -f ./helm/redis/values.yaml --namespace redis --create-namespace
helm:
helm repo add bitnami https://charts.bitnami.com/bitnami
secret:
kubectl create secret docker-registry github-registry-secret \
--docker-server=ghcr.io \
--docker-username=${GITHUB_USERNAME} \
--docker-password=${GITHUB_PERSONAL_ACCESS_TOKEN} \
-o yaml > k8s/secret.yaml
d:
kubectl delete -f ./k8s/job.yaml --ignore-not-found
kubectl apply -f ./k8s
# kubectl apply -f ./k8s/deployment.yaml
stats:
kubectl delete -f ./k8s/stats.yaml --ignore-not-found
kubectl apply -f ./k8s/stats.yaml
top:
# kubectl top nodes
kubectl get deployment coredns -n kube-system -o yaml > ./k8s/coredns.yaml