From fe50e1331bfd30c6e7256ac48e2bdd4465463ab3 Mon Sep 17 00:00:00 2001 From: Sheldan <5037282+Sheldan@users.noreply.github.com> Date: Mon, 25 Dec 2023 19:04:22 +0100 Subject: [PATCH] [OPB-xxx] updating abstracto version enabling giveaway and image generation feature --- .env | 4 ++ .github/workflows/release.yml | 3 +- Tiltfile | 2 + application/executable/pom.xml | 10 +++ .../oneplus-bot/templates/deployment.yaml | 4 ++ .../private-rest-api-deployment.yaml | 65 +++++++++++++++++++ .../templates/private-rest-api-service.yaml | 12 ++++ deployment/helm/oneplus-bot/values.yaml | 36 +++++++++- deployment/image-packaging/pom.xml | 62 ++++++++++++++++++ .../image-packaging/src/main/docker/.env | 2 - .../db-data/config/artifact_versions.json | 2 + .../src/main/docker/docker-compose.yml | 15 ----- .../main/docker/private-rest-api/Dockerfile | 6 ++ .../config/artifact_versions.json | 4 +- docker-compose.yml | 22 +++++++ pom.xml | 6 +- 16 files changed, 228 insertions(+), 27 deletions(-) create mode 100644 .env create mode 100644 deployment/helm/oneplus-bot/templates/private-rest-api-deployment.yaml create mode 100644 deployment/helm/oneplus-bot/templates/private-rest-api-service.yaml delete mode 100644 deployment/image-packaging/src/main/docker/.env delete mode 100644 deployment/image-packaging/src/main/docker/docker-compose.yml create mode 100644 deployment/image-packaging/src/main/docker/private-rest-api/Dockerfile create mode 100644 docker-compose.yml diff --git a/.env b/.env new file mode 100644 index 0000000..24bf10e --- /dev/null +++ b/.env @@ -0,0 +1,4 @@ +REGISTRY_PREFIX=harbor.sheldan.dev/oneplus-bot/ +ABSTRACTO_PREFIX=harbor.sheldan.dev/abstracto/ +VERSION=1.6.12 +ABSTRACTO_VERSION=1.5.18 \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c15c8f1..bd2f09e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,9 +33,8 @@ jobs: id: dotenv uses: falti/dotenv-action@v1.0.4 with: - path: ./deployment/image-packaging/src/main/docker/.env + path: .env - name: Push container - working-directory: ./deployment/image-packaging/src/main/docker run: docker-compose build && docker-compose push env: REGISTRY_PREFIX: ${{ steps.dotenv.outputs.registry_prefix }} diff --git a/Tiltfile b/Tiltfile index be729ca..a67b32e 100644 --- a/Tiltfile +++ b/Tiltfile @@ -2,6 +2,7 @@ allow_k8s_contexts('k8s-cluster') load('ext://restart_process', 'docker_build_with_restart') registry = 'harbor.sheldan.dev/oneplus-bot/' +abstracto_registry = 'harbor.sheldan.dev/abstracto/' local_resource( 'oneplus-bot-java-compile', @@ -29,6 +30,7 @@ docker_build_with_restart( docker_build(registry + 'oneplus-bot-db-data', 'deployment/image-packaging/src/main/docker/db-data/') docker_build(registry + 'oneplus-bot-template-data', 'deployment/image-packaging/src/main/docker/template-data/') +docker_build(registry + 'oneplus-bot-private-rest-api', 'deployment/image-packaging/src/main/docker/private-rest-api/', build_args={'REGISTRY_PREFIX': abstracto_registry}) k8s_yaml(helm('deployment/helm/oneplus-bot', values= diff --git a/application/executable/pom.xml b/application/executable/pom.xml index 29efc76..ace6087 100644 --- a/application/executable/pom.xml +++ b/application/executable/pom.xml @@ -151,6 +151,16 @@ experience-tracking-impl + + dev.sheldan.abstracto.modules + giveaway-impl + + + + dev.sheldan.abstracto.modules + image-generation-impl + + dev.sheldan.abstracto.modules moderation-impl diff --git a/deployment/helm/oneplus-bot/templates/deployment.yaml b/deployment/helm/oneplus-bot/templates/deployment.yaml index f5816b1..4b4f000 100644 --- a/deployment/helm/oneplus-bot/templates/deployment.yaml +++ b/deployment/helm/oneplus-bot/templates/deployment.yaml @@ -71,6 +71,10 @@ spec: secretKeyRef: name: api-keys key: youtubeApiKey + - name: PRIVATE_REST_API_HOST + value: "{{ .Values.privateRestApi.service.name }}.{{ .Release.Namespace }}.svc.cluster.local" + - name: PRIVATE_REST_API_PORT + value: "{{ .Values.privateRestApi.service.targetPort }}" {{- range $key, $value := .Values.bot.propertyConfig }} - name: {{ $key | quote }} value: {{ $value | quote}} diff --git a/deployment/helm/oneplus-bot/templates/private-rest-api-deployment.yaml b/deployment/helm/oneplus-bot/templates/private-rest-api-deployment.yaml new file mode 100644 index 0000000..53298ba --- /dev/null +++ b/deployment/helm/oneplus-bot/templates/private-rest-api-deployment.yaml @@ -0,0 +1,65 @@ +{{- if .Values.privateRestApi.enabled -}} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "oneplusBot.fullname" . }}-private-rest-api +spec: + replicas: 1 + selector: + matchLabels: + app: private-rest-api + template: + metadata: + {{- with .Values.privateRestApi.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + app: private-rest-api + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "oneplusBot.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.privateRestApi.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }}-private-rest-api + securityContext: + {{- toYaml .Values.privateRestApi.securityContext | nindent 12 }} + image: "{{ .Values.privateRestApi.repository }}/{{ .Values.privateRestApi.image }}:{{ .Values.privateRestApi.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.privateRestApi.pullPolicy }} + ports: + - name: {{ .Values.privateRestApi.service.name }} + containerPort: {{ .Values.privateRestApi.service.port }} + protocol: TCP + livenessProbe: + httpGet: + path: / + port: {{ .Values.privateRestApi.service.port }} + initialDelaySeconds: {{ $.Values.privateRestApi.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ $.Values.privateRestApi.livenessProbe.periodSeconds }} + failureThreshold: {{ $.Values.privateRestApi.livenessProbe.failureThreshold }} + readinessProbe: + httpGet: + path: / + port: {{ .Values.privateRestApi.service.port }} + initialDelaySeconds: {{ $.Values.privateRestApi.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ $.Values.privateRestApi.readinessProbe.periodSeconds }} + failureThreshold: {{ $.Values.privateRestApi.readinessProbe.failureThreshold }} + resources: + {{- toYaml .Values.privateRestApi.resources | nindent 12 }} + {{- with .Values.privateRestApi.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.privateRestApi.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.privateRestApi.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/deployment/helm/oneplus-bot/templates/private-rest-api-service.yaml b/deployment/helm/oneplus-bot/templates/private-rest-api-service.yaml new file mode 100644 index 0000000..8fb3667 --- /dev/null +++ b/deployment/helm/oneplus-bot/templates/private-rest-api-service.yaml @@ -0,0 +1,12 @@ +{{- if .Values.privateRestApi.enabled -}} +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.privateRestApi.service.name }} +spec: + selector: + app: private-rest-api + ports: + - port: {{ .Values.privateRestApi.service.targetPort }} + targetPort: {{ .Values.privateRestApi.service.port }} +{{- end }} diff --git a/deployment/helm/oneplus-bot/values.yaml b/deployment/helm/oneplus-bot/values.yaml index 81b9271..489319d 100644 --- a/deployment/helm/oneplus-bot/values.yaml +++ b/deployment/helm/oneplus-bot/values.yaml @@ -27,7 +27,7 @@ templateDeployment: repository: harbor.sheldan.dev/abstracto pullPolicy: Always image: abstracto-template-deployment - tag: 1.5.12 + tag: 1.5.18 templateDeploymentData: repository: harbor.sheldan.dev/oneplus-bot @@ -40,7 +40,7 @@ dbConfigDeployment: repository: harbor.sheldan.dev/abstracto pullPolicy: Always image: abstracto-db-deployment - tag: 1.5.12 + tag: 1.5.18 dbConfigDeploymentData: repository: harbor.sheldan.dev/oneplus-bot @@ -55,6 +55,38 @@ dbCredentials: password: name: +privateRestApi: + enabled: true + repository: harbor.sheldan.dev/oneplus-bot + pullPolicy: Always + image: oneplus-bot-private-rest-api + tag: 1.6.12 + podAnnotations: {} + podSecurityContext: {} + securityContext: {} + livenessProbe: + initialDelaySeconds: 2 + periodSeconds: 5 + failureThreshold: 3 + readinessProbe: + initialDelaySeconds: 2 + periodSeconds: 5 + failureThreshold: 3 + service: + port: 8080 + targetPort: 80 + name: private-restapi # must be less than 16 chars + resources: + limits: + cpu: + memory: + requests: + cpu: + memory: + nodeSelector: {} + tolerations: [] + affinity: {} + grafanaDeployment: repository: harbor.sheldan.dev/grafana-tools pullPolicy: Always diff --git a/deployment/image-packaging/pom.xml b/deployment/image-packaging/pom.xml index ad1abd9..da888aa 100644 --- a/deployment/image-packaging/pom.xml +++ b/deployment/image-packaging/pom.xml @@ -200,6 +200,26 @@ statistic.zip + + dev.sheldan.abstracto-templates.templates + giveaway + ${abstracto.templates.version} + zip + true + ${file.basedir}/template-data/template-artifacts/ + giveaway.zip + + + + dev.sheldan.abstracto-templates.templates + image-generation + ${abstracto.templates.version} + zip + true + ${file.basedir}/template-data/template-artifacts/ + image-generation.zip + + dev.sheldan.abstracto-templates.templates logging @@ -442,6 +462,26 @@ logging.zip + + dev.sheldan.abstracto-templates.translations + giveaway + ${abstracto.templates.version} + zip + true + ${file.basedir}/template-data/translation-artifacts/ + giveaway.zip + + + + dev.sheldan.abstracto-templates.translations + image-generation + ${abstracto.templates.version} + zip + true + ${file.basedir}/template-data/translation-artifacts/ + image-generation.zip + + dev.sheldan.oneplus.bot.templates.translations.customizations starboard-customization-translations @@ -745,6 +785,28 @@ logging.zip + + dev.sheldan.abstracto.modules + giveaway-impl + ${abstracto.version} + liquibase + zip + true + ${file.basedir}/db-data/liquibase-artifacts/ + giveaway.zip + + + + dev.sheldan.abstracto.modules + image-generation-impl + ${abstracto.version} + liquibase + zip + true + ${file.basedir}/db-data/liquibase-artifacts/ + image-generation.zip + + dev.sheldan.oneplus.bot.application.custom diff --git a/deployment/image-packaging/src/main/docker/.env b/deployment/image-packaging/src/main/docker/.env deleted file mode 100644 index d49d8b5..0000000 --- a/deployment/image-packaging/src/main/docker/.env +++ /dev/null @@ -1,2 +0,0 @@ -REGISTRY_PREFIX=harbor.sheldan.dev/oneplus-bot/ -VERSION=1.6.12 \ No newline at end of file diff --git a/deployment/image-packaging/src/main/docker/db-data/config/artifact_versions.json b/deployment/image-packaging/src/main/docker/db-data/config/artifact_versions.json index ae843e9..2feb0ba 100644 --- a/deployment/image-packaging/src/main/docker/db-data/config/artifact_versions.json +++ b/deployment/image-packaging/src/main/docker/db-data/config/artifact_versions.json @@ -9,6 +9,8 @@ { "zip": "starboard", "file": "starboard-changeLog.xml"}, { "zip": "remind", "file": "remind-changeLog.xml"}, { "zip": "logging", "file": "logging-changeLog.xml"}, + { "zip": "giveaway", "file": "giveaway-changeLog.xml"}, + { "zip": "image-generation", "file": "imageGeneration-changeLog.xml"}, { "zip": "suggestion", "file": "suggestion-changeLog.xml"}, { "zip": "invite-filter", "file": "inviteFilter-changeLog.xml"}, { "zip": "profanity-filter", "file": "profanityFilter-changeLog.xml"}, diff --git a/deployment/image-packaging/src/main/docker/docker-compose.yml b/deployment/image-packaging/src/main/docker/docker-compose.yml deleted file mode 100644 index bd49a8d..0000000 --- a/deployment/image-packaging/src/main/docker/docker-compose.yml +++ /dev/null @@ -1,15 +0,0 @@ -version: "3.7" - -services: - bot: - build: - context: oneplusbot - image: ${REGISTRY_PREFIX}oneplus-bot-image:${VERSION:-latest} - db-data: - build: - context: db-data - image: ${REGISTRY_PREFIX}oneplus-bot-db-data:${VERSION:-latest} - template-data: - build: - context: template-data - image: ${REGISTRY_PREFIX}oneplus-bot-template-data:${VERSION:-latest} \ No newline at end of file diff --git a/deployment/image-packaging/src/main/docker/private-rest-api/Dockerfile b/deployment/image-packaging/src/main/docker/private-rest-api/Dockerfile new file mode 100644 index 0000000..a895069 --- /dev/null +++ b/deployment/image-packaging/src/main/docker/private-rest-api/Dockerfile @@ -0,0 +1,6 @@ +ARG REGISTRY_PREFIX +ARG ABSTRACTO_VERSION +FROM ${REGISTRY_PREFIX}abstracto-rest-api-image-gen:${ABSTRACTO_VERSION:-latest} AS image-gen-api + +FROM ${REGISTRY_PREFIX}abstracto-rest-api:${ABSTRACTO_VERSION:-latest} AS running-image +COPY --from=image-gen-api /python /python \ No newline at end of file diff --git a/deployment/image-packaging/src/main/docker/template-data/config/artifact_versions.json b/deployment/image-packaging/src/main/docker/template-data/config/artifact_versions.json index 95a99ad..270dbb9 100644 --- a/deployment/image-packaging/src/main/docker/template-data/config/artifact_versions.json +++ b/deployment/image-packaging/src/main/docker/template-data/config/artifact_versions.json @@ -1,14 +1,14 @@ { "template_artifacts": ["utility", "core", "entertainment", "starboard", "link-embed", "webservices", "remind", "logging", "suggestion", "invite-filter", "profanity-filter", "statistic", "experience-tracking", "moderation", "modmail", "assignable-roles", - "voice-channel-context", "anti-raid", + "voice-channel-context", "anti-raid", "giveaway", "image-generation", "starboard-custom", "overrides-templates-webservices", "overrides-templates-core", "overrides-templates-logging", "overrides-templates-statistic", "overrides-templates-modmail", "overrides-templates-moderation", "news", "referral", "faq"], "translation_artifacts": ["utility", "core", "entertainment", "starboard", "link-embed", "webservices", "suggestion", "remind", "logging", "invite-filter", "profanity-filter", "statistic", "experience-tracking", "moderation", "modmail", "assignable-roles", - "voice-channel-context", "anti-raid", + "voice-channel-context", "anti-raid", "giveaway", "image-generation", "starboard-custom", "dynamic-activity-custom-translations", "moderation-custom", "overrides-translation-moderation", "news", "setup", "referral", "faq", "seasonal"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..7246b25 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,22 @@ +version: "3.7" + +services: + bot: + build: + context: deployment/image-packaging/src/main/docker/oneplusbot + image: ${REGISTRY_PREFIX}oneplus-bot-image:${VERSION:-latest} + db-data: + build: + context: deployment/image-packaging/src/main/docker/db-data + image: ${REGISTRY_PREFIX}oneplus-bot-db-data:${VERSION:-latest} + private-rest-api-packaging: + build: + context: deployment/image-packaging/src/main/docker/private-rest-api + args: + REGISTRY_PREFIX: ${ABSTRACTO_PREFIX} + ABSTRACTO_VERSION: ${ABSTRACTO_VERSION} + image: ${REGISTRY_PREFIX}oneplus-bot-private-rest-api:${VERSION:-latest} + template-data: + build: + context: deployment/image-packaging/src/main/docker/template-data + image: ${REGISTRY_PREFIX}oneplus-bot-template-data:${VERSION:-latest} \ No newline at end of file diff --git a/pom.xml b/pom.xml index cd5328a..8fd237f 100644 --- a/pom.xml +++ b/pom.xml @@ -17,10 +17,8 @@ 17 17 - - - 1.5.12 - 1.4.23 + 1.5.18 + 1.4.27