diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..1d8f511 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,30 @@ +# This workflow will build a Java project with Maven +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven + +name: Execute build + +on: + push: + branches: + - master + - feature/** + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Build with Maven + run: mvn -s settings.xml -B install --file pom.xml + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + user: Sheldan + token: ${{ secrets.ABSTRACTO_PAT }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..8063178 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,36 @@ +name: Publish package to GitHub Packages +on: + release: + types: [created] +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + persist-credentials: false + - name: Set up Java for publishing to GitHub Packages + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Load current version + id: version + run: echo "version=$(mvn --file pom.xml -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive exec:exec)" >> $GITHUB_ENV + - name: Publish to GitHub Packages + run: mvn -s settings.xml --file pom.xml -B deploy -Dmaven.wagon.http.pool=false -DskipTests=true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + user: Sheldan + token: ${{ secrets.ABSTRACTO_PAT }} + - name: Login to GitHub Packages Docker Registry + uses: docker/login-action@v1 + with: + registry: docker.pkg.github.com + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Push deployment container + working-directory: ./deployment/image-packaging/src/main/docker + run: docker-compose build && docker-compose push + env: + REGISTRY_PREFIX: docker.pkg.github.com/sheldan/oneplusbot/ + VERSION: ${{ env.version }} \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..af7e11d --- /dev/null +++ b/.gitignore @@ -0,0 +1,25 @@ +# Compiled class file +*.class +.idea/ +target/ +*.iml +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* diff --git a/README.md b/README.md new file mode 100644 index 0000000..0f90ee2 --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +# r/oneplus Discord server bot + +This repository contains the rewrite of the [Bot](https://github.com/Rithari/OnePlusBot), which is still in use. The features will be gradually be ported +and most of them will be in [abstracto](https://github.com/Sheldan/abstracto), but some of the features need to be customized, as they are r/oneplus specific. + +The migration of the existing data from the database is handled via one time migration, and can be found [here](https://github.com/Sheldan/OnePlusBot-migration). + +Custom features which were ported + - [ ] FAQ + - [ ] Setup channel handling + - [ ] Referral link handling diff --git a/application/executable/pom.xml b/application/executable/pom.xml new file mode 100644 index 0000000..b3825ba --- /dev/null +++ b/application/executable/pom.xml @@ -0,0 +1,98 @@ + + + + dev.sheldan.oneplus.bot.application + application + 1.0-SNAPSHOT + + 4.0.0 + executable + + + 8 + 8 + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + repackage + + repackage + + + exec + + + + + + + + + + org.springframework.boot + spring-boot-starter + + + org.postgresql + postgresql + runtime + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + + dev.sheldan.abstracto.core + core-impl + + + + dev.sheldan.abstracto.core + metrics-impl + + + + + dev.sheldan.abstracto.modules + utility-impl + + + + dev.sheldan.abstracto.scheduling + scheduling-impl + + + + dev.sheldan.abstracto.modules + entertainment-impl + + + + dev.sheldan.abstracto.modules + link-embed-impl + + + + dev.sheldan.abstracto.modules + starboard-impl + + + + dev.sheldan.oneplus.bot.application.custom + starboard-custom + ${project.version} + + + + + \ No newline at end of file diff --git a/application/executable/src/main/java/dev/sheldan/oneplus/bot/executable/Application.java b/application/executable/src/main/java/dev/sheldan/oneplus/bot/executable/Application.java new file mode 100644 index 0000000..ed2e1fd --- /dev/null +++ b/application/executable/src/main/java/dev/sheldan/oneplus/bot/executable/Application.java @@ -0,0 +1,37 @@ +package dev.sheldan.oneplus.bot.executable; + +import dev.sheldan.abstracto.core.service.Startup; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.domain.EntityScan; +import org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration; +import org.springframework.cache.annotation.EnableCaching; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +@SpringBootApplication +@EnableAutoConfiguration(exclude = { FreeMarkerAutoConfiguration.class }) +@ComponentScan(basePackages = {"dev.sheldan.abstracto", "dev.sheldan.oneplus.bot"}) +@EnableCaching +@EnableJpaRepositories(basePackages = {"dev.sheldan.abstracto", "dev.sheldan.oneplus.bot"}) +@EntityScan(basePackages = {"dev.sheldan.abstracto", "dev.sheldan.oneplus.bot"}) +@EnableTransactionManagement +public class Application implements CommandLineRunner { + + @Autowired + private Startup startup; + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + + @Override + public void run(String... args) throws Exception { + startup.startBot(); + } + +} diff --git a/application/executable/src/main/resources/application-local.properties b/application/executable/src/main/resources/application-local.properties new file mode 100644 index 0000000..d926b4c --- /dev/null +++ b/application/executable/src/main/resources/application-local.properties @@ -0,0 +1,19 @@ +spring.datasource.url=jdbc:postgresql://localhost:5432/abstracto +spring.datasource.username= abstracto +spring.datasource.password= abstracto +spring.jpa.properties.hibernate.default_schema=abstracto +spring.quartz.jdbc.initialize-schema=never + +spring.jpa.hibernate.ddl-auto = none + +spring.jpa.show-sql = false + +spring.jpa.properties.hibernate.format_sql = true +log4j.logger.org.hibernate.SQL=trace +log4j.logger.org.hibernate.type.descriptor.sql=trace +log4j.logger.org.hibernate.type=trace + +management.metrics.tags.application=oneplus-bot +spring.security.user.name=abstracto +spring.security.user.password=password +spring.security.user.roles=USER \ No newline at end of file diff --git a/application/executable/src/main/resources/application.properties b/application/executable/src/main/resources/application.properties new file mode 100644 index 0000000..986b872 --- /dev/null +++ b/application/executable/src/main/resources/application.properties @@ -0,0 +1,9 @@ +spring.datasource.url=jdbc:postgresql://${DB_HOST}:${DB_PORT}/${DB_NAME} +spring.datasource.username= ${DB_USER} +spring.datasource.password= ${DB_PASS} +spring.jpa.hibernate.default_schema=${DB_NAME} +spring.quartz.jdbc.initialize-schema=never +management.metrics.tags.application=oneplus-bot +spring.security.user.name= ${REST_USER_NAME} +spring.security.user.password= ${REST_PASSWORD} +spring.security.user.roles=USER \ No newline at end of file diff --git a/application/executable/src/main/resources/logback.xml b/application/executable/src/main/resources/logback.xml new file mode 100644 index 0000000..9eb0da5 --- /dev/null +++ b/application/executable/src/main/resources/logback.xml @@ -0,0 +1,39 @@ + + + + + + + %d{dd-MM-yyyy HH:mm:ss.SSS} %magenta([%thread]) %highlight(%-5level) %logger{36} - %msg%n + + + + + + + ${LOG_PATH}/log.log + + + + %d{dd-MM-yyyy HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + ${LOG_PATH}/archived/log_%d{dd-MM-yyyy}.log + + 10 + 1GB + + + + + + + + + + + + \ No newline at end of file diff --git a/application/oneplus-bot-customizations/pom.xml b/application/oneplus-bot-customizations/pom.xml new file mode 100644 index 0000000..c05e19d --- /dev/null +++ b/application/oneplus-bot-customizations/pom.xml @@ -0,0 +1,19 @@ + + + + dev.sheldan.oneplus.bot.application + application + 1.0-SNAPSHOT + + 4.0.0 + + dev.sheldan.oneplus.bot.application.custom + oneplus-bot-customizations + pom + + + starboard-custom + + \ No newline at end of file diff --git a/application/oneplus-bot-customizations/starboard-custom/pom.xml b/application/oneplus-bot-customizations/starboard-custom/pom.xml new file mode 100644 index 0000000..b034e8c --- /dev/null +++ b/application/oneplus-bot-customizations/starboard-custom/pom.xml @@ -0,0 +1,49 @@ + + + + dev.sheldan.oneplus.bot.application.custom + oneplus-bot-customizations + 1.0-SNAPSHOT + + 4.0.0 + + starboard-custom + jar + + + 8 + 8 + + + + + + maven-assembly-plugin + + + src/main/assembly/liquibase.xml + + + + + make-assembly + package + + single + + + + + + + + + + dev.sheldan.abstracto.modules + starboard-int + + + + \ No newline at end of file diff --git a/application/oneplus-bot-customizations/starboard-custom/src/main/assembly/liquibase.xml b/application/oneplus-bot-customizations/starboard-custom/src/main/assembly/liquibase.xml new file mode 100644 index 0000000..8b4774f --- /dev/null +++ b/application/oneplus-bot-customizations/starboard-custom/src/main/assembly/liquibase.xml @@ -0,0 +1,18 @@ + + liquibase + + zip + + false + + + . + ${project.basedir}/src/main/resources/migrations + + **/* + + + + \ No newline at end of file diff --git a/application/oneplus-bot-customizations/starboard-custom/src/main/java/dev/sheldan/oneplus/bot/custom/starboard/config/StarboardCustomFeature.java b/application/oneplus-bot-customizations/starboard-custom/src/main/java/dev/sheldan/oneplus/bot/custom/starboard/config/StarboardCustomFeature.java new file mode 100644 index 0000000..40ffef7 --- /dev/null +++ b/application/oneplus-bot-customizations/starboard-custom/src/main/java/dev/sheldan/oneplus/bot/custom/starboard/config/StarboardCustomFeature.java @@ -0,0 +1,33 @@ +package dev.sheldan.oneplus.bot.custom.starboard.config; + +import dev.sheldan.abstracto.core.config.FeatureConfig; +import dev.sheldan.abstracto.core.config.FeatureDefinition; +import dev.sheldan.abstracto.core.config.PostTargetEnum; +import dev.sheldan.abstracto.starboard.config.StarboardFeatureConfig; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.Arrays; +import java.util.List; + +@Component +public class StarboardCustomFeature implements FeatureConfig { + + @Autowired + private StarboardFeatureConfig starboardFeature; + + @Override + public FeatureDefinition getFeature() { + return StarboardCustomFeatureDefinition.STARBOARD_NOTIFICATION; + } + + @Override + public List getRequiredFeatures() { + return Arrays.asList(starboardFeature); + } + + @Override + public List getRequiredPostTargets() { + return Arrays.asList(StarboardCustomPostTarget.STARBOARD_NOTIFICATION); + } +} diff --git a/application/oneplus-bot-customizations/starboard-custom/src/main/java/dev/sheldan/oneplus/bot/custom/starboard/config/StarboardCustomFeatureDefinition.java b/application/oneplus-bot-customizations/starboard-custom/src/main/java/dev/sheldan/oneplus/bot/custom/starboard/config/StarboardCustomFeatureDefinition.java new file mode 100644 index 0000000..98bcd57 --- /dev/null +++ b/application/oneplus-bot-customizations/starboard-custom/src/main/java/dev/sheldan/oneplus/bot/custom/starboard/config/StarboardCustomFeatureDefinition.java @@ -0,0 +1,15 @@ +package dev.sheldan.oneplus.bot.custom.starboard.config; + +import dev.sheldan.abstracto.core.config.FeatureDefinition; +import lombok.Getter; + +@Getter +public enum StarboardCustomFeatureDefinition implements FeatureDefinition { + STARBOARD_NOTIFICATION("starboardNotification"); + + private String key; + + StarboardCustomFeatureDefinition(String key) { + this.key = key; + } +} \ No newline at end of file diff --git a/application/oneplus-bot-customizations/starboard-custom/src/main/java/dev/sheldan/oneplus/bot/custom/starboard/config/StarboardCustomPostTarget.java b/application/oneplus-bot-customizations/starboard-custom/src/main/java/dev/sheldan/oneplus/bot/custom/starboard/config/StarboardCustomPostTarget.java new file mode 100644 index 0000000..aec1f94 --- /dev/null +++ b/application/oneplus-bot-customizations/starboard-custom/src/main/java/dev/sheldan/oneplus/bot/custom/starboard/config/StarboardCustomPostTarget.java @@ -0,0 +1,15 @@ +package dev.sheldan.oneplus.bot.custom.starboard.config; + +import dev.sheldan.abstracto.core.config.PostTargetEnum; +import lombok.Getter; + +@Getter +public enum StarboardCustomPostTarget implements PostTargetEnum { + STARBOARD_NOTIFICATION("starboardNotification"); + + private String key; + + StarboardCustomPostTarget(String key) { + this.key = key; + } +} diff --git a/application/oneplus-bot-customizations/starboard-custom/src/main/java/dev/sheldan/oneplus/bot/custom/starboard/config/StarboardCustomProperties.java b/application/oneplus-bot-customizations/starboard-custom/src/main/java/dev/sheldan/oneplus/bot/custom/starboard/config/StarboardCustomProperties.java new file mode 100644 index 0000000..c0702ac --- /dev/null +++ b/application/oneplus-bot-customizations/starboard-custom/src/main/java/dev/sheldan/oneplus/bot/custom/starboard/config/StarboardCustomProperties.java @@ -0,0 +1,10 @@ +package dev.sheldan.oneplus.bot.custom.starboard.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; + +@Configuration +@PropertySource("classpath:starboard-custom.properties") +public class StarboardCustomProperties { + +} diff --git a/application/oneplus-bot-customizations/starboard-custom/src/main/java/dev/sheldan/oneplus/bot/custom/starboard/listener/StarboardPostCreatedListenerBean.java b/application/oneplus-bot-customizations/starboard-custom/src/main/java/dev/sheldan/oneplus/bot/custom/starboard/listener/StarboardPostCreatedListenerBean.java new file mode 100644 index 0000000..5e85f16 --- /dev/null +++ b/application/oneplus-bot-customizations/starboard-custom/src/main/java/dev/sheldan/oneplus/bot/custom/starboard/listener/StarboardPostCreatedListenerBean.java @@ -0,0 +1,94 @@ +package dev.sheldan.oneplus.bot.custom.starboard.listener; + +import dev.sheldan.abstracto.core.config.FeatureDefinition; +import dev.sheldan.abstracto.core.listener.DefaultListenerResult; +import dev.sheldan.abstracto.core.service.MemberService; +import dev.sheldan.abstracto.core.service.MessageService; +import dev.sheldan.abstracto.core.service.PostTargetService; +import dev.sheldan.abstracto.core.templating.model.MessageToSend; +import dev.sheldan.abstracto.core.templating.service.TemplateService; +import dev.sheldan.abstracto.starboard.listener.StarboardPostCreatedListener; +import dev.sheldan.abstracto.starboard.model.StarboardPostCreatedModel; +import dev.sheldan.abstracto.starboard.model.database.StarboardPost; +import dev.sheldan.abstracto.starboard.service.management.StarboardPostManagementService; +import dev.sheldan.oneplus.bot.custom.starboard.config.StarboardCustomFeatureDefinition; +import dev.sheldan.oneplus.bot.custom.starboard.config.StarboardCustomPostTarget; +import dev.sheldan.oneplus.bot.custom.starboard.model.StarboardPostCreatedNotificationModel; +import lombok.extern.slf4j.Slf4j; +import net.dv8tion.jda.api.entities.Member; +import net.dv8tion.jda.api.entities.Message; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.CompletableFuture; + +@Slf4j +@Component +public class StarboardPostCreatedListenerBean implements StarboardPostCreatedListener { + + @Autowired + private PostTargetService postTargetService; + + @Autowired + private StarboardPostManagementService starboardPostManagementService; + + @Autowired + private MessageService messageService; + + @Autowired + private MemberService memberService; + + @Autowired + private StarboardPostCreatedListenerBean self; + + @Autowired + private TemplateService templateService; + + private static final String STARBOARD_POST_CREATED_NOTIFICATION_TEMPLATE_KEY = "starboard_post_created_notification"; + + @Override + public DefaultListenerResult execute(StarboardPostCreatedModel model) { + Long serverId = model.getServerId(); + CompletableFuture starboardMessageFuture = messageService.loadMessage(serverId, model.getStarboardMessage().getChannelId(), model.getStarboardMessage().getMessageId()); + CompletableFuture starredMessageFuture = messageService.loadMessage(serverId, model.getStarredMessage().getChannelId(), model.getStarredMessage().getMessageId()); + CompletableFuture starredUserFuture = memberService.retrieveMemberInServer(model.getStarredUser()); + CompletableFuture starringUserFuture = memberService.retrieveMemberInServer(model.getLastStarrer()); + List futures = Arrays.asList(starboardMessageFuture, starredMessageFuture, starredUserFuture, starringUserFuture); + CompletableFuture.allOf(starboardMessageFuture, starredMessageFuture, starredUserFuture, starringUserFuture) + .whenComplete((unused, throwable) -> self.sendNotification(futures, model)); + log.info("Starboard created event for post {}.", model.getStarboardPostId()); + return DefaultListenerResult.PROCESSED; + } + + @Transactional + public void sendNotification(List futures, StarboardPostCreatedModel model) { + StarboardPost post = starboardPostManagementService.findByStarboardPostId(model.getStarboardPostId()).orElse(null); + Message starboardMessage = futures.get(0).isCompletedExceptionally() ? null : (Message) futures.get(0).join(); + Message starredMessage = futures.get(1).isCompletedExceptionally() ? null : (Message) futures.get(1).join(); + Member starredMember = futures.get(2).isCompletedExceptionally() ? null : (Member) futures.get(2).join(); + Member starringMember = futures.get(3).isCompletedExceptionally() ? null : (Member) futures.get(3).join(); + StarboardPostCreatedNotificationModel templateModel = StarboardPostCreatedNotificationModel + .builder() + .post(post) + .starboardMessage(starboardMessage) + .starredMessage(starredMessage) + .starredMember(starredMember) + .starringMember(starringMember) + .starboardMessageSimple(model.getStarboardMessage()) + .starredMessageSimple(model.getStarredMessage()) + .starredUserId(model.getStarredUser().getUserId()) + .starringUserId(model.getLastStarrer().getUserId()) + .build(); + MessageToSend messageToSend = templateService.renderEmbedTemplate(STARBOARD_POST_CREATED_NOTIFICATION_TEMPLATE_KEY, templateModel); + postTargetService.sendEmbedInPostTarget(messageToSend, StarboardCustomPostTarget.STARBOARD_NOTIFICATION, model.getServerId()); + } + + @Override + public FeatureDefinition getFeature() { + return StarboardCustomFeatureDefinition.STARBOARD_NOTIFICATION; + } + +} diff --git a/application/oneplus-bot-customizations/starboard-custom/src/main/java/dev/sheldan/oneplus/bot/custom/starboard/listener/StarboardPostDeletedListenerBean.java b/application/oneplus-bot-customizations/starboard-custom/src/main/java/dev/sheldan/oneplus/bot/custom/starboard/listener/StarboardPostDeletedListenerBean.java new file mode 100644 index 0000000..17db338 --- /dev/null +++ b/application/oneplus-bot-customizations/starboard-custom/src/main/java/dev/sheldan/oneplus/bot/custom/starboard/listener/StarboardPostDeletedListenerBean.java @@ -0,0 +1,89 @@ +package dev.sheldan.oneplus.bot.custom.starboard.listener; + +import dev.sheldan.abstracto.core.config.FeatureDefinition; +import dev.sheldan.abstracto.core.listener.DefaultListenerResult; +import dev.sheldan.abstracto.core.service.MemberService; +import dev.sheldan.abstracto.core.service.MessageService; +import dev.sheldan.abstracto.core.service.PostTargetService; +import dev.sheldan.abstracto.core.templating.model.MessageToSend; +import dev.sheldan.abstracto.core.templating.service.TemplateService; +import dev.sheldan.abstracto.starboard.listener.StarboardPostDeletedListener; +import dev.sheldan.abstracto.starboard.model.StarboardPostDeletedModel; +import dev.sheldan.abstracto.starboard.service.management.StarboardPostManagementService; +import dev.sheldan.oneplus.bot.custom.starboard.config.StarboardCustomFeatureDefinition; +import dev.sheldan.oneplus.bot.custom.starboard.config.StarboardCustomPostTarget; +import dev.sheldan.oneplus.bot.custom.starboard.model.StarboardPostDeletedNotificationModel; +import lombok.extern.slf4j.Slf4j; +import net.dv8tion.jda.api.entities.Member; +import net.dv8tion.jda.api.entities.Message; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.CompletableFuture; + +@Slf4j +@Component +public class StarboardPostDeletedListenerBean implements StarboardPostDeletedListener { + + @Autowired + private PostTargetService postTargetService; + + @Autowired + private StarboardPostManagementService starboardPostManagementService; + + @Autowired + private MessageService messageService; + + @Autowired + private MemberService memberService; + + @Autowired + private StarboardPostDeletedListenerBean self; + + @Autowired + private TemplateService templateService; + + private static final String STARBOARD_POST_DELETED_NOTIFICATION_TEMPLATE_KEY = "starboard_post_deleted_notification"; + + @Override + public DefaultListenerResult execute(StarboardPostDeletedModel model) { + Long serverId = model.getServerId(); + CompletableFuture starboardMessageFuture = messageService.loadMessage(serverId, model.getStarboardMessage().getChannelId(), model.getStarboardMessage().getMessageId()); + CompletableFuture starredMessageFuture = messageService.loadMessage(serverId, model.getStarredMessage().getChannelId(), model.getStarredMessage().getMessageId()); + CompletableFuture starredUserFuture = memberService.retrieveMemberInServer(model.getStarredUser()); + CompletableFuture starringUserFuture = memberService.retrieveMemberInServer(model.getLastStarrer()); + List futures = Arrays.asList(starboardMessageFuture, starredMessageFuture, starredUserFuture, starringUserFuture); + CompletableFuture.allOf(starboardMessageFuture, starredMessageFuture, starredUserFuture, starringUserFuture) + .whenComplete((unused, throwable) -> self.sendNotification(futures, model)); + log.info("Starboard deleted event for post {}.", model.getStarboardPostId()); + return DefaultListenerResult.PROCESSED; + } + + @Transactional + public void sendNotification(List futures, StarboardPostDeletedModel model) { + Message starboardMessage = futures.get(0).isCompletedExceptionally() ? null : (Message) futures.get(0).join(); + Message starredMessage = futures.get(1).isCompletedExceptionally() ? null : (Message) futures.get(1).join(); + Member starredMember = futures.get(2).isCompletedExceptionally() ? null : (Member) futures.get(2).join(); + Member starringMember = futures.get(3).isCompletedExceptionally() ? null : (Member) futures.get(3).join(); + StarboardPostDeletedNotificationModel templateModel = StarboardPostDeletedNotificationModel + .builder() + .starboardMessage(starboardMessage) + .starredMessage(starredMessage) + .starredMember(starredMember) + .starringMember(starringMember) + .starredUserId(model.getStarredUser().getUserId()) + .starringUserId(model.getLastStarrer().getUserId()) + .build(); + MessageToSend messageToSend = templateService.renderEmbedTemplate(STARBOARD_POST_DELETED_NOTIFICATION_TEMPLATE_KEY, templateModel); + postTargetService.sendEmbedInPostTarget(messageToSend, StarboardCustomPostTarget.STARBOARD_NOTIFICATION, model.getServerId()); + } + + @Override + public FeatureDefinition getFeature() { + return StarboardCustomFeatureDefinition.STARBOARD_NOTIFICATION; + } + +} diff --git a/application/oneplus-bot-customizations/starboard-custom/src/main/java/dev/sheldan/oneplus/bot/custom/starboard/model/StarboardPostCreatedNotificationModel.java b/application/oneplus-bot-customizations/starboard-custom/src/main/java/dev/sheldan/oneplus/bot/custom/starboard/model/StarboardPostCreatedNotificationModel.java new file mode 100644 index 0000000..42ffa3a --- /dev/null +++ b/application/oneplus-bot-customizations/starboard-custom/src/main/java/dev/sheldan/oneplus/bot/custom/starboard/model/StarboardPostCreatedNotificationModel.java @@ -0,0 +1,24 @@ +package dev.sheldan.oneplus.bot.custom.starboard.model; + +import dev.sheldan.abstracto.core.models.ServerChannelMessage; +import dev.sheldan.abstracto.starboard.model.database.StarboardPost; +import lombok.Builder; +import lombok.Getter; +import lombok.Setter; +import net.dv8tion.jda.api.entities.Member; +import net.dv8tion.jda.api.entities.Message; + +@Getter +@Setter +@Builder +public class StarboardPostCreatedNotificationModel { + private StarboardPost post; + private ServerChannelMessage starboardMessageSimple; + private Message starboardMessage; + private ServerChannelMessage starredMessageSimple; + private Message starredMessage; + private Member starredMember; + private Long starredUserId; + private Member starringMember; + private Long starringUserId; +} diff --git a/application/oneplus-bot-customizations/starboard-custom/src/main/java/dev/sheldan/oneplus/bot/custom/starboard/model/StarboardPostDeletedNotificationModel.java b/application/oneplus-bot-customizations/starboard-custom/src/main/java/dev/sheldan/oneplus/bot/custom/starboard/model/StarboardPostDeletedNotificationModel.java new file mode 100644 index 0000000..1765a77 --- /dev/null +++ b/application/oneplus-bot-customizations/starboard-custom/src/main/java/dev/sheldan/oneplus/bot/custom/starboard/model/StarboardPostDeletedNotificationModel.java @@ -0,0 +1,22 @@ +package dev.sheldan.oneplus.bot.custom.starboard.model; + +import dev.sheldan.abstracto.core.models.ServerChannelMessage; +import lombok.Builder; +import lombok.Getter; +import lombok.Setter; +import net.dv8tion.jda.api.entities.Member; +import net.dv8tion.jda.api.entities.Message; + +@Getter +@Setter +@Builder +public class StarboardPostDeletedNotificationModel { + private ServerChannelMessage starboardMessageSimple; + private Message starboardMessage; + private ServerChannelMessage starredMessageSimple; + private Message starredMessage; + private Member starredMember; + private Long starredUserId; + private Member starringMember; + private Long starringUserId; +} diff --git a/application/oneplus-bot-customizations/starboard-custom/src/main/resources/migrations/1.0-starboard-custom/collection.xml b/application/oneplus-bot-customizations/starboard-custom/src/main/resources/migrations/1.0-starboard-custom/collection.xml new file mode 100644 index 0000000..3c65f6d --- /dev/null +++ b/application/oneplus-bot-customizations/starboard-custom/src/main/resources/migrations/1.0-starboard-custom/collection.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/application/oneplus-bot-customizations/starboard-custom/src/main/resources/migrations/1.0-starboard-custom/starboard-custom-seedData/data.xml b/application/oneplus-bot-customizations/starboard-custom/src/main/resources/migrations/1.0-starboard-custom/starboard-custom-seedData/data.xml new file mode 100644 index 0000000..9790388 --- /dev/null +++ b/application/oneplus-bot-customizations/starboard-custom/src/main/resources/migrations/1.0-starboard-custom/starboard-custom-seedData/data.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/application/oneplus-bot-customizations/starboard-custom/src/main/resources/migrations/1.0-starboard-custom/starboard-custom-seedData/feature.xml b/application/oneplus-bot-customizations/starboard-custom/src/main/resources/migrations/1.0-starboard-custom/starboard-custom-seedData/feature.xml new file mode 100644 index 0000000..6c4ca7d --- /dev/null +++ b/application/oneplus-bot-customizations/starboard-custom/src/main/resources/migrations/1.0-starboard-custom/starboard-custom-seedData/feature.xml @@ -0,0 +1,14 @@ + + + + + + + + \ No newline at end of file diff --git a/application/oneplus-bot-customizations/starboard-custom/src/main/resources/migrations/dbchangelog-3.8.xsd b/application/oneplus-bot-customizations/starboard-custom/src/main/resources/migrations/dbchangelog-3.8.xsd new file mode 100644 index 0000000..ebfe6d6 --- /dev/null +++ b/application/oneplus-bot-customizations/starboard-custom/src/main/resources/migrations/dbchangelog-3.8.xsd @@ -0,0 +1,1377 @@ + + + + + + + + + + + + + + Extension to standard XSD boolean type to allow ${} parameters + + + + + + + + + + + + + + + + Extension to standard XSD integer type to allow ${} parameters + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + onChangeLogPreconditionOnSqlOutput determines what should + happen when evaluating this precondition in updateSQL mode. TEST: Run + precondition, FAIL: Fail precondition, IGNORE: Skip precondition check + [DEFAULT] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Used with valueClobFile to specify file encoding explicitly. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true for a cycling sequence, false for a non-cycling sequence. + Default is false. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/oneplus-bot-customizations/starboard-custom/src/main/resources/migrations/starboard-custom-changeLog.xml b/application/oneplus-bot-customizations/starboard-custom/src/main/resources/migrations/starboard-custom-changeLog.xml new file mode 100644 index 0000000..9e48812 --- /dev/null +++ b/application/oneplus-bot-customizations/starboard-custom/src/main/resources/migrations/starboard-custom-changeLog.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/application/oneplus-bot-customizations/starboard-custom/src/main/resources/starboard-custom.properties b/application/oneplus-bot-customizations/starboard-custom/src/main/resources/starboard-custom.properties new file mode 100644 index 0000000..064cc50 --- /dev/null +++ b/application/oneplus-bot-customizations/starboard-custom/src/main/resources/starboard-custom.properties @@ -0,0 +1,4 @@ +abstracto.postTargets.starboardNotification.name=starboardNotification + +abstracto.featureFlags.starboardNotification.featureName=starboardNotification +abstracto.featureFlags.starboardNotification.enabled=false \ No newline at end of file diff --git a/application/pom.xml b/application/pom.xml new file mode 100644 index 0000000..486c861 --- /dev/null +++ b/application/pom.xml @@ -0,0 +1,52 @@ + + + 4.0.0 + + + dev.sheldan.oneplus.bot + oneplusbot + 1.0-SNAPSHOT + + + dev.sheldan.oneplus.bot.application + application + pom + 1.0-SNAPSHOT + + executable + oneplus-bot-customizations + + + + + + dev.sheldan.abstracto + bundle + ${abstracto.version} + import + pom + + + + + + + + dev.sheldan.abstracto.core + core-int + + + + dev.sheldan.abstracto.modules + utility-int + + + + dev.sheldan.abstracto.scheduling + scheduling-int + + + + \ No newline at end of file diff --git a/deployment/docker-compose/pom.xml b/deployment/docker-compose/pom.xml new file mode 100644 index 0000000..69e8d64 --- /dev/null +++ b/deployment/docker-compose/pom.xml @@ -0,0 +1,36 @@ + + + + dev.sheldan.oneplus.bot.deployment + deployment + 1.0-SNAPSHOT + + 4.0.0 + + pom + docker-compose + + + + + maven-assembly-plugin + + + assembly-docker-compose-configuration + package + + single + + + + src/main/assembly/docker-compose.xml + + + + + + + + \ No newline at end of file diff --git a/deployment/docker-compose/src/main/assembly/docker-compose.xml b/deployment/docker-compose/src/main/assembly/docker-compose.xml new file mode 100644 index 0000000..370bed3 --- /dev/null +++ b/deployment/docker-compose/src/main/assembly/docker-compose.xml @@ -0,0 +1,19 @@ + + docker-compose + + zip + + false + + + ./docker-compose + ${project.basedir}/src/main/resources/ + + **/* + + true + + + \ No newline at end of file diff --git a/deployment/docker-compose/src/main/resources/.env b/deployment/docker-compose/src/main/resources/.env new file mode 100644 index 0000000..fe788e0 --- /dev/null +++ b/deployment/docker-compose/src/main/resources/.env @@ -0,0 +1,27 @@ +# database configuration +DATABASE_HOST=database +DATABASE_PORT=5432 +DATABASE_USER=abstracto +DATABASE_NAME=abstracto +DATABASE_PASSWORD=abstracto +# deployment configuration, whether or not the container should execute the parts on startup +EXECUTE_DEPLOYMENT=true +EXECUTE_LIQUIBASE=true +EXECUTE_TEMPLATES=true +# whether or not remote debug should be enabled on the application +REMOTE_DEBUG=false +DEBUG_PORT=5005 +TOMCAT_PORT=8080 +# authentication for actuator endpoints +REST_USER_NAME=abstracto +REST_PASSWORD=password +# port grafana will be reachable +GRAFANA_PORT=3000 +# port prometheus will be reachable +PROMETHEUS_PORT=9090 +# port pg admin will be reachable +PGADMIN_PORT=5050 +# default authentication for pg admin +PGADMIN_DEFAULT_EMAIL=sheldan@sheldan.dev +PGADMIN_DEFAULT_PASSWORD=admin +TOKEN= \ No newline at end of file diff --git a/deployment/docker-compose/src/main/resources/README.md b/deployment/docker-compose/src/main/resources/README.md new file mode 100644 index 0000000..11c7647 --- /dev/null +++ b/deployment/docker-compose/src/main/resources/README.md @@ -0,0 +1,10 @@ +# Setup for local docker-compose deployment + +* Install docker [here](https://docs.docker.com/get-docker/) +* Install docker-compose [here](https://docs.docker.com/compose/install/). +* Execute `docker-compose build` in `image-packaging`. +* Fill out values in `.env` for token and database password. There are some default values, but token is required to be changed. +* Execute `fill-prometheus-file-sh` in order to populate the prometheus config with the correct password (https://github.com/prometheus/prometheus/issues/2357) +* Execute `docker-compose up` in this directory and wait for completion. +* Per default pgAdmin is available on `localhost:5050` with the configured user and password. It will contain a configuration in the servers list. + diff --git a/deployment/docker-compose/src/main/resources/docker-compose.yml b/deployment/docker-compose/src/main/resources/docker-compose.yml new file mode 100644 index 0000000..579f647 --- /dev/null +++ b/deployment/docker-compose/src/main/resources/docker-compose.yml @@ -0,0 +1,105 @@ +version: '3.7' + +services: + db: + image: ${REGISTRY_PREFIX}oneplus_bot_database + container_name: database + restart: always + environment: + POSTGRES_PASSWORD: ${DATABASE_PASSWORD} + POSTGRES_USER: ${DATABASE_USER} + ports: + - "${DATABASE_PORT}:5432" + networks: + - oneplusbot + volumes: + - db-data:/var/lib/postgresql/data + deployment_container: + container_name: deployment + image: ${REGISTRY_PREFIX}oneplus_bot_deployment + depends_on: + - db + environment: + DB_PASS: ${DATABASE_PASSWORD} + DB_HOST: ${DATABASE_HOST} + DB_PORT: ${DATABASE_PORT} + DB_USER: ${DATABASE_USER} + DB_NAME: ${DATABASE_NAME} + EXECUTE_DEPLOYMENT: ${EXECUTE_DEPLOYMENT} + EXECUTE_LIQUIBASE: ${EXECUTE_LIQUIBASE} + EXECUTE_TEMPLATES: ${EXECUTE_TEMPLATES} + LIQUIBASE_PATH: ${LIQUIBASE_PATH:-/liquibase} + POSTGRES_DRIVER_PATH: ${EXECUTE_DEPLOYMENT:-/postgres/driver.jar} + WAIT_HOSTS: database:5432 + networks: + - oneplusbot + bot: + image: ${REGISTRY_PREFIX}oneplus_bot + depends_on: + - db + - deployment_container + restart: on-failure + container_name: oneplusbot + environment: + TOKEN: ${TOKEN} + REMOTE_DEBUG: ${REMOTE_DEBUG} + DB_PASS: ${DATABASE_PASSWORD} + DB_HOST: ${DATABASE_HOST} + DB_PORT: ${DATABASE_PORT} + DB_USER: ${DATABASE_USER} + DB_NAME: ${DATABASE_NAME} + REST_USER_NAME: ${REST_USER_NAME} + REST_PASSWORD: ${REST_PASSWORD} + command: sh -c "while ping -c1 deployment_container &>/dev/null; do sleep 1; done; echo 'Liquibase finished!' && ./start.sh" + ports: + - "${DEBUG_PORT}:5005" + - "${TOMCAT_PORT}:8080" + networks: + - oneplusbot + pgadmin: + container_name: pgadmin + image: ${REGISTRY_PREFIX}oneplus_bot_pg_admin + depends_on: + - db + environment: + PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL} + PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD} + ports: + - "${PGADMIN_PORT}:80" + restart: unless-stopped + networks: + - oneplusbot + prometheus: + container_name: prometheus + image: ${REGISTRY_PREFIX}oneplus_bot_prometheus + depends_on: + - bot + ports: + - "${PROMETHEUS_PORT}:9090" + restart: unless-stopped + networks: + - oneplusbot + volumes: + - ./res/prometheus-scrapper-password-filled:/etc/prometheus/micrometer_password + grafana: + container_name: grafana + image: ${REGISTRY_PREFIX}oneplus_bot_grafana + depends_on: + - prometheus + - bot + ports: + - "${GRAFANA_PORT}:3000" + restart: unless-stopped + volumes: + - grafana-user-data:/var/lib/grafana + networks: + - oneplusbot + +networks: + oneplusbot: + driver: bridge + name: oneplusbot-network + +volumes: + db-data: + grafana-user-data: \ No newline at end of file diff --git a/deployment/docker-compose/src/main/resources/fill-prometheus-file.sh b/deployment/docker-compose/src/main/resources/fill-prometheus-file.sh new file mode 100755 index 0000000..d070780 --- /dev/null +++ b/deployment/docker-compose/src/main/resources/fill-prometheus-file.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -o allexport +source .env +set +o allexport +envsubst < res/prometheus-scrapper-password > res/prometheus-scrapper-password-filled \ No newline at end of file diff --git a/deployment/docker-compose/src/main/resources/res/prometheus-scrapper-password b/deployment/docker-compose/src/main/resources/res/prometheus-scrapper-password new file mode 100644 index 0000000..70b2df2 --- /dev/null +++ b/deployment/docker-compose/src/main/resources/res/prometheus-scrapper-password @@ -0,0 +1 @@ +${REST_PASSWORD} \ No newline at end of file diff --git a/deployment/image-packaging/pom.xml b/deployment/image-packaging/pom.xml new file mode 100644 index 0000000..3e1f74b --- /dev/null +++ b/deployment/image-packaging/pom.xml @@ -0,0 +1,266 @@ + + + + dev.sheldan.oneplus.bot.deployment + deployment + 1.0-SNAPSHOT + + 4.0.0 + + image-packaging + pom + + ${project.basedir}/src/main/docker/ + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy + package + + copy + + + + + + + + + dev.sheldan.oneplus.bot.application + executable + ${project.version} + exec + jar + true + ${file.basedir}/oneplusbot/bot + app.jar + + + + + dev.sheldan.abstracto-templates.templates + core + ${abstracto.templates.version} + zip + true + ${file.basedir}/deployment/template-artifacts/ + core.zip + + + dev.sheldan.abstracto-templates.templates + entertainment + ${abstracto.templates.version} + zip + true + ${file.basedir}/deployment/template-artifacts/ + entertainment.zip + + + dev.sheldan.abstracto-templates.templates + link-embed + ${abstracto.templates.version} + zip + true + ${file.basedir}/deployment/template-artifacts/ + link-embed.zip + + + dev.sheldan.abstracto-templates.templates + starboard + ${abstracto.templates.version} + zip + true + ${file.basedir}/deployment/template-artifacts/ + starboard.zip + + + dev.sheldan.abstracto-templates.templates + utility + ${abstracto.templates.version} + zip + true + ${file.basedir}/deployment/template-artifacts/ + utility.zip + + + + dev.sheldan.oneplus.bot.templates.modules + starboard-custom-templates + ${project.version} + zip + true + ${file.basedir}/deployment/template-artifacts/ + starboard-custom.zip + + + + + dev.sheldan.abstracto-templates.translations + utility + ${abstracto.templates.version} + zip + true + ${file.basedir}/deployment/translation-artifacts/ + utility.zip + + + dev.sheldan.abstracto-templates.translations + core + ${abstracto.templates.version} + zip + true + ${file.basedir}/deployment/translation-artifacts/ + core.zip + + + dev.sheldan.abstracto-templates.translations + entertainment + ${abstracto.templates.version} + zip + true + ${file.basedir}/deployment/translation-artifacts/ + entertainment.zip + + + dev.sheldan.abstracto-templates.translations + link-embed + ${abstracto.templates.version} + zip + true + ${file.basedir}/deployment/translation-artifacts/ + link-embed.zip + + + dev.sheldan.abstracto-templates.translations + starboard + ${abstracto.templates.version} + zip + true + ${file.basedir}/deployment/translation-artifacts/ + starboard.zip + + + dev.sheldan.abstracto-templates.translations + utility + ${abstracto.templates.version} + zip + true + ${file.basedir}/deployment/translation-artifacts/ + utility.zip + + + + dev.sheldan.oneplus.bot.templates.translations + starboard-custom + ${project.version} + zip + true + ${file.basedir}/deployment/translation-artifacts/ + starboard-custom.zip + + + + + dev.sheldan.abstracto.scheduling + scheduling-impl + ${abstracto.version} + liquibase + zip + true + ${file.basedir}/deployment/liquibase-artifacts/ + scheduling.zip + + + + dev.sheldan.abstracto.core + core-impl + ${abstracto.version} + liquibase + zip + true + ${file.basedir}/deployment/liquibase-artifacts/ + core.zip + + + + dev.sheldan.abstracto.modules + utility-impl + ${abstracto.version} + liquibase + zip + true + ${file.basedir}/deployment/liquibase-artifacts/ + utility.zip + + + + dev.sheldan.abstracto.modules + entertainment-impl + ${abstracto.version} + liquibase + zip + true + ${file.basedir}/deployment/liquibase-artifacts/ + entertainment.zip + + + + dev.sheldan.abstracto.modules + link-embed-impl + ${abstracto.version} + liquibase + zip + true + ${file.basedir}/deployment/liquibase-artifacts/ + link-embed.zip + + + + dev.sheldan.abstracto.modules + starboard-impl + ${abstracto.version} + liquibase + zip + true + ${file.basedir}/deployment/liquibase-artifacts/ + starboard.zip + + + + + dev.sheldan.abstracto.modules + utility-impl + ${abstracto.version} + liquibase + zip + true + ${file.basedir}/deployment/liquibase-artifacts/ + utility.zip + + + + dev.sheldan.oneplus.bot.application.custom + starboard-custom + ${project.version} + liquibase + zip + true + ${file.basedir}/deployment/liquibase-artifacts/ + starboard-custom.zip + + + + + + + + + \ No newline at end of file diff --git a/deployment/image-packaging/src/main/docker/database/Dockerfile b/deployment/image-packaging/src/main/docker/database/Dockerfile new file mode 100644 index 0000000..50d95b0 --- /dev/null +++ b/deployment/image-packaging/src/main/docker/database/Dockerfile @@ -0,0 +1,4 @@ +FROM postgres +MAINTAINER Sheldan +VOLUME /tmp +ADD sql/init.sql /docker-entrypoint-initdb.d/init.sql \ No newline at end of file diff --git a/deployment/image-packaging/src/main/docker/database/sql/init.sql b/deployment/image-packaging/src/main/docker/database/sql/init.sql new file mode 100644 index 0000000..176cd93 --- /dev/null +++ b/deployment/image-packaging/src/main/docker/database/sql/init.sql @@ -0,0 +1 @@ +CREATE SCHEMA abstracto \ No newline at end of file diff --git a/deployment/image-packaging/src/main/docker/deployment/Dockerfile b/deployment/image-packaging/src/main/docker/deployment/Dockerfile new file mode 100644 index 0000000..0d9ebbb --- /dev/null +++ b/deployment/image-packaging/src/main/docker/deployment/Dockerfile @@ -0,0 +1,6 @@ +FROM abstracto_deployment:latest +MAINTAINER Sheldan +ADD template-artifacts /templates +ADD translation-artifacts /translations +ADD liquibase-artifacts /liquibase-zips +ADD config / diff --git a/deployment/image-packaging/src/main/docker/deployment/config/artifact_versions.json b/deployment/image-packaging/src/main/docker/deployment/config/artifact_versions.json new file mode 100644 index 0000000..369f2e2 --- /dev/null +++ b/deployment/image-packaging/src/main/docker/deployment/config/artifact_versions.json @@ -0,0 +1,15 @@ +{ + "template_artifacts": ["utility", "core", "entertainment", "starboard", "link-embed", "starboard-custom"], + "translation_artifacts": ["utility", "core", "entertainment", "starboard", "link-embed", "starboard-custom"], + "liquibase_artifacts": [ + { "zip": "scheduling", "file": "scheduling-changeLog.xml" }, + { "zip": "core", "file": "core-changeLog.xml" }, + { "zip": "utility", "file": "utility-changeLog.xml"}, + { "zip": "entertainment", "file": "entertainment-changeLog.xml"}, + { "zip": "link-embed", "file": "link-embed-changeLog.xml"}, + { "zip": "starboard", "file": "starboard-changeLog.xml"}, + { "zip": "starboard-custom", "file": "starboard-custom-changeLog.xml"} + ] +} + + diff --git a/deployment/image-packaging/src/main/docker/docker-compose.yml b/deployment/image-packaging/src/main/docker/docker-compose.yml new file mode 100644 index 0000000..4b96013 --- /dev/null +++ b/deployment/image-packaging/src/main/docker/docker-compose.yml @@ -0,0 +1,21 @@ +version: "3.7" + +services: + bot: + build: oneplusbot + image: ${REGISTRY_PREFIX}oneplus_bot:${VERSION:-latest} + database: + build: database + image: ${REGISTRY_PREFIX}oneplus_bot_database:${VERSION:-latest} + pg_admin: + build: pgAdmin + image: ${REGISTRY_PREFIX}oneplus_bot_pg_admin:${VERSION:-latest} + deployment_container: + build: deployment + image: ${REGISTRY_PREFIX}oneplus_bot_deployment:${VERSION:-latest} + prometheus: + build: prometheus + image: ${REGISTRY_PREFIX}oneplus_bot_prometheus:${VERSION:-latest} + grafana: + build: grafana + image: ${REGISTRY_PREFIX}oneplus_bot_grafana:${VERSION:-latest} diff --git a/deployment/image-packaging/src/main/docker/grafana/Dockerfile b/deployment/image-packaging/src/main/docker/grafana/Dockerfile new file mode 100644 index 0000000..f2c1447 --- /dev/null +++ b/deployment/image-packaging/src/main/docker/grafana/Dockerfile @@ -0,0 +1,5 @@ +FROM grafana/grafana +MAINTAINER Sheldan +ADD ./provisioning /etc/grafana/provisioning +ADD ./config.ini /etc/grafana/config.ini +ADD ./dashboards /var/lib/grafana/dashboards \ No newline at end of file diff --git a/deployment/image-packaging/src/main/docker/grafana/config.ini b/deployment/image-packaging/src/main/docker/grafana/config.ini new file mode 100644 index 0000000..4980ea8 --- /dev/null +++ b/deployment/image-packaging/src/main/docker/grafana/config.ini @@ -0,0 +1,2 @@ +[paths] +provisioning = conf/provisioning \ No newline at end of file diff --git a/deployment/image-packaging/src/main/docker/grafana/dashboards/crimson-status-dashboard.json b/deployment/image-packaging/src/main/docker/grafana/dashboards/crimson-status-dashboard.json new file mode 100644 index 0000000..f0e7fec --- /dev/null +++ b/deployment/image-packaging/src/main/docker/grafana/dashboards/crimson-status-dashboard.json @@ -0,0 +1,1368 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- Grafana --", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "gnetId": null, + "graphTooltip": 1, + "id": 1, + "links": [], + "panels": [ + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 0 + }, + "hiddenSeries": false, + "id": 16, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.7", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "increase(discord_api_interactions_total[1m])", + "interval": "", + "legendFormat": "{{ action }}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Discord API Interaction", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 0 + }, + "hiddenSeries": false, + "id": 4, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.7", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "increase(command_processed_total[1m])", + "interval": "", + "legendFormat": "{{status}}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Commands processed", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "prometheus", + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 8 + }, + "hiddenSeries": false, + "id": 2, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.7", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "increase(message_total[1m])", + "interval": "", + "legendFormat": "{{ action }}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Message events", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 8 + }, + "hiddenSeries": false, + "id": 26, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.7", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "increase(okhttp_request_total[1m])", + "interval": "", + "legendFormat": "{{ http_code }}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "HTTP Reponse codes", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 6, + "x": 0, + "y": 16 + }, + "hiddenSeries": false, + "id": 24, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.7", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "increase(modmail_messges_total[1m])", + "interval": "", + "legendFormat": "{{ direction }}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Modmail messages", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 6, + "x": 6, + "y": 16 + }, + "hiddenSeries": false, + "id": 8, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.7", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "increase(starboard_stars_total[1m])", + "interval": "", + "legendFormat": "{{ action }}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Starboard reactions", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 16 + }, + "hiddenSeries": false, + "id": 10, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.7", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "increase(help_executions_total[1m])", + "interval": "", + "legendFormat": "{{ category }}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Help command", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 7, + "w": 6, + "x": 0, + "y": 24 + }, + "hiddenSeries": false, + "id": 14, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.7", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "increase(assignable_roles_total[1m])", + "interval": "", + "legendFormat": "{{ action }}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Assignable role actions", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 7, + "w": 6, + "x": 6, + "y": 24 + }, + "hiddenSeries": false, + "id": 12, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.7", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "increase(emote_usages_total[1m])", + "interval": "", + "legendFormat": "Used emotes", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Emote tracking", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 7, + "w": 6, + "x": 12, + "y": 24 + }, + "hiddenSeries": false, + "id": 6, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.7", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "increase(message_embedded_total[1m])", + "interval": "", + "legendFormat": "{{action}}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Embedded messages", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 7, + "w": 6, + "x": 18, + "y": 24 + }, + "hiddenSeries": false, + "id": 22, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.7", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "increase(modmail_threads_total[1m])", + "interval": "", + "legendFormat": "{{ action }}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Modmail threads", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 7, + "w": 6, + "x": 6, + "y": 31 + }, + "hiddenSeries": false, + "id": 28, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.7", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "increase(experience_runtime_storage[1m])", + "interval": "", + "legendFormat": "Amount of entries", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Experience storage", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 7, + "w": 6, + "x": 12, + "y": 31 + }, + "hiddenSeries": false, + "id": 18, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.7", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "increase(invite_filter_total[1m])", + "interval": "", + "legendFormat": "{{ consequence }}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Invite filter", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 7, + "w": 6, + "x": 18, + "y": 31 + }, + "hiddenSeries": false, + "id": 20, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.7", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "increase(moderation_purge_total[1m])", + "interval": "", + "legendFormat": "Messages", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Message purges", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + } + ], + "refresh": "10s", + "schemaVersion": 26, + "style": "dark", + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "OnePlus Bot status", + "uid": "6WIJ36BMz", + "version": 1 +} \ No newline at end of file diff --git a/deployment/image-packaging/src/main/docker/grafana/dashboards/jvm-dashboard.json b/deployment/image-packaging/src/main/docker/grafana/dashboards/jvm-dashboard.json new file mode 100644 index 0000000..90d02b5 --- /dev/null +++ b/deployment/image-packaging/src/main/docker/grafana/dashboards/jvm-dashboard.json @@ -0,0 +1,1561 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- Grafana --", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "limit": 100, + "name": "Annotations & Alerts", + "showIn": 0, + "type": "dashboard" + } + ] + }, + "description": "Dashboard for OnePlus Bot spring boot monitoring (adapted from https://grafana.com/grafana/dashboards/4701)", + "editable": true, + "gnetId": null, + "graphTooltip": 1, + "id": 2, + "iteration": 1612052492351, + "links": [], + "panels": [ + { + "collapsed": false, + "datasource": null, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 125, + "panels": [], + "repeat": null, + "title": "Overview", + "type": "row" + }, + { + "cacheTimeout": null, + "colorBackground": false, + "colorValue": true, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "datasource": "prometheus", + "decimals": 1, + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "format": "s", + "gauge": { + "maxValue": 100, + "minValue": 0, + "show": false, + "thresholdLabels": false, + "thresholdMarkers": true + }, + "gridPos": { + "h": 3, + "w": 6, + "x": 0, + "y": 1 + }, + "height": "", + "id": 63, + "interval": null, + "links": [], + "mappingType": 1, + "mappingTypes": [ + { + "name": "value to text", + "value": 1 + }, + { + "name": "range to text", + "value": 2 + } + ], + "maxDataPoints": 100, + "nullPointMode": "connected", + "nullText": null, + "postfix": "", + "postfixFontSize": "50%", + "prefix": "", + "prefixFontSize": "70%", + "rangeMaps": [ + { + "from": "null", + "text": "N/A", + "to": "null" + } + ], + "sparkline": { + "fillColor": "rgba(31, 118, 189, 0.18)", + "full": false, + "lineColor": "rgb(31, 120, 193)", + "show": false + }, + "tableColumn": "", + "targets": [ + { + "expr": "process_uptime_seconds{application=\"$application\"}", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "", + "metric": "", + "refId": "A", + "step": 14400 + } + ], + "thresholds": "", + "title": "Uptime", + "type": "singlestat", + "valueFontSize": "80%", + "valueMaps": [ + { + "op": "=", + "text": "N/A", + "value": "null" + } + ], + "valueName": "current" + }, + { + "cacheTimeout": null, + "colorBackground": false, + "colorValue": true, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "datasource": "prometheus", + "decimals": null, + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "format": "dateTimeAsIso", + "gauge": { + "maxValue": 100, + "minValue": 0, + "show": false, + "thresholdLabels": false, + "thresholdMarkers": true + }, + "gridPos": { + "h": 3, + "w": 6, + "x": 6, + "y": 1 + }, + "height": "", + "id": 92, + "interval": null, + "links": [], + "mappingType": 1, + "mappingTypes": [ + { + "name": "value to text", + "value": 1 + }, + { + "name": "range to text", + "value": 2 + } + ], + "maxDataPoints": 100, + "nullPointMode": "connected", + "nullText": null, + "postfix": "", + "postfixFontSize": "50%", + "prefix": "", + "prefixFontSize": "70%", + "rangeMaps": [ + { + "from": "null", + "text": "N/A", + "to": "null" + } + ], + "sparkline": { + "fillColor": "rgba(31, 118, 189, 0.18)", + "full": false, + "lineColor": "rgb(31, 120, 193)", + "show": false + }, + "tableColumn": "", + "targets": [ + { + "expr": "process_start_time_seconds{application=\"$application\"}*1000", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "", + "metric": "", + "refId": "A", + "step": 14400 + } + ], + "thresholds": "", + "title": "Start time", + "type": "singlestat", + "valueFontSize": "70%", + "valueMaps": [ + { + "op": "=", + "text": "N/A", + "value": "null" + } + ], + "valueName": "current" + }, + { + "cacheTimeout": null, + "colorBackground": false, + "colorValue": true, + "colors": [ + "rgba(50, 172, 45, 0.97)", + "rgba(237, 129, 40, 0.89)", + "rgba(245, 54, 54, 0.9)" + ], + "datasource": "prometheus", + "decimals": 2, + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "format": "percent", + "gauge": { + "maxValue": 100, + "minValue": 0, + "show": false, + "thresholdLabels": false, + "thresholdMarkers": true + }, + "gridPos": { + "h": 3, + "w": 6, + "x": 12, + "y": 1 + }, + "id": 65, + "interval": null, + "links": [], + "mappingType": 1, + "mappingTypes": [ + { + "name": "value to text", + "value": 1 + }, + { + "name": "range to text", + "value": 2 + } + ], + "maxDataPoints": 100, + "nullPointMode": "connected", + "nullText": null, + "postfix": "", + "postfixFontSize": "50%", + "prefix": "", + "prefixFontSize": "70%", + "rangeMaps": [ + { + "from": "null", + "text": "N/A", + "to": "null" + } + ], + "sparkline": { + "fillColor": "rgba(31, 118, 189, 0.18)", + "full": false, + "lineColor": "rgb(31, 120, 193)", + "show": false + }, + "tableColumn": "", + "targets": [ + { + "expr": "sum(jvm_memory_used_bytes{application=\"$application\", area=\"heap\"})*100/sum(jvm_memory_max_bytes{application=\"$application\", area=\"heap\"})", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "", + "refId": "A", + "step": 14400 + } + ], + "thresholds": "70,90", + "title": "Heap used", + "type": "singlestat", + "valueFontSize": "80%", + "valueMaps": [ + { + "op": "=", + "text": "N/A", + "value": "null" + } + ], + "valueName": "current" + }, + { + "cacheTimeout": null, + "colorBackground": false, + "colorValue": true, + "colors": [ + "rgba(50, 172, 45, 0.97)", + "rgba(237, 129, 40, 0.89)", + "rgba(245, 54, 54, 0.9)" + ], + "datasource": "prometheus", + "decimals": 2, + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "format": "percent", + "gauge": { + "maxValue": 100, + "minValue": 0, + "show": false, + "thresholdLabels": false, + "thresholdMarkers": true + }, + "gridPos": { + "h": 3, + "w": 6, + "x": 18, + "y": 1 + }, + "id": 75, + "interval": null, + "links": [], + "mappingType": 2, + "mappingTypes": [ + { + "name": "value to text", + "value": 1 + }, + { + "name": "range to text", + "value": 2 + } + ], + "maxDataPoints": 100, + "nullPointMode": "connected", + "nullText": null, + "postfix": "", + "postfixFontSize": "50%", + "prefix": "", + "prefixFontSize": "70%", + "rangeMaps": [ + { + "from": "null", + "text": "N/A", + "to": "null" + }, + { + "from": "-99999999999999999999999999999999", + "text": "N/A", + "to": "0" + } + ], + "sparkline": { + "fillColor": "rgba(31, 118, 189, 0.18)", + "full": false, + "lineColor": "rgb(31, 120, 193)", + "show": false + }, + "tableColumn": "", + "targets": [ + { + "expr": "sum(jvm_memory_used_bytes{application=\"$application\", area=\"nonheap\"})*100/sum(jvm_memory_max_bytes{application=\"$application\",area=\"nonheap\"})", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "", + "refId": "A", + "step": 14400 + } + ], + "thresholds": "70,90", + "title": "Non-Heap used", + "type": "singlestat", + "valueFontSize": "80%", + "valueMaps": [ + { + "op": "=", + "text": "N/A", + "value": "null" + }, + { + "op": "=", + "text": "x", + "value": "" + } + ], + "valueName": "current" + }, + { + "collapsed": false, + "datasource": null, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 4 + }, + "id": 127, + "panels": [], + "repeat": null, + "title": "Memory", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "prometheus", + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "grid": { + "leftLogBase": 1, + "leftMax": null, + "leftMin": null, + "rightLogBase": 1, + "rightMax": null, + "rightMin": null + }, + "gridPos": { + "h": 7, + "w": 6, + "x": 0, + "y": 5 + }, + "hiddenSeries": false, + "id": 24, + "legend": { + "avg": false, + "current": true, + "max": true, + "min": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.7", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(jvm_memory_used_bytes{application=\"$application\", area=\"heap\"})", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "used", + "metric": "", + "refId": "A", + "step": 2400 + }, + { + "expr": "sum(jvm_memory_committed_bytes{application=\"$application\", area=\"heap\"})", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "committed", + "refId": "B", + "step": 2400 + }, + { + "expr": "sum(jvm_memory_max_bytes{application=\"$application\", area=\"heap\"})", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "max", + "refId": "C", + "step": 2400 + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "JVM Heap", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "y-axis": true, + "y_formats": [ + "mbytes", + "short" + ], + "yaxes": [ + { + "format": "bytes", + "label": null, + "logBase": 1, + "max": null, + "min": 0, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "prometheus", + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "grid": { + "leftLogBase": 1, + "leftMax": null, + "leftMin": null, + "rightLogBase": 1, + "rightMax": null, + "rightMin": null + }, + "gridPos": { + "h": 7, + "w": 6, + "x": 6, + "y": 5 + }, + "hiddenSeries": false, + "id": 25, + "legend": { + "avg": false, + "current": true, + "max": true, + "min": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.7", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(jvm_memory_used_bytes{application=\"$application\", area=\"nonheap\"})", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "used", + "metric": "", + "refId": "A", + "step": 2400 + }, + { + "expr": "sum(jvm_memory_committed_bytes{application=\"$application\", area=\"nonheap\"})", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "committed", + "refId": "B", + "step": 2400 + }, + { + "expr": "sum(jvm_memory_max_bytes{application=\"$application\", area=\"nonheap\"})", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "max", + "refId": "C", + "step": 2400 + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "JVM Non-Heap", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "y-axis": true, + "y_formats": [ + "mbytes", + "short" + ], + "yaxes": [ + { + "format": "bytes", + "label": null, + "logBase": 1, + "max": null, + "min": 0, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "prometheus", + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "grid": { + "leftLogBase": 1, + "leftMax": null, + "leftMin": null, + "rightLogBase": 1, + "rightMax": null, + "rightMin": null + }, + "gridPos": { + "h": 7, + "w": 6, + "x": 12, + "y": 5 + }, + "hiddenSeries": false, + "id": 26, + "legend": { + "alignAsTable": false, + "avg": false, + "current": true, + "max": true, + "min": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.7", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(jvm_memory_used_bytes{application=\"$application\"})", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "used", + "metric": "", + "refId": "A", + "step": 2400 + }, + { + "expr": "sum(jvm_memory_committed_bytes{application=\"$application\"})", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "committed", + "refId": "B", + "step": 2400 + }, + { + "expr": "sum(jvm_memory_max_bytes{application=\"$application\"})", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "max", + "refId": "C", + "step": 2400 + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "JVM Total", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "y-axis": true, + "y_formats": [ + "mbytes", + "short" + ], + "yaxes": [ + { + "format": "bytes", + "label": "", + "logBase": 1, + "max": null, + "min": 0, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": { + "debug": "#1F78C1", + "error": "#BF1B00", + "info": "#508642", + "trace": "#6ED0E0", + "warn": "#EAB839" + }, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "prometheus", + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "grid": { + "leftLogBase": 1, + "leftMax": null, + "leftMin": null, + "rightLogBase": 1, + "rightMax": null, + "rightMin": null + }, + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 12 + }, + "height": "", + "hiddenSeries": false, + "id": 91, + "legend": { + "alignAsTable": false, + "avg": false, + "current": true, + "hideEmpty": false, + "hideZero": false, + "max": true, + "min": false, + "rightSide": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": true, + "pluginVersion": "7.3.7", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "error", + "yaxis": 1 + }, + { + "alias": "warn", + "yaxis": 1 + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "increase(logback_events_total{application=\"$application\"}[1m])", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "{{level}}", + "metric": "", + "refId": "A", + "step": 1200 + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Log Events", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "x-axis": true, + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "y-axis": true, + "y_formats": [ + "short", + "short" + ], + "yaxes": [ + { + "decimals": 0, + "format": "opm", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "collapsed": false, + "datasource": null, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 19 + }, + "id": 128, + "panels": [], + "repeat": null, + "title": "CPU & Load", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "prometheus", + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "grid": { + "leftLogBase": 1, + "leftMax": null, + "leftMin": null, + "rightLogBase": 1, + "rightMax": null, + "rightMin": null + }, + "gridPos": { + "h": 7, + "w": 6, + "x": 0, + "y": 20 + }, + "hiddenSeries": false, + "id": 106, + "legend": { + "avg": false, + "current": true, + "max": true, + "min": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.7", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "system_cpu_usage{application=\"$application\"}", + "format": "time_series", + "hide": false, + "intervalFactor": 1, + "legendFormat": "system", + "metric": "", + "refId": "A", + "step": 2400 + }, + { + "expr": "process_cpu_usage{application=\"$application\"}", + "format": "time_series", + "hide": false, + "intervalFactor": 1, + "legendFormat": "process", + "refId": "B" + }, + { + "expr": "avg_over_time(process_cpu_usage{application=\"$application\"}[1h])", + "format": "time_series", + "hide": false, + "intervalFactor": 1, + "legendFormat": "process-1h", + "refId": "C" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "CPU Usage", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "y-axis": true, + "y_formats": [ + "short", + "short" + ], + "yaxes": [ + { + "decimals": 1, + "format": "percentunit", + "label": "", + "logBase": 1, + "max": "1", + "min": 0, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "prometheus", + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "grid": { + "leftLogBase": 1, + "leftMax": null, + "leftMin": null, + "rightLogBase": 1, + "rightMax": null, + "rightMin": null + }, + "gridPos": { + "h": 7, + "w": 6, + "x": 6, + "y": 20 + }, + "hiddenSeries": false, + "id": 93, + "legend": { + "avg": false, + "current": true, + "max": true, + "min": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.7", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "system_load_average_1m{application=\"$application\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "system-1m", + "metric": "", + "refId": "A", + "step": 2400 + }, + { + "expr": "system_cpu_count{application=\"$application\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "cpus", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Load", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "y-axis": true, + "y_formats": [ + "short", + "short" + ], + "yaxes": [ + { + "decimals": 1, + "format": "short", + "label": "", + "logBase": 1, + "max": null, + "min": 0, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "prometheus", + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "grid": { + "leftLogBase": 1, + "leftMax": null, + "leftMin": null, + "rightLogBase": 1, + "rightMax": null, + "rightMin": null + }, + "gridPos": { + "h": 7, + "w": 6, + "x": 12, + "y": 20 + }, + "hiddenSeries": false, + "id": 32, + "legend": { + "avg": false, + "current": true, + "max": true, + "min": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.7", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "jvm_threads_live_threads{application=\"$application\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "live", + "metric": "", + "refId": "A", + "step": 2400 + }, + { + "expr": "jvm_threads_daemon_threads{application=\"$application\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "daemon", + "metric": "", + "refId": "B", + "step": 2400 + }, + { + "expr": "jvm_threads_peak_threads{application=\"$application\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "peak", + "refId": "C", + "step": 2400 + }, + { + "expr": "process_threads{application=\"$application\"}", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "process", + "refId": "D", + "step": 2400 + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Threads", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "y-axis": true, + "y_formats": [ + "short", + "short" + ], + "yaxes": [ + { + "decimals": 0, + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": 0, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": { + "blocked": "#bf1b00", + "new": "#fce2de", + "runnable": "#7eb26d", + "terminated": "#511749", + "timed-waiting": "#c15c17", + "waiting": "#eab839" + }, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "prometheus", + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 7, + "w": 6, + "x": 18, + "y": 20 + }, + "hiddenSeries": false, + "id": 124, + "legend": { + "alignAsTable": false, + "avg": false, + "current": true, + "max": true, + "min": false, + "rightSide": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.7", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "jvm_threads_states_threads{application=\"$application\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "{{state}}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Thread States", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + } + ], + "refresh": "30s", + "schemaVersion": 26, + "style": "dark", + "tags": [], + "templating": { + "list": [ + { + "allValue": null, + "current": { + "selected": true, + "text": "oneplusbot", + "value": "oneplusbot" + }, + "datasource": "prometheus", + "definition": "", + "error": null, + "hide": 0, + "includeAll": false, + "label": "Application", + "multi": false, + "name": "application", + "options": [], + "query": "label_values(application)", + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "tagValuesQuery": "", + "tags": [], + "tagsQuery": "", + "type": "query", + "useTags": false + } + ] + }, + "time": { + "from": "now-1h", + "to": "now" + }, + "timepicker": { + "now": true, + "refresh_intervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h" + ], + "time_options": [ + "5m", + "15m", + "1h", + "6h", + "12h", + "24h", + "2d", + "7d" + ] + }, + "timezone": "browser", + "title": "JVM (Micrometer)", + "uid": "YryNLtLMk", + "version": 1 +} \ No newline at end of file diff --git a/deployment/image-packaging/src/main/docker/grafana/provisioning/dashboards/all.yml b/deployment/image-packaging/src/main/docker/grafana/provisioning/dashboards/all.yml new file mode 100644 index 0000000..8ddb6b0 --- /dev/null +++ b/deployment/image-packaging/src/main/docker/grafana/provisioning/dashboards/all.yml @@ -0,0 +1,6 @@ +- name: 'oneplus-dashboards' + org_id: 1 + folder: '' + type: 'file' + options: + folder: '/var/lib/grafana/dashboards' \ No newline at end of file diff --git a/deployment/image-packaging/src/main/docker/grafana/provisioning/datasources/all.yml b/deployment/image-packaging/src/main/docker/grafana/provisioning/datasources/all.yml new file mode 100644 index 0000000..3d3045d --- /dev/null +++ b/deployment/image-packaging/src/main/docker/grafana/provisioning/datasources/all.yml @@ -0,0 +1,9 @@ +datasources: + - access: 'proxy' + editable: true + is_default: true + name: 'prometheus' + org_id: 1 + type: 'prometheus' + url: 'http://prometheus:9090' + version: 1 \ No newline at end of file diff --git a/deployment/image-packaging/src/main/docker/oneplusbot/Dockerfile b/deployment/image-packaging/src/main/docker/oneplusbot/Dockerfile new file mode 100644 index 0000000..fcdc04c --- /dev/null +++ b/deployment/image-packaging/src/main/docker/oneplusbot/Dockerfile @@ -0,0 +1,8 @@ +FROM openjdk:8-jdk-alpine +MAINTAINER Sheldan +VOLUME /tmp +ADD bot/app.jar /app.jar +ADD config/* /config/ +ADD wrapper/*.sh / +RUN chmod +x /start.sh +CMD ["/start.sh"] \ No newline at end of file diff --git a/deployment/image-packaging/src/main/docker/oneplusbot/config/application.properties b/deployment/image-packaging/src/main/docker/oneplusbot/config/application.properties new file mode 100644 index 0000000..7949759 --- /dev/null +++ b/deployment/image-packaging/src/main/docker/oneplusbot/config/application.properties @@ -0,0 +1,2 @@ +logging.config=config/logback.xml + diff --git a/deployment/image-packaging/src/main/docker/oneplusbot/config/logback.xml b/deployment/image-packaging/src/main/docker/oneplusbot/config/logback.xml new file mode 100644 index 0000000..779e490 --- /dev/null +++ b/deployment/image-packaging/src/main/docker/oneplusbot/config/logback.xml @@ -0,0 +1,37 @@ + + + + + + + %d{dd-MM-yyyy HH:mm:ss.SSS} %magenta([%thread]) %highlight(%-5level) %logger{36} - %msg%n + + + + + + + ${LOG_PATH}/log.log + + + + %d{dd-MM-yyyy HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + ${LOG_PATH}/archived/log_%d{dd-MM-yyyy}.log + + 10 + 1GB + + + + + + + + + + \ No newline at end of file diff --git a/deployment/image-packaging/src/main/docker/oneplusbot/wrapper/start.sh b/deployment/image-packaging/src/main/docker/oneplusbot/wrapper/start.sh new file mode 100644 index 0000000..0d69daa --- /dev/null +++ b/deployment/image-packaging/src/main/docker/oneplusbot/wrapper/start.sh @@ -0,0 +1,7 @@ +#!/bin/sh +DEBUG_PARAMS="" +if [ "x$REMOTE_DEBUG" = 'xtrue' ]; then + DEBUG_PARAMS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005" + echo "Starting with remote debugging on port 5005" +fi; +java ${DEBUG_PARAMS} -jar app.jar \ No newline at end of file diff --git a/deployment/image-packaging/src/main/docker/pgAdmin/Dockerfile b/deployment/image-packaging/src/main/docker/pgAdmin/Dockerfile new file mode 100644 index 0000000..3dc7316 --- /dev/null +++ b/deployment/image-packaging/src/main/docker/pgAdmin/Dockerfile @@ -0,0 +1,4 @@ +FROM dpage/pgadmin4 +MAINTAINER Sheldan +VOLUME /tmp +ADD config/servers.json /pgadmin4/servers.json \ No newline at end of file diff --git a/deployment/image-packaging/src/main/docker/pgAdmin/config/servers.json b/deployment/image-packaging/src/main/docker/pgAdmin/config/servers.json new file mode 100644 index 0000000..84d1c0f --- /dev/null +++ b/deployment/image-packaging/src/main/docker/pgAdmin/config/servers.json @@ -0,0 +1,13 @@ +{ + "Servers": { + "1": { + "Name": "OnePlusBot database", + "Group": "Server Group 1", + "Port": 5432, + "Username": "abstracto", + "Host": "db", + "SSLMode": "prefer", + "MaintenanceDB": "postgres" + } + } +} \ No newline at end of file diff --git a/deployment/image-packaging/src/main/docker/prometheus/Dockerfile b/deployment/image-packaging/src/main/docker/prometheus/Dockerfile new file mode 100644 index 0000000..a49eff6 --- /dev/null +++ b/deployment/image-packaging/src/main/docker/prometheus/Dockerfile @@ -0,0 +1,3 @@ +FROM prom/prometheus +MAINTAINER Sheldan +ADD prometheus.yml /etc/prometheus/prometheus.yml \ No newline at end of file diff --git a/deployment/image-packaging/src/main/docker/prometheus/prometheus.yml b/deployment/image-packaging/src/main/docker/prometheus/prometheus.yml new file mode 100644 index 0000000..103f8e5 --- /dev/null +++ b/deployment/image-packaging/src/main/docker/prometheus/prometheus.yml @@ -0,0 +1,17 @@ +global: + scrape_interval: 10s + scrape_timeout: 10s + evaluation_interval: 1m +scrape_configs: + - job_name: oneplus_bot_micrometer + honor_timestamps: true + scrape_interval: 5s + scrape_timeout: 5s + metrics_path: /actuator/prometheus + scheme: http + static_configs: + - targets: + - 172.17.0.1:8080 + basic_auth: + username: "abstracto" + password_file: /etc/prometheus/micrometer_password \ No newline at end of file diff --git a/deployment/pom.xml b/deployment/pom.xml new file mode 100644 index 0000000..20b5fd5 --- /dev/null +++ b/deployment/pom.xml @@ -0,0 +1,21 @@ + + + + oneplusbot + dev.sheldan.oneplus.bot + 1.0-SNAPSHOT + + 4.0.0 + + dev.sheldan.oneplus.bot.deployment + deployment + pom + + + docker-compose + image-packaging + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..99838b0 --- /dev/null +++ b/pom.xml @@ -0,0 +1,48 @@ + + + 4.0.0 + pom + + + org.springframework.boot + spring-boot-starter-parent + 2.3.1.RELEASE + + + + dev.sheldan.oneplus.bot + oneplusbot + 1.0-SNAPSHOT + + + 1.8 + 1.8 + 1.2 + 1.2 + + + + application + templates + deployment + + + + + jcenter + jcenter-bintray + https://jcenter.bintray.com + + + github + https://maven.pkg.github.com/Sheldan/* + + true + + + + + + \ No newline at end of file diff --git a/settings.xml b/settings.xml new file mode 100644 index 0000000..7f7915a --- /dev/null +++ b/settings.xml @@ -0,0 +1,36 @@ + + + + github + + + + + github + + + central + https://repo1.maven.org/maven2 + + + github + https://maven.pkg.github.com/Sheldan/* + + true + + + + + + + + + github + ${env.user} + ${env.token} + + + diff --git a/templates/oneplus-bot-modules/pom.xml b/templates/oneplus-bot-modules/pom.xml new file mode 100644 index 0000000..add3c9c --- /dev/null +++ b/templates/oneplus-bot-modules/pom.xml @@ -0,0 +1,21 @@ + + + + dev.sheldan.oneplus.bot.templates + templates + 1.0-SNAPSHOT + + 4.0.0 + + dev.sheldan.oneplus.bot.templates.modules + oneplus-bot-modules + pom + 1.0-SNAPSHOT + + starboard-custom + + + + \ No newline at end of file diff --git a/templates/oneplus-bot-modules/starboard-custom/pom.xml b/templates/oneplus-bot-modules/starboard-custom/pom.xml new file mode 100644 index 0000000..1e7a84d --- /dev/null +++ b/templates/oneplus-bot-modules/starboard-custom/pom.xml @@ -0,0 +1,39 @@ + + + + dev.sheldan.oneplus.bot.templates.modules + oneplus-bot-modules + 1.0-SNAPSHOT + + 4.0.0 + + starboard-custom-templates + pom + + + + + org.apache.maven.plugins + maven-assembly-plugin + + + package + + single + + + starboard-custom-templates-${project.version} + false + + src/main/assembly/assembly.xml + + + + + + + + + \ No newline at end of file diff --git a/templates/oneplus-bot-modules/starboard-custom/src/main/assembly/assembly.xml b/templates/oneplus-bot-modules/starboard-custom/src/main/assembly/assembly.xml new file mode 100644 index 0000000..aca1e51 --- /dev/null +++ b/templates/oneplus-bot-modules/starboard-custom/src/main/assembly/assembly.xml @@ -0,0 +1,15 @@ + + zip + false + + zip + + + + . + ${project.basedir}/src/main/resources + + + \ No newline at end of file diff --git a/templates/oneplus-bot-modules/starboard-custom/src/main/resources/en_US/listener/starboardNotification/starboard_post_created_notification_embed_en_US.ftl b/templates/oneplus-bot-modules/starboard-custom/src/main/resources/en_US/listener/starboardNotification/starboard_post_created_notification_embed_en_US.ftl new file mode 100644 index 0000000..3977bd5 --- /dev/null +++ b/templates/oneplus-bot-modules/starboard-custom/src/main/resources/en_US/listener/starboardNotification/starboard_post_created_notification_embed_en_US.ftl @@ -0,0 +1,41 @@ +{ + "title": { + "title": "<@safe_include "starboard_post_created_title"/>" + }, + <#include "abstracto_color">, + "description": "<@safe_include "starboard_post_created_description"/>", + "fields": [ + { + "name": "<@safe_include "starboard_post_notification_field_starboard_message"/>", + <#if starboardMessage??> + "value": "[<@safe_include "starboard_post_notification_field_starboard_message_jump"/>](${starboardMessage.jumpUrl})" + <#else> + "value": "${post.starboardMessageId?c}" + + }, + { + "name": "<@safe_include "starboard_post_notification_field_starred_message"/>", + <#if starredMessage??> + "value": "[<@safe_include "starboard_post_notification_field_starboard_message_jump"/>](${starredMessage.jumpUrl})" + <#else> + "value": "${post.postMessageId?c}" + + }, + { + "name": "<@safe_include "starboard_post_notification_field_starred_user"/>", + <#if starredMember??> + "value": "${starredMember.asMention}" + <#else> + "value": "${starredUserId?c} (<@safe_include "user_left_server"/>)" + + }, + { + "name": "<@safe_include "starboard_post_notification_field_starring_user"/>", + <#if starringMember??> + "value": "${starringMember.asMention}" + <#else> + "value": "${starringUserId?c} (<@safe_include "user_left_server"/>)" + + } + ] +} \ No newline at end of file diff --git a/templates/oneplus-bot-modules/starboard-custom/src/main/resources/en_US/listener/starboardNotification/starboard_post_deleted_notification_embed_en_US.ftl b/templates/oneplus-bot-modules/starboard-custom/src/main/resources/en_US/listener/starboardNotification/starboard_post_deleted_notification_embed_en_US.ftl new file mode 100644 index 0000000..b4fbe93 --- /dev/null +++ b/templates/oneplus-bot-modules/starboard-custom/src/main/resources/en_US/listener/starboardNotification/starboard_post_deleted_notification_embed_en_US.ftl @@ -0,0 +1,33 @@ +{ + "title": { + "title": "<@safe_include "starboard_post_deleted_title"/>" + }, + <#include "abstracto_color">, + "description": "<@safe_include "starboard_post_deleted_description"/>", + "fields": [ + { + "name": "<@safe_include "starboard_post_notification_field_starred_message"/>", + <#if starredMessage??> + "value": "[<@safe_include "starboard_post_notification_field_starboard_message_jump"/>](${starredMessage.jumpUrl})" + <#else> + "value": "${starredMessageSimple.jumpUrl}" + + }, + { + "name": "<@safe_include "starboard_post_notification_field_starred_user"/>", + <#if starredMember??> + "value": "${starredMember.asMention}" + <#else> + "value": "${starredUserId?c} (<@safe_include "user_left_server"/>)" + + }, + { + "name": "<@safe_include "starboard_post_notification_field_starring_user"/>", + <#if starringMember??> + "value": "${starringMember.asMention}" + <#else> + "value": "${starringUserId?c} (<@safe_include "user_left_server"/>)" + + } + ] +} \ No newline at end of file diff --git a/templates/pom.xml b/templates/pom.xml new file mode 100644 index 0000000..27e4615 --- /dev/null +++ b/templates/pom.xml @@ -0,0 +1,22 @@ + + + 4.0.0 + + dev.sheldan.oneplus.bot + oneplusbot + 1.0-SNAPSHOT + + + + oneplus-bot-modules + translations + + + dev.sheldan.oneplus.bot.templates + templates + 1.0-SNAPSHOT + pom + + \ No newline at end of file diff --git a/templates/translations/pom.xml b/templates/translations/pom.xml new file mode 100644 index 0000000..572f7c3 --- /dev/null +++ b/templates/translations/pom.xml @@ -0,0 +1,18 @@ + + + + dev.sheldan.oneplus.bot.templates + templates + 1.0-SNAPSHOT + + 4.0.0 + + dev.sheldan.oneplus.bot.templates.translations + translations + pom + + starboard-custom-translations + + \ No newline at end of file diff --git a/templates/translations/starboard-custom-translations/pom.xml b/templates/translations/starboard-custom-translations/pom.xml new file mode 100644 index 0000000..c730195 --- /dev/null +++ b/templates/translations/starboard-custom-translations/pom.xml @@ -0,0 +1,39 @@ + + + + dev.sheldan.oneplus.bot.templates.translations + translations + 1.0-SNAPSHOT + + 4.0.0 + + starboard-custom + pom + + + + + org.apache.maven.plugins + maven-assembly-plugin + + + package + + single + + + starboard-custom-translations-${project.version} + false + + src/main/assembly/assembly.xml + + + + + + + + + \ No newline at end of file diff --git a/templates/translations/starboard-custom-translations/src/main/assembly/assembly.xml b/templates/translations/starboard-custom-translations/src/main/assembly/assembly.xml new file mode 100644 index 0000000..aca1e51 --- /dev/null +++ b/templates/translations/starboard-custom-translations/src/main/assembly/assembly.xml @@ -0,0 +1,15 @@ + + zip + false + + zip + + + + . + ${project.basedir}/src/main/resources + + + \ No newline at end of file diff --git a/templates/translations/starboard-custom-translations/src/main/resources/en_US/config/feature_setup_posttarget_starboardNotification_en_US.ftl b/templates/translations/starboard-custom-translations/src/main/resources/en_US/config/feature_setup_posttarget_starboardNotification_en_US.ftl new file mode 100644 index 0000000..69f0789 --- /dev/null +++ b/templates/translations/starboard-custom-translations/src/main/resources/en_US/config/feature_setup_posttarget_starboardNotification_en_US.ftl @@ -0,0 +1 @@ +The channel where the notifications about starboard posts should be posted to. Currently: ${currentTarget} \ No newline at end of file diff --git a/templates/translations/starboard-custom-translations/src/main/resources/en_US/config/feature_starboardNotification_en_US.ftl b/templates/translations/starboard-custom-translations/src/main/resources/en_US/config/feature_starboardNotification_en_US.ftl new file mode 100644 index 0000000..b34dc61 --- /dev/null +++ b/templates/translations/starboard-custom-translations/src/main/resources/en_US/config/feature_starboardNotification_en_US.ftl @@ -0,0 +1 @@ +Starboard notifications \ No newline at end of file diff --git a/templates/translations/starboard-custom-translations/src/main/resources/en_US/listener/starboardNotification/starboard_post_created_description_en_US.ftl b/templates/translations/starboard-custom-translations/src/main/resources/en_US/listener/starboardNotification/starboard_post_created_description_en_US.ftl new file mode 100644 index 0000000..21aa2f2 --- /dev/null +++ b/templates/translations/starboard-custom-translations/src/main/resources/en_US/listener/starboardNotification/starboard_post_created_description_en_US.ftl @@ -0,0 +1 @@ +Starboard post ${post.id?c} was created, because it reached the threshold. \ No newline at end of file diff --git a/templates/translations/starboard-custom-translations/src/main/resources/en_US/listener/starboardNotification/starboard_post_created_title_en_US.ftl b/templates/translations/starboard-custom-translations/src/main/resources/en_US/listener/starboardNotification/starboard_post_created_title_en_US.ftl new file mode 100644 index 0000000..75f3808 --- /dev/null +++ b/templates/translations/starboard-custom-translations/src/main/resources/en_US/listener/starboardNotification/starboard_post_created_title_en_US.ftl @@ -0,0 +1 @@ +Starboard post has been created \ No newline at end of file diff --git a/templates/translations/starboard-custom-translations/src/main/resources/en_US/listener/starboardNotification/starboard_post_deleted_description_en_US.ftl b/templates/translations/starboard-custom-translations/src/main/resources/en_US/listener/starboardNotification/starboard_post_deleted_description_en_US.ftl new file mode 100644 index 0000000..b629f33 --- /dev/null +++ b/templates/translations/starboard-custom-translations/src/main/resources/en_US/listener/starboardNotification/starboard_post_deleted_description_en_US.ftl @@ -0,0 +1 @@ +Starboard post was deleted, because it fell under the threshold. \ No newline at end of file diff --git a/templates/translations/starboard-custom-translations/src/main/resources/en_US/listener/starboardNotification/starboard_post_deleted_title_en_US.ftl b/templates/translations/starboard-custom-translations/src/main/resources/en_US/listener/starboardNotification/starboard_post_deleted_title_en_US.ftl new file mode 100644 index 0000000..4127fe4 --- /dev/null +++ b/templates/translations/starboard-custom-translations/src/main/resources/en_US/listener/starboardNotification/starboard_post_deleted_title_en_US.ftl @@ -0,0 +1 @@ +Starboard post has been deleted \ No newline at end of file diff --git a/templates/translations/starboard-custom-translations/src/main/resources/en_US/listener/starboardNotification/starboard_post_notification_field_starboard_message_en_US.ftl b/templates/translations/starboard-custom-translations/src/main/resources/en_US/listener/starboardNotification/starboard_post_notification_field_starboard_message_en_US.ftl new file mode 100644 index 0000000..5ac7e85 --- /dev/null +++ b/templates/translations/starboard-custom-translations/src/main/resources/en_US/listener/starboardNotification/starboard_post_notification_field_starboard_message_en_US.ftl @@ -0,0 +1 @@ +Message on starboard \ No newline at end of file diff --git a/templates/translations/starboard-custom-translations/src/main/resources/en_US/listener/starboardNotification/starboard_post_notification_field_starboard_message_jump_en_US.ftl b/templates/translations/starboard-custom-translations/src/main/resources/en_US/listener/starboardNotification/starboard_post_notification_field_starboard_message_jump_en_US.ftl new file mode 100644 index 0000000..341c2ff --- /dev/null +++ b/templates/translations/starboard-custom-translations/src/main/resources/en_US/listener/starboardNotification/starboard_post_notification_field_starboard_message_jump_en_US.ftl @@ -0,0 +1 @@ +Jump \ No newline at end of file diff --git a/templates/translations/starboard-custom-translations/src/main/resources/en_US/listener/starboardNotification/starboard_post_notification_field_starred_message_en_US.ftl b/templates/translations/starboard-custom-translations/src/main/resources/en_US/listener/starboardNotification/starboard_post_notification_field_starred_message_en_US.ftl new file mode 100644 index 0000000..b180242 --- /dev/null +++ b/templates/translations/starboard-custom-translations/src/main/resources/en_US/listener/starboardNotification/starboard_post_notification_field_starred_message_en_US.ftl @@ -0,0 +1 @@ +Starred message \ No newline at end of file diff --git a/templates/translations/starboard-custom-translations/src/main/resources/en_US/listener/starboardNotification/starboard_post_notification_field_starred_user_en_US.ftl b/templates/translations/starboard-custom-translations/src/main/resources/en_US/listener/starboardNotification/starboard_post_notification_field_starred_user_en_US.ftl new file mode 100644 index 0000000..3bf960d --- /dev/null +++ b/templates/translations/starboard-custom-translations/src/main/resources/en_US/listener/starboardNotification/starboard_post_notification_field_starred_user_en_US.ftl @@ -0,0 +1 @@ +Starred user \ No newline at end of file diff --git a/templates/translations/starboard-custom-translations/src/main/resources/en_US/listener/starboardNotification/starboard_post_notification_field_starring_user_en_US.ftl b/templates/translations/starboard-custom-translations/src/main/resources/en_US/listener/starboardNotification/starboard_post_notification_field_starring_user_en_US.ftl new file mode 100644 index 0000000..3a50724 --- /dev/null +++ b/templates/translations/starboard-custom-translations/src/main/resources/en_US/listener/starboardNotification/starboard_post_notification_field_starring_user_en_US.ftl @@ -0,0 +1 @@ +Starring user \ No newline at end of file