-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement monitoring and observability (#70)
- Loading branch information
Showing
20 changed files
with
430 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# API | ||
FRONTEND_URL=https://domain.com | ||
POSTGRES_URL=postgresql://postgres:5432/db | ||
POSTGRES_USER= | ||
POSTGRES_PASSWORD= | ||
KEYCLOAK_ISSUER_URL=https://keycloak.domain.com/realms/realm_name | ||
|
||
# Keycloak | ||
KEYCLOAK_URL=https://keycloak.domain.com | ||
KEYCLOAK_ADMIN= | ||
KEYCLOAK_ADMIN_PASSWORD= | ||
|
||
# Grafana | ||
GRAFANA_USER= | ||
GRAFANA_PASSWORD= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,6 @@ | |
.angular | ||
dist/ | ||
node_modules/ | ||
screenshots/ | ||
screenshots/ | ||
logs/ | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<configuration debug="false"> | ||
<include resource="org/springframework/boot/logging/logback/defaults.xml" /> | ||
<include resource="org/springframework/boot/logging/logback/console-appender.xml" /> | ||
<property name="LOG_PATH" value="logs/api" /> | ||
<property name="CONSOLE_LOG_PATTERN" value="%highlight([%level]) %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %X{id} %c{1} - %msg%n" /> | ||
<property name="FILE_LOG_PATTERN" value="[%level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %X{id} %c{1} - %msg%n" /> | ||
|
||
<appender name="CONSOLE_APPENDER" class="ch.qos.logback.core.ConsoleAppender"> | ||
<encoder> | ||
<pattern>${CONSOLE_LOG_PATTERN}</pattern> | ||
<charset>utf8</charset> | ||
</encoder> | ||
</appender> | ||
|
||
<appender name="ROLLING_TEXT_FILE_APPENDER" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||
<file>${LOG_PATH}/api.log</file> | ||
<encoder> | ||
<Pattern>${FILE_LOG_PATTERN}</Pattern> | ||
</encoder> | ||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> | ||
<!-- rollover daily --> | ||
<fileNamePattern>${LOG_PATH}/spring-with-grafana-loki-text.%d{yyyy-MM-dd}.%i.gz</fileNamePattern> | ||
<maxFileSize>5GB</maxFileSize> | ||
<!-- keep 30 days worth of history --> | ||
<maxHistory>30</maxHistory> | ||
<totalSizeCap>20GB</totalSizeCap> | ||
</rollingPolicy> | ||
</appender> | ||
|
||
<root level="INFO"> | ||
<appender-ref ref="CONSOLE_APPENDER" /> | ||
<appender-ref ref="ROLLING_TEXT_FILE_APPENDER" /> | ||
</root> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
services: | ||
postgres: | ||
container_name: mally-postgres | ||
build: | ||
context: . | ||
dockerfile: ./infra/postgres/Dockerfile | ||
restart: unless-stopped | ||
healthcheck: | ||
test: [ "CMD", "pg_isready", "-q", "-d", "keycloak", "-U", "postgres" ] | ||
timeout: 45s | ||
interval: 10s | ||
retries: 5 | ||
environment: | ||
POSTGRES_DBS: 'mally,keycloak' | ||
POSTGRES_USER: ${POSTGRES_USER} | ||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} | ||
env_file: | ||
- .env | ||
networks: | ||
- mally-network | ||
volumes: | ||
- postgres:/var/lib/postgresql/data | ||
|
||
keycloak: | ||
container_name: mally-keycloak | ||
build: | ||
context: . | ||
dockerfile: ./infra/keycloak/Dockerfile | ||
restart: unless-stopped | ||
healthcheck: | ||
test: ["CMD", "curl", "-f", "http://0.0.0.0:9000/health/ready"] | ||
timeout: 45s | ||
interval: 10s | ||
retries: 15 | ||
environment: | ||
JAVA_OPTS_APPEND: -Dkeycloak.profile.feature.upload_scripts=enabled | ||
KC_DB: postgres | ||
KC_DB_URL: jdbc:postgresql://postgres/keycloak | ||
KC_DB_USERNAME: ${POSTGRES_USER} | ||
KC_DB_PASSWORD: ${POSTGRES_PASSWORD} | ||
KC_HEALTH_ENABLED: 'true' | ||
KC_HTTP_ENABLED: 'true' | ||
KC_METRICS_ENABLED: 'true' | ||
KC_HOSTNAME_STRICT_HTTPS: 'false' | ||
KC_HOSTNAME_URL: ${KEYCLOAK_URL} | ||
KC_PROXY: edge | ||
KC_PROXY_HEADERS: xforwarded | ||
KEYCLOAK_ADMIN: ${KEYCLOAK_ADMIN} | ||
KEYCLOAK_ADMIN_PASSWORD: ${KEYCLOAK_ADMIN_PASSWORD} | ||
env_file: | ||
- .env | ||
depends_on: | ||
postgres: | ||
condition: service_healthy | ||
networks: | ||
- mally-network | ||
command: start --hostname ${KEYCLOAK_URL} --import-realm | ||
|
||
api: | ||
container_name: mally-api | ||
build: | ||
context: . | ||
dockerfile: ./apps/api/Dockerfile | ||
restart: unless-stopped | ||
healthcheck: | ||
test: [ "CMD", "curl", "-f", "http://0.0.0.0:8080/health/" ] | ||
timeout: 45s | ||
interval: 10s | ||
retries: 15 | ||
environment: | ||
DATABASE_URL: ${POSTGRES_URL} | ||
DATABASE_USERNAME: ${POSTGRES_USER} | ||
DATABASE_PASSWORD: ${POSTGRES_PASSWORD} | ||
KEYCLOAK_ISSUER_URL: ${KEYCLOAK_ISSUER_URL} | ||
FRONTEND_URL: ${FRONTEND_URL} | ||
env_file: | ||
- .env | ||
volumes: | ||
- ./logs/api:/app/logs/api | ||
networks: | ||
- mally-network | ||
depends_on: | ||
postgres: | ||
condition: service_healthy | ||
keycloak: | ||
condition: service_healthy | ||
|
||
ui: | ||
container_name: mally-ui | ||
build: | ||
context: . | ||
dockerfile: ./apps/ui/Dockerfile | ||
restart: unless-stopped | ||
networks: | ||
- mally-network | ||
depends_on: | ||
api: | ||
condition: service_healthy | ||
keycloak: | ||
condition: service_healthy | ||
|
||
nginx: | ||
container_name: mally-nginx | ||
build: | ||
context: . | ||
dockerfile: ./infra/nginx/Dockerfile | ||
restart: unless-stopped | ||
networks: | ||
- mally-network | ||
depends_on: | ||
- api | ||
- ui | ||
ports: | ||
- '80:80' | ||
- '443:443' | ||
volumes: | ||
- ./certbot/www/:/var/www/certbot/:rw | ||
- ./certbot/conf/:/etc/letsencrypt/:rw | ||
|
||
loki: | ||
container_name: mally-loki | ||
build: | ||
context: . | ||
dockerfile: ./infra/loki/Dockerfile | ||
restart: unless-stopped | ||
command: -config.file=/etc/loki/loki.yml | ||
networks: | ||
- mally-network | ||
|
||
promtail: | ||
container_name: mally-promtail | ||
build: | ||
context: . | ||
dockerfile: ./infra/promtail/Dockerfile | ||
restart: unless-stopped | ||
volumes: | ||
- ./logs/api/:/var/log/ | ||
command: -config.file=/etc/promtail/promtail.yml | ||
networks: | ||
- mally-network | ||
|
||
prometheus: | ||
container_name: mally-prometheus | ||
build: | ||
context: . | ||
dockerfile: ./infra/prometheus/Dockerfile | ||
restart: unless-stopped | ||
command: '--config.file=/etc/prometheus/config.yml' | ||
networks: | ||
- mally-network | ||
|
||
grafana: | ||
container_name: mally-grafana | ||
build: | ||
context: . | ||
dockerfile: ./infra/grafana/Dockerfile | ||
restart: unless-stopped | ||
environment: | ||
GF_SECURITY_ADMIN_USER: ${GRAFANA_USER} | ||
GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_PASSWORD} | ||
env_file: | ||
- .env | ||
volumes: | ||
- grafana:/var/lib/grafana | ||
networks: | ||
- mally-network | ||
|
||
volumes: | ||
postgres: | ||
grafana: | ||
|
||
networks: | ||
mally-network: | ||
name: mally-network |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM grafana/grafana:11.2.1 | ||
|
||
COPY ./infra/grafana/conf /etc/grafana/provisioning/datasources |
Oops, something went wrong.