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 connect_four: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. | - |
GAME_MAPPER_GAME_EXPIRES_IN |
No | Game expiration time in seconds. | 3600 |
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:
connect-four create-nats-streams <nats_url>Run the message consumer to process game-related events from NATS:
connect-four run-message-consumerRun the task scheduler:
connect-four run-task-schedulerRun the task executor for scheduled tasks:
connect-four run-task-executorconnect-four create-game --id <UUID> --lobby-id <UUID> --first-player-id <UUID> --first-player-time <number_of_seconds> --first-player-communication <"centrifugo" | "other"> --second-player-id <UUID> --second-player-time <number_of_seconds> --second-player-communication <"centrifugo" | "other">connect-four end-game --id <UUID>