File tree Expand file tree Collapse file tree 7 files changed +191
-37
lines changed Expand file tree Collapse file tree 7 files changed +191
-37
lines changed Original file line number Diff line number Diff line change
1
+ services :
2
+ code-server :
3
+ image : lscr.io/linuxserver/code-server:latest
4
+ container_name : code-server
5
+ environment :
6
+ - PUID=0
7
+ - PGID=0
8
+ - TZ=Europe/London
9
+ - PASSWORD=password # optional
10
+ - SUDO_PASSWORD=password # optional
11
+ - DEFAULT_WORKSPACE=/config/workspace # optional
12
+ volumes :
13
+ - $HOME/.config/vscode/config:/home/coder/config
14
+ - /home/sysadm/monitoring:/config/workspace/monitoring
15
+ ports :
16
+ - 8443:8443
17
+ restart : always
Original file line number Diff line number Diff line change
1
+ services :
2
+ prometheus :
3
+ image : prom/prometheus
4
+ container_name : prometheus
5
+ command :
6
+ - " --config.file=/etc/prometheus/prometheus.yaml"
7
+ ports :
8
+ - 9090:9090
9
+ restart : unless-stopped
10
+ volumes :
11
+ - /home/sysadm/monitoring/prometheus:/etc/prometheus
12
+ - prom_data:/prometheus
13
+ grafana :
14
+ image : grafana/grafana
15
+ container_name : grafana
16
+ ports :
17
+ - 3000:3000
18
+ restart : unless-stopped
19
+ environment :
20
+ - GF_SECURITY_ADMIN_USER=admin
21
+ - GF_SECURITY_ADMIN_PASSWORD=grafana
22
+ volumes :
23
+ - ./home/sysadm/monitoring/grafana:/etc/grafana/provisioning/datasources
24
+ volumes :
25
+ prom_data :
Original file line number Diff line number Diff line change
1
+ services :
2
+ postgres :
3
+ container_name : postgres
4
+ image : postgres:latest
5
+ restart : always
6
+ environment :
7
+ POSTGRES_PASSWORD : password
8
+ ports :
9
+ - " 5432:5432"
10
+ healthcheck :
11
+ test : ["CMD-SHELL", "pg_isready"]
12
+ interval : 1s
13
+ timeout : 5s
14
+ retries : 10
15
+ volumes :
16
+ - postgres_data:/var/lib/postgresql/data
17
+
18
+ pgadmin :
19
+ container_name : pgadmin
20
+ image : dpage/pgadmin4:latest
21
+ environment :
22
+ - PGADMIN_DEFAULT_EMAIL=pbennett.uk@gmail.com
23
+ - PGADMIN_DEFAULT_PASSWORD=password
24
+ ports :
25
+ - " 5050:80"
26
+ restart : always
27
+ volumes :
28
+ - pgadmin_data:/var/lib/pgadmin
29
+
30
+ volumes :
31
+ postgres_data :
32
+ pgadmin_data :
Original file line number Diff line number Diff line change 26
26
style: row
27
27
columns: 3
28
28
29
- Applications :
29
+ Kubernetes :
30
30
style: row
31
- columns: 3
31
+ columns: 2
32
+
33
+ Docker:
34
+ style: row
35
+ columns: 1
32
36
33
37
custom.css : " "
34
38
custom.js : " "
81
85
ping: 192.168.4.110
82
86
target: _blank
83
87
84
- - Applications :
88
+ - Kubernetes :
85
89
- Kubernetes:
86
90
icon: kubernetes.png
87
91
href: http://192.168.5.55
@@ -118,14 +122,6 @@ data:
118
122
description: Easy-to-use distributed block storage
119
123
target: _blank
120
124
121
-
122
- - Home Assistant:
123
- icon: https://raw.githubusercontent.com/walkxcode/dashboard-icons/main/svg/home-assistant-alt.svg
124
- href: #
125
- description: Home Automation
126
- ping: #
127
- target: _blank
128
-
129
125
- Cloudflare:
130
126
icon: https://raw.githubusercontent.com/walkxcode/dashboard-icons/main/svg/cloudflare.svg
131
127
href: https://dash.cloudflare.com/5a2fb936e1a58d410c2a9ab8cf7e5ec3
@@ -139,6 +135,37 @@ data:
139
135
ping: 192.168.7.210
140
136
target: _blank
141
137
138
+
139
+ - Docker:
140
+ - Portainer
141
+ icon: portainer.png
142
+ href: https://192.168.7.70:9443/
143
+ description: Container management
144
+
145
+ - PGAdmin:
146
+ icon: postgres.png
147
+ href: http://192.168.7.70:5050
148
+ description: PGAdmin for Postgres
149
+ target: _blank
150
+
151
+ - Code Server:
152
+ icon: vsc.png
153
+ href: http://192.168.7.70:8443
154
+ description: VSC in the browser
155
+ target: _blank
156
+
157
+ - Grafana:
158
+ icon: grafana.png
159
+ href: http://192.168.7.70:3000
160
+ description: Managed observability platform
161
+ target: _blank
162
+
163
+ - Prometheus:
164
+ icon: prometheus.png
165
+ href: http://192.168.7.70:9090
166
+ description: Open-source monitoring system
167
+ target: _blank
168
+
142
169
- Network:
143
170
144
171
- PiHole 1:
Original file line number Diff line number Diff line change 1
1
apiVersion : batch/v1
2
2
kind : CronJob
3
3
metadata :
4
- name : oura-ring-data
4
+ name : health-dashboard
5
5
namespace : cron-jobs
6
6
spec :
7
7
concurrencyPolicy : Replace
@@ -11,12 +11,12 @@ spec:
11
11
template :
12
12
spec :
13
13
containers :
14
- - image : 192.168.7.210:5000/oura_ring :0.0.1
14
+ - image : 192.168.7.210:5000/health-dashboard :0.0.6
15
15
imagePullPolicy : Always
16
- name : oura-ring-data
16
+ name : health-dashboard
17
17
resources :
18
18
requests :
19
19
memory : 256Mi
20
20
restartPolicy : OnFailure
21
21
terminationGracePeriodSeconds : 30
22
- schedule : " 0 9 * * *"
22
+ schedule : " 0 7 * * *"
Original file line number Diff line number Diff line change
1
+ apiVersion : batch/v1
2
+ kind : CronJob
3
+ metadata :
4
+ name : postgres-backup
5
+ namespace : cron-jobs
6
+ spec :
7
+ schedule : " 0 0 * * *" # Cron schedule (e.g., run daily at midnight)
8
+ jobTemplate :
9
+ spec :
10
+ template :
11
+ spec :
12
+ containers :
13
+ - name : postgres-backup
14
+ image : postgres:latest # Use an image with pg_dump installed
15
+ command :
16
+ - " /bin/bash"
17
+ - " -c"
18
+ - |
19
+ #!/bin/bash
20
+
21
+ # Variables
22
+ PGHOST=192.168.5.52
23
+ PGPORT=5432
24
+ PGUSER=postgres
25
+ PGDATABASE=password
26
+ BACKUP_FILE=/tmp/backup_$(date +%Y%m%d_%H%M%S).sql # Backup file path inside the pod
27
+
28
+ # Log start of script
29
+ echo "$(date +'%Y-%m-%d %H:%M:%S') - Starting backup script..."
30
+
31
+ # Dump PostgreSQL database
32
+ pg_dump -h $PGHOST -p $PGPORT -U $PGUSER $PGDATABASE > $BACKUP_FILE
33
+
34
+ # Check if pg_dump was successful
35
+ if [ $? -eq 0 ]; then
36
+ echo "$(date +'%Y-%m-%d %H:%M:%S') - Database backup successful."
37
+ else
38
+ echo "$(date +'%Y-%m-%d %H:%M:%S') - ERROR: Database backup failed."
39
+ exit 1
40
+ fi
41
+
42
+ # Copy backup file to Kubernetes Persistent Volume
43
+ kubectl cp $BACKUP_FILE postgres-db/postgres-64449687f6-bs4m7:/mnt/storage/postgresql/backup
44
+
45
+ # Check if copy was successful
46
+ if [ $? -eq 0 ]; then
47
+ echo "$(date +'%Y-%m-%d %H:%M:%S') - Backup file copied successfully."
48
+ else
49
+ echo "$(date +'%Y-%m-%d %H:%M:%S') - ERROR: Failed to copy backup file."
50
+ exit 1
51
+ fi
52
+
53
+ # Example: Transfer backup file to external server via SCP
54
+ scp $BACKUP_FILE sysadm@192.168.7.70:/home/sysadm/db_backup
55
+
56
+ # Check if transfer was successful
57
+ if [ $? -eq 0 ]; then
58
+ echo "$(date +'%Y-%m-%d %H:%M:%S') - Backup file transferred successfully."
59
+ else
60
+ echo "$(date +'%Y-%m-%d %H:%M:%S') - ERROR: Failed to transfer backup file."
61
+ exit 1
62
+ fi
63
+
64
+ # Log end of script
65
+ echo "$(date +'%Y-%m-%d %H:%M:%S') - Backup script completed."
66
+
67
+ volumeMounts :
68
+ - name : backup-volume
69
+ mountPath : /mnt/storage/postgresql/backup
70
+
71
+ restartPolicy : OnFailure
72
+ volumes :
73
+ - name : backup-volume
74
+ persistentVolumeClaim :
75
+ claimName : backup-pvc
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments