You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+75Lines changed: 75 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,3 +7,78 @@ Useful saved commands, auto-moderation tools, and more, for the Reactiflux serve
7
7
Contact @vcarl (`@vcarl#7694` in Discord) for help getting into the test server.
8
8
9
9
See [the contributing guide](./CONTRIBUTING.md) for specific instructions.
10
+
11
+
## Testing deployment
12
+
13
+
You must have a working `.env` file that enables you to run the bot locally. With the values in `.env`, create a `reactibot-env` secret in your local minikube cluster. Everything must be provided a value, but it's okay if some of them are just random strings.
14
+
15
+
```sh
16
+
kubectl create secret generic reactibot-env \
17
+
--from-literal=DISCORD_HASH= \
18
+
--from-literal=DISCORD_PUBLIC_KEY= \
19
+
--from-literal=DISCORD_APP_ID= \
20
+
--from-literal=GUILD_ID= \
21
+
--from-literal=OPENAI_KEY='<only needed if testing resume review>' \
22
+
--from-literal=GH_READ_TOKEN='<only needed if testing React docs integration>' \
23
+
--from-literal=AMPLITUDE_KEY='<optional, use random string>'
24
+
```
25
+
26
+
(you can delete this secret with `kubectl delete secret reactibot-env`)
27
+
28
+
### Locally
29
+
30
+
Set up kubectl and minikube locally. It's kinda hard.
31
+
32
+
Start up a local Docker image registry.
33
+
34
+
```sh
35
+
docker run -d -p 5000:5000 --name registry registry:2.7
36
+
```
37
+
38
+
`-d` means this will run in "detached mode", so it will exit without logs after pulling required images and starting. You can view logs for it with `docker logs -f registry`.
39
+
40
+
Create a file, `k8s-context`, in the project root, alongside the Dockerfile, with an IMAGE variable for kubectl to use.
41
+
42
+
```sh
43
+
echo IMAGE=reactibot:latest > k8s-context
44
+
```
45
+
46
+
Run a docker build and tag it. We need to retrieve the image ID of the build we run, which complicates the command.
If it doesn't deploy correctly (e.g. `kubectl get pods` shows a status other than success), you can debug it with `kubectl describe pod reactibot-deployment`
60
+
61
+
### Testing with GHCR
62
+
63
+
I actually couldn't get a local registry working so I fell back on using ghcr.io, GitHub container registry.
64
+
65
+
Create a file, `k8s-context`, in the project root, alongside the Dockerfile, with an IMAGE variable for kubectl to use.
If it doesn't deploy correctly (e.g. `kubectl get pods` shows a status other than success), you can debug it with `kubectl describe pod reactibot-deployment`
0 commit comments