diff --git a/README.md b/README.md index 13975dc..4c849e7 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,11 @@ cp config.example.toml config.toml # Set a private api_key in config.toml. mkdir -p data -USHORT_UID="$(id -u)" USHORT_GID="$(id -g)" \ - docker compose -f deploy/docker-compose.build.yml up --build -d +USHORT_CONFIG="$PWD/config.toml" \ +USHORT_DATA="$PWD/data" \ +USHORT_UID="$(id -u)" \ +USHORT_GID="$(id -g)" \ + docker compose -f deploy/docker-compose.prod.yml up -d ``` The example starts ushort at and stores its SQLite @@ -28,12 +31,24 @@ Check it and stop it with: ```bash curl http://localhost:18082/s/api/health -docker compose -f deploy/docker-compose.build.yml down +docker compose -f deploy/docker-compose.prod.yml down ``` -For a production server, use the published image through -`deploy/docker-compose.prod.yml`; it does not build or require a source -checkout. +This pulls the published image; it does not compile ushort or require a Rust +toolchain. + +## Build from source instead + +To build the current checkout locally, use the alternative build definition: + +```bash +mkdir -p data +USHORT_UID="$(id -u)" USHORT_GID="$(id -g)" \ + docker compose -f deploy/docker-compose.build.yml up --build -d +``` + +It uses the same root-level `config.toml` and `data/` directory as the quick +start. ## Documentation diff --git a/deploy/docker-compose.prod.yml b/deploy/docker-compose.prod.yml index 3dbf4ac..023db53 100644 --- a/deploy/docker-compose.prod.yml +++ b/deploy/docker-compose.prod.yml @@ -6,9 +6,9 @@ services: ports: - "127.0.0.1:18082:8080" volumes: - - ./config.toml:/app/config.toml:ro - - ./data:/app/data - user: "1001:1001" + - "${USHORT_CONFIG:-./config.toml}:/app/config.toml:ro" + - "${USHORT_DATA:-./data}:/app/data" + user: "${USHORT_UID:-1001}:${USHORT_GID:-1001}" read_only: true security_opt: - no-new-privileges:true diff --git a/docs/development.md b/docs/development.md index 93bf8f2..a6eae04 100644 --- a/docs/development.md +++ b/docs/development.md @@ -18,7 +18,8 @@ USHORT_UID="$(id -u)" USHORT_GID="$(id -g)" \ The production definition, [`deploy/docker-compose.prod.yml`](../deploy/docker-compose.prod.yml), never -builds source. It pulls the published version instead. +builds source. It pulls the published version instead and is therefore the +recommended quick-start path in the root README. ## Automated tests