-
Notifications
You must be signed in to change notification settings - Fork 8
/
justfile
99 lines (70 loc) · 2.57 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
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
set dotenv-load := true
default:
@just --list --list-heading $'photofield\n'
build *args:
go build {{args}}
build-ui:
cd ui && npm run build
build-docs:
cd docs && npm run docs:build
build-local:
goreleaser build --snapshot --single-target --clean
e2e *args:
cd e2e && npm run watch
# Download geopackage to be embedded via -tags embedgeo
assets:
mkdir -p data/geo
gpkg_file="$(grep -e '//go:embed data/geo/' embed-geo.go | cut -d / -f 5)" && \
gpkg_ver="$(grep -e '// tinygpkg-data release:' embed-geo.go | cut -d ' ' -f 4)" && \
gpkg_dst="data/geo/$gpkg_file" && \
echo "Downloading $gpkg_ver/$gpkg_file" && \
wget -q -O "$gpkg_dst" https://github.com/SmilyOrg/tinygpkg-data/releases/download/$gpkg_ver/$gpkg_file && \
echo "Downloaded to $gpkg_dst"
release-local:
goreleaser release --snapshot --clean
run *args: build
./photofield {{args}}
run-embed *args:
go build -tags embedui,embeddocs
PHOTOFIELD_API_PREFIX="/api" ./photofield {{args}}
run-ui *args:
go build -tags embedui
PHOTOFIELD_API_PREFIX="/api" ./photofield {{args}}
run-geo *args:
go build -tags embedgeo
./photofield {{args}}
bench collection: build
./photofield -bench -bench.collection {{collection}} -test.benchtime 1s -test.count 6
ui:
cd ui && npm run dev
docs:
cd docs && npm run docs:dev
watch:
watchexec --exts go -r just run
watch-build:
watchexec --exts go,yaml -r 'just build && echo build successful'
db-add migration_file_name:
migrate create -ext sql -dir db/migrations -seq {{migration_file_name}}
db *args:
migrate -database sqlite://data/photofield.cache.db -path db/migrations {{args}}
dbt-add migration_file_name:
migrate create -ext sql -dir db/migrations-thumbs -seq {{migration_file_name}}
dbt *args:
migrate -database sqlite://data/photofield.thumbs.db -path db/migrations-thumbs {{args}}
api-codegen:
oapi-codegen -generate="types,chi-server" -package=openapi api.yaml > internal/openapi/api.gen.go
grafana-export:
@hamara export --host=localhost:9091 --key=$GRAFANA_API_KEY > docker/grafana/provisioning/datasources/default.yaml
pprof := "http://localhost:8080/debug/pprof"
prof-cpu seconds="10":
go tool pprof -http=: {{pprof}}/profile?seconds={{seconds}}
prof-heap:
go tool pprof -http=: {{pprof}}/heap
prof-reload:
go test -benchmem -benchtime 10s '-run=^$' -bench '^BenchmarkReload$' photofield
monitor:
docker compose up prometheus grafana pyroscope
test-reload:
mkdir -p profiles/
go test -v '-run=^TestReloadLeaks$' photofield
go tool pprof -http ':' -diff_base profiles/reload-before.pprof profiles/reload-after.pprof