Follow this guide to set up the project locally using Docker Compose and explore the game.
- Docker: Make sure Docker is installed on your system. You can download it from Docker's official site.
- Docker Compose: Ensure Docker Compose is also installed. It comes bundled with Docker Desktop.
-
Clone the Repository
Clone this repository to your local machine:
git clone https://github.com/sonastea/WizardWarriors cd WizardWarriors -
Build and Start Services
Run the following command to build and start all services in detached mode:
docker-compose up -d
-
Seed the Database
After the services are running, populate the database with initial data:
go run seed.go
-
Access the Game
Once the services are up:
- Open your browser and navigate to: http://localhost
- The Traefik dashboard is available at: http://localhost:8080
-
Stopping the Services
To stop the running services:
docker-compose down
| Service | Description | URL |
|---|---|---|
| Traefik | Reverse proxy and load balancer | http://localhost:8080 (dashboard) |
| Database | PostgreSQL database for game data | localhost:5432 (PostgreSQL client) |
| Backend | Game backend API server | http://localhost/api |
| Frontend | Game user interface | http://localhost |
If you need to connect to the PostgreSQL database:
- Host:
localhost - Port:
5432 - Username:
postgres - Password:
postgres - Database:
wizardwarriors
psql -h localhost -U postgres -d wizardwarriorsYou can update the following environment variables in docker-compose.yml:
-
Frontend:
NEXT_PUBLIC_API_URL: URL for the backend API (default:http://localhost)NEXT_PUBLIC_WS_URL: URL for the WebSocket server (default:ws://localhost/game)
-
Backend:
DATABASE_URL: Connection string for PostgreSQLREDIS_URL: Connection string for Redis
Note: Both frontend and backend are served from the same domain (localhost) to ensure cookies work properly. Traefik routes requests to /api, /game, and /healthcheck to the backend, while all other requests go to the frontend.
Enjoy the game! 🎮