build: update Just workflows for Compose and SQLite development
This commit is contained in:
parent
d3a230bd47
commit
0fbe9d553d
17
Justfile
17
Justfile
|
|
@ -2,19 +2,10 @@ default:
|
||||||
@just --list
|
@just --list
|
||||||
|
|
||||||
run:
|
run:
|
||||||
cargo run
|
docker compose down && docker compose up --build -d
|
||||||
|
|
||||||
run-release:
|
stop:
|
||||||
cargo run --release
|
|
||||||
|
|
||||||
sqlite:
|
|
||||||
DATABASE_URL="sqlite://sim.db?mode=rwc" cargo run
|
|
||||||
|
|
||||||
compose-up:
|
|
||||||
docker compose up --build -d
|
|
||||||
|
|
||||||
compose-down:
|
|
||||||
docker compose down
|
docker compose down
|
||||||
|
|
||||||
docker-build:
|
dev:
|
||||||
docker build -t sim .
|
DATABASE_URL="sqlite://sim.db?mode=rwc" cargo run
|
||||||
19
README.md
19
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
|
### 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
|
```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:
|
To choose a seed on the first run:
|
||||||
|
|
||||||
|
|
@ -35,23 +35,20 @@ just
|
||||||
Useful recipes:
|
Useful recipes:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
just run # Run locally with the default SQLite database
|
just run # Stop Compose services, then build and start the app with Postgres
|
||||||
just run-release # Run an optimized local build
|
just stop # Stop Compose services; keep the database volume
|
||||||
just sqlite # Explicitly select sim.db for local testing
|
just dev # Run locally with SQLite
|
||||||
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
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Run with Docker Compose and Postgres
|
### 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
|
```sh
|
||||||
docker compose up --build -d
|
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:
|
To remove the database volume and all saved simulation data as well:
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue