feat(discordgsm) add discordgsm (#4296)

* add(discordGSM) add discordGSM

* set portal to true

* rofs false

* add additional storage

* set APP_TOKEN = -1

* remove env

* disable probes

* rename + postgres dependencies.

* remove whitespace + fix common + postgres

* fix postgres

* rename to discordgsm + truechart image

* fix values property

* fix questions

* fix group

* set ver to 2.8.1 and fix chart

* update commons + postgresql

* Update charts/incubator/discordgsm/docs/installation_notes.md

Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>

* use secret

* whitlelist

* update questions

* correct envs

* add more evns

* add qs

* missing :

* Update charts/incubator/discordgsm/templates/_secret.tpl

Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>

* update commons + postgres

* update version

* remove service and start discord bot only

* disable POSTGRES_SSL_MODE

* comment out web api

* command

* format token

* Update charts/incubator/discordgsm/values.yaml

Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>

* empty app_token

* comment out variable

* Update values.yaml

* Update values.yaml

* test

* fix app_token

* Update token

Fake token

* fix questions

* fix questions

* Update charts/incubator/discordgsm/values.yaml

Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>

Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
This commit is contained in:
Xstar97 2022-11-28 02:40:50 -05:00 committed by GitHub
parent 7c28103711
commit d333fffe95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 375 additions and 0 deletions

View File

@ -0,0 +1,30 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
# OWNERS file for Kubernetes
OWNERS
# helm-docs templates
*.gotmpl
# docs folder
/docs
# icon
icon.png

View File

@ -0,0 +1,33 @@
apiVersion: v2
appVersion: "2.9.0"
dependencies:
- name: common
repository: https://library-charts.truecharts.org
version: 11.0.3
- condition: postgresql.enabled
name: postgresql
repository: https://charts.truecharts.org/
version: 11.0.4
description: A discord bot that monitors your game server and tracks the live data of your game servers.
home: https://truecharts.org/docs/charts/incubator/discordgsm
icon: https://truecharts.org/img/hotlink-ok/chart-icons/discordgsm.png
keywords:
- discordgsm
- game-server
- monitor
kubeVersion: ">=1.16.0-0"
maintainers:
- email: info@truecharts.org
name: TrueCharts
url: https://truecharts.org
name: discordgsm
sources:
- https://github.com/truecharts/charts/tree/master/charts/incubator/discordgsm
- https://github.com/DiscordGSM/GameServerMonitor
version: 0.0.1
annotations:
truecharts.org/catagories: |
- monitor
- discord
truecharts.org/SCALE-support: "true"
truecharts.org/grade: U

View File

@ -0,0 +1 @@
# discordgsm

View File

@ -0,0 +1,12 @@
# Installation Notes
- Set `App Token` to your discord bot token. Here's a basic guide from [discordGSM](https://discordgsm.com/guide/how-to-get-a-discord-bot-token).
- Set `Whitelist Guilds` to the server guild Ids if adding multiple Ids separate with `;`.
Add your discord bot if you haven't done so and run initial commands to get started with discordGSM.
:::info
Checkout discordGSM supported list of game servers [here](https://discordgsm.com/guide/supported-games).
:::

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -0,0 +1,187 @@
# Include{groups}
portals:
open:
# Include{portalLink}
questions:
# Include{global}
# Include{controller}
# Include{replicas}
# Include{replica1}
# Include{controllerExpertExtraArgs}
- variable: gsm
group: App Configuration
label: Discord GSM Configuration
schema:
additional_attrs: true
type: dict
attrs:
- variable: app_token
label: App Token
description: Discord Bot Token.
schema:
type: string
required: true
default: ""
- variable: whitelist_guilds
label: Whitelist Guilds
description: Discord Guild ID
schema:
type: list
required: true
default: []
items:
- variable: whitelist_guild_entry
label: Whitelist Guild Entry
schema:
type: string
required: true
default: ""
- variable: app_activity_type
label: App Activity Type
description: Presence activity type override.
schema:
type: string
required: true
default: "3"
enum:
- value: "0"
description: Playing
- value: "2"
description: Listening
- value: "3"
description: Watching
- value: "5"
description: Playing
- variable: app_activity_name
label: App Activity Name
description: Presence activity name override.
schema:
type: string
default: ""
- variable: app_presence_advertise
label: App Presense Advertise
description: Enable advertisement feature on presence
schema:
type: boolean
default: false
- variable: task_query_server
label: Task Query Server
description: Query servers task scheduled time in seconds.
schema:
type: int
default: 60
- variable: command_query_public
label: Command Query Public
description: Whether the /queryserver command should be available to all users.
schema:
type: boolean
default: false
- variable: command_query_cooldown
label: Command Query Cooldown
description: The /queryserver command cooldown in seconds. (Administrator will not be affected)
schema:
type: int
default: 5
- variable: web_api_enable
label: Web API Enable
description: Enable Web API feature.
schema:
type: boolean
default: false
# Include{containerConfig}
# Include{serviceRoot}
- variable: main
label: Main Service
description: The Primary service on which the healthcheck runs, often the webUI
schema:
additional_attrs: true
type: dict
attrs:
# Include{serviceSelectorLoadBalancer}
# Include{serviceSelectorExtras}
- variable: main
label: Main Service Port Configuration
schema:
additional_attrs: true
type: dict
attrs:
- variable: port
label: Port
description: This port exposes the container port on the service
schema:
type: int
default: 10589
required: true
# Include{serviceExpertRoot}
default: false
# Include{serviceExpert}
# Include{serviceList}
# Include{persistenceRoot}
- variable: config
label: App Config Storage
description: Stores the Application Configuration.
schema:
additional_attrs: true
type: dict
attrs:
# Include{persistenceBasic}
# Include{persistenceList}
# Include{ingressRoot}
- variable: main
label: Main Ingress
schema:
additional_attrs: true
type: dict
attrs:
# Include{ingressDefault}
# Include{ingressTLS}
# Include{ingressTraefik}
# Include{ingressList}
# Include{security}
# Include{securityContextAdvancedRoot}
- variable: privileged
label: Privileged mode
schema:
type: boolean
default: false
- variable: readOnlyRootFilesystem
label: ReadOnly Root Filesystem
schema:
type: boolean
default: false
- variable: allowPrivilegeEscalation
label: Allow Privilege Escalation
schema:
type: boolean
default: false
- variable: runAsNonRoot
label: runAsNonRoot
schema:
type: boolean
default: false
# Include{podSecurityContextRoot}
- variable: runAsUser
label: runAsUser
description: The UserID of the user running the application
schema:
type: int
default: 0
- variable: runAsGroup
label: runAsGroup
description: The groupID this App of the user running the application
schema:
type: int
default: 0
- variable: fsGroup
label: fsGroup
description: The group that should own ALL storage.
schema:
type: int
default: 568
# Include{podSecurityContextAdvanced}
# Include{resources}
# Include{advanced}
# Include{addons}
# Include{codeserver}
# Include{vpn}
# Include{documentation}

View File

@ -0,0 +1,32 @@
{{/* Define the secret */}}
{{- define "gsm.secret" -}}
{{- $secretName := printf "%s-gsm-secret" (include "tc.common.names.fullname" .) }}
---
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: {{ $secretName }}
labels:
{{- include "tc.common.labels" . | nindent 4 }}
stringData:
DATABASE_URL: {{ .Values.postgresql.url.complete | trimAll "\"" }}
DB_CONNECTION: {{ print "postgres" }}
APP_TOKEN: {{ .Values.gsm.app_token | quote }}
{{- with .Values.gsm.whitelist_guilds }}
WHITELIST_GUILDS: {{ join ";" . }}
{{- end }}
APP_ACTIVITY_TYPE: {{ .Values.gsm.app_activity_type | quote }}
{{- with .Values.gsm.app_activity_name }}
APP_ACTIVITY_NAME: {{ . | quote }}
{{- end }}
APP_PRESENCE_ADVERTISE: {{ .Values.gsm.app_presence_advertise | quote }}
POSTGRES_SSL_MODE: {{ .Values.gsm.postgres_ssl_mode | quote }}
TASK_QUERY_SERVER: {{ .Values.gsm.task_query_server | quote }}
COMMAND_QUERY_PUBLIC: {{ .Values.gsm.command_query_public | quote }}
COMMAND_QUERY_COOLDOWN: {{ .Values.gsm.command_query_cooldown | quote }}
WEB_API_ENABLE: {{ .Values.gsm.web_api_enable | quote }}
{{- end }}

View File

@ -0,0 +1,7 @@
{{/* Make sure all variables are set properly */}}
{{- include "tc.common.loader.init" . }}
{{- include "gsm.secret" . -}}
{{/* Render the templates */}}
{{ include "tc.common.loader.apply" . }}

View File

@ -0,0 +1,73 @@
image:
repository: tccr.io/truecharts/game-server-monitor
pullPolicy: IfNotPresent
tag: 2.9.0@sha256:270daf32b89029ea12945698e6087f4b774ae8c01f6a2f14e23080ece30e85c2
securityContext:
runAsNonRoot: false
readOnlyRootFilesystem: false
podSecurityContext:
runAsUser: 0
runAsGroup: 0
command:
- /bin/sh
- -c
- |
gunicorn \
--bind 0.0.0.0:{{ .Values.service.main.ports.main.port }} \
--workers={{ .Values.gsm.workers }} \
--worker-class=gthread app:app \
--timeout {{ .Values.gsm.timeout }} & \
python -u main.py
gsm:
# Server Config
workers: 2
timeout: 90
# Bot Config
# Fake Token for CI
app_token: ""
whitelist_guilds: []
app_activity_type: 3
app_activity_name: ""
app_presence_advertise: false
task_query_server: 60
command_query_public: false
command_query_cooldown: 5
web_api_enable: false
postgres_ssl_mode: disable
envFrom:
- secretRef:
name: '{{ include "tc.common.names.fullname" . }}-gsm-secret'
service:
main:
ports:
main:
port: 10230
protocol: HTTP
probes:
liveness:
type: HTTP
readiness:
type: HTTP
startup:
type: HTTP
persistence:
config:
enabled: true
mountPath: /app/data
postgresql:
enabled: true
existingSecret: dbcreds
postgresqlDatabase: discord_gsm
postgresqlUsername: discord_gsm
portal:
enabled: true