This commit is contained in:
Mateusz Gruszczyński committed 2026-10-31 14:36:07 +01:00
1 parent fc81ecafd6
commit dc57aa7089
89 files changed
+5290 -1551

No files matched your search

+4
View File
@@ -0,0 +1,4 @@
target
.git
RustBox*.zip
.dev
+13
View File
@@ -0,0 +1,13 @@
FROM rust:1.88-bookworm AS builder
WORKDIR /build
RUN apt-get update && apt-get install -y --no-install-recommends pkg-config libssl-dev ca-certificates && rm -rf /var/lib/apt/lists/*
COPY . .
RUN cargo generate-lockfile && cargo build --release --locked
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates libssl3 && rm -rf /var/lib/apt/lists/*
RUN useradd --system --uid 10001 --create-home --home-dir /var/lib/rustbox rustbox
COPY --from=builder /build/target/release/rustbox /usr/local/bin/rustbox
USER rustbox
EXPOSE 3001
ENTRYPOINT ["/usr/local/bin/rustbox"]
+15
View File
@@ -0,0 +1,15 @@
# RustBox 0.2.0 Docker variants
The example images are version-pinned where practical so a release does not silently change its integration stack. The bundled SILO topology is for local/integration validation of the S3 API; production deployments should use a security-reviewed S3-compatible service and their own lifecycle/HA policy.
Run commands from `docker/`.
- `docker compose -f compose-single-sqlite.yml up --build` — single node, SQLite, local filesystem blobs, local Tantivy.
- `docker compose -f compose-postgres-s3-opensearch.yml up --build` — cluster-ready application shape with PostgreSQL, SILO (S3-compatible blobs) and OpenSearch. The RustBox container has no persistent `data_dir` volume.
- `NFS_SERVER=10.0.0.10 NFS_EXPORT=/exports/rustbox docker compose -f compose-mysql-nfs-opensearch.yml up --build` — MySQL, real shared POSIX/NFS blob storage and OpenSearch.
Set `IMAP_HOST` and `SMTP_HOST` for the mail system. Replace all example passwords and `SESSION_ENCRYPTION_KEY` before production use. The OpenSearch examples disable its security plugin only to keep the local Compose topology self-contained; production should use TLS/authentication and `search.urls` with HTTPS.
The NFS variant deliberately uses an NFS volume driver instead of a local Docker named volume: a local named volume is not shared across Docker hosts and therefore is not a valid multi-node RustBox blob backend.
The two cluster-ready Compose examples intentionally run one RustBox application container so they remain directly runnable on a single Docker host. To run multiple RustBox application nodes, place them behind an external load balancer (or adapt the Compose networking) and do not publish the same host port from every node; the shared SQL/blob/OpenSearch services are the cluster-safe backing topology.
+62
View File
@@ -0,0 +1,62 @@
services:
mysql:
image: mysql:8.4
environment:
MYSQL_DATABASE: rustbox
MYSQL_USER: rustbox
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-rustbox-dev-password}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-rustbox-root-password}
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-uroot", "-p${MYSQL_ROOT_PASSWORD:-rustbox-root-password}"]
interval: 5s
timeout: 5s
retries: 30
volumes:
- mysql-data:/var/lib/mysql
opensearch:
image: opensearchproject/opensearch:3.9.0
environment:
discovery.type: single-node
DISABLE_INSTALL_DEMO_CONFIG: "true"
DISABLE_SECURITY_PLUGIN: "true"
OPENSEARCH_JAVA_OPTS: -Xms512m -Xmx512m
healthcheck:
test: ["CMD-SHELL", "curl -fsS http://localhost:9200/_cluster/health >/dev/null || exit 1"]
interval: 10s
timeout: 5s
retries: 30
volumes:
- opensearch-data:/usr/share/opensearch/data
rustbox:
build:
context: ..
dockerfile: docker/Dockerfile
depends_on:
mysql:
condition: service_healthy
opensearch:
condition: service_healthy
ports:
- "3001:3001"
environment:
RUSTBOX_CONFIG: /etc/rustbox/rustbox.toml
DATABASE_URL: mysql://rustbox:${MYSQL_PASSWORD:-rustbox-dev-password}@mysql:3306/rustbox
SESSION_ENCRYPTION_KEY: ${SESSION_ENCRYPTION_KEY:-MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWY=}
IMAP_HOST: ${IMAP_HOST:-mail.example.com}
SMTP_HOST: ${SMTP_HOST:-mail.example.com}
volumes:
- ./configs/mysql-nfs-opensearch.toml:/etc/rustbox/rustbox.toml:ro
- rustbox-nfs:/mnt/rustbox-shared
restart: unless-stopped
volumes:
mysql-data:
opensearch-data:
rustbox-nfs:
driver: local
driver_opts:
type: nfs
o: addr=${NFS_SERVER:?set NFS_SERVER},rw,nfsvers=4
device: :${NFS_EXPORT:-/rustbox}
+82
View File
@@ -0,0 +1,82 @@
services:
postgres:
image: postgres:17-bookworm
environment:
POSTGRES_DB: rustbox
POSTGRES_USER: rustbox
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-rustbox-dev-password}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U rustbox -d rustbox"]
interval: 5s
timeout: 5s
retries: 20
volumes:
- postgres-data:/var/lib/postgresql/data
s3:
image: docker.io/pgsty/silo:RELEASE.2026-10-26T00-00-00Z
command: server /data --console-address :9001
environment:
MINIO_ROOT_USER: ${S3_ACCESS_KEY:-rustbox}
MINIO_ROOT_PASSWORD: ${S3_SECRET_KEY:-rustbox-s3-dev-password}
healthcheck:
test: ["CMD", "silo", "healthcheck", "ready"]
interval: 5s
timeout: 5s
retries: 30
volumes:
- s3-data:/data
s3-init:
image: docker.io/pgsty/mc:RELEASE.2026-10-26T00-00-00Z
depends_on:
s3:
condition: service_healthy
environment:
MC_HOST_local: http://${S3_ACCESS_KEY:-rustbox}:${S3_SECRET_KEY:-rustbox-s3-dev-password}@s3:9000
command: ["mb", "--ignore-existing", "local/rustbox"]
opensearch:
image: opensearchproject/opensearch:3.9.0
environment:
discovery.type: single-node
DISABLE_INSTALL_DEMO_CONFIG: "true"
DISABLE_SECURITY_PLUGIN: "true"
OPENSEARCH_JAVA_OPTS: -Xms512m -Xmx512m
healthcheck:
test: ["CMD-SHELL", "curl -fsS http://localhost:9200/_cluster/health >/dev/null || exit 1"]
interval: 10s
timeout: 5s
retries: 30
volumes:
- opensearch-data:/usr/share/opensearch/data
rustbox:
build:
context: ..
dockerfile: docker/Dockerfile
depends_on:
postgres:
condition: service_healthy
s3-init:
condition: service_completed_successfully
opensearch:
condition: service_healthy
ports:
- "3001:3001"
environment:
RUSTBOX_CONFIG: /etc/rustbox/rustbox.toml
DATABASE_URL: postgres://rustbox:${POSTGRES_PASSWORD:-rustbox-dev-password}@postgres:5432/rustbox
SESSION_ENCRYPTION_KEY: ${SESSION_ENCRYPTION_KEY:-MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWY=}
AWS_ACCESS_KEY_ID: ${S3_ACCESS_KEY:-rustbox}
AWS_SECRET_ACCESS_KEY: ${S3_SECRET_KEY:-rustbox-s3-dev-password}
IMAP_HOST: ${IMAP_HOST:-mail.example.com}
SMTP_HOST: ${SMTP_HOST:-mail.example.com}
volumes:
- ./configs/postgres-s3-opensearch.toml:/etc/rustbox/rustbox.toml:ro
restart: unless-stopped
volumes:
postgres-data:
s3-data:
opensearch-data:
+18
View File
@@ -0,0 +1,18 @@
services:
rustbox:
build:
context: ..
dockerfile: docker/Dockerfile
ports:
- "3001:3001"
environment:
RUSTBOX_CONFIG: /etc/rustbox/rustbox.toml
IMAP_HOST: ${IMAP_HOST:-mail.example.com}
SMTP_HOST: ${SMTP_HOST:-mail.example.com}
volumes:
- ./configs/single-sqlite.toml:/etc/rustbox/rustbox.toml:ro
- rustbox-data:/var/lib/rustbox
restart: unless-stopped
volumes:
rustbox-data:
+22
View File
@@ -0,0 +1,22 @@
host = "0.0.0.0"
port = 3001
environment = "production"
database_backend = "mysql"
session_backend = "database"
cluster_mode = true
pgp_enabled = false
[storage]
backend = "filesystem"
path = "/mnt/rustbox-shared"
shared = true
[search]
backend = "opensearch"
urls = ["http://opensearch:9200"]
index_prefix = "rustbox"
allow_insecure_http = true
required = true
worker_interval_secs = 2
worker_batch_size = 100
worker_max_attempts = 8
@@ -0,0 +1,26 @@
host = "0.0.0.0"
port = 3001
environment = "production"
database_backend = "pgsql"
session_backend = "database"
cluster_mode = true
pgp_enabled = false
[storage]
backend = "s3"
bucket = "rustbox"
region = "us-east-1"
endpoint = "http://s3:9000"
path_style = true
allow_http = true
prefix = "mail"
[search]
backend = "opensearch"
urls = ["http://opensearch:9200"]
index_prefix = "rustbox"
allow_insecure_http = true
required = true
worker_interval_secs = 2
worker_batch_size = 100
worker_max_attempts = 8
+17
View File
@@ -0,0 +1,17 @@
host = "0.0.0.0"
port = 3001
environment = "production"
data_dir = "/var/lib/rustbox"
database_backend = "sqlite"
session_backend = "database"
cluster_mode = false
pgp_enabled = true
[storage]
backend = "filesystem"
path = "/var/lib/rustbox/blobs"
shared = false
[search]
backend = "local_tantivy"
path = "/var/lib/rustbox/search"