mirror of
https://github.com/Sheldan/Sissi.git
synced 2026-01-01 23:35:21 +00:00
[RAB-1] initial setup of structure
This commit is contained in:
34
deployment/docker-compose/pom.xml
Normal file
34
deployment/docker-compose/pom.xml
Normal file
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>dev.sheldan.raustria.bot</groupId>
|
||||
<artifactId>deployment</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<packaging>pom</packaging>
|
||||
<artifactId>docker-compose</artifactId>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>assembly-docker-compose-configuration</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/docker-compose.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,19 @@
|
||||
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.1.0 http://maven.apache.org/xsd/assembly-2.1.0.xsd">
|
||||
<id>docker-compose</id>
|
||||
<formats>
|
||||
<format>zip</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>false</includeBaseDirectory>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<outputDirectory>./docker-compose</outputDirectory>
|
||||
<directory>${project.basedir}/src/main/resources/</directory>
|
||||
<includes>
|
||||
<include>**/*</include>
|
||||
</includes>
|
||||
<filtered>true</filtered>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</assembly>
|
||||
32
deployment/docker-compose/src/main/resources/.env
Normal file
32
deployment/docker-compose/src/main/resources/.env
Normal file
@@ -0,0 +1,32 @@
|
||||
# database configuration
|
||||
DATABASE_HOST=database
|
||||
DATABASE_PORT=5432
|
||||
DATABASE_USER=abstracto
|
||||
DATABASE_NAME=abstracto
|
||||
DATABASE_PASSWORD=abstracto
|
||||
GRAFANA_DATABASE_PASSWORD=grafana
|
||||
GRAFANA_DATABASE_USER=grafana
|
||||
# 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
|
||||
LOKI_PORT=3100
|
||||
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=<INSERT TOKEN>
|
||||
YOUTUBE_API_KEY=<INSERT KEY>
|
||||
R_AUSTRIA_BOT_VERSION=1.0.0
|
||||
10
deployment/docker-compose/src/main/resources/README.md
Normal file
10
deployment/docker-compose/src/main/resources/README.md
Normal file
@@ -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.
|
||||
|
||||
146
deployment/docker-compose/src/main/resources/docker-compose.yml
Normal file
146
deployment/docker-compose/src/main/resources/docker-compose.yml
Normal file
@@ -0,0 +1,146 @@
|
||||
version: '3.7'
|
||||
|
||||
services:
|
||||
db:
|
||||
image: ${REGISTRY_PREFIX}r_austria_bot_database:${R_AUSTRIA_BOT_VERSION}
|
||||
container_name: database
|
||||
restart: always
|
||||
environment:
|
||||
POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
|
||||
POSTGRES_USER: ${DATABASE_USER}
|
||||
ports:
|
||||
- "127.0.0.1:${DATABASE_PORT}:5432"
|
||||
networks:
|
||||
- raustriabot
|
||||
volumes:
|
||||
- r-austria-bot-db-data:/var/lib/postgresql/data
|
||||
deployment_container:
|
||||
container_name: deployment
|
||||
image: ${REGISTRY_PREFIX}r_austria_bot_deployment:${R_AUSTRIA_BOT_VERSION}
|
||||
depends_on:
|
||||
- db
|
||||
environment:
|
||||
DB_PASS: ${DATABASE_PASSWORD}
|
||||
DB_HOST: ${DATABASE_HOST}
|
||||
DB_PORT: ${DATABASE_PORT}
|
||||
DB_USER: ${DATABASE_USER}
|
||||
DB_NAME: ${DATABASE_NAME}
|
||||
ABSTRACTO_GRAFANA_DB_PASS: ${GRAFANA_DATABASE_PASSWORD}
|
||||
ABSTRACTO_GRAFANA_DB_USER: ${GRAFANA_DATABASE_USER}
|
||||
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_HOST}:${DATABASE_PORT}
|
||||
networks:
|
||||
- raustriabot
|
||||
bot:
|
||||
image: ${REGISTRY_PREFIX}r_austria_bot:${R_AUSTRIA_BOT_VERSION}
|
||||
depends_on:
|
||||
- db
|
||||
- deployment_container
|
||||
restart: on-failure
|
||||
container_name: raustriabot
|
||||
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}
|
||||
YOUTUBE_API_KEY: ${YOUTUBE_API_KEY}
|
||||
command: sh -c "while ping -c1 deployment_container &>/dev/null; do sleep 1; done; echo 'Liquibase finished!' && ./start.sh"
|
||||
ports:
|
||||
- "127.0.0.1:${DEBUG_PORT}:5005"
|
||||
- "127.0.0.1:${TOMCAT_PORT}:8080"
|
||||
networks:
|
||||
- raustriabot
|
||||
volumes:
|
||||
- r-austria-bot-bot-logs:/logs
|
||||
- ./config:/config
|
||||
pgadmin:
|
||||
container_name: pgadmin
|
||||
image: ${REGISTRY_PREFIX}r_austria_bot_pg_admin:${R_AUSTRIA_BOT_VERSION}
|
||||
depends_on:
|
||||
- db
|
||||
environment:
|
||||
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL}
|
||||
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD}
|
||||
ports:
|
||||
- "127.0.0.1:${PGADMIN_PORT}:80"
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- raustriabot
|
||||
prometheus:
|
||||
container_name: prometheus
|
||||
image: ${REGISTRY_PREFIX}r_austria_bot_prometheus:${R_AUSTRIA_BOT_VERSION}
|
||||
depends_on:
|
||||
- bot
|
||||
ports:
|
||||
- "127.0.0.1:${PROMETHEUS_PORT}:9090"
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- raustriabot
|
||||
volumes:
|
||||
- ./res/prometheus-scrapper-password-filled:/etc/prometheus/micrometer_password
|
||||
- r-austria-bot-prometheus-data:/prometheus
|
||||
grafana:
|
||||
container_name: grafana
|
||||
image: ${REGISTRY_PREFIX}r_austria_bot_grafana:${R_AUSTRIA_BOT_VERSION}
|
||||
depends_on:
|
||||
- prometheus
|
||||
- bot
|
||||
ports:
|
||||
- "127.0.0.1:${GRAFANA_PORT}:3000"
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
DB_PASS: ${GRAFANA_DATABASE_PASSWORD}
|
||||
DB_HOST: ${DATABASE_HOST}
|
||||
DB_PORT: ${DATABASE_PORT}
|
||||
DB_USER: ${GRAFANA_DATABASE_USER}
|
||||
DB_NAME: ${DATABASE_NAME}
|
||||
PROMETHEUS_HOST: 'prometheus'
|
||||
PROMETHEUS_PORT: 9090
|
||||
LOKI_HOST: 'loki'
|
||||
LOKI_PORT: ${LOKI_PORT}
|
||||
volumes:
|
||||
- r-austria-bot-grafana-user-data:/var/lib/grafana
|
||||
networks:
|
||||
- raustriabot
|
||||
promtail:
|
||||
container_name: promtail
|
||||
image: ${REGISTRY_PREFIX}r_austria_bot_promtail:${R_AUSTRIA_BOT_VERSION}
|
||||
depends_on:
|
||||
- bot
|
||||
restart: unless-stopped
|
||||
command: -config.file=/mnt/config/promtail-config.yaml
|
||||
volumes:
|
||||
- r-austria-bot-bot-logs:/logs
|
||||
networks:
|
||||
- raustriabot
|
||||
loki:
|
||||
container_name: loki
|
||||
image: ${REGISTRY_PREFIX}r_austria_bot_loki:${R_AUSTRIA_BOT_VERSION}
|
||||
depends_on:
|
||||
- promtail
|
||||
command: -config.file=/mnt/config/loki-config.yaml
|
||||
ports:
|
||||
- "127.0.0.1:${LOKI_PORT}:3100"
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- raustriabot
|
||||
|
||||
networks:
|
||||
raustriabot:
|
||||
driver: bridge
|
||||
name: raustriabot-network
|
||||
|
||||
volumes:
|
||||
r-austria-bot-db-data:
|
||||
r-austria-bot-grafana-user-data:
|
||||
r-austria-bot-prometheus-data:
|
||||
r-austria-bot-bot-logs:
|
||||
5
deployment/docker-compose/src/main/resources/fill-prometheus-file.sh
Executable file
5
deployment/docker-compose/src/main/resources/fill-prometheus-file.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -o allexport
|
||||
source .env
|
||||
set +o allexport
|
||||
envsubst < res/prometheus-scrapper-password > res/prometheus-scrapper-password-filled
|
||||
166
deployment/image-packaging/pom.xml
Normal file
166
deployment/image-packaging/pom.xml
Normal file
@@ -0,0 +1,166 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>dev.sheldan.raustria.bot</groupId>
|
||||
<artifactId>deployment</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>image-packaging</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<properties>
|
||||
<file.basedir>${project.basedir}/src/main/docker/</file.basedir>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<artifactItems>
|
||||
|
||||
<!-- backend jar -->
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.raustria.bot.application</groupId>
|
||||
<artifactId>executable</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<classifier>exec</classifier>
|
||||
<type>jar</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>${file.basedir}/r-austria-bot/bot</outputDirectory>
|
||||
<destFileName>app.jar</destFileName>
|
||||
</artifactItem>
|
||||
|
||||
<!-- template artefacts -->
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.abstracto-templates.templates</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
<version>${abstracto.templates.version}</version>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
|
||||
<destFileName>core.zip</destFileName>
|
||||
</artifactItem>
|
||||
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.abstracto-templates.templates</groupId>
|
||||
<artifactId>link-embed</artifactId>
|
||||
<version>${abstracto.templates.version}</version>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
|
||||
<destFileName>link-embed.zip</destFileName>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.abstracto-templates.templates</groupId>
|
||||
<artifactId>starboard</artifactId>
|
||||
<version>${abstracto.templates.version}</version>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
|
||||
<destFileName>starboard.zip</destFileName>
|
||||
</artifactItem>
|
||||
|
||||
<!-- translation artefacts -->
|
||||
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.abstracto-templates.translations</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
<version>${abstracto.templates.version}</version>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
|
||||
<destFileName>core.zip</destFileName>
|
||||
</artifactItem>
|
||||
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.abstracto-templates.translations</groupId>
|
||||
<artifactId>link-embed</artifactId>
|
||||
<version>${abstracto.templates.version}</version>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
|
||||
<destFileName>link-embed.zip</destFileName>
|
||||
</artifactItem>
|
||||
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.abstracto-templates.translations</groupId>
|
||||
<artifactId>starboard</artifactId>
|
||||
<version>${abstracto.templates.version}</version>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
|
||||
<destFileName>starboard.zip</destFileName>
|
||||
</artifactItem>
|
||||
|
||||
<!-- custom -->
|
||||
|
||||
<!-- liquibase artifacts -->
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.abstracto.scheduling</groupId>
|
||||
<artifactId>scheduling-impl</artifactId>
|
||||
<version>${abstracto.version}</version>
|
||||
<classifier>liquibase</classifier>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
|
||||
<destFileName>scheduling.zip</destFileName>
|
||||
</artifactItem>
|
||||
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.abstracto.core</groupId>
|
||||
<artifactId>core-impl</artifactId>
|
||||
<version>${abstracto.version}</version>
|
||||
<classifier>liquibase</classifier>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
|
||||
<destFileName>core.zip</destFileName>
|
||||
</artifactItem>
|
||||
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>link-embed-impl</artifactId>
|
||||
<version>${abstracto.version}</version>
|
||||
<classifier>liquibase</classifier>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
|
||||
<destFileName>link-embed.zip</destFileName>
|
||||
</artifactItem>
|
||||
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>starboard-impl</artifactId>
|
||||
<version>${abstracto.version}</version>
|
||||
<classifier>liquibase</classifier>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
|
||||
<destFileName>starboard.zip</destFileName>
|
||||
</artifactItem>
|
||||
|
||||
<!-- customizations -->
|
||||
|
||||
<!-- overrides -->
|
||||
|
||||
<!-- overrides translations -->
|
||||
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
6
deployment/image-packaging/src/main/docker/.env
Normal file
6
deployment/image-packaging/src/main/docker/.env
Normal file
@@ -0,0 +1,6 @@
|
||||
PROMTAIL_VERSION=2.2.1
|
||||
LOKI_VERSION=2.2.1
|
||||
PROMETHEUS_VERSION=v2.28.1
|
||||
PG_ADMIN_VERSION=5.5
|
||||
GRAFANA_VERSION=8.0.6
|
||||
POSTGRES_VERSION=13.3-buster
|
||||
@@ -0,0 +1,5 @@
|
||||
ARG POSTGRES_VERSION
|
||||
FROM postgres:${POSTGRES_VERSION}
|
||||
MAINTAINER Sheldan
|
||||
VOLUME /tmp
|
||||
ADD sql/init.sql /docker-entrypoint-initdb.d/init.sql
|
||||
@@ -0,0 +1 @@
|
||||
CREATE SCHEMA abstracto
|
||||
@@ -0,0 +1,8 @@
|
||||
ARG ABSTRACTO_REGISTRY_PREFIX
|
||||
ARG ABSTRACTO_VERSION=latest
|
||||
FROM ${ABSTRACTO_REGISTRY_PREFIX}abstracto_deployment:${ABSTRACTO_VERSION:-latest}
|
||||
MAINTAINER Sheldan
|
||||
ADD template-artifacts /templates
|
||||
ADD translation-artifacts /translations
|
||||
ADD liquibase-artifacts /liquibase-zips
|
||||
ADD config /
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"template_artifacts": ["core","starboard", "link-embed"],
|
||||
"translation_artifacts": ["core", "starboard", "link-embed"],
|
||||
"liquibase_artifacts": [
|
||||
{ "zip": "scheduling", "file": "scheduling-changeLog.xml" },
|
||||
{ "zip": "core", "file": "core-changeLog.xml" },
|
||||
{ "zip": "link-embed", "file": "link-embed-changeLog.xml"},
|
||||
{ "zip": "starboard", "file": "starboard-changeLog.xml"}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
version: "3.7"
|
||||
|
||||
services:
|
||||
bot:
|
||||
build:
|
||||
context: r-austria-bot
|
||||
image: ${REGISTRY_PREFIX}r_austria_bot:${VERSION:-latest}
|
||||
database:
|
||||
build:
|
||||
context: database
|
||||
args:
|
||||
POSTGRES_VERSION: ${POSTGRES_VERSION}
|
||||
image: ${REGISTRY_PREFIX}r_austria_bot_database:${VERSION:-latest}
|
||||
pg_admin:
|
||||
build:
|
||||
context: pgAdmin
|
||||
args:
|
||||
PG_ADMIN_VERSION: ${PG_ADMIN_VERSION}
|
||||
image: ${REGISTRY_PREFIX}r_austria_bot_pg_admin:${VERSION:-latest}
|
||||
deployment_container:
|
||||
build:
|
||||
context: deployment
|
||||
args:
|
||||
ABSTRACTO_REGISTRY_PREFIX: ${ABSTRACTO_REGISTRY_PREFIX}
|
||||
ABSTRACTO_VERSION: ${ABSTRACTO_VERSION}
|
||||
image: ${REGISTRY_PREFIX}r_austria_bot_deployment:${VERSION:-latest}
|
||||
prometheus:
|
||||
build:
|
||||
context: prometheus
|
||||
args:
|
||||
PROMETHEUS_VERSION: ${PROMETHEUS_VERSION}
|
||||
image: ${REGISTRY_PREFIX}r_austria_bot_prometheus:${VERSION:-latest}
|
||||
grafana:
|
||||
build:
|
||||
context: grafana
|
||||
args:
|
||||
GRAFANA_VERSION: ${GRAFANA_VERSION}
|
||||
image: ${REGISTRY_PREFIX}r_austria_bot_grafana:${VERSION:-latest}
|
||||
promtail:
|
||||
build:
|
||||
context: promtail
|
||||
args:
|
||||
PROMTAIL_VERSION: ${PROMTAIL_VERSION}
|
||||
image: ${REGISTRY_PREFIX}r_austria_bot_promtail:${VERSION:-latest}
|
||||
loki:
|
||||
build:
|
||||
context: loki
|
||||
args:
|
||||
LOKI_VERSION: ${LOKI_VERSION}
|
||||
image: ${REGISTRY_PREFIX}r_austria_bot_loki:${VERSION:-latest}
|
||||
@@ -0,0 +1,6 @@
|
||||
ARG GRAFANA_VERSION
|
||||
FROM grafana/grafana:${GRAFANA_VERSION}
|
||||
MAINTAINER Sheldan
|
||||
ADD ./provisioning /etc/grafana/provisioning
|
||||
ADD ./config.ini /etc/grafana/config.ini
|
||||
ADD ./dashboards /var/lib/grafana/dashboards
|
||||
@@ -0,0 +1,2 @@
|
||||
[paths]
|
||||
provisioning = conf/provisioning
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"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": 0,
|
||||
"id": 4,
|
||||
"links": [],
|
||||
"panels": [
|
||||
{
|
||||
"datasource": "Loki",
|
||||
"gridPos": {
|
||||
"h": 14,
|
||||
"w": 24,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"id": 2,
|
||||
"options": {
|
||||
"dedupStrategy": "none",
|
||||
"enableLogDetails": true,
|
||||
"showLabels": false,
|
||||
"showTime": false,
|
||||
"sortOrder": "Descending",
|
||||
"wrapLogMessage": true
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "{job=\"r-austria-bot-logs\", filename=\"/logs/log.log\"}",
|
||||
"queryType": "randomWalk",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "RAustria Bot logs",
|
||||
"type": "logs"
|
||||
}
|
||||
],
|
||||
"refresh": "",
|
||||
"schemaVersion": 30,
|
||||
"style": "dark",
|
||||
"tags": [],
|
||||
"templating": {
|
||||
"list": []
|
||||
},
|
||||
"time": {
|
||||
"from": "now-3h",
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {},
|
||||
"timezone": "",
|
||||
"title": "RAustria Bot logs",
|
||||
"uid": "1uGb0q4nz",
|
||||
"version": 2
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,6 @@
|
||||
- name: 'r-austria-bot-dashboards'
|
||||
org_id: 1
|
||||
folder: ''
|
||||
type: 'file'
|
||||
options:
|
||||
folder: '/var/lib/grafana/dashboards'
|
||||
@@ -0,0 +1,29 @@
|
||||
apiVersion: 1
|
||||
datasources:
|
||||
- access: 'proxy'
|
||||
editable: true
|
||||
is_default: true
|
||||
name: 'prometheus'
|
||||
org_id: 1
|
||||
type: 'prometheus'
|
||||
url: 'http://${PROMETHEUS_HOST}:${PROMETHEUS_PORT}'
|
||||
version: 1
|
||||
- name: 'postgres-db'
|
||||
type: postgres
|
||||
access: 'proxy'
|
||||
url: '${DB_HOST}:${DB_PORT}'
|
||||
password: '${DB_PASS}'
|
||||
user: '${DB_USER}'
|
||||
database: '${DB_NAME}'
|
||||
basicAuth: false
|
||||
is_default: false
|
||||
jsonData:
|
||||
sslmode: 'disable'
|
||||
version: 1
|
||||
editable: false
|
||||
- name: Loki
|
||||
type: loki
|
||||
access: proxy
|
||||
url: 'http://${LOKI_HOST}:${LOKI_PORT}'
|
||||
jsonData:
|
||||
maxLines: 2000
|
||||
@@ -0,0 +1,4 @@
|
||||
ARG LOKI_VERSION
|
||||
FROM grafana/loki:${LOKI_VERSION}
|
||||
MAINTAINER Sheldan
|
||||
ADD loki.yml /mnt/config/loki-config.yaml
|
||||
66
deployment/image-packaging/src/main/docker/loki/loki.yml
Normal file
66
deployment/image-packaging/src/main/docker/loki/loki.yml
Normal file
@@ -0,0 +1,66 @@
|
||||
auth_enabled: false
|
||||
|
||||
server:
|
||||
http_listen_port: 3100
|
||||
grpc_listen_port: 9096
|
||||
|
||||
ingester:
|
||||
wal:
|
||||
enabled: true
|
||||
dir: /tmp/wal
|
||||
lifecycler:
|
||||
address: 127.0.0.1
|
||||
ring:
|
||||
kvstore:
|
||||
store: inmemory
|
||||
replication_factor: 1
|
||||
final_sleep: 0s
|
||||
chunk_idle_period: 1h
|
||||
max_chunk_age: 1h
|
||||
chunk_target_size: 1048576
|
||||
chunk_retain_period: 30s
|
||||
max_transfer_retries: 0
|
||||
|
||||
schema_config:
|
||||
configs:
|
||||
- from: 2020-10-24
|
||||
store: boltdb-shipper
|
||||
object_store: filesystem
|
||||
schema: v11
|
||||
index:
|
||||
prefix: index_
|
||||
period: 24h
|
||||
|
||||
storage_config:
|
||||
boltdb_shipper:
|
||||
active_index_directory: /tmp/loki/boltdb-shipper-active
|
||||
cache_location: /tmp/loki/boltdb-shipper-cache
|
||||
cache_ttl: 24h
|
||||
shared_store: filesystem
|
||||
filesystem:
|
||||
directory: /tmp/loki/chunks
|
||||
|
||||
compactor:
|
||||
working_directory: /tmp/loki/boltdb-shipper-compactor
|
||||
shared_store: filesystem
|
||||
|
||||
limits_config:
|
||||
reject_old_samples: true
|
||||
reject_old_samples_max_age: 168h
|
||||
|
||||
chunk_store_config:
|
||||
max_look_back_period: 0s
|
||||
|
||||
table_manager:
|
||||
retention_deletes_enabled: true
|
||||
retention_period: 360h
|
||||
|
||||
ruler:
|
||||
storage:
|
||||
type: local
|
||||
local:
|
||||
directory: /tmp/loki/rules
|
||||
rule_path: /tmp/loki/rules-temp
|
||||
ring:
|
||||
kvstore:
|
||||
store: inmemory
|
||||
@@ -0,0 +1,5 @@
|
||||
ARG PG_ADMIN_VERSION
|
||||
FROM dpage/pgadmin4:${PG_ADMIN_VERSION}
|
||||
MAINTAINER Sheldan
|
||||
VOLUME /tmp
|
||||
ADD config/servers.json /pgadmin4/servers.json
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"Servers": {
|
||||
"1": {
|
||||
"Name": "r-austria bot database",
|
||||
"Group": "Server Group 1",
|
||||
"Port": 5432,
|
||||
"Username": "abstracto",
|
||||
"Host": "db",
|
||||
"SSLMode": "prefer",
|
||||
"MaintenanceDB": "postgres"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
ARG PROMETHEUS_VERSION
|
||||
FROM prom/prometheus:${PROMETHEUS_VERSION}
|
||||
MAINTAINER Sheldan
|
||||
ADD prometheus.yml /etc/prometheus/prometheus.yml
|
||||
@@ -0,0 +1,17 @@
|
||||
global:
|
||||
scrape_interval: 10s
|
||||
scrape_timeout: 10s
|
||||
evaluation_interval: 1m
|
||||
scrape_configs:
|
||||
- job_name: r_austria_bot_micrometer
|
||||
honor_timestamps: true
|
||||
scrape_interval: 5s
|
||||
scrape_timeout: 5s
|
||||
metrics_path: /actuator/prometheus
|
||||
scheme: http
|
||||
static_configs:
|
||||
- targets:
|
||||
- r_austra:8080
|
||||
basic_auth:
|
||||
username: "abstracto"
|
||||
password_file: /etc/prometheus/micrometer_password
|
||||
@@ -0,0 +1,4 @@
|
||||
ARG PROMTAIL_VERSION
|
||||
FROM grafana/promtail:${PROMTAIL_VERSION}
|
||||
MAINTAINER Sheldan
|
||||
ADD promtail.yaml /mnt/config/promtail-config.yaml
|
||||
@@ -0,0 +1,17 @@
|
||||
server:
|
||||
disable: true
|
||||
|
||||
positions:
|
||||
filename: /tmp/positions.yaml
|
||||
|
||||
clients:
|
||||
- url: http://loki:3100/loki/api/v1/push
|
||||
|
||||
scrape_configs:
|
||||
- job_name: system
|
||||
static_configs:
|
||||
- targets:
|
||||
- localhost
|
||||
labels:
|
||||
job: r-austria-bot-logs
|
||||
__path__: /logs/*.log
|
||||
@@ -0,0 +1,10 @@
|
||||
FROM openjdk:8-jdk-alpine
|
||||
MAINTAINER Sheldan
|
||||
VOLUME /tmp
|
||||
ADD bot/app.jar /app.jar
|
||||
ADD config/* /config/
|
||||
VOLUME ["/config"]
|
||||
VOLUME ["/logs"]
|
||||
ADD wrapper/*.sh /
|
||||
RUN chmod +x /start.sh
|
||||
CMD ["/start.sh"]
|
||||
@@ -0,0 +1,2 @@
|
||||
logging.config=config/logback.xml
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="30 seconds">
|
||||
<property name="LOG_PATH" value="logs"/>
|
||||
<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>
|
||||
%d{dd-MM-yyyy HH:mm:ss.SSS} %magenta([%thread]) %highlight(%-5level) %logger{36} - %msg%n
|
||||
</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<appender name="logFileAppender" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
|
||||
<file>${LOG_PATH}/log.log</file>
|
||||
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<Pattern>
|
||||
%d{dd-MM-yyyy HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
|
||||
</Pattern>
|
||||
</encoder>
|
||||
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>
|
||||
${LOG_PATH}/archived/log_%d{dd-MM-yyyy}.log
|
||||
</fileNamePattern>
|
||||
<maxHistory>10</maxHistory>
|
||||
<totalSizeCap>1GB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
|
||||
</appender>
|
||||
|
||||
<appender name="requests-file" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_PATH}/requests_log.log</file>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<Pattern>
|
||||
%d{dd-MM-yyyy HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
|
||||
</Pattern>
|
||||
</encoder>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>
|
||||
${LOG_PATH}/archived/requests_log_%d{dd-MM-yyyy}.log
|
||||
</fileNamePattern>
|
||||
<maxHistory>10</maxHistory>
|
||||
<totalSizeCap>1GB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
|
||||
<logger name="dev.sheldan.abstracto" level="INFO"/>
|
||||
<logger name="dev.sheldan.abstracto.core.logging" level="DEBUG">
|
||||
<appender-ref ref="requests-file"/>
|
||||
</logger>
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="logFileAppender"/>
|
||||
<appender-ref ref="stdout"/>
|
||||
</root>
|
||||
|
||||
</configuration>
|
||||
@@ -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
|
||||
22
deployment/pom.xml
Normal file
22
deployment/pom.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>dev.sheldan.raustria.bot</groupId>
|
||||
<artifactId>r-austria-bot</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>deployment</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
<module>docker-compose</module>
|
||||
<module>image-packaging</module>
|
||||
</modules>
|
||||
|
||||
|
||||
|
||||
</project>
|
||||
Reference in New Issue
Block a user