mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2026-09-02 21:03:34 +03:00
# Description of Changes - The multi-node compose stack + behave suite (11 features) - The nightly multinode-e2e job in build-enterprise.yml cuke features are cluster_health - both nodes boot healthy and join the Valkey backplane load_balancing - traffic spreads across nodes; no spurious 401 when bounced cross_node_auth - a token from one node validates on all nodes (shared DB keys) shared_state - teams/sources/org visible from every node policy_management - create/rename/delete a policy on any node, reflected everywhere source_management - source CRUD cross-node; referenced source can't be deleted anywhere connections - S3 connection resolves (secret masked) and deletes cluster-wide processor_ledger - files processed exactly once even when both nodes trigger together policy_run_coordination - a run on one node is visible from every node rate_limiting - rate-limit counters shared via Valkey, not per node failover - LB keeps serving when a node dies; recovered node accepts existing tokens can now start a full node system with export PREMIUM_KEY=<your licence key> ./start-multinode-test.sh starts a 40 person org DB install with multi node and database (--no-seed to have without DB on startup) 4 teams 1 s3 connection 1 policy --- ## Checklist ### General - [ ] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [ ] I have read the [Stirling-PDF Developer Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md) (if applicable) - [ ] I have read the [How to add new languages to Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md) (if applicable) - [ ] I have performed a self-review of my own code - [ ] My changes generate no new warnings ### Documentation - [ ] I have updated relevant docs on [Stirling-PDF's doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) (if functionality has heavily changed) - [ ] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) ### Translations (if applicable) - [ ] I ran [`scripts/counter_translation.py`](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/docs/counter_translation.md) ### UI Changes (if applicable) - [ ] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR) ### Testing (if applicable) - [ ] I have run `task check` to verify linters, typechecks, and tests pass - [ ] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#7-testing) for more details.
66 lines
2.6 KiB
Bash
66 lines
2.6 KiB
Bash
#!/usr/bin/env bash
|
|
# Brings up the multi-node stack (Postgres/Valkey/MinIO/2 app nodes/nginx LB), seeds teams/users/an S3 connection/policies, then leaves it running for manual testing.
|
|
# Usage: ./start-multinode-test.sh [--no-seed | --down]
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")"
|
|
|
|
COMPOSE="docker compose -f docker-compose-multinode.yml"
|
|
|
|
if [ "${1:-}" = "--down" ]; then
|
|
echo "Tearing down multi-node stack + volumes..."
|
|
$COMPOSE --profile seed down -v --remove-orphans
|
|
exit 0
|
|
fi
|
|
|
|
SEED=1
|
|
[ "${1:-}" = "--no-seed" ] && SEED=0
|
|
|
|
# Cluster mode is licence-gated. Without a valid key the nodes fail the cluster licence gate at boot.
|
|
if [ -z "${PREMIUM_KEY:-}" ]; then
|
|
echo "WARNING: PREMIUM_KEY is not set - cluster mode needs a valid enterprise/pro licence key."
|
|
echo " Run: export PREMIUM_KEY=<your test licence key> before starting."
|
|
fi
|
|
|
|
echo "==> Building the Stirling image (first run compiles the app; be patient)..."
|
|
$COMPOSE build
|
|
|
|
echo "==> Starting Postgres + Valkey + MinIO + 2 app nodes + nginx..."
|
|
$COMPOSE up -d
|
|
|
|
echo "==> Waiting for both app nodes to report healthy..."
|
|
for node in multinode-stirling-1 multinode-stirling-2; do
|
|
for i in $(seq 1 60); do
|
|
status=$(docker inspect -f '{{.State.Health.Status}}' "$node" 2>/dev/null || echo "starting")
|
|
[ "$status" = "healthy" ] && { echo " $node: healthy"; break; }
|
|
[ "$i" = "60" ] && { echo " $node did not become healthy; see: $COMPOSE logs $node"; exit 1; }
|
|
sleep 5
|
|
done
|
|
done
|
|
|
|
if [ "$SEED" = "1" ]; then
|
|
echo "==> Seeding teams / users / S3 connection / policies..."
|
|
$COMPOSE --profile seed run --rm seed || echo " (seed reported issues; check output above)"
|
|
fi
|
|
|
|
cat <<EOF
|
|
|
|
============================================================================
|
|
Multi-node Stirling is UP.
|
|
|
|
App (via load balancer): http://localhost:8080 (admin / stirling)
|
|
MinIO console: http://localhost:9001 (minioadmin / minioadmin)
|
|
Postgres: localhost:5434 (stirling / stirling, db 'stirling')
|
|
|
|
Seeded users: user01..user40@stirling.test / Password123!
|
|
Global API key: multinode-test-key (header: X-API-KEY)
|
|
|
|
Try it:
|
|
./validate-multinode-test.sh # multi-node smoke tests (optional)
|
|
$COMPOSE logs -f stirling-1 # tail a node
|
|
./start-multinode-test.sh --down # stop + wipe
|
|
|
|
Nodes are reachable directly for cross-node checks:
|
|
docker compose -f docker-compose-multinode.yml exec stirling-1 curl -s localhost:8080/api/v1/info/status
|
|
============================================================================
|
|
EOF
|