/chess-backend

Primary LanguageElixirMIT LicenseMIT

ExChess - Backend

Table of Contents
  1. Built With
  2. Getting Started
  3. Documentation
  4. License

Built With

(back to top)

Getting Started

If you want to use the docker container you can skip the Prerequisites section and go to Configuration.

Prerequisites

Erlang + Elixir 1.14.2 / OTP 25

Stockfish

  • Linux/MacOS Download the latest version of stockfish:

    git clone https://github.com/official-stockfish/Stockfish
  • Build the project

    cd src
    make help
    make net
    make build ARCH=x86-64-modern
  • Install it

    sudo make install

Configuration

Database

In order to launch the database server, you need to launch the Docker container. Rename docker-compose.yml.example to docker-compose.yml and set the follwing environment variables:

app:
  environment:
    DB_USER: "<DB_USER>"
    DB_PASSWORD: "<DB_PASSWORD>"
db:
  environment:
    POSTGRES_USER: <DB_USER>
    POSTGRES_PASSWORD: <DB_PASSWORD>

Installation

In can either install Elixir's binaries directly on your machine or you can use a docker container that provides an already configured development environment.

On your machine

  1. Install dependencies

    mix deps.get
  2. Compile the dependencies

    mix deps.compile
  3. Launch the database container

    docker compose up -d
  4. Create database and lanch migrations

    mix ecto.create
    mix ecto.migrate
  5. Populate the database

    mix run ./priv/repo/seeds.exs
  6. Finally, launch the web server

    mix phx.server

    Or you if want to have a console and execute Elixir code in live (just like Ruby on Rails console/irb):

    iex -S mix phx.server

On the container

  1. Build Phoenix and Stockfish images

    docker-compose build
  2. Run all containers

    docker-compose up -d
  3. Check the logs

    docker-compose logs -f

(back to top)

Directory structure

Just like most web applications written in Elixir, this project follows the directory structure defined for Phoenix. The excellent official documentation explains in great detail the purpose of each directory.

The unit tests can be found under the test/ directory.

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE for more information.

(back to top)

Contact

(back to top)