-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJustfile
More file actions
106 lines (90 loc) · 3.14 KB
/
Copy pathJustfile
File metadata and controls
106 lines (90 loc) · 3.14 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
set dotenv-load := true
repo := justfile_directory()
home := env_var("HOME")
uid := `id -u`
label := "dev.glog"
plist := home + "/Library/LaunchAgents/" + label + ".plist"
bin := home + "/go/bin/glog"
db := repo + "/glog.db"
web := repo + "/web/build"
addr := env_var_or_default("GLOG_ADDR", "127.0.0.1:6016")
default:
@just --list
# Build the static dashboard.
build-web:
cd web && bun run build
# Install the current CLI to the active GOPATH bin directory.
install-cli:
go install ./cmd/glog
# Build dashboard and install the CLI binary.
build: build-web install-cli
# Run all backend tests.
test:
go test ./... -timeout 5m
# Run the frontend production build.
test-web:
cd web && bun run build
# Run the local server in the foreground.
serve: build-web
{{bin}} serve --addr {{addr}} --db {{db}} --web {{web}}
# Check the installed CLI and local server configuration.
doctor:
{{bin}} doctor --server http://{{addr}}
# Open the dashboard in the default browser.
dashboard:
open "http://{{addr}}"
# Install and start the macOS launchd user service.
service-install: build
mkdir -p "{{home}}/Library/LaunchAgents"
printf '%s\n' \
'<?xml version="1.0" encoding="UTF-8"?>' \
'<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">' \
'<plist version="1.0">' \
' <dict>' \
' <key>Label</key>' \
' <string>{{label}}</string>' \
' <key>ProgramArguments</key>' \
' <array>' \
' <string>{{bin}}</string>' \
' <string>serve</string>' \
' <string>--addr</string>' \
' <string>{{addr}}</string>' \
' <string>--db</string>' \
' <string>{{db}}</string>' \
' <string>--web</string>' \
' <string>{{web}}</string>' \
' </array>' \
' <key>WorkingDirectory</key>' \
' <string>{{repo}}</string>' \
' <key>RunAtLoad</key>' \
' <true/>' \
' <key>KeepAlive</key>' \
' <true/>' \
' <key>StandardOutPath</key>' \
' <string>{{repo}}/glog.launchd.log</string>' \
' <key>StandardErrorPath</key>' \
' <string>{{repo}}/glog.launchd.err.log</string>' \
' </dict>' \
'</plist>' > "{{plist}}"
plutil -lint "{{plist}}"
launchctl bootout gui/{{uid}}/{{label}} 2>/dev/null || true
launchctl bootstrap gui/{{uid}} "{{plist}}"
launchctl enable gui/{{uid}}/{{label}}
launchctl kickstart -k gui/{{uid}}/{{label}}
@echo "Installed {{label}}. Dashboard: http://{{addr}}"
# Stop and remove the macOS launchd user service.
service-uninstall:
launchctl bootout gui/{{uid}}/{{label}} 2>/dev/null || true
rm -f "{{plist}}"
# Restart the macOS launchd user service.
service-restart:
launchctl kickstart -k gui/{{uid}}/{{label}}
# Show launchd status for the GLog service.
service-status:
launchctl print gui/{{uid}}/{{label}}
# Tail launchd stdout/stderr logs.
service-logs:
tail -f "{{repo}}/glog.launchd.log" "{{repo}}/glog.launchd.err.log"
# Check the running service health endpoint.
health:
curl -fsS "http://{{addr}}/health?detailed=true"