The Clash of Clans API provides near real time access to game related data.
To run this Clash API proxy using Docker Compose, follow these steps:
- Docker installed.
- Docker Compose installed.
- An active CoC Developer account.
-
Clone the repository:
git clone https://github.com/SilverKnightKMA/clash-api-proxy
cd clash-api-proxy -
Configure Environment Variables:
The project uses a
.envfile for configuration. A template is provided as.env.example.Copy the example file to create your
.envfile:cp .env.example .env
Now, edit the newly created
.envfile using a text editor. You must update the following variables according to your Clash API configuration:-
PORT: The port number on which the proxy service will listen for incoming HTTP requests.- Example:
PORT=5000
- Example:
-
HOST: The host or IP address the proxy service will bind to. Use0.0.0.0to make the proxy accessible from any interface.- Example:
HOST=0.0.0.0
- Example:
-
API_SERVICE_URL: Clash of Clan API- Example:
API_SERVICE_URL=https://api.clashofclans.com/v1
- Example:
-
DOMAIN: Your Domain/IP- Example:
DOMAIN=https://your.domain
- Example:
-
EMAIL: The email address required for authentication with CoC API (API_SERVICE_URL).- Example:
EMAIL=your.api.email@example.com
- Example:
-
PASSWORD: The password associated with theEMAILfor authentication with CoC API.- Example:
PASSWORD=your_api_password
- Example:
-
GAME: An identifier for the game.- Example:
GAME=clashofclans
- Example:
Save the changes to the
.envfile. -
-
Run with Docker Compose:
In the project directory (
clash-api-proxy), execute the following command to build the Docker image (if necessary) and start the container(s) defined indocker-compose.ymlin detached mode (running in the background):docker compose up -d
- Check if the container is running:
docker compose ps
- View the logs of the container to check for any errors during startup:
docker compose logs -f
- By default, the proxy container exposes port
5000(checkdocker-compose.yml). You should be able to access the proxy:curl http://localhost:5000/info
To stop the running proxy container and clean up the resources (network, etc.) created by docker compose up, run the following command in the project directory:
docker compose down