chessh/README.md

82 lines
2.7 KiB
Markdown
Raw Normal View History

# CheSSH
2023-02-24 17:59:42 -05:00
CheSSH is a distributed multiplayer implementation of the game of Chess over SSH,
written in Elixir, with Discord integrations to deliver alerts when players are
2023-02-25 01:37:52 -05:00
looking for opponents, or in games when it is one's turn.
2023-05-29 19:36:56 -04:00
[![cheSSH demo](https://img.youtube.com/vi/RMnEg-cj5dI/0.jpg)](https://www.youtube.com/watch?v=RMnEg-cj5dI)
2023-02-24 18:06:59 -05:00
## Bots
As a user, you can create 2 bot accounts at [/bots](https://chessh.linux.usu.edu/bots). These are driven by
webhooks.
For an example bot, see [chessh example bot](https://github.com/Simponic/chessh_bot).
2023-02-24 17:59:42 -05:00
## Usage
### Dependencies
+ `npm`
+ `elixir`
+ `postgresql`
2023-02-25 01:37:52 -05:00
+ `redis` (which you can ignore if you only use the ETS backend for Hammer in
`config/dev.exs` [set by default])
2023-02-24 17:59:42 -05:00
### Installation
Do something among the lines of:
```bash
2023-02-24 17:59:42 -05:00
git clone https://github.com/Simponic/chessh
cd chessh
asdf install
2023-02-24 17:59:42 -05:00
cp .env.example .env
2023-03-15 18:46:13 -04:00
vim .env # Fill it out mf
2023-02-24 17:59:42 -05:00
chmod 0700 .env
export $(cat .env | xargs)
2023-03-15 18:46:13 -04:00
# In one shell (after filling in your .env), migrate schema and start CheSSH
2023-02-24 17:59:42 -05:00
mix ecto.create
mix ecto.migrate
2023-03-15 18:46:13 -04:00
mix deps.compile
2023-02-24 17:59:42 -05:00
2023-03-15 18:46:13 -04:00
# Install frontend stuff
2023-02-24 17:59:42 -05:00
cd front
npm install
# Generate SSH keys
cd ../priv
./make_keys.sh
2023-03-15 18:46:13 -04:00
# Run the frontend and server concurrently!
cd ..
npm install -g concurrently
concurrently "mix run --no-halt" "cd front && npm start"
2023-02-24 17:59:42 -05:00
```
2023-02-25 01:37:52 -05:00
## Architecture
The process of building the pi cluster is wholly contained in the awful
`buildscripts`, which will individually `ssh` into separate pi's and build the
services locally there as well as update the load balancer pi's configurations for nginx
and HAproxy.
More architecture talk of CheSSH can be found in my (albeit kinda cringe) FSLC
presentation on Elixir:
[https://github.com/Simponic/chessh/blob/main/presentation/chessh.org](https://github.com/Simponic/chessh/blob/main/presentation/chessh.org)
2023-02-25 01:39:34 -05:00
## Environment Variables (mostly optional)
2023-02-24 17:59:42 -05:00
+ `REACT_APP_DISCORD_INVITE` is the invite link to the discord server with the
CheSSH bot
2023-02-25 01:39:34 -05:00
+ `REACT_APP_DISCORD_OAUTH` is the link (after replacing the GET URL params) that will
be used to initiate discord OAUTH from the frontend
2023-02-24 17:59:42 -05:00
+ `CLIENT_REDIRECT_AFTER_OAUTH` & `SERVER_REDIRECT_URI` are self-explanatory
+ `REACT_APP_SSH_SERVER` and `REACT_APP_SSH_PORT` are used to build the .ssh config
given to users on the home page of CheSSH after authentication
2023-02-25 01:39:34 -05:00
+ `NEW_GAME_PINGABLE_ROLE_ID` is the role id of the role to ping when one is
2023-02-24 17:59:42 -05:00
looking for an opponent
+ `REMIND_MOVE_CHANNEL_ID` is the channel id to create private threads with players
for move reminders and other communications
+ `NEW_GAME_CHANNEL_ID` is similar to the above
2023-02-28 17:07:35 -05:00
+ `CLUSTER_NODES` is a comma-separated list of nodes accepting connections to connect with libclustre