mirror of
https://github.com/Sheldan/Sissi.git
synced 2026-01-01 23:35:21 +00:00
[SIS-xxx] updating abstracto version
restructuring api to private and public rest api adding custom image generation module
This commit is contained in:
4
.env
Normal file
4
.env
Normal file
@@ -0,0 +1,4 @@
|
||||
REGISTRY_PREFIX=harbor.sheldan.dev/sissi/
|
||||
ABSTRACTO_PREFIX=harbor.sheldan.dev/abstracto/
|
||||
VERSION=1.4.29
|
||||
ABSTRACTO_VERSION=1.5.16
|
||||
3
.github/workflows/release.yml
vendored
3
.github/workflows/release.yml
vendored
@@ -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 }}
|
||||
|
||||
7
Tiltfile
7
Tiltfile
@@ -29,7 +29,12 @@ docker_build_with_restart(
|
||||
)
|
||||
|
||||
docker_build(registry + 'sissi-db-data', 'deployment/image-packaging/src/main/docker/db-data/')
|
||||
docker_build(registry + 'sissi-rest-api', 'deployment/image-packaging/src/main/docker/rest-api/', build_args={'REGISTRY_PREFIX': abstracto_registry})
|
||||
docker_build(registry + 'sissi-debra-rest-api', 'python/modules/debra-rest-api/', dockerfile='python/modules/debra-rest-api/docker/Dockerfile')
|
||||
update_settings(suppress_unused_image_warnings=[registry + "sissi-debra-rest-api"]) # only used in docker image building
|
||||
docker_build(registry + 'sissi-image-gen-api', 'python/modules/image-gen-api/', dockerfile='python/modules/image-gen-api/docker/Dockerfile')
|
||||
update_settings(suppress_unused_image_warnings=[registry + "sissi-image-gen-api"]) # only used in docker image building
|
||||
docker_build(registry + 'sissi-rest-api', 'deployment/image-packaging/src/main/docker/rest-api/', build_args={'REGISTRY_PREFIX': abstracto_registry, 'SISSI_REGISTRY_PREFIX': registry})
|
||||
docker_build(registry + 'sissi-private-rest-api', 'deployment/image-packaging/src/main/docker/private-rest-api/', build_args={'REGISTRY_PREFIX': abstracto_registry, 'SISSI_REGISTRY_PREFIX': registry})
|
||||
docker_build(registry + 'sissi-template-data', 'deployment/image-packaging/src/main/docker/template-data/')
|
||||
|
||||
|
||||
|
||||
@@ -141,6 +141,11 @@
|
||||
<artifactId>giveaway-impl</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>image-generation-impl</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- sissi modules -->
|
||||
|
||||
<dependency>
|
||||
@@ -175,6 +180,12 @@
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>dev.sheldan.sissi.application.module.custom</groupId>
|
||||
<artifactId>image-generation-custom</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>dev.sheldan.sissi.application.module.custom</groupId>
|
||||
<artifactId>sissi-customizations</artifactId>
|
||||
<version>1.4.30-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>image-generation-custom</artifactId>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>image-generation-int</artifactId>
|
||||
<version>${abstracto.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>dev.sheldan.abstracto.core</groupId>
|
||||
<artifactId>core-int</artifactId>
|
||||
<version>${abstracto.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,18 @@
|
||||
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.1.0 http://maven.apache.org/xsd/assembly-2.1.0.xsd">
|
||||
<id>liquibase</id>
|
||||
<formats>
|
||||
<format>zip</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>false</includeBaseDirectory>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<outputDirectory>.</outputDirectory>
|
||||
<directory>${project.basedir}/src/main/resources/migrations</directory>
|
||||
<includes>
|
||||
<include>**/*</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</assembly>
|
||||
@@ -0,0 +1,78 @@
|
||||
package dev.sheldan.sissi.module.custom.imagegeneration.command;
|
||||
|
||||
import dev.sheldan.abstracto.core.command.CommandAlternative;
|
||||
import dev.sheldan.abstracto.core.command.execution.UnParsedCommandParameter;
|
||||
import dev.sheldan.abstracto.core.command.service.CommandRegistry;
|
||||
import dev.sheldan.abstracto.core.config.ListenerPriority;
|
||||
import dev.sheldan.abstracto.core.service.ChannelService;
|
||||
import dev.sheldan.abstracto.core.service.FeatureFlagService;
|
||||
import dev.sheldan.abstracto.core.templating.model.AttachedFile;
|
||||
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
||||
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
||||
import dev.sheldan.abstracto.core.utils.FileService;
|
||||
import dev.sheldan.abstracto.core.utils.FutureUtils;
|
||||
import dev.sheldan.abstracto.imagegeneration.config.ImageGenerationFeatureConfig;
|
||||
import dev.sheldan.sissi.module.custom.imagegeneration.service.ImageGenerationService;
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class OrangeSunDogeCommandAlternative implements CommandAlternative {
|
||||
|
||||
@Autowired
|
||||
private ImageGenerationService imageGenerationService;
|
||||
|
||||
@Autowired
|
||||
private TemplateService templateService;
|
||||
|
||||
@Autowired
|
||||
private ChannelService channelService;
|
||||
|
||||
@Autowired
|
||||
private FileService fileService;
|
||||
|
||||
@Autowired
|
||||
private CommandRegistry commandRegistry;
|
||||
|
||||
@Autowired
|
||||
private FeatureFlagService featureFlagService;
|
||||
|
||||
@Autowired
|
||||
private ImageGenerationFeatureConfig imageGenerationFeatureConfig;
|
||||
|
||||
private static final String DOGE_ORANGE_SUN_RESPONSE_TEMPLATE_KEY = "doge_orangeSun_response";
|
||||
|
||||
@Override
|
||||
public boolean shouldExecute(UnParsedCommandParameter parameter, Guild guild) {
|
||||
return parameter.getParameters().isEmpty() && featureFlagService.isFeatureEnabled(imageGenerationFeatureConfig, guild.getIdLong());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(UnParsedCommandParameter parameter, Message message) {
|
||||
String contentStripped = message.getContentRaw();
|
||||
List<String> parameters = Arrays.asList(contentStripped.split(" "));
|
||||
String inputText = commandRegistry.getCommandName(parameters.get(0), message.getGuild().getIdLong());
|
||||
File triggeredGifFile = imageGenerationService.getOrangeSunDogeImage(inputText);
|
||||
MessageToSend messageToSend = templateService.renderEmbedTemplate(DOGE_ORANGE_SUN_RESPONSE_TEMPLATE_KEY, new Object());
|
||||
// template support does not support binary files
|
||||
AttachedFile file = AttachedFile
|
||||
.builder()
|
||||
.file(triggeredGifFile)
|
||||
.fileName("doge.png")
|
||||
.build();
|
||||
messageToSend.getAttachedFiles().add(file);
|
||||
FutureUtils.toSingleFutureGeneric(channelService.sendMessageToSendToChannel(messageToSend, message.getGuildChannel()))
|
||||
.thenAccept(unused -> fileService.safeDeleteIgnoreException(messageToSend.getAttachedFiles().get(0).getFile()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getPriority() {
|
||||
return ListenerPriority.LOW;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package dev.sheldan.sissi.module.custom.imagegeneration.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
||||
@Configuration
|
||||
@PropertySource("classpath:custom-image-generation-config.properties")
|
||||
public class CustomImageGenerationConfig {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package dev.sheldan.sissi.module.custom.imagegeneration.service;
|
||||
|
||||
import dev.sheldan.abstracto.core.exception.AbstractoRunTimeException;
|
||||
import dev.sheldan.abstracto.core.service.HttpService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
@Component
|
||||
public class ImageGenerationService {
|
||||
|
||||
@Value("${abstracto.feature.imagegeneration.doge.orangeSun.url}")
|
||||
private String dogeOrangeSunUrl;
|
||||
|
||||
@Autowired
|
||||
private HttpService httpService;
|
||||
|
||||
public File getOrangeSunDogeImage(String inputText) {
|
||||
try {
|
||||
return httpService.downloadFileToTempFile(dogeOrangeSunUrl.replace("{1}", inputText));
|
||||
} catch (IOException e) {
|
||||
throw new AbstractoRunTimeException(String.format("Failed to download orange doge image for url %s with error %s", inputText, e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
abstracto.feature.imagegeneration.doge.orangeSun.url=http://${PRIVATE_REST_API_HOST}:${PRIVATE_REST_API_PORT}/memes/doge/orangeSun/?text={1}
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
<modules>
|
||||
<module>moderation-custom</module>
|
||||
<module>image-generation-custom</module>
|
||||
</modules>
|
||||
|
||||
|
||||
|
||||
@@ -84,6 +84,10 @@ spec:
|
||||
secretKeyRef:
|
||||
name: api-keys
|
||||
key: twitchSecret
|
||||
- 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}}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
{{- if .Values.privateRestApi.enabled -}}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "sissi.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 "sissi.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 }}
|
||||
env:
|
||||
- name: SISSI_HOST
|
||||
value: "{{ include "sissi.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local"
|
||||
- name: SISSI_PORT
|
||||
value: "{{ .Values.service.port }}"
|
||||
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 }}
|
||||
@@ -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 }}
|
||||
@@ -63,12 +63,44 @@ restApi:
|
||||
extraPaths: []
|
||||
tls: []
|
||||
|
||||
privateRestApi:
|
||||
enabled: true
|
||||
repository: harbor.sheldan.dev/sissi
|
||||
pullPolicy: Always
|
||||
image: sissi-private-rest-api
|
||||
tag: 1.4.29
|
||||
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: {}
|
||||
|
||||
templateDeployment:
|
||||
enabled: true
|
||||
repository: harbor.sheldan.dev/abstracto
|
||||
pullPolicy: Always
|
||||
image: abstracto-template-deployment
|
||||
tag: 1.5.14
|
||||
tag: 1.5.16
|
||||
|
||||
templateDeploymentData:
|
||||
repository: harbor.sheldan.dev/sissi
|
||||
@@ -81,7 +113,7 @@ dbConfigDeployment:
|
||||
repository: harbor.sheldan.dev/abstracto
|
||||
pullPolicy: Always
|
||||
image: abstracto-db-deployment
|
||||
tag: 1.5.14
|
||||
tag: 1.5.16
|
||||
|
||||
dbConfigDeploymentData:
|
||||
repository: harbor.sheldan.dev/sissi
|
||||
|
||||
@@ -191,6 +191,16 @@
|
||||
<destFileName>custom-command.zip</destFileName>
|
||||
</artifactItem>
|
||||
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.abstracto-templates.templates</groupId>
|
||||
<artifactId>image-generation</artifactId>
|
||||
<version>${abstracto.templates.version}</version>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>${file.basedir}/template-data/template-artifacts/</outputDirectory>
|
||||
<destFileName>image-generation.zip</destFileName>
|
||||
</artifactItem>
|
||||
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.abstracto-templates.templates</groupId>
|
||||
<artifactId>statistic</artifactId>
|
||||
@@ -264,6 +274,16 @@
|
||||
<destFileName>moderation-custom.zip</destFileName>
|
||||
</artifactItem>
|
||||
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.sissi.templates</groupId>
|
||||
<artifactId>image-generation-customization-templates</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>${file.basedir}/template-data/template-artifacts/</outputDirectory>
|
||||
<destFileName>image-generation-custom.zip</destFileName>
|
||||
</artifactItem>
|
||||
|
||||
<!-- abstracto translation artefacts -->
|
||||
|
||||
<artifactItem>
|
||||
@@ -416,6 +436,16 @@
|
||||
<destFileName>custom-command.zip</destFileName>
|
||||
</artifactItem>
|
||||
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.abstracto-templates.translations</groupId>
|
||||
<artifactId>image-generation</artifactId>
|
||||
<version>${abstracto.templates.version}</version>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>${file.basedir}/template-data/translation-artifacts/</outputDirectory>
|
||||
<destFileName>image-generation.zip</destFileName>
|
||||
</artifactItem>
|
||||
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.abstracto-templates.translations</groupId>
|
||||
<artifactId>statistic</artifactId>
|
||||
@@ -668,6 +698,17 @@
|
||||
<destFileName>custom-command.zip</destFileName>
|
||||
</artifactItem>
|
||||
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>image-generation-impl</artifactId>
|
||||
<version>${abstracto.version}</version>
|
||||
<classifier>liquibase</classifier>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>${file.basedir}/db-data/liquibase-artifacts/</outputDirectory>
|
||||
<destFileName>image-generation.zip</destFileName>
|
||||
</artifactItem>
|
||||
|
||||
<!-- sissi liquibase artifacts -->
|
||||
|
||||
<artifactItem>
|
||||
@@ -829,43 +870,6 @@
|
||||
</executions>
|
||||
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-resources</id>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>src/main/docker/rest-api/python/custom</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>../../python/modules/rest-api/python</directory>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>copy-resources-resources</id>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>src/main/docker/rest-api/python/resources</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>../../python/modules/rest-api/resources</directory>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
REGISTRY_PREFIX=harbor.sheldan.dev/sissi/
|
||||
VERSION=1.4.29
|
||||
ABSTRACTO_VERSION=1.5.15
|
||||
@@ -9,6 +9,7 @@
|
||||
{ "zip": "starboard", "file": "starboard-changeLog.xml"},
|
||||
{ "zip": "quotes", "file": "quotes-changeLog.xml"},
|
||||
{ "zip": "giveaway", "file": "giveaway-changeLog.xml"},
|
||||
{ "zip": "image-generation", "file": "imageGeneration-changeLog.xml"},
|
||||
{ "zip": "meetup", "file": "meetup-changeLog.xml"},
|
||||
{ "zip": "rss-news", "file": "rssNews-changeLog.xml"},
|
||||
{ "zip": "debra", "file": "debra-changeLog.xml"},
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
version: "3.7"
|
||||
|
||||
services:
|
||||
bot:
|
||||
build:
|
||||
context: sissi
|
||||
image: ${REGISTRY_PREFIX}sissi-bot:${VERSION:-latest}
|
||||
rest-api:
|
||||
build:
|
||||
context: rest-api
|
||||
image: ${REGISTRY_PREFIX}sissi-rest-api:${VERSION:-latest}
|
||||
db-data:
|
||||
build:
|
||||
context: db-data
|
||||
image: ${REGISTRY_PREFIX}sissi-db-data:${VERSION:-latest}
|
||||
template-data:
|
||||
build:
|
||||
context: template-data
|
||||
image: ${REGISTRY_PREFIX}sissi-template-data:${VERSION:-latest}
|
||||
@@ -0,0 +1,11 @@
|
||||
ARG REGISTRY_PREFIX
|
||||
ARG SISSI_REGISTRY_PREFIX
|
||||
ARG VERSION
|
||||
ARG ABSTRACTO_VERSION
|
||||
FROM ${REGISTRY_PREFIX}abstracto-rest-api-image-gen:${ABSTRACTO_VERSION:-latest} AS image-gen-api
|
||||
|
||||
FROM ${SISSI_REGISTRY_PREFIX}sissi-image-gen-api:${VERSION:-latest} AS sissi-image-gen-api
|
||||
|
||||
FROM ${REGISTRY_PREFIX}abstracto-rest-api:${ABSTRACTO_VERSION:-latest} AS running-image
|
||||
COPY --from=image-gen-api /python /python
|
||||
COPY --from=sissi-image-gen-api /python /python
|
||||
@@ -1,5 +1,9 @@
|
||||
ARG REGISTRY_PREFIX
|
||||
ARG SISSI_REGISTRY_PREFIX
|
||||
ARG VERSION
|
||||
ARG ABSTRACTO_VERSION
|
||||
FROM ${SISSI_REGISTRY_PREFIX}sissi-debra-rest-api:${VERSION:-latest} AS debra-api
|
||||
|
||||
|
||||
FROM ${REGISTRY_PREFIX}abstracto-rest-api:${ABSTRACTO_VERSION:-latest}
|
||||
ADD python/resources /python/resources
|
||||
ADD python/custom /python/custom
|
||||
COPY --from=debra-api /python /python
|
||||
@@ -1 +0,0 @@
|
||||
*
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Starting python server..."
|
||||
cd python
|
||||
python3 -u main.py
|
||||
@@ -1,13 +1,17 @@
|
||||
{
|
||||
"template_artifacts": [
|
||||
"core","starboard", "link-embed", "moderation", "entertainment", "custom-command", "utility", "webservices", "remind", "suggestion", "modmail", "assignable-roles", "experience-tracking", "logging", "statistic", "twitch", "giveaway",
|
||||
"core","starboard", "link-embed", "moderation", "entertainment", "custom-command", "utility", "webservices", "remind",
|
||||
"suggestion", "modmail", "assignable-roles", "experience-tracking", "logging", "statistic", "twitch", "giveaway",
|
||||
"image-generation",
|
||||
"quotes", "meetup", "debra", "rss-news",
|
||||
"moderation-custom",
|
||||
"moderation-custom", "image-generation-custom",
|
||||
"moderation-template-overrides", "experience-template-overrides", "logging-template-overrides"
|
||||
],
|
||||
"translation_artifacts": [
|
||||
"core",
|
||||
"starboard", "link-embed", "moderation", "entertainment", "custom-command", "utility", "webservices", "suggestion", "remind", "modmail", "assignable-roles", "experience-tracking", "logging", "statistic", "twitch", "giveaway",
|
||||
"starboard", "link-embed", "moderation", "entertainment", "custom-command", "utility", "webservices",
|
||||
"suggestion", "remind", "modmail", "assignable-roles", "experience-tracking", "logging", "statistic", "twitch", "giveaway",
|
||||
"image-generation",
|
||||
"quotes", "meetup", "debra", "rss-news",
|
||||
"moderation-custom",
|
||||
"moderation-translation-overrides", "experience-translation-overrides", "logging-translation-overrides"
|
||||
|
||||
40
docker-compose.yml
Normal file
40
docker-compose.yml
Normal file
@@ -0,0 +1,40 @@
|
||||
version: "3.7"
|
||||
|
||||
services:
|
||||
bot-packaging:
|
||||
build:
|
||||
context: deployment/image-packaging/src/main/docker/sissi
|
||||
image: ${REGISTRY_PREFIX}sissi-bot:${VERSION:-latest}
|
||||
debra-rest-api:
|
||||
build:
|
||||
context: python/modules/debra-rest-api
|
||||
dockerfile: docker/Dockerfile
|
||||
image: ${REGISTRY_PREFIX}sissi-debra-rest-api:${VERSION:-latest}
|
||||
image-gen-api:
|
||||
build:
|
||||
context: python/modules/image-gen-api
|
||||
dockerfile: docker/Dockerfile
|
||||
image: ${REGISTRY_PREFIX}sissi-image-gen-api:${VERSION:-latest}
|
||||
rest-api-packaging:
|
||||
build:
|
||||
context: deployment/image-packaging/src/main/docker/rest-api
|
||||
args:
|
||||
SISSI_REGISTRY_PREFIX: ${REGISTRY_PREFIX}
|
||||
image: ${REGISTRY_PREFIX}sissi-rest-api:${VERSION:-latest}
|
||||
private-rest-api-packaging:
|
||||
build:
|
||||
context: deployment/image-packaging/src/main/docker/private-rest-api
|
||||
args:
|
||||
REGISTRY_PREFIX: ${ABSTRACTO_PREFIX}
|
||||
SISSI_REGISTRY_PREFIX: ${REGISTRY_PREFIX}
|
||||
ABSTRACTO_VERSION: ${ABSTRACTO_VERSION}
|
||||
VERSION: ${VERSION}
|
||||
image: ${REGISTRY_PREFIX}sissi-private-rest-api:${VERSION:-latest}
|
||||
db-data:
|
||||
build:
|
||||
context: deployment/image-packaging/src/main/docker/db-data
|
||||
image: ${REGISTRY_PREFIX}sissi-db-data:${VERSION:-latest}
|
||||
template-data:
|
||||
build:
|
||||
context: deployment/image-packaging/src/main/docker/template-data
|
||||
image: ${REGISTRY_PREFIX}sissi-template-data:${VERSION:-latest}
|
||||
4
pom.xml
4
pom.xml
@@ -18,8 +18,8 @@
|
||||
<properties>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<abstracto.version>1.5.15-SNAPSHOT</abstracto.version>
|
||||
<abstracto.templates.version>1.4.25</abstracto.templates.version>
|
||||
<abstracto.version>1.5.16</abstracto.version>
|
||||
<abstracto.templates.version>1.4.26</abstracto.templates.version>
|
||||
<apache-jena.version>4.9.0</apache-jena.version>
|
||||
<rssreader.version>3.5.0</rssreader.version>
|
||||
</properties>
|
||||
|
||||
3
python/modules/debra-rest-api/docker/Dockerfile
Normal file
3
python/modules/debra-rest-api/docker/Dockerfile
Normal file
@@ -0,0 +1,3 @@
|
||||
FROM alpine:3.19.0
|
||||
ADD resources/ /python/resources
|
||||
ADD python /python
|
||||
3
python/modules/image-gen-api/docker/Dockerfile
Normal file
3
python/modules/image-gen-api/docker/Dockerfile
Normal file
@@ -0,0 +1,3 @@
|
||||
FROM alpine:3.19.0
|
||||
ADD resources/ /python/resources
|
||||
ADD python /python
|
||||
24
python/modules/image-gen-api/python/endpoints/doge.py
Normal file
24
python/modules/image-gen-api/python/endpoints/doge.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from __main__ import app
|
||||
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
from flask import request
|
||||
import logging
|
||||
|
||||
from utils import flask_utils
|
||||
|
||||
@app.route('/memes/doge/orangeSun/')
|
||||
def doge_orange_sun():
|
||||
text = request.args.get('text')
|
||||
if text is None:
|
||||
return 'no text', 400
|
||||
logging.info(f'Rendering doge orange sun.')
|
||||
with Image.open('resources/img/semf_template.jpg') as im:
|
||||
d1 = ImageDraw.Draw(im)
|
||||
text_box_size = (300, 240)
|
||||
W, H = text_box_size
|
||||
font = ImageFont.truetype(f'Impact.ttf', 60)
|
||||
_, _, w, h = d1.textbbox((0, 0), text, font=font)
|
||||
d1.text(((W-w)/2 + 320, (H-h)/2 + 120), text, font=font, fill=(255, 255, 255))
|
||||
return flask_utils.serve_pil_image(im)
|
||||
|
||||
|
||||
BIN
python/modules/image-gen-api/resources/img/semf_template.jpg
Normal file
BIN
python/modules/image-gen-api/resources/img/semf_template.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>customization-templates</artifactId>
|
||||
<groupId>dev.sheldan.sissi.templates</groupId>
|
||||
<version>1.4.30-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>image-generation-customization-templates</artifactId>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<finalName>image-generation-custom-templates-${project.version}</finalName>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/assembly.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,15 @@
|
||||
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
|
||||
<id>zip</id>
|
||||
<includeBaseDirectory>false</includeBaseDirectory>
|
||||
<formats>
|
||||
<format>zip</format>
|
||||
</formats>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<outputDirectory>.</outputDirectory>
|
||||
<directory>${project.basedir}/src/main/resources</directory>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</assembly>
|
||||
@@ -0,0 +1 @@
|
||||
{}
|
||||
@@ -11,6 +11,7 @@
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>moderation-customization-templates</module>
|
||||
<module>image-generation-customization-templates</module>
|
||||
</modules>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user