Skip to content

Commit

Permalink
Merge pull request #25 from MindsHub/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Usioumeo authored Oct 19, 2024
2 parents e8beb68 + e17e2e7 commit 08dcdcd
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 27 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ tree
nohup*
dump.sql
test.sql
**/backup

# Created by https://www.toptal.com/developers/gitignore/api/django
# Edit at https://www.toptal.com/developers/gitignore?templates=django
Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@
"rust-analyzer.check.extraArgs": [
"--target-dir=target/analyzer"
],
"files.associations": {
"caddyfile": "cpp"
},
}
11 changes: 11 additions & 0 deletions docker/Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

{$COMP_PROTOCOL}://{$COMP_HOST} {

reverse_proxy /grafana* grafana:3000

reverse_proxy /grafana/api/live* grafana:3000/api/live

reverse_proxy insigno:8000


}
22 changes: 22 additions & 0 deletions docker/backup-volumes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

backup(){
sudo docker run -it --rm -v $1:/volume -v $(pwd):/backup --name dbstore ubuntu tar cf /backup/backup/backup-$1.tar /volume
}

restore(){
sudo docker run -it --rm -v $1:/volume -v $(pwd):/backup --name dbstore ubuntu tar xf /backup/backup/backup-$1.tar -C /volume
}
mkdir backup

backup docker_db-vol
backup docker_grafana-vol
backup docker_media-vol
backup docker_prometheus-vol
backup docker_caddy-data-vol

#restore docker_db-vol
#restore docker_grafana-vol
#restore docker_media-vol
#restore docker_caddy-data-vol
#restore docker_caddy-data-vol
52 changes: 29 additions & 23 deletions docker/db-insigno-grafana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,40 @@ services:
image: grafana/grafana:latest
container_name: grafana
restart: always
ports:
- '3000:3000'
volumes:
- grafana-vol:/var/lib/grafana
- ./grafana-provisioning:/etc/grafana/provisioning
- ./dashboards:/var/lib/grafana/dashboards
- ./dalvany-image-panel:/var/lib/grafana/plugins/dalvany-image-panel
#command: sh -c "grafana cli plugins install dalvany-image-panel"

environment:
GF_SECURITY_ADMIN_MAIL: "[email protected]"
GF_SECURITY_ADMIN_USER: "Mindshub"
GF_SECURITY_ADMIN_PASSWORD: "test"
GF_SERVER_DOMAIN: insigno.mindshub.it
datasource: prometheus_uid

GF_SERVER_ROOT_URL: localhost:3000
#on production use this
#GF_SERVER_ROOT_URL =https://insigno.mindshub.it/grafana/
GF_SERVER_SERVE_FROM_SUB_PATH: false
GF_SERVER_ROOT_URL: "${COMP_PROTOCOL}://${COMP_HOST}/grafana/"
GF_SERVER_SERVE_FROM_SUB_PATH: true

prometheus:
image: prom/prometheus:latest
restart: always
ports:
- '9090:9090'
volumes:
- prometheus-vol:/prometheus
- "./prometheus.yml:/etc/prometheus/prometheus.yml"
environment:
PROM_SCRAPE_TIME: ${PROM_SCRAPE_TIME}
#
command: ["--config.file=/etc/prometheus/prometheus.yml", "--storage.tsdb.path=/prometheus", "--storage.tsdb.retention.time=1y", "--storage.tsdb.retention.size=5GB", "--storage.tsdb.wal-compression", "--web.external-url=/prometheus/"]


node_exporter:
image: prom/node-exporter:latest
restart: always
ports:
- 9100:9100
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
#- /:/rootfs:ro
command:
- '--path.procfs=/host/proc'
- '--path.rootfs=/rootfs'
Expand All @@ -50,21 +46,18 @@ services:
postgresql_exporter:
image: bitnami/postgres-exporter:latest
restart: always
ports:
- 9187:9187
environment:
- DATA_SOURCE_NAME=postgres://root:test@postgresql:5432/root?sslmode=disable
- DATA_SOURCE_NAME=postgres://root:${POSTGRES_PASSWORD}@postgresql:5432/${POSTGRES_DB}?sslmode=disable

postgresql:
image: postgis/postgis
#use tobi312/rpi-postgresql-postgis:16-3.4-alpine-arm on raspberry
restart: always
ports:
- "5432:5432"

environment:
- POSTGRES_USER=root
- POSTGRES_PASSWORD=test
- POSTGRES_DB=root
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
- PGDATA=/var/lib/postgresql/data/pgdata
volumes:
- db-vol:/var/lib/postgresql/data
Expand All @@ -87,13 +80,26 @@ services:
# source: ./templates
# target: /templates
- media-vol:/app/media
ports:
- "8000:8000"
depends_on:
postgresql:
condition: service_healthy
caddy:
image: caddy:latest
restart: always
ports:
- "80:80"
- "443:443"
volumes:
- caddy-data:/data
- ./Caddyfile:/etc/caddy/Caddyfile
environment:
COMP_HOST: ${COMP_HOST}
COMP_PROTOCOL: ${COMP_PROTOCOL}


volumes:
db-vol:
media-vol:
prometheus-vol:
grafana-vol:
grafana-vol:
caddy-data:
3 changes: 2 additions & 1 deletion docker/grafana-provisioning/datasources/prometheus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ datasources:
type: prometheus
access: proxy
# Access mode - proxy (server in the UI) or direct (browser in the UI).
url: http://prometheus:9090
url: http://prometheus:9090/prometheus
uid: "prometheus_uid"
jsonData:
httpMethod: POST
manageAlerts: true
prometheusType: Prometheus
timeInterval: 1m
#prometheusVersion: 2.44.0
#cacheLevel: 'High'
#disableRecordingRules: false
Expand Down
6 changes: 3 additions & 3 deletions docker/prometheus.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
global:
scrape_interval: 15s
scrape_interval: 1m
scrape_timeout: 10s
evaluation_interval: 15s
evaluation_interval: 1m

scrape_configs:
- job_name: prometheus
metrics_path: /metrics
metrics_path: /prometheus/metrics
static_configs:
- targets:
- prometheus:9090
Expand Down

0 comments on commit 08dcdcd

Please sign in to comment.