orchard
mirrorEvery site I host, in one repo, along with the Cloudflare Tunnel and Caddy that front them. It's all Go, Vite, and SQLite, and it runs on a desktop at home with nothing listening on an inbound port.
blogbuncaddycloudflare-tunneldockergogolanghomelabhtml-templatemonorepoself-hostedseosqlitestatic-sitetypstuptime-monitoringviteweb-analytics
1package tools
2
3import (
4 "context"
5 "encoding/json"
6 "net/http"
7 "os"
8 "testing"
9 "time"
10)
11
12// Runs against a real kiwix only when told to, since the suite must not need
13// a container to pass.
14func TestWikipediaSmoke(t *testing.T) {
15 base := os.Getenv("WIKI_SMOKE")
16 if base == "" {
17 t.Skip("set WIKI_SMOKE to a kiwix base url")
18 }
19 d := &Deps{HTTP: &http.Client{Timeout: 10 * time.Second}, Now: time.Now, Guard: NewGuard(time.Minute)}
20 for _, q := range []string{"Prime Minister of Japan", "Kim Jong-un", "PostgreSQL", "Photosynthesis"} {
21 start := time.Now()
22 out, err := wikiLookup(context.Background(), d, base, q)
23 if err != nil {
24 t.Errorf("%s: %v", q, err)
25 continue
26 }
27 b, _ := json.MarshalIndent(out, "", " ")
28 t.Logf("QUERY %q in %s\n%s\n", q, time.Since(start).Round(time.Millisecond), b)
29 }
30}