-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathMakefile
More file actions
185 lines (147 loc) · 7.11 KB
/
Makefile
File metadata and controls
185 lines (147 loc) · 7.11 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
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
.PHONY: help
OLLAMA_BASE_MODEL ?= llama3
GCP_PROJECT ?= pluralsh
APP_NAME ?= console
APP_VSN ?= `git describe`
BUILD ?= `git rev-parse --short HEAD`
DKR_HOST ?= dkr.plural.sh
PLRL_WWW ?= ../plural/www/src
dep ?= forge-core
GIT_COMMIT ?= abd123
TARGETARCH ?= amd64
ERLANG_VERSION ?= `grep erlang .tool-versions | cut -d' ' -f2`
REPO_ROOT ?= `pwd`
GIT_HOOKS_PATH = .githooks
TEST_CMD ?= mix deps.get && mix compile && mix test
help:
@perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
find-k8s-version:
curl -Ls https://dl.k8s.io/release/stable.txt | tr -d v | cut -d '.' -f 1,2 > KUBE_VERSION
find-versions: find-versions-aws find-versions-azure find-versions-gcloud
find-versions-aws:
aws eks describe-addon-versions --region=eu-west-1 | jq -r ".addons[] | .addonVersions[] | .compatibilities[] | .clusterVersion" | sort | uniq > static/k8s-versions/eks.json
find-versions-azure:
az aks get-versions --location eastus --output json > static/k8s-versions/aks.json
find-versions-gcloud:
gcloud container get-server-config --zone=us-central1-f --format=json > static/k8s-versions/gke.json
pull-ollama-helm-chart: ## update ollama Helm chart
helm repo add ollama-helm https://otwld.github.io/ollama-helm/
helm repo update
rm -rf charts/ollama
helm pull ollama-helm/ollama --untar --untardir charts
docker-build-ollama: ## build ollama image
docker build \
--build-arg=OLLAMA_BASE_MODEL=$(OLLAMA_BASE_MODEL) \
-t ollama:$(OLLAMA_BASE_MODEL) \
-t gcr.io/$(GCP_PROJECT)/ollama:$(OLLAMA_BASE_MODEL) \
-f dockerfiles/ollama/base.Dockerfile \
.
docker-push-ollama: ## push ollama image
docker push gcr.io/$(GCP_PROJECT)/ollama:$(OLLAMA_BASE_MODEL)
download-deprecations:
curl -L https://raw.githubusercontent.com/FairwindsOps/pluto/refs/heads/master/versions.yaml --output static/versions.yml
download-cost:
curl -L https://raw.githubusercontent.com/opencost/opencost/refs/heads/develop/configs/alibaba.json --output priv/cost/alibaba.json
curl -L https://raw.githubusercontent.com/opencost/opencost/refs/heads/develop/configs/aws.json --output priv/cost/aws.json
curl -L https://raw.githubusercontent.com/opencost/opencost/refs/heads/develop/configs/azure.json --output priv/cost/azure.json
curl -L https://raw.githubusercontent.com/opencost/opencost/refs/heads/develop/configs/gcp.json --output priv/cost/gcp.json
curl -L https://raw.githubusercontent.com/opencost/opencost/refs/heads/develop/configs/oracle.json --output priv/cost/oracle.json
build: ## Build the Docker image
docker build --build-arg GIT_COMMIT=$(GIT_COMMIT) \
--build-arg TARGETARCH=$(TARGETARCH) \
-t $(APP_NAME):$(APP_VSN) \
-t $(APP_NAME):latest \
-t gcr.io/$(GCP_PROJECT)/$(APP_NAME):$(APP_VSN) \
-t $(DKR_HOST)/console/$(APP_NAME):$(APP_VSN) .
helm-dependencies-rapid:
cd charts/console-rapid && helm dependency update
helm-dependencies: ## updates helm deps for all key charts
cd charts/console && helm dependency update
push: ## push to gcr
docker push gcr.io/$(GCP_PROJECT)/$(APP_NAME):$(APP_VSN)
docker push $(DKR_HOST)/console/$(APP_NAME):$(APP_VSN)
reshim: ## reshims erlang into asdf
cp -r /opt/homebrew/opt/erlang@26/lib/erlang ~/.asdf/installs/erlang/$(ERLANG_VERSION)
asdf reshim erlang $(ERLANG_VERSION)
deploy: ## deploy artifacts to plural
cd plural && plural apply
secrets: ## dir to manage random secret
mkdir secrets
data: ## dir for test sqlite data
mkdir data
testup: secrets data ## sets up dependent services for test
docker compose up -d
# Sleep since we need to wait for services to start
# @echo "Waiting 15 seconds for containers to start..."
# @sleep 10
# @echo "Creating OpenSearch domain (opensearch-local)..."
# # access key id, secret access key, session token must be the same values as in config/test.exs under :opensearch
# aws configure set aws_access_key_id test-access-key --no-cli-pager
# aws configure set aws_secret_access_key test-secret-key --no-cli-pager
# aws configure set aws_session_token test-session-token --no-cli-pager
# aws configure set aws_default_region us-east-1 --no-cli-pager
# # create opensearch domain but use the sigv4-proxy endpoint (localhost:4567 as set in docker-compose.yml)
# aws opensearch create-domain \
# --domain-name opensearch-local \
# --engine-version "OpenSearch_2.11" \
# --cluster-config InstanceType=t3.small.search,InstanceCount=1 \
# --ebs-options EBSEnabled=true,VolumeType=gp2,VolumeSize=10 \
# --endpoint-url http://localhost:4567 \
# --region us-east-1 \
# --no-cli-pager
# @echo "Test environment setup complete."
testdown: ## tear down test dependencies
docker compose down
test-full: ## run test suite in docker (TEST_CMD=...)
@docker compose -f docker-compose.test.yml up --attach=console --build --abort-on-container-exit --exit-code-from console; \
status=$$?; \
docker compose -f docker-compose.test.yml down; \
exit $$status
migration:
MIX_ENV=test mix ecto.gen.migration $(name)
web: ## starts a local webserver
cd assets && yarn start
gql-codegen: ## generates introspection information for our graph
cd assets && yarn run graphql-codegen
yarn-add: ## adds a yarn dep
cd assets && yarn add $(dep)
release-vsn: # tags and pushes a new release
@read -p "Version: " tag; \
git checkout master; \
git pull --rebase; \
git tag -a $$tag -m "new release"; \
git push origin $$tag
release-agentk-vsn: # tags and pushes a new release for agentk
@read -p "Version: " tag; \
git checkout master; \
git pull --rebase; \
git tag -a go/agentk/$$tag -m "agentk release $$tag"; \
git push origin go/agentk/$$tag
openapi-schema:
MIX_ENV=test mix openapi.dump Console.OpenAPI --pretty -o schema/openapi.json
update-schema: openapi-schema
MIX_ENV=test mix absinthe.schema.sdl --schema Console.GraphQl schema/schema.graphql
cd assets && yarn graphql:codegen
cd assets && yarn fix
@$(MAKE) --directory go/client --no-print-directory generate
k3s: ## starts a k3d cluster for testing
@read -p "cluster name: " name; \
k3d cluster create $$name --image docker.io/rancher/k3s:v1.26.11-k3s2
kind: ## starts a kind cluster for testing
@read -p "cluster name: " name; \
kind create cluster --name $$name --image kindest/node:v1.23.4
delete-tag: ## deletes a tag from git locally and upstream
@read -p "Version: " tag; \
git tag -d $$tag; \
git push origin :$$tag
latest-version: # finds latest release version
git tag | tr - \~ | sort -V | tr \~ -
install-git-hooks: ## enforces usage of git hooks stored under '.githooks' dir
@git config --local core.hooksPath ${GIT_HOOKS_PATH}/
@echo Successfully configured git hooks, \'core.hooksPath\' now points to \'${GIT_HOOKS_PATH}\'.
scrape-addons: ## scrapes cloud addon information and prints to a common format in-repo
@python3 utils/addons/main.py
proto: .PHONY ## generates protobufs schemas for elixir
cd go/cloud-query/api/proto && protoc --elixir_out=plugins=grpc:./../../../../lib/cloud_query cloudquery.proto
cd go/cloud-query/api/proto && protoc --elixir_out=plugins=grpc:./../../../../lib/cloud_query toolquery.proto
cd proto && pwd && protoc --elixir_out=plugins=grpc:./../lib/grpc console.proto