Make server deployable with Docker Compose on Coolify #1

Merged
selimaj-dev merged 1 commits from coolify-deploy into master 2026-09-25 03:01:48 +00:00
Owner

Summary

  • Read the listen address and database location from BIND_ADDR / DATABASE_URL. The defaults (127.0.0.1:8080, ./users.db) are unchanged, so cargo run works as before.
  • Rename DockerFile to Dockerfile and rewrite it:
    • builds with a current Rust 1.x, since 1.76 can't build edition 2024
    • caches crates and build output between builds (BuildKit cache mounts)
    • runs as a non-root user
    • defaults to BIND_ADDR=0.0.0.0:8080 and a DB at /data/users.db
  • Add compose.yaml: publishes ${HOST_PORT:-8080}:8080, restarts unless-stopped, and keeps the DB on the server-data volume.
  • Add .dockerignore to keep target/, .git/, DB files and token.key out of the build context.

Coolify setup

  • Build pack: Docker Compose, compose file /compose.yaml.
  • Domain for the server service: https://saturn-server.selimaj.dev:8080. The proxy handles TLS for wss://.
  • Optional: set HOST_PORT if 8080 is taken on the host.

Testing

  • cargo build passes. The server was run locally with BIND_ADDR=0.0.0.0:18080 and an absolute DATABASE_URL: it listened on all interfaces and created the schema.
  • Not tested: the Docker image build and docker compose up, because Docker wasn't available on the dev machine.

There is no healthcheck yet. One is planned once the server moves to axum and has an HTTP endpoint.

🤖 Generated with Claude Code

## Summary - Read the listen address and database location from `BIND_ADDR` / `DATABASE_URL`. The defaults (`127.0.0.1:8080`, `./users.db`) are unchanged, so `cargo run` works as before. - Rename `DockerFile` to `Dockerfile` and rewrite it: - builds with a current Rust 1.x, since 1.76 can't build edition 2024 - caches crates and build output between builds (BuildKit cache mounts) - runs as a non-root user - defaults to `BIND_ADDR=0.0.0.0:8080` and a DB at `/data/users.db` - Add `compose.yaml`: publishes `${HOST_PORT:-8080}:8080`, restarts `unless-stopped`, and keeps the DB on the `server-data` volume. - Add `.dockerignore` to keep `target/`, `.git/`, DB files and `token.key` out of the build context. ## Coolify setup - Build pack: Docker Compose, compose file `/compose.yaml`. - Domain for the `server` service: `https://saturn-server.selimaj.dev:8080`. The proxy handles TLS for `wss://`. - Optional: set `HOST_PORT` if 8080 is taken on the host. ## Testing - `cargo build` passes. The server was run locally with `BIND_ADDR=0.0.0.0:18080` and an absolute `DATABASE_URL`: it listened on all interfaces and created the schema. - **Not tested:** the Docker image build and `docker compose up`, because Docker wasn't available on the dev machine. There is no healthcheck yet. One is planned once the server moves to axum and has an HTTP endpoint. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
selimaj-dev added 1 commit 2026-09-25 03:01:31 +00:00
- Read bind address and database URL from BIND_ADDR / DATABASE_URL
  (defaults unchanged for local cargo run)
- Rename DockerFile to Dockerfile and rewrite it: current Rust for
  edition 2024, BuildKit cache mounts, non-root user, DB on /data
- Add compose.yaml publishing ${HOST_PORT:-8080} with a persistent
  data volume, and a .dockerignore

Co-Authored-By: Claude Opus 5.5 <[email protected]>
selimaj-dev merged commit 6058367d96 into master 2026-09-25 03:01:48 +00:00
selimaj-dev deleted branch coolify-deploy 2026-09-25 03:01:51 +00:00
Sign in to join this conversation.