This is the back end for the online twitch-chat game otter chaos.
This game was designed, built and deployed in 24 hours by Sergi Tortosa, Adria Abella and me for the Global Game Jam 2020.
Demo:
This project is build using nix
+ cabal-install
.
After installing both nix
and cabal-install
, you can compile the project:
$ nix-build
The hack the project you can use nix-shell
:
$ nix-shell
shell> cabal v1-configure
shell> cabal v1-build
shell> cabal v1-run
This service is deploying using nixops.
After installing nix/nixops (google it), you only need to do the following:
- Add your aws credentials to ~/.aws/credentials (google it)
- Execute the following commands:
$ nixops create --deployment twitch-game logical.nix physical.nix
$ nixops deploy --deployment twitch-game
This is probably not gonna work on a Windows/macOS because nixOps tries to compile the derivation locally if the architecture matches but delegates the compilation to the server if it doesn't match. The instance is small and resources like memory and disk are scarce so when nix tries to compile it, it end up with an OutOfMemory error.
This will create a new ec2 machine with this service running as a systemd unit.
You can query the status of your ec2 instance:
$ nixops info --deployment twitch-game
SSH Connection to the server:
$ nixops ssh --deployment twitch-game machine
# Check the status of the service
ec2:root> systemctl status twitch-game
ec2:root> journalctl -f -u twitch-game
Stop the ec2 instance and remove it (answer 'y' to the questions):
nixops destroy -d twitch-game && nixops delete -d twitch-game
- Unhardcode the port
- Replace STM for MVar (performance and bugs)
- TLS on IRC connection
*STM suffers from performance degradation as the number of concurrent users grows.
** There is possible some race conditions that I need to fix.