reogranize docker stuff + add backup script

master
Paul Walko 2019-09-08 14:20:20 -04:00
parent c18a93ef6b
commit ebff7f5d72
25 changed files with 117 additions and 9 deletions

21
.gitignore vendored
View File

@ -1,10 +1,13 @@
**/*htpasswd* **/*htpasswd*
docker-fogcutter/airsonic/config **/backups
docker-fogcutter/minecraft/data fogcutter/docker/airsonic/config
docker-fogcutter/nginx/config fogcutter/docker/minecraft/data
docker-fogcutter/plex/config fogcutter/docker/nginx/config
docker-fogcutter/syncthing/config fogcutter/docker/plex/config
docker-fogcutter/syncthing/sync fogcutter/docker/syncthing/config
docker-madone/nginx/config fogcutter/docker/syncthing/sync
docker-madone/syncthing/config fogcutter/docker/monitoring/grafana/data
docker-madone/syncthing/sync fogcutter/docker/monitoring/prometheus/data
madone/docker/nginx/config
madone/docker/syncthing/config
madone/docker/syncthing/sync

20
fogcutter/backup.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
# GPG key must be imported
DATE=$(date --iso-8601)
FINGERPRINT=1807F8D422B89582ADEC4A790B1A6ED3E577B121
SERVICE_PATH=/home/paul/scripts/fogcutter/docker
BACKUP_PATH=/bigdata/backups
WORKDIR=/tmp
cd $WORKDIR
cp -r "$SERVICE_PATH"/minecraft/data ./minecraft-data
tar cz ./minecraft-data | gpg -e -r $FINGERPRINT -o "$BACKUP_PATH"/minecraft-data-"$DATE".tgz.gpg
rm -rf ./minecraft-data
cp -r "$SERVICE_PATH"/syncthing/sync ./syncthing-data
tar cz ./syncthing-data | gpg -e -r $FINGERPRINT -o "$BACKUP_PATH"/syncthing-data-"$DATE".tgz.gpg
rm -rf ./syncthing-data

View File

@ -0,0 +1,61 @@
#!/bin/bash
# Assumes pew-net exists
# Assumes mounted dirs are created as non-root user
# Prometheus + Node Exporter + cAdvisor + Grafana
docker network create pew-monitoring-net
# grafana-cli plugins install grafana-piechart-panel
sudo chown 472:472 $PWD/grafana/{data,provisioning} \
&& \
docker run \
--name monitoring_grafana \
--detach \
--restart unless-stopped \
--user 472 \
--volume $PWD/grafana/data:/var/lib/grafana:rw \
--volume $PWD/grafana/provisioning:/etc/grafana/provisioning:rw \
--publish 3000:3000 \
--network pew-monitoring-net \
grafana/grafana:6.3.5 \
&& \
docker network connect pew-net monitoring_grafana
# --publish 9090:9090 \
sudo chown nobody:nogroup $PWD/prometheus/data \
&& \
docker run \
--name monitoring_prometheus \
--detach \
--restart unless-stopped \
--volume $PWD/prometheus/data:/prometheus:rw \
--volume $PWD/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro \
--volume $PWD/prometheus/alert.rules:/etc/prometheus/alert.rules:ro \
--network pew-monitoring-net \
prom/prometheus:v2.12.0 --config.file=/etc/prometheus/prometheus.yml \
--storage.tsdb.path=/prometheus
docker run \
--name monitoring_node-exporter \
--detach \
--restart unless-stopped \
--cap-add SYS_TIME \
--pid host \
--volume /:/host:ro,rslave \
--network pew-monitoring-net \
quay.io/prometheus/node-exporter:v0.18.1 --path.rootfs=/host
docker run \
--name monitoring_cadvisor \
--detach \
--restart unless-stopped \
--volume /:/rootfs:ro \
--volume /var/run:/var/run:ro \
--volume /sys:/sys:ro \
--volume /var/lib/docker:/var/lib/docker:ro \
--volume /dev/disk:/dev/disk:ro \
--network pew-monitoring-net \
google/cadvisor:v0.32.0
# alert manager

View File

@ -0,0 +1,24 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: prometheus
static_configs:
- targets: ['monitoring_prometheus:9090']
- job_name: cadvisor
static_configs:
- targets: ['monitoring_cadvisor:8080']
- job_name: node-exporter
static_configs:
- targets: ['monitoring_node-exporter:9100']
#alerting:
# alertmanagers:
# - static_configs:
# - targets: ['alertmanager:9093']
#
#rule_files:
#- 'alert.rules'

View File