diff --git a/kubernetes/namespaces/modmail/README.md b/kubernetes/namespaces/modmail/README.md index b78857be..f9a09d2d 100644 --- a/kubernetes/namespaces/modmail/README.md +++ b/kubernetes/namespaces/modmail/README.md @@ -1,12 +1,15 @@ # Modmail -This folder contains the manifests for our Modmail service. +This namespace runs our Modmail system. -## Secrets +| Component | Description | +| --------- | ----------- | +| Polonium (`polonium-api`, `polonium-bot`) | The current Modmail bot. Its manifests are not in this directory. | +| [`barium/`](./barium) | Read-only viewer for logs from the **legacy** Modmail bot, so old `modmail.pydis.wtf/logs/` links keep working. | + +The legacy Modmail bot and its web logviewer have been retired. Their logs were exported from MongoDB +and are now served statically by Barium. -The services require one shared secret called `modmail` containing the following: +## Secrets -| Key | Value | Description | -| ------------------------| ---------------------------------|--------------------------------------------------------------| -| `CONNECTION_URI` | MongoDB connection URI | Used for storing data | -| `TOKEN` | Discord Token | Used to connect to Discord | +The `modmail` secret is shared by the Polonium deployments. diff --git a/kubernetes/namespaces/modmail/barium/README.md b/kubernetes/namespaces/modmail/barium/README.md new file mode 100644 index 00000000..29701422 --- /dev/null +++ b/kubernetes/namespaces/modmail/barium/README.md @@ -0,0 +1,8 @@ +# Barium +Static viewer for logs from the legacy Modmail bot. Serves pre-rendered logs at `/logs/` +(the original `modmail.pydis.wtf` URLs) and a SQLite index for client-side search. + +The image (`ghcr.io/owl-corp/barium`) is private, as it contains the archived logs, and is built +locally from a Modmail export (see the [barium repo](https://github.com/owl-corp/barium)). It needs +no secrets, and is exposed on `modmail.pydis.wtf` through the `modmail-pydis-wtf` route in +`nginx-gateway/routes/service-routes/`. diff --git a/kubernetes/namespaces/modmail/web/deployment.yaml b/kubernetes/namespaces/modmail/barium/deployment.yaml similarity index 56% rename from kubernetes/namespaces/modmail/web/deployment.yaml rename to kubernetes/namespaces/modmail/barium/deployment.yaml index 877e9459..e6c2e431 100644 --- a/kubernetes/namespaces/modmail/web/deployment.yaml +++ b/kubernetes/namespaces/modmail/barium/deployment.yaml @@ -1,38 +1,41 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: modmail-web + name: barium namespace: modmail spec: replicas: 1 selector: matchLabels: - app: modmail-web + app: barium template: metadata: labels: - app: modmail-web + app: barium spec: containers: - - name: modmail-web - image: ghcr.io/python-discord/logviewer:latest + - name: barium + image: ghcr.io/owl-corp/barium:latest imagePullPolicy: Always resources: requests: cpu: 50m - memory: 100Mi + memory: 64Mi limits: - cpu: 100m - memory: 150Mi + cpu: 200m + memory: 128Mi ports: - containerPort: 8000 - envFrom: - - secretRef: - name: modmail - - configMapRef: - name: modmail-config-env + volumeMounts: + - name: tmp + mountPath: /tmp securityContext: readOnlyRootFilesystem: true + volumes: + - name: tmp + emptyDir: {} + imagePullSecrets: + - name: ghcr-pull-secret securityContext: fsGroup: 2000 runAsUser: 1000 diff --git a/kubernetes/namespaces/modmail/web/service.yaml b/kubernetes/namespaces/modmail/barium/service.yaml similarity index 77% rename from kubernetes/namespaces/modmail/web/service.yaml rename to kubernetes/namespaces/modmail/barium/service.yaml index 2ea2e7da..a5b57335 100644 --- a/kubernetes/namespaces/modmail/web/service.yaml +++ b/kubernetes/namespaces/modmail/barium/service.yaml @@ -1,11 +1,11 @@ apiVersion: v1 kind: Service metadata: - name: modmail-web + name: barium namespace: modmail spec: selector: - app: modmail-web + app: barium ports: - protocol: TCP port: 80 diff --git a/kubernetes/namespaces/modmail/bot/README.md b/kubernetes/namespaces/modmail/bot/README.md deleted file mode 100644 index ac29ac2b..00000000 --- a/kubernetes/namespaces/modmail/bot/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Modmail bot -These manifests will provision the resources for an instance of our Modmail bot. - -To deploy this bot simply run: -``` -kubectl apply -f deployment.yaml -``` diff --git a/kubernetes/namespaces/modmail/bot/deployment.yaml b/kubernetes/namespaces/modmail/bot/deployment.yaml deleted file mode 100644 index 3e1ea9b6..00000000 --- a/kubernetes/namespaces/modmail/bot/deployment.yaml +++ /dev/null @@ -1,51 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: modmail-bot - namespace: modmail -spec: - replicas: 1 - selector: - matchLabels: - app: modmail-bot - template: - metadata: - labels: - app: modmail-bot - spec: - containers: - - name: modmail-bot - image: ghcr.io/python-discord/modmail:latest - resources: - requests: - cpu: 75m - memory: 600Mi - limits: - cpu: 125m - memory: 1000Mi - imagePullPolicy: "Always" - volumeMounts: - - mountPath: /opt/modmail/plugins - name: plugins-vol - - mountPath: /opt/modmail/temp - name: temp-vol - env: - - name: TMPDIR - value: /opt/modmail/temp - envFrom: - - secretRef: - name: modmail - - configMapRef: - name: modmail-config-env - securityContext: - readOnlyRootFilesystem: true - volumes: - - name: plugins-vol - emptyDir: {} - - name: temp-vol - emptyDir: - medium: Memory - securityContext: - fsGroup: 2000 - runAsUser: 1000 - runAsNonRoot: true diff --git a/kubernetes/namespaces/modmail/configmap.yaml b/kubernetes/namespaces/modmail/configmap.yaml deleted file mode 100644 index 5d5d8506..00000000 --- a/kubernetes/namespaces/modmail/configmap.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: modmail-config-env - namespace: modmail -data: - DATABASE_TYPE: 'mongodb' # The type of database to use, only supports mongodb right now - DATA_COLLECTION: 'false' # Disable bot metadata collection by modmail devs - DISABLE_AUTOUPDATES: 'yes' - GUILD_ID: '267624335836053506' - LOG_URL: https://modmail.pydis.wtf/ - OWNERS: 165023948638126080,95872159741644800,336843820513755157 - REGISTRY_PLUGINS_ONLY: 'false' # Allow the usage of plugins outside of the official registry diff --git a/kubernetes/namespaces/modmail/web/README.md b/kubernetes/namespaces/modmail/web/README.md deleted file mode 100644 index 7b7e19e0..00000000 --- a/kubernetes/namespaces/modmail/web/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# Modmail web -These manifests provision an instance of the web logviewer for our Modmail system. diff --git a/kubernetes/namespaces/nginx-gateway/routes/service-routes/modmail-pydis-wtf.yaml b/kubernetes/namespaces/nginx-gateway/routes/service-routes/modmail-pydis-wtf.yaml index 8cdb645f..34ff6609 100644 --- a/kubernetes/namespaces/nginx-gateway/routes/service-routes/modmail-pydis-wtf.yaml +++ b/kubernetes/namespaces/nginx-gateway/routes/service-routes/modmail-pydis-wtf.yaml @@ -11,7 +11,7 @@ spec: namespace: nginx-gateway rules: - backendRefs: - - name: modmail-web + - name: barium namespace: modmail port: 80 filters: