Build defiant

This commit is contained in:
Aram 🍐 2019-10-27 00:48:46 -04:00
parent ebb54c74e7
commit 8ab5245778
10 changed files with 261 additions and 0 deletions

View file

@ -2,9 +2,11 @@ variables:
WEBSITE_SRC: ${CI_PROJECT_DIR}/website WEBSITE_SRC: ${CI_PROJECT_DIR}/website
INFRA_SRC: ${CI_PROJECT_DIR}/infra INFRA_SRC: ${CI_PROJECT_DIR}/infra
TEAMSPEAK_SRC: ${CI_PROJECT_DIR}/teamspeak TEAMSPEAK_SRC: ${CI_PROJECT_DIR}/teamspeak
DEFIANT_SRC: ${CI_PROJECT_DIR}/defiant
IMAGE_PREFIX: registry.gitlab.com/momothereal/momoperes.ca IMAGE_PREFIX: registry.gitlab.com/momothereal/momoperes.ca
WEBSITE_IMAGE: ${IMAGE_PREFIX}/website WEBSITE_IMAGE: ${IMAGE_PREFIX}/website
DEFIANT_IMAGE: ${IMAGE_PREFIX}/defiant
KUBECONFIG_PARENT: /etc/deploy KUBECONFIG_PARENT: /etc/deploy
KUBECONFIG: ${KUBECONFIG_PARENT}/config KUBECONFIG: ${KUBECONFIG_PARENT}/config
@ -48,6 +50,8 @@ website:deploy:
changes: changes:
- website/**/* - website/**/*
# INFRA #
infra:deploy: infra:deploy:
stage: deploy stage: deploy
image: lwolf/helm-kubectl-docker:v1.15.4-v2.14.3 image: lwolf/helm-kubectl-docker:v1.15.4-v2.14.3
@ -68,6 +72,8 @@ infra:deploy:
changes: changes:
- infra/**/* - infra/**/*
# TEAMSPEAK #
teamspeak:deploy: teamspeak:deploy:
stage: deploy stage: deploy
image: lwolf/helm-kubectl-docker:v1.15.4-v2.14.3 image: lwolf/helm-kubectl-docker:v1.15.4-v2.14.3
@ -85,3 +91,22 @@ teamspeak:deploy:
- master - master
changes: changes:
- teamspeak/**/* - teamspeak/**/*
# DEFIANT #
defiant:release:
stage: release
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- cd ${DEFIANT_SRC}/src
- git clone https://github.com/momothereal/code-jam-2.git defiant
- cp main_config.yaml defiant/config/main_config.yaml
- echo "Building to ${DEFIANT_IMAGE}:${CI_COMMIT_TAG}"
- echo "{\"auths\":{\"${CI_REGISTRY}\":{\"username\":\"${CI_REGISTRY_USER}\",\"password\":\"${CI_REGISTRY_PASSWORD}\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context ${DEFIANT_SRC}/src/defiant --dockerfile ${DEFIANT_SRC}/src/defiant/Dockerfile --destination ${DEFIANT_IMAGE}:${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA} --destination ${DEFIANT_IMAGE}:${CI_COMMIT_REF_SLUG}
only:
changes:
- defiant/**/*

2
defiant/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
.idea/
chart/defiant/manifests/

View file

@ -0,0 +1,5 @@
apiVersion: v1
description: DefiantSails entry for PythonDiscord code jam number 2
engine: gotpl
name: defiant
version: 0.1.0

View file

@ -0,0 +1,50 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}
labels:
app: defiant
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
replicas: 1
selector:
matchLabels:
app: defiant
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
template:
metadata:
{{- if .Values.podAnnotations }}
annotations:
{{ toYaml .Values.podAnnotations | indent 8 }}
{{- end }}
labels:
app: defiant
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
containers:
- name: defiant
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: 80
protocol: TCP
resources:
{{ toYaml .Values.resources | indent 12 }}

View file

@ -0,0 +1,61 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}
labels:
app: rethinkdb
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
replicas: 1
selector:
matchLabels:
app: rethinkdb
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
template:
metadata:
{{- if .Values.podAnnotations }}
annotations:
{{ toYaml .Values.podAnnotations | indent 8 }}
{{- end }}
labels:
app: rethinkdb
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
containers:
- name: defiant
image: "rethinkdb:2.3.6"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: 28015
protocol: TCP
resources:
{{ toYaml .Values.resources | indent 12 }}
volumeMounts:
- mountPath: /data
name: rethinkdb-data
volumes:
- name: rethinkdb-data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ .Values.persistence.existingClaim | default (printf "%s-%s" (.Release.Name) "data") | quote }}
{{- else }}
emptyDir: {}
{{- end }}

View file

@ -0,0 +1,28 @@
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ .Release.Name }}-data
labels:
app: checkmk
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if .Values.persistence.annotations }}
annotations:
{{ toYaml .Values.persistence.annotations | indent 4 }}
{{- end }}
spec:
accessModes:
- {{ .Values.persistence.accessMode | quote }}
resources:
requests:
storage: {{ .Values.persistence.storageSize | quote }}
{{- if .Values.persistence.storageClass }}
{{- if (eq "-" .Values.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.persistence.storageClass }}"
{{- end }}
{{- end }}
{{- end }}

View file

@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}
labels:
app: rethinkdb
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
type: ClusterIP
ports:
- targetPort: 28015
protocol: TCP
name: rethinkdb
port: 28015
selector:
app: rethinkdb
release: {{ .Release.Name }}

View file

@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}
labels:
app: defiant
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
type: ClusterIP
ports:
- targetPort: 80
protocol: TCP
name: defiant-voice
port: 80
selector:
app: defiant
release: {{ .Release.Name }}

View file

@ -0,0 +1,26 @@
image:
repository: registry.gitlab.com/momothereal/momoperes.ca/defiant
tag: latest
pullPolicy: Always
podAnnotations: {}
resources:
limits:
cpu: 250m
memory: 512Mi
requests:
cpu: 100m
memory: 256Mi
nodeSelector: {}
tolerations: []
affinity: {}
persistence:
enabled: true
accessMode: ReadWriteOnce
annotations:
"helm.sh/resource-policy": keep
storageClass: do-block-storage
storageSize: 1Gi

View file

@ -0,0 +1,26 @@
web:
# Flask (web) configuration
ip: "0.0.0.0"
port: 80
database:
# RethinkDB configuration
ip: "rethinkdb.public"
port: 28015
database_name: "battle_myth_theater"
admin:
username: "admin" #Insecure, change from example credentials.
password: "admin" #Insecure, change from example credentials.
game:
max_stat_points: 20
debug: true
stories:
# Path to FFMPEG executable
ffmpeg: "/usr/bin/ffmpeg"
# Max story count per user.
# Note: this is ignored when 'debug' is set to true
max_story_count: 10