Skip to content
Merged
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
99 changes: 57 additions & 42 deletions on-prem/.env.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
# IMAGE_REPOSITORY=513558712013.dkr.ecr.us-east-1.amazonaws.com/currents/on-prem/
# IMAGE_TAG=staging

GITLAB_REDIRECT_URL=http://localhost:4000/integrations/gitlab/callback
# =============================================================================
# Docker Compose Configuration
# =============================================================================
# These variables are used by docker-compose only (not passed to containers)
# DC_IMAGE_REPOSITORY=513558712013.dkr.ecr.us-east-1.amazonaws.com/currents/on-prem/
# DC_IMAGE_TAG=staging

# =============================================================================
# Data Volume Configuration
# =============================================================================
# By default, data is stored in ./data/<service> (auto-created)
# Set to a custom path or a pre-created Docker volume name
#
# Examples:
# DC_REDIS_VOLUME=./data/redis # Local path (default)
# DC_REDIS_VOLUME=/mnt/ssd/redis # Custom path
# DC_REDIS_VOLUME=my_redis_volume # Pre-created Docker volume
#
# DC_REDIS_VOLUME=./data/redis
# DC_MONGODB_VOLUME=./data/mongodb
# DC_CLICKHOUSE_VOLUME=./data/clickhouse
# DC_RUSTFS_VOLUME=./data/rustfs
# DC_SCHEDULER_STARTUP_VOLUME=./data/startup

# =============================================================================
# Redis Configuration
Expand All @@ -12,29 +30,51 @@ GITLAB_REDIRECT_URL=http://localhost:4000/integrations/gitlab/callback
REDIS_URI=redis://redis:6379
REDIS_URI_SLAVE=redis://redis:6379

# Remote Object Storage
# For minio when using the full data environment
MINIO_SERVER_ACCESS_KEY=minio-access-key
# =============================================================================
# Object Storage (RustFS / S3)
# =============================================================================
# For rustfs when using the full data environment
RUSTFS_ACCESS_KEY=rustfs-access-key
# Run `./scripts/generate-secrets.sh token` from the root of the project to generate a new secret
MINIO_SERVER_SECRET_KEY=minio-secret-key
RUSTFS_SECRET_KEY=rustfs-secret-key
FILE_STORAGE_ENDPOINT="http://localhost:9000"
FILE_STORAGE_INTERNAL_ENDPOINT="http://host.docker.internal:9000"
FILE_STORAGE_ACCESS_KEY_ID=${MINIO_SERVER_ACCESS_KEY}
FILE_STORAGE_SECRET_ACCESS_KEY=${MINIO_SERVER_SECRET_KEY}
FILE_STORAGE_ACCESS_KEY_ID=${RUSTFS_ACCESS_KEY}
FILE_STORAGE_SECRET_ACCESS_KEY=${RUSTFS_SECRET_KEY}
FILE_STORAGE_BUCKET="currents"
FILE_STORAGE_FORCE_PATH_STYLE=true

# ON_PREM_EMAIL=admin@currents.local
# =============================================================================
# ClickHouse Configuration
# =============================================================================
# Connection settings (uses service name for internal Docker network)
CLICKHOUSE_URL=http://clickhouse:8123
CLICKHOUSE_USERNAME=currents

# Passwords for ClickHouse users (generated by setup.sh)
# Default PASSWORD only used if using the included clickhouse
CLICKHOUSE_DEFAULT_PASSWORD=
# The CURRENTS USER PASSWORD is how all services connect
CLICKHOUSE_CURRENTS_PASSWORD=

# =============================================================================
# Authentication
# =============================================================================
# Run `./scripts/generate-secrets.sh token` from the root of the project to generate a new secret
JWT_SECRET=
JWT_SECRET_EXPIRY=10m

# =============================================================================
# GitLab Integration
# =============================================================================
GITLAB_REDIRECT_URL=http://localhost:4000/integrations/gitlab/callback
# Run `./scripts/generate-secrets key gitlab-key.pem`
# Then `base64 < "gitlab-key.pem" | tr -d '\n'` to get the base64 secret to set here
GITLAB_STATE_SECRET=

# Email Configuration
# =============================================================================
# Email Configuration
# =============================================================================
EMAIL_TRANSPORTER=smtp
SMTP_HOST=localhost
SMTP_PORT=1025
Expand All @@ -43,40 +83,15 @@ SMTP_USER=test
SMTP_PASS=test

# Automated Reports Configuration
# -------------------------------
AUTOMATED_REPORTS_EMAIL_FROM="Currents Report <report@example.com>"
AUTOMATED_REPORTS_EMAIL_BCC=

# =============================================================================
# Observability (Optional)
# =============================================================================
# Coralogix support
CORALOGIX_API_ENDPOINT=
CORALOGIX_API_KEY=
CORALOGIX_APP_NAME="customer-name"

# =============================================================================
# Data Volume Configuration
# =============================================================================
# By default, data is stored in ./data/<service> (auto-created)
# Set to a custom path or a pre-created Docker volume name
#
# Examples:
# REDIS_VOLUME=./data/redis # Local path (default)
# REDIS_VOLUME=/mnt/ssd/redis # Custom path
# REDIS_VOLUME=my_redis_volume # Pre-created Docker volume
#
# REDIS_VOLUME=./data/redis
# MONGODB_VOLUME=./data/mongodb
# CLICKHOUSE_VOLUME=./data/clickhouse
# MINIO_VOLUME=./data/minio
# SCHEDULER_STARTUP_VOLUME=./data/startup

# =============================================================================
# ClickHouse Configuration
# =============================================================================
# Connection settings (uses service name for internal Docker network)
CLICKHOUSE_URL=http://clickhouse:8123
CLICKHOUSE_USERNAME=currents

# Passwords for ClickHouse users (generated by setup.sh)
# Default PASSWORD only used if using the included clickhouse
CLICKHOUSE_DEFAULT_PASSWORD=
# The CURRENTS USER PASSWORD is how all services connect
CLICKHOUSE_CURRENTS_PASSWORD=
# ON_PREM_EMAIL=admin@currents.local
29 changes: 21 additions & 8 deletions on-prem/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ docker compose up -d

| Profile | Services Included | Use Case |
|---------|-------------------|----------|
| `full` | Redis, MongoDB, ClickHouse, MinIO | Running everything locally |
| `full` | Redis, MongoDB, ClickHouse, RustFS | Running everything locally |
| `database` | Redis, MongoDB, ClickHouse | External S3-compatible storage |
| `cache` | Redis | External MongoDB, ClickHouse, and S3 |

Expand Down Expand Up @@ -55,7 +55,7 @@ Generates a docker-compose file for a specific profile. Used by `setup.sh` but c
./scripts/generate-compose.sh redis
./scripts/generate-compose.sh mongodb
./scripts/generate-compose.sh clickhouse
./scripts/generate-compose.sh minio
./scripts/generate-compose.sh rustfs

# Combine multiple profiles/services
./scripts/generate-compose.sh database storage
Expand All @@ -65,15 +65,15 @@ Generates a docker-compose file for a specific profile. Used by `setup.sh` but c

| Profile | Description |
|---------|-------------|
| `full` | All services (redis, mongodb, clickhouse, minio) |
| `full` | All services (redis, mongodb, clickhouse, rustfs) |
| `database` | Database services (redis, mongodb, clickhouse) |
| `cache` | Cache (redis) |
| `analytics` | Analytics (clickhouse) |
| `storage` | Object storage (minio) |
| `storage` | Object storage (rustfs) |
| `redis` | Redis only |
| `mongodb` | MongoDB only |
| `clickhouse` | ClickHouse only |
| `minio` | MinIO only |
| `rustfs` | RustFS only |

### `scripts/generate-secrets.sh`

Expand Down Expand Up @@ -106,11 +106,24 @@ Utility for generating secrets and keys.

Copy `.env.example` to `.env` and configure as needed. The `setup.sh` script does this automatically and generates required secrets.

Key variables:
### Application Variables

- `JWT_SECRET` - Authentication token secret
- `MINIO_SERVER_ACCESS_KEY` / `MINIO_SERVER_SECRET_KEY` - MinIO credentials
- `RUSTFS_ACCESS_KEY` / `RUSTFS_SECRET_KEY` - RustFS credentials
- `GITLAB_STATE_SECRET` - GitLab integration key (base64-encoded PEM)

### Compose-Only Variables

Variables prefixed with `DC_` are used only by docker-compose (not passed to containers):

- `DC_IMAGE_REPOSITORY` - Docker image repository prefix
- `DC_IMAGE_TAG` - Docker image tag
- `DC_REDIS_VOLUME` - Redis data volume path
- `DC_MONGODB_VOLUME` - MongoDB data volume path
- `DC_CLICKHOUSE_VOLUME` - ClickHouse data volume path
- `DC_RUSTFS_VOLUME` - RustFS data volume path
- `DC_SCHEDULER_STARTUP_VOLUME` - Scheduler startup data volume path

## Services

### Currents Application
Expand All @@ -125,7 +138,7 @@ Key variables:
- **redis** (port 6379, 8001) - Cache and pub/sub
- **mongodb** (port 27017) - Primary database
- **clickhouse** (port 8123, 9123) - Analytics database
- **minio** (port 9000, 9001) - S3-compatible object storage
- **rustfs** (port 9000, 9001) - S3-compatible object storage

## Development

Expand Down
16 changes: 8 additions & 8 deletions on-prem/docker-compose.cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
# Currents services depend on redis
director:
hostname: director
image: ${IMAGE_REPOSITORY:-currents-}director:${IMAGE_TAG:-dev}
image: ${DC_IMAGE_REPOSITORY:-currents-}director:${DC_IMAGE_TAG:-dev}
expose:
- 1234
ports:
Expand All @@ -32,7 +32,7 @@ services:
required: false
api:
hostname: api
image: ${IMAGE_REPOSITORY:-currents-}api:${IMAGE_TAG:-dev}
image: ${DC_IMAGE_REPOSITORY:-currents-}api:${DC_IMAGE_TAG:-dev}
expose:
- 4000
ports:
Expand All @@ -54,7 +54,7 @@ services:
condition: service_started
required: false
changestreams-worker:
image: ${IMAGE_REPOSITORY:-currents-}change-streams:${IMAGE_TAG:-dev}
image: ${DC_IMAGE_REPOSITORY:-currents-}change-streams:${DC_IMAGE_TAG:-dev}
restart: unless-stopped
networks:
- default
Expand All @@ -69,7 +69,7 @@ services:
condition: service_started
required: false
write-worker:
image: ${IMAGE_REPOSITORY:-currents-}writer:${IMAGE_TAG:-dev}
image: ${DC_IMAGE_REPOSITORY:-currents-}writer:${DC_IMAGE_TAG:-dev}
restart: unless-stopped
networks:
- default
Expand All @@ -85,7 +85,7 @@ services:
condition: service_started
required: false
scheduler:
image: ${IMAGE_REPOSITORY:-currents-}scheduler:${IMAGE_TAG:-dev}
image: ${DC_IMAGE_REPOSITORY:-currents-}scheduler:${DC_IMAGE_TAG:-dev}
restart: unless-stopped
networks:
- default
Expand All @@ -97,13 +97,13 @@ services:
- CLICKHOUSE_PASSWORD=${CLICKHOUSE_CURRENTS_PASSWORD}
- RUN_STARTUP_TASKS=true
volumes:
- ${SCHEDULER_STARTUP_VOLUME:-./data/startup}:/app/packages/scheduler/dist/.startup
- ${DC_SCHEDULER_STARTUP_VOLUME:-./data/startup}:/app/packages/scheduler/dist/.startup
depends_on:
redis:
condition: service_started
required: false
webhooks:
image: ${IMAGE_REPOSITORY:-currents-}webhooks:${IMAGE_TAG:-dev}
image: ${DC_IMAGE_REPOSITORY:-currents-}webhooks:${DC_IMAGE_TAG:-dev}
restart: unless-stopped
networks:
- default
Expand All @@ -126,6 +126,6 @@ services:
networks:
- default
volumes:
- ${REDIS_VOLUME:-./data/redis}:/data
- ${DC_REDIS_VOLUME:-./data/redis}:/data
networks:
default: null
20 changes: 10 additions & 10 deletions on-prem/docker-compose.database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
# Currents services depend on redis
director:
hostname: director
image: ${IMAGE_REPOSITORY:-currents-}director:${IMAGE_TAG:-dev}
image: ${DC_IMAGE_REPOSITORY:-currents-}director:${DC_IMAGE_TAG:-dev}
expose:
- 1234
ports:
Expand All @@ -38,7 +38,7 @@ services:
required: false
api:
hostname: api
image: ${IMAGE_REPOSITORY:-currents-}api:${IMAGE_TAG:-dev}
image: ${DC_IMAGE_REPOSITORY:-currents-}api:${DC_IMAGE_TAG:-dev}
expose:
- 4000
ports:
Expand Down Expand Up @@ -66,7 +66,7 @@ services:
condition: service_started
required: false
changestreams-worker:
image: ${IMAGE_REPOSITORY:-currents-}change-streams:${IMAGE_TAG:-dev}
image: ${DC_IMAGE_REPOSITORY:-currents-}change-streams:${DC_IMAGE_TAG:-dev}
restart: unless-stopped
networks:
- default
Expand All @@ -87,7 +87,7 @@ services:
condition: service_started
required: false
write-worker:
image: ${IMAGE_REPOSITORY:-currents-}writer:${IMAGE_TAG:-dev}
image: ${DC_IMAGE_REPOSITORY:-currents-}writer:${DC_IMAGE_TAG:-dev}
restart: unless-stopped
networks:
- default
Expand All @@ -109,7 +109,7 @@ services:
condition: service_started
required: false
scheduler:
image: ${IMAGE_REPOSITORY:-currents-}scheduler:${IMAGE_TAG:-dev}
image: ${DC_IMAGE_REPOSITORY:-currents-}scheduler:${DC_IMAGE_TAG:-dev}
restart: unless-stopped
networks:
- default
Expand All @@ -121,7 +121,7 @@ services:
- CLICKHOUSE_PASSWORD=${CLICKHOUSE_CURRENTS_PASSWORD}
- RUN_STARTUP_TASKS=true
volumes:
- ${SCHEDULER_STARTUP_VOLUME:-./data/startup}:/app/packages/scheduler/dist/.startup
- ${DC_SCHEDULER_STARTUP_VOLUME:-./data/startup}:/app/packages/scheduler/dist/.startup
depends_on:
clickhouse:
condition: service_healthy
Expand All @@ -133,7 +133,7 @@ services:
condition: service_started
required: false
webhooks:
image: ${IMAGE_REPOSITORY:-currents-}webhooks:${IMAGE_TAG:-dev}
image: ${DC_IMAGE_REPOSITORY:-currents-}webhooks:${DC_IMAGE_TAG:-dev}
restart: unless-stopped
networks:
- default
Expand Down Expand Up @@ -177,7 +177,7 @@ services:
- source: clickhouse_users
target: /etc/clickhouse-server/users.d/users.xml
volumes:
- ${CLICKHOUSE_VOLUME:-./data/clickhouse}:/var/lib/clickhouse
- ${DC_CLICKHOUSE_VOLUME:-./data/clickhouse}:/var/lib/clickhouse
mongodb:
hostname: mongodb
image: mongo:7.0.0
Expand All @@ -197,7 +197,7 @@ services:
timeout: 5s
retries: 10
volumes:
- ${MONGODB_VOLUME:-./data/mongodb}:/data/db
- ${DC_MONGODB_VOLUME:-./data/mongodb}:/data/db
redis:
hostname: redis
image: redis/redis-stack-server:7.4.0-v8
Expand All @@ -207,7 +207,7 @@ services:
networks:
- default
volumes:
- ${REDIS_VOLUME:-./data/redis}:/data
- ${DC_REDIS_VOLUME:-./data/redis}:/data
networks:
default: null
configs:
Expand Down
Loading