Appearance
7 - Deployment
The application supports two deployment modes: Docker Compose for single-node setups and Docker Swarm (beta) for multi-node, highly available deployments. In both cases, all services run as independent containers and are managed via a centralised script.
7.1 - Installation
1. Clone the repository
bash
git clone https://github.com/EvenToNight/EvenToNight.git
cd EvenToNight2. Configure environment variables
bash
cp .env.template .env
# Edit .env and fill in all required fields
# Note: if using the --no-deps flag, Stripe keys can contain arbitrary values. All fields must still be filled in.3. Start the application
3.1 - Docker Compose
Option A: Use pre-built images from ghcr.io (Recommended)
Pull images:
bash
./scripts/composeApplication.sh pullPull images with database seeding:
bash
./scripts/composeApplication.sh --init-db pullDeploy the application:
bash
./scripts/composeApplication.sh up -d --waitDeploy with database seeding:
bash
./scripts/composeApplication.sh --init-db up -d --waitDeploy in development mode (with host-mapped ports and dashboards for databases, RabbitMQ and Traefik):
bash
./scripts/composeApplication.sh --init-db --dev up -d --waitOption B: Local build
Add the --build flag to build services locally instead of using pre-built images. The --dev flag is required as it includes the build instructions:
bash
# Build and deploy
./scripts/composeApplication.sh --dev up --build -d --wait
# Build and deploy with seeding
./scripts/composeApplication.sh --init-db --dev up --build -d --waitAdditional flags
--no-deps: Excludes external dependencies (Stripe)
The --no-deps flag can be added to any deploy command to exclude external services:
bash
# Deploy without external dependencies
./scripts/composeApplication.sh --no-deps up -d --wait
# Deploy with seeding but without external dependencies
./scripts/composeApplication.sh --init-db --no-deps up -d --waitNote: When using --no-deps, the Stripe keys (STRIPE_SECRET_KEY, STRIPE_PUBLISHABLE_KEY, STRIPE_WEBHOOK_SECRET) in .env can contain arbitrary values.
--project-name: Overrides the Docker Compose project name (defaults to eventonight):
bash
./scripts/composeApplication.sh --project-name myproject up -d --waitStripe configuration
For Stripe payments in a local environment (required only if NOT using --no-deps):
bash
./services/payments/scripts/local-webhooks.shThis script must be run to forward Stripe webhooks to the local environment.
For more information on using sandbox mode, refer to the Stripe documentation.
Alternative setup
Use Gradle to set up the entire environment with seeding and the Stripe listener:
bash
./gradlew setupApplicationEnvironmentTeardown
Stop the application:
bash
./scripts/composeApplication.sh downStop and remove volumes:
bash
./scripts/composeApplication.sh down -vOr using Gradle:
bash
./gradlew teardownApplicationEnvironment3.2 - Docker Swarm (beta)
Prerequisites
Initialise the swarm on the manager node:
bash
docker swarm initJoin additional worker nodes using the token provided by the manager:
bash
docker swarm join --token <token> <manager-ip>:2377Option A: Use pre-built images from ghcr.io (Recommended)
bash
./scripts/deploySwarm.shThe --auto-labels flag can be added to automatically assign placement labels to nodes in a balanced way, without having to configure them manually:
bash
./scripts/deploySwarm.sh --auto-labelsNote: On the first deploy, database seeding is performed automatically.
Option B: Local build
Build images locally and push them to Docker Hub (multi-arch) so all workers have access to them, then deploy:
bash
./scripts/deploySwarm.sh --local --buildTo override the hostname baked into the frontend image (defaults to HOST from .env, e.g. to use localhost for local testing):
bash
./scripts/deploySwarm.sh --local --build --host <hostname> --auto-labelsTo deploy using already-pushed local images (without rebuilding):
bash
./scripts/deploySwarm.sh --localTo build and push without deploying:
bash
./scripts/deploySwarm.sh --buildAdditional flags
--no-deps: Same behaviour as in Docker Compose: excludes external dependencies. Stripe configuration applies equally (see 3.1 - Stripe configuration).
bash
./scripts/deploySwarm.sh --no-deps--stack-name: Overrides the stack name (defaults to eventonight-swarm):
bash
./scripts/deploySwarm.sh --stack-name mystackRecovery
If some services are not fully running after a deploy, the recovery script force-updates only the failing ones:
bash
./scripts/swarmRecover.sh [STACK_NAME]To check the current status of all services without recovering:
bash
./scripts/swarmRecover.sh [STACK_NAME] --statusSTACK_NAME defaults to eventonight-swarm.
Teardown
Remove the stack:
bash
./scripts/deploySwarm.sh --stopRemove the stack and volumes:
bash
./scripts/deploySwarm.sh --stop --remove-volumesRemove test images from docker hub
bash
./scripts/deploySwarm.sh --remove-local-imagesAlternatively, the application is already running in production at https://eventonight.site/it