[OPB-3] adding initial structure of oneplus bot with deployment and selected modules

adding volume configuration to grafana and postgres
adding .env file for variables in docker compose
adding handling of password for prometheus
adding port configuration for more services
adding custom starboard notifications
updating readme and adding release job
 adding settings.xml for build
This commit is contained in:
Sheldan
2021-03-17 01:15:21 +01:00
parent 44a56d67c7
commit 71896bf3b6
77 changed files with 6086 additions and 0 deletions

View File

@@ -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>

View File

@@ -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=<INSERT TOKEN>

View 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.

View File

@@ -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:

View 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

View File

@@ -0,0 +1 @@
${REST_PASSWORD}