Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Keep the build context small — none of this is needed by any Dockerfile stage.
.git
**/node_modules
server/target
server/bin
server/obj
server-tests
web/dist
e2e
api-tests
api-live-tests
allure-report
allure-results
**/*.db
**/*.db-shm
**/*.db-wal
41 changes: 41 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Rust

on:
push:
branches: [main]
paths:
- 'server/**'
- '.github/workflows/rust.yml'
pull_request:
branches: [main]
paths:
- 'server/**'
- '.github/workflows/rust.yml'

defaults:
run:
working-directory: server

jobs:
check:
name: fmt + clippy + test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust toolchain
run: rustup component add rustfmt clippy

- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
server/target
key: cargo-${{ runner.os }}-${{ hashFiles('server/Cargo.lock') }}
restore-keys: cargo-${{ runner.os }}-

- run: cargo fmt --check
- run: cargo clippy --all-targets -- -D warnings
- run: cargo test --locked
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# ── Stage 0: Build the Rust API server (ADR 0033 — strangler-fig on :3001) ────
FROM rust:1-slim AS rust-server-builder

WORKDIR /build
COPY server/Cargo.toml server/Cargo.lock ./
COPY server/src ./src
RUN cargo build --release --bin arrgh-server

# ── Stage 1: Build the .NET API server ───────────────────────────────────────
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS server-builder

Expand Down Expand Up @@ -25,6 +33,9 @@ COPY docker/nginx.conf /etc/nginx/sites-available/default
# .NET server publish output
COPY --from=server-builder /publish /app

# Rust server binary (ADR 0033) — runs alongside .NET during the migration
COPY --from=rust-server-builder /build/target/release/arrgh-server /app/arrgh-server

# Bundled plugin index (default when PluginIndexUrl not overridden)
COPY plugin-index/index.json /app/plugin-index.json

Expand Down
7 changes: 7 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,12 @@ mkdir -p "$DownloadDir"
# Start .NET API server in background
dotnet /app/ArrghServer.dll &

# Start Rust API server in background (ADR 0033 — serves migrated /api
# prefixes on :3001; reads DatabasePath/PluginHostUrl/DownloadDir/JwtSecret
# exported above, same as .NET). Absent in older images — guard on the binary.
if [ -x /app/arrgh-server ]; then
RUST_BIND="127.0.0.1:3001" LOG_LEVEL="${LOG_LEVEL:-info}" /app/arrgh-server &
fi

# Start nginx in foreground (keeps the container alive)
nginx -g "daemon off;"
16 changes: 15 additions & 1 deletion docker/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,21 @@ server {
root /var/www/arrgh;
index index.html;

# Proxy API calls to the .NET server
# ── Strangler-fig routing (ADR 0033) ───────────────────────────────────
# Migrated route groups → Rust server on :3001; everything else stays on
# the .NET server on :3000. nginx matches the longest prefix, so each
# migrated `location /api/<group>` block wins over the catch-all. Add one
# block per phase as its Hurl tests pass; delete the catch-all at S10.

location /api/version {
proxy_pass http://127.0.0.1:3001;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_read_timeout 300s;
client_max_body_size 0;
}

# Catch-all — .NET server (shrinks each phase, removed at cutover).
location /api/ {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
Expand Down
1 change: 1 addition & 0 deletions server/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
Loading
Loading