Skip to content

Snake with vim navigation, developed in Rust and compiled to Web Assembly.

License

Notifications You must be signed in to change notification settings

christianfosli/snake

Repository files navigation

snake

Snake with optional vim navigation. Visit playsnake.no to play!

wasm_app highscore_api highscore_cleanup_job terraform test_e2e

Architecture 🏗

graph TD
    A(<b>Front-end</b><br/>Snake implemented in rust/wasm<br/>Deployed as Azure static webapp<br/>https://www.playsnake.no)-->B
    B(<b>Highscore API</b><br/>REST API to manage highscores<br/>Deployed as Azure Container App<br/>https://highscores.playsnake.no)-->C(Mongo DB Database)
    D(<b>Highscore Cleanup Job</b><br/>Periodically deletes stale highscores<br/>Deployed as Azure Container App Job)-->C
Loading

All the cloud infra is Infrastructure-as-Code managed by Terraform.

The highscores API is documented with OpenApi. Swagger UI | json | yaml.

Development 🐳

Run all services with docker compose, from the root folder in the repository.

docker compose up -d --build

Requires enabling buildkit, but this is enabled by default in newer versions of docker desktop, so you're probably all set 😄

Open up front-end at localhost:8080. The back-end is available at localhost:3000.

To stop all services and remove their containers:

docker compose down

Required Tools

docker and compose (incuded in Docker Desktop)

Monitoring

Application Insights

Query the ContainerAppConsoleLogs_CL and ContainerAppSystemLogs_CL tables to find pod logs and system logs.

Open Telemetry

The backend service(s) are set up to collect logs using Open Telemetry. Currently (July, 2023) the open telemetry data is not exported anywhere, so it is hard to visualize this data. It is printed to the console (see above for finding console logs in application insights). //TODO: Make this work smoothly 😄