miles-no / chess-robot

4 stars 1 forks source link

Simplify setup by using Docker #405

Open SjoenH opened 4 months ago

SjoenH commented 4 months ago

Todo:

The Plan

We aim for a simplified setup, ideally to be executed on a Raspberry Pi 5.

Here's a diagram illustrating the necessary application containers:

graph LR
    title[Chess Robot Application Containers]
    database[PostgresSQL]
    chess-logic[Stockfish UCI]
    backend[Python backend - flask api]
    frontend[React frontend]
    database --> backend
    chess-logic --> backend
    backend --> frontend
Component Status
Front-end āœ… Completed. Refer to the frontend folder
Back-end Pending. Requires integration with the chess-board driver
Database Consider using the official image
Chess-logic Utilize tchorwat/stockfish

Front-end

The front-end is completed. Refer to the frontend folder.

Back-end

The back-end is pending. It requires integration with the chess-board driver. Might also need to adjust the python code to use the Stockfish UCI and the database.

Database:

Consider using the official image: https://hub.docker.com/_/postgres

docker run --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres

Chess-logic

A Docker image for this component already exists. Refer to: https://github.com/tchorwat/stockfish

To run the Docker image, use the following command:

docker run -d -p 23249:23249 tchorwat/stockfish

Docker Compose

We can use Docker Compose to manage the containers.

Here's an example of a docker-compose.yml file:

version: '3.8'

services:
  frontend:
    image: frontend:latest
    ports:
      - "3000:3000"

  backend:
    image: backend:latest
    ports:
      - "5000:5000"

  database:
    image: postgres:latest
    environment:
      POSTGRES_PASSWORD: mysecretpassword

  chess-logic:
    image: tchorwat/stockfish:latest
    ports:
      - "23249:23249"
SjoenH commented 3 months ago

@brotherBear please help with python dependencies šŸ™