From 0fbe9d553dd79b3c078ad89df5fe5f36e34a74cb Mon Sep 17 00:00:00 2001 From: Steve Biedermann Date: Thu, 8 Oct 2026 09:24:14 +0200 Subject: [PATCH] build: update Just workflows for Compose and SQLite development --- Justfile | 17 ++++------------- README.md | 19 ++++++++----------- 2 files changed, 12 insertions(+), 24 deletions(-) diff --git a/Justfile b/Justfile index 3eba8f7..0912d1e 100644 --- a/Justfile +++ b/Justfile @@ -2,19 +2,10 @@ default: @just --list run: - cargo run + docker compose down && docker compose up --build -d -run-release: - cargo run --release - -sqlite: - DATABASE_URL="sqlite://sim.db?mode=rwc" cargo run - -compose-up: - docker compose up --build -d - -compose-down: +stop: docker compose down -docker-build: - docker build -t sim . \ No newline at end of file +dev: + DATABASE_URL="sqlite://sim.db?mode=rwc" cargo run \ No newline at end of file diff --git a/README.md b/README.md index d964d8b..3ffc38e 100644 --- a/README.md +++ b/README.md @@ -8,13 +8,13 @@ The UI is built automatically as part of `cargo run` and embedded in the server ### Local run with SQLite -Install Rust with `rustup`. The build script installs the `wasm32-unknown-unknown` target if it is missing. Then run: +Install Rust with `rustup`. The build script installs the `wasm32-unknown-unknown` target if it is missing. Start locally with SQLite using: ```sh -cargo run +just dev ``` -Open [http://127.0.0.1:7878](http://127.0.0.1:7878). The default database is SQLite at `sim.db` in the current directory, and the initial seed is `42`. +Open [http://127.0.0.1:7878](http://127.0.0.1:7878). The database is SQLite at `sim.db` in the current directory, and the initial seed is `42`. You can also run directly with `cargo run`. To choose a seed on the first run: @@ -35,23 +35,20 @@ just Useful recipes: ```sh -just run # Run locally with the default SQLite database -just run-release # Run an optimized local build -just sqlite # Explicitly select sim.db for local testing -just docker-build # Build the application image -just compose-up # Build and start the app and Postgres in the background -just compose-down # Stop the Compose services; keep the database volume +just run # Stop Compose services, then build and start the app with Postgres +just stop # Stop Compose services; keep the database volume +just dev # Run locally with SQLite ``` ### Run with Docker Compose and Postgres -Install Docker with the Compose plugin, then run: +Install Docker with the Compose plugin, then run `just run`. This stops any existing Compose stack before rebuilding and starting the app with Postgres. You can also use the equivalent Docker command directly: ```sh docker compose up --build -d ``` -Open [http://localhost:7878](http://localhost:7878). Compose waits for Postgres to become healthy before starting the app. Postgres data is stored in the `postgres_data` volume and survives container restarts and `docker compose down`. +Open [http://localhost:7878](http://localhost:7878). Compose waits for Postgres to become healthy before starting the app. Postgres data is stored in the `postgres_data` volume and survives container restarts, `just stop`, and `docker compose down`. To remove the database volume and all saved simulation data as well: