This project is licensed under the Personal Use License. See the LICENSE file for details.
Ensure the following services are installed and running:
- Redis
- NATS
- Centrifugo
-
Create and activate a virtual environment:
uv venv --python 3.13 source ./.venv/bin/activate -
Install dependencies:
For development
uv sync --all-extras --frozen
For production
uv sync --frozen
-
Create and activate a virtual environment:
python3 -m venv .venv source ./.venv/bin/activate -
Install dependencies:
For development:
pip install -e ".[dev]"For production:
pip install -e .
-
Build Docker image:
docker build -t connection_hub:latest .
Configure the following environment variables before running the application:
| Variable | Required | Description | Default |
|---|---|---|---|
LOGGING_LEVEL |
No | Logging level | DEBUG |
REDIS_URL |
No | URL for the Redis instance. | redis://localhost:6379 |
NATS_URL |
No | URL for the NATS server. | nats://localhost:4222) |
CENTRIFUGO_URL |
Yes | URL for the Centrifugo server. | - |
CENTRIFUGO_API_KEY |
Yes | API key for Centrifugo. | - |
LOBBY_MAPPER_LOBBY_EXPIRES_IN |
No | Lobby expiration time in seconds | 86400 |
GAME_MAPPER_GAME_EXPIRES_IN |
No | Game expiration time in seconds. | 86400 |
LOCK_EXPIRES_IN |
No | Lock expiration time in seconds. | 5 |
TEST_REDIS_URL |
Yes (for tests) | URL for the test Redis instance. | - |
TEST_NATS_URL |
Yes (for tests) | URL for the test NATS server. | - |
Create NATS streams with all subjects used by application to test it:
connection-hub create-nats-streams <nats_url>Run the message consumer to process events from NATS:
connection-hub run-message-consumerRun the task scheduler:
connection-hub run-task-schedulerRun the task executor for scheduled tasks:
connection-hub run-task-executor