-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
66 lines (54 loc) · 2.09 KB
/
justfile
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
set dotenv-load
# Choose a task to run
default:
@just --choose
# Install project tools
prereqs:
brew bundle install
minikube config set memory no-limit
minikube config set cpus no-limit
# Setup minikube
minikube:
which k9s || @just prereqs
minikube status || minikube start
# Forward mysql from service defined in env
mysql-svc: minikube
ss -ltpn | grep 3306 || kubectl port-forward $KUBECTL_FORWARD_MYSQL 3306:3306 -n everest & sleep 1
# SQLMesh ui for local dev
dev: mysql-svc
@just mysql sqlmesh -e exit || just mysql -e 'create database sqlmesh;'
@just mysql -e 'SET GLOBAL pxc_strict_mode=PERMISSIVE;'
uv run sqlmesh ui
# Build and test container (run dev first to make sure db exists)
test: mysql-svc
docker build . -t harvest-consultations
@just mysql -e 'SET GLOBAL pxc_strict_mode=PERMISSIVE;'
@docker run --net=host \
-e SECRETS_YAML='{{env('SECRETS_YAML')}}' \
-e MYSQL_PWD='{{env('MYSQL_PWD')}}' \
-e MYSQL_DUCKDB_PATH='{{env('MYSQL_DUCKDB_PATH')}}' \
harvest-consultations \
sqlmesh plan --auto-apply --run --verbose
# skaffold configured with env and minikube
[positional-arguments]
skaffold *args: minikube
skaffold "$@"
# Dump the sqlmesh database to logs/consultations.sql.gz
dump-consultations: mysql-svc
mysqldump -uroot -h127.0.0.1 sqlmesh | gzip > logs/consultations.sql.gz
# mysql configured with same env as SQLMesh
[positional-arguments]
mysql *args: mysql-svc
mysql -uroot -h127.0.0.1 "$@"
# Install percona everest cli
everestctl:
curl -sSL -o everestctl-linux-amd64 https://github.com/percona/everest/releases/latest/download/everestctl-linux-amd64
sudo install -m 555 everestctl-linux-amd64 /usr/local/bin/everestctl
rm everestctl-linux-amd64
# Percona Everest webui to manage databases
everest: minikube
which everestctl || @just everestctl
everestctl accounts list || everestctl install --skip-wizard
everestctl accounts set-password --username admin --new-password everest
ss -ltpn | grep 8080 || kubectl port-forward svc/everest 8080:8080 -n everest-system &
@echo "Manage databases: http://localhost:8080 (login admin/everest)"