Go to file
Amolith 8ccbce977f
correct typo
2021-10-02 23:39:33 -04:00
docs Initial commit 2020-05-23 14:51:11 -07:00
frontend Update to CRA 4 2020-10-23 20:23:19 -07:00
internal add expanded word list 2021-10-02 23:27:38 -04:00
.gitignore Use pkger for static assets 2020-06-06 14:01:45 -07:00
Dockerfile Bump to Go 1.15 2020-08-12 16:46:59 -07:00
LICENSE Initial commit 2020-05-23 14:51:11 -07:00
README.org correct typo 2021-10-02 23:39:33 -04:00
go.mod Update deps 2020-10-20 20:55:58 -07:00
go.sum Update deps 2020-10-20 20:55:58 -07:00
helpers.go Use hashids for player IDs, drop UUID uses 2020-06-14 14:01:17 -07:00
main.go Update golangci-lint, deps 2020-08-02 21:08:33 -07:00
metrics.go Add prometheus metrics 2020-05-24 22:18:35 -07:00
tools.go Use pkger for static assets 2020-06-06 14:01:45 -07:00

README.org

Codies

This is a fork of eltmon/codies from GitHub. I run my own instance of it but, it's just for friends; the old one run by the original creator, codies.xyz, was taken down due to copyright issues and I would prefer to avoid the same thing happening to mine. If you would like to host this yourself, please follow the included instructions.

From the original README:

Yet another Codenames webapp. Featuring:

  • Custom word packs
  • Timed mode
  • Quick room joining
  • Dark/light mode
  • Responsiveness for mobile play
  • And more!

This is entirely inspired by the wonderful codenames.plus, which works very well, but hasn't been scaling too well recently. I wanted an opportunity to learn TypeScript and React, and figured I could make something that worked just as well with a few extra niceties (and a more stable backend).

/Amolith/codies/media/commit/8ccbce977f191d7b1fd6871eca05cb5e2068484f/docs/screenshot1.png

Manual installation

Prerequisites

First, you'll need Golang 1.15 and Node 14 for building codies. Take a look at golang's download page and follow the related documentation for installing with the binary or from source, then for Node, try NodeSource.

Creating users

Running codies as root is not recommended. Please run the following commands to create a new unprivileged user and execute all of the commands in the following section as that user.

  useradd -Ums /bin/bash codies
  su -c /bin/bash - codies
  git clone https://git.nixnet.services/Misc-Mirrors/codies.git
  cd codies

Building the frontend

  cd frontend
  yarn install --frozen-lockfile
  yarn build

Building the backend

  go mod download
  go run github.com/markbates/pkger/cmd/pkger
  go run github.com/markbates/pkger/cmd/pkger -o internal/pkger
  go build -ldflags="-X github.com/zikaeroh/codies/internal/version.version=1.15" .

Running

Execute the binary to ensure it all works properly:

  ./codies --debug

Daemonizing

If you want it to start as soon as your machine boots and that it restarts on crash, you'll need to run it with a supervisor like OpenRC, runit, or systemd.

Below is a service file for systemd. If you want to use it, paste the contents into /etc/systemd/system/codies.service.

  [Unit]
  Description=Codies
  After=network.target network-online.target
  Requires=network-online.target

  [Service]
  Type=simple
  User=codies
  Group=codies
  WorkingDirectory=/home/codies/codies
  ExecStart=/home/codies/codies/codies --debug
  TimeoutStopSec=5s
  PrivateTmp=true
  ProtectSystem=full

  [Install]
  WantedBy=multi-user.target

Reverse proxy

Runing codies behind a reverse proxy is recommended. With Caddy, this is as simple as

  example.com {
      encode zstd gzip
      reverse_proxy localhost:5000
  }

For NGINX, the vhost could look something like this

  server {
      listen 443 ssl http2;
      listen [::]:443 ssl http2;

      server_name example.com;

      ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
      ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;

      location /
          proxy_pass http://localhost:5000;
          proxy_http_version 1.1;
          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection "Upgrade";
          proxy_set_header Host $host;
      }
  }

Docker installation

The Dockerfile will only be kept as long as it continues working. My goal in forking the app is to rip Docker out and package the entire thing up in a single statically-linked binary.

I don't know whether this will actually succeed, but here you go!

  docker build -t codies .
  docker run -p 5000:5000 codies