1* Codies
2
3This is a fork of [[https://github.com/eltmon/codies][eltmon/codies]] from GitHub. I run my own instance of it
4but, but it's just for friends; the old one run by the original creator,
5[[https://codies.xyz][codies.xyz]], was taken down due to copyright issues and I would prefer to
6avoid the same thing happening to mine. If you would like to host this
7yourself, please follow the included instructions.
8
9*From the original README:*
10
11Yet another Codenames webapp. Featuring:
12
13- Custom word packs
14- Timed mode
15- Quick room joining
16- Dark/light mode
17- Responsiveness for mobile play
18- And more!
19
20This is entirely inspired by the wonderful [[https://github.com/Joooop/codenames.plus][codenames.plus]], which works
21very well, but hasn't been scaling too well recently. I wanted an
22opportunity to learn TypeScript and React, and figured I could make
23something that worked just as well with a few extra niceties (and a more
24stable backend).
25
26[[file:docs/screenshot1.png]]
27
28* Installation
29
30** Prerequisites
31
32First, you'll need Golang 1.15 and Node 14 for building codies. Take a
33look at golang's [[https://golang.org/dl/][download]] page and follow the related documentation for
34[[https://golang.org/doc/install][installing with the binary]] or [[https://golang.org/doc/install/source][from source]], then for Node, try
35[[https://github.com/nodesource/distributions][NodeSource]].
36
37** Creating users
38Running codies as root is not recommended. Please run the following
39commands to create a new unprivileged user and execute all of the
40commands in the following section as that user.
41
42#+BEGIN_SRC bash
43 useradd -Ums /bin/bash codies
44 su -c /bin/bash - codies
45 git clone https://git.nixnet.services/Misc-Mirrors/codies.git
46 cd codies
47#+END_SRC
48
49** Building the frontend
50#+BEGIN_SRC bash
51 cd frontend
52 yarn install --frozen-lockfile
53 yarn build
54#+END_SRC
55
56** Building the backend
57#+BEGIN_SRC bash
58 go mod download
59 go run github.com/markbates/pkger/cmd/pkger
60 go run github.com/markbates/pkger/cmd/pkger -o internal/pkger
61 go build -ldflags="-X github.com/zikaeroh/codies/internal/version.version=1.15" .
62#+END_SRC
63
64** Running
65Execute the binary to ensure it all works properly:
66#+BEGIN_SRC bash
67 ./codies --debug
68#+END_SRC
69
70** Daemonizing
71If you want it to start as soon as your machine boots and that it
72restarts on crash, you'll need to run it with a supervisor like OpenRC,
73runit, or systemd.
74
75Below is a service file for systemd. If you want to use it, paste the
76contents into ~/etc/systemd/system/codies.service~.
77
78#+BEGIN_SRC text
79 [Unit]
80 Description=Codies
81 After=network.target network-online.target
82 Requires=network-online.target
83
84 [Service]
85 Type=simple
86 User=codies
87 Group=codies
88 WorkingDirectory=/home/codies/codies
89 ExecStart=/home/codies/codies/codies --debug
90 TimeoutStopSec=5s
91 PrivateTmp=true
92 ProtectSystem=full
93
94 [Install]
95 WantedBy=multi-user.target
96#+END_SRC
97
98** Reverse proxy
99Runing codies behind a reverse proxy is recommended. With [[https://caddyserver.com/][Caddy]], this is
100as simple as
101
102#+BEGIN_SRC text
103 example.com {
104 encode zstd gzip
105 reverse_proxy localhost:5000
106 }
107#+END_SRC
108
109For NGINX, the vhost could look something like this
110#+BEGIN_SRC text
111 server {
112 listen 443 ssl http2;
113 listen [::]:443 ssl http2;
114
115 server_name example.com;
116
117 ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
118 ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
119
120 location /
121 proxy_pass http://localhost:5000;
122 proxy_http_version 1.1;
123 proxy_set_header Upgrade $http_upgrade;
124 proxy_set_header Connection "Upgrade";
125 proxy_set_header Host $host;
126 }
127 }
128#+END_SRC