ExChess - Backend
Table of Contents
Built With
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
-
macOS
brew install erlang elixir
-
ArchLinux
pacman -S erlang elixir
-
Windows Checkout Elixir's documentation
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
-
Install dependencies
mix deps.get
-
Compile the dependencies
mix deps.compile
-
Launch the database container
docker compose up -d
-
Create database and lanch migrations
mix ecto.create mix ecto.migrate
-
Populate the database
mix run ./priv/repo/seeds.exs
-
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
-
Build
Phoenix
andStockfish
imagesdocker-compose build
-
Run all containers
docker-compose up -d
-
Check the logs
docker-compose logs -f
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.
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.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
License
Distributed under the MIT License. See LICENSE
for more information.