Certainly! Here's a README.md
file that provides instructions on how to deploy the Player and Game Master servers using Docker and test the game:
# Number Guessing Game Deployment with Docker
This project consists of two Python servers, a Player server, and a Game Master server, that play a number-guessing game with each other. You can deploy these servers using Docker and test the game.
## Prerequisites
Before you begin, ensure you have the following installed:
- Docker: [Install Docker](https://docs.docker.com/get-docker/)
- Git: [Install Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
## Clone the Repository
Clone this repository to your local machine:
```bash
git clone git@github.com:maddipatla1/application-task-anil.git
```
cd application-task-anil
-
Navigate to the
player
andmaster
directories.cd player
-
Build the Docker image for the Player server:
docker build -t player-server .
-
Navigate to the
master
directory.cd ../master
-
Build the Docker image for the Game Master server:
docker build -t game-master-server .
-
Start the Player server as a Docker container:
docker run -d -p 5000:5000 --name player-container player-server
-
Start the Game Master server as a Docker container:
docker run -d -p 5001:5001 --name game-master-container game-master-server
Now that the Player and Game Master servers are running as Docker containers, you can test the game by making HTTP requests to their respective endpoints.
-
Health Check:
curl http://localhost:5000/health
-
Hostname:
curl http://localhost:5000/hostname
-
Play the Game:
curl http://localhost:5000/play
-
Health Check:
curl http://localhost:5001/health
-
Start a New Game (replace
min_number
andmax_number
with desired values):curl -X POST -H "Content-Type: application/json" -d '{"min_number": 1, "max_number": 1000}' http://localhost:5001/start_game
-
Play a Game (replace
game_id
with the game ID obtained from the previous step):curl http://localhost:5001/play_game/<game_id>
To stop and remove the Docker containers when you're done testing:
docker stop player-container game-master-container
docker rm player-container game-master-container
This concludes the deployment and testing of the Number Guessing Game using Docker. Enjoy watching the Player and Game Master servers play the game!
Replace `"https://github.com/yourusername/number-guessing-game.git"` with the actual URL of your Git repository. This `README.md` provides step-by-step instructions for deploying the servers and testing the game.