go build -o ztf-viz *.go
./ztf-viz
- Generate go structs from the avro schemas
go install github.com/hamba/avro/v2/cmd/avrogen@<version>
avrogen -pkg main -o schemas.go -fullschema -fullname -tags json:snake schemas/candidate.avsc schemas/prv_candidate.avsc schemas/fp_hist.avsc schemas/cutout.avsc schemas/alert.avsc
Running avrogen
is only necessary when the avro schemas change.
- Generate go code from templ files
go install github.com/a-h/templ/cmd/templ@latest
templ generate
You need to run templ generate
for every change in the templates.
- Run the server
go run *.go
- Open the browser at
http://localhost:8080
There is a separate command that can produce random alerts to the Kafka broker every 1 second. To run it, use the following command:
go run *.go -cmd producer
While the producer is running, you can run the server with go run *.go
and watch alerts appear every second.
You can easily run a local Kafka broker using docker:
docker compose up
And then you can connect to it using the default address localhost:9092
.
For a complete list of configuration options, run ./ztf-viz -h
.
- Kafka broker address
The command line flag
-kafka-brokers
can be used to specify the address of the Kafka broker. The default value islocalhost:9092
.