/chess-club

Chess Club is an Open Source General-Purpose Learning Platform.

Primary LanguageElixirGNU Affero General Public License v3.0AGPL-3.0

ChessClub


Mission


Want to own and operate a learning platform?

This code should help.


Usage


source api/venv/bin/activate
iex -S mix phx.server

To run all tests: Elm, Elixir, and Cypress:

./scripts/ci.bash

Install an elm dependency:

npm run elm install mdgriffith/elm-ui --prefix assets

First time setup


Install python deps

This project uses a Python library for move generation.

So the first step is to wrap your python dependencies in a virtual environment:

pushd api
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.py
popd

To deactivate venv later:

deactivate

Configure your environment variables:

This project is optimized to be used with direnv

cp .envrc{.example,}

Edit as needed for production. . .


Deployment


Elixir release

cp rel/ansible/inventory/main.yml{.example,}

Edit inventory file with actual nodes.

Use the script

./scripts/deploy_prod.bash

Migrate the database

SSH into the host:

  • edit /opt/chess_club/chess_club.env to be able to source variables
  • and then run:
/opt/chess_club/bin/prod eval "ChessClub.Release.migrate"

Setting up a fresh environment on AWS. Must have environment variables in place.

cd rel/terraform
terraform apply

MIX_ENV=prod mix ansible.playbook setup

TODO (LfG - Looking for Group)


Modules missing test coverage:

[ ] Mutation -> makeMove [ ] Subcriptions -> MoveMade


Inspirations


Want to understand how this project was built?


BEGIN GENERATED


To start your Phoenix server:

  • Install dependencies with mix deps.get
  • Create and migrate your database with mix ecto.setup
  • Install Node.js dependencies with npm install inside the assets directory
  • Start Phoenix endpoint with mix phx.server

Now you can visit localhost:4000 from your browser.

Ready to run in production? Please check our deployment guides.

Learn more


END GENERATED