Skip to content

Commit ead2dfa

Browse files
committed
adding docker host
1 parent c9b7f2c commit ead2dfa

File tree

7 files changed

+191
-37
lines changed

7 files changed

+191
-37
lines changed

docker/code-server.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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

docker/monitoring.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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:

docker/postgres.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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:

kubernetes/apps/homepage-dashboard/config-map.yaml

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,13 @@ data:
2626
style: row
2727
columns: 3
2828
29-
Applications:
29+
Kubernetes:
3030
style: row
31-
columns: 3
31+
columns: 2
32+
33+
Docker:
34+
style: row
35+
columns: 1
3236
3337
custom.css: ""
3438
custom.js: ""
@@ -81,7 +85,7 @@ data:
8185
ping: 192.168.4.110
8286
target: _blank
8387
84-
- Applications:
88+
- Kubernetes:
8589
- Kubernetes:
8690
icon: kubernetes.png
8791
href: http://192.168.5.55
@@ -118,14 +122,6 @@ data:
118122
description: Easy-to-use distributed block storage
119123
target: _blank
120124
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-
129125
- Cloudflare:
130126
icon: https://raw.githubusercontent.com/walkxcode/dashboard-icons/main/svg/cloudflare.svg
131127
href: https://dash.cloudflare.com/5a2fb936e1a58d410c2a9ab8cf7e5ec3
@@ -139,6 +135,37 @@ data:
139135
ping: 192.168.7.210
140136
target: _blank
141137
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+
142169
- Network:
143170
144171
- PiHole 1:
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: batch/v1
22
kind: CronJob
33
metadata:
4-
name: oura-ring-data
4+
name: health-dashboard
55
namespace: cron-jobs
66
spec:
77
concurrencyPolicy: Replace
@@ -11,12 +11,12 @@ spec:
1111
template:
1212
spec:
1313
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
1515
imagePullPolicy: Always
16-
name: oura-ring-data
16+
name: health-dashboard
1717
resources:
1818
requests:
1919
memory: 256Mi
2020
restartPolicy: OnFailure
2121
terminationGracePeriodSeconds: 30
22-
schedule: "0 9 * * *"
22+
schedule: "0 7 * * *"
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
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

kubernetes/jobs/test-cjob.yaml

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)