tangled
alpha
login
or
join now
kacaii.dev
/
sigo
0
fork
atom
๐ฉโ๐ Firefighters API written in Gleam!
lustre
gleam
0
fork
atom
overview
issues
pulls
pipelines
:stethoscope: add server healthcheck
kacaii.dev
4 days ago
0215786f
04650816
verified
This commit was signed with the committer's
known signature
.
kacaii.dev
SSH Key Fingerprint:
SHA256:n9v7QGNWHCUv1x/483hCtPUvTsVabU5PzC5CSJMUNtI=
+10
2 changed files
expand all
collapse all
unified
split
justfile
server
src
server
router.gleam
+8
justfile
···
8
8
9
9
pod_name := "pod_sigo"
10
10
11
11
+
# database
11
12
pg_image := "docker.io/postgres:18-alpine"
12
13
pg_env := "-e POSTGRES_USER -e POSTGRES_PASSWORD -e POSTGRES_DB"
13
14
pg_volume := "-v ./sql/create:/docker-entrypoint-initdb.d"
···
19
20
# server
20
21
run_server_locally := env("RUN_SERVER_LOCALLY", "false")
21
22
server_port := if run_server_locally == "false" { "-p 8000:8000" } else { "" }
23
23
+
24
24
+
server_health_cmd := "--health-cmd 'wget -q --spider http://127.0.0.1:8000/api/health || exit 1'"
25
25
+
server_health_conf := "--health-interval 30s --health-retries 3 --health-timeout 10s"
26
26
+
server_health_start_period := "--health-start-period 10s"
22
27
23
28
# List available recipes
24
29
@_default:
···
90
95
--pod {{ pod_name }} \
91
96
--name server \
92
97
-e DATABASE_URL -e SECRET_KEY \
98
98
+
{{ server_health_cmd }} \
99
99
+
{{ server_health_conf }} \
100
100
+
{{ server_health_start_period }} \
93
101
sigo-server
94
102
95
103
+2
server/src/server/router.gleam
···
10
10
use req <- middleware(req, ctx)
11
11
12
12
case wisp.path_segments(req) {
13
13
+
["api", "health"] -> wisp.ok()
14
14
+
13
15
["api", "login"] -> login.handle_request(req, ctx)
14
16
["api", "signup"] -> signup.handle_request(req, ctx)
15
17
["api", "whoami"] -> whoami.handle_request(req, ctx)