upd homelabdb
This commit is contained in:
29
homelabdb/Bastillefile
Normal file
29
homelabdb/Bastillefile
Normal file
@@ -0,0 +1,29 @@
|
||||
# PostgreSQL 18 Homelab Setup
|
||||
SYSRC hostid_enable=YES
|
||||
SYSRC sendmail_enable=NONE
|
||||
SYSRC allow.sysvipc=YES
|
||||
SYSRC postgresql_enable=YES
|
||||
|
||||
PKG install -y postgresql18-server
|
||||
|
||||
# Initialisierung nur, wenn nötig
|
||||
CMD [ ! -f /var/db/postgres/data18/PG_VERSION ] && service postgresql initdb
|
||||
|
||||
# FIX: Wir ersetzen die listen_addresses Zeile direkt
|
||||
# Das '' ist bei FreeBSD sed für "kein Backup-File" nötig
|
||||
CMD sed -i '' "s/[# ]*listen_addresses =.*/listen_addresses = '*'/g" /var/db/postgres/data18/postgresql.conf
|
||||
|
||||
# HBA schreiben (dein funktionierender Stand)
|
||||
CMD sh -c "cat <<HBA > /var/db/postgres/data18/pg_hba.conf
|
||||
local all all trust
|
||||
host all all 127.0.0.1/32 trust
|
||||
host all all ::1/128 trust
|
||||
host all homelab 172.16.0.0/22 md5
|
||||
HBA"
|
||||
|
||||
# Neustart ist KRITISCH für das Binding an die IP
|
||||
CMD service postgresql restart
|
||||
|
||||
# User & DB Setup
|
||||
CMD su - postgres -c "psql -tc \"SELECT 1 FROM pg_user WHERE usename = 'homelab'\" | grep -q 1 || psql -c \"CREATE USER homelab WITH PASSWORD 'homelab';\""
|
||||
CMD su - postgres -c "psql -lqt | cut -d \| -f 1 | grep -qw homelabdb || createdb -O homelab homelabdb"
|
||||
17
homelabdb/README.md
Normal file
17
homelabdb/README.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# Bastille Stack: PostgreSQL 18 HomeLab
|
||||
|
||||
Dieses Template automatisiert die Bereitstellung eines **PostgreSQL 18** Servers in einem BastilleBSD Jail. Es ist vorkonfiguriert für den Netzwerkzugriff innerhalb eines HomeLabs.
|
||||
|
||||
## Features
|
||||
- **Version:** PostgreSQL 18.x
|
||||
- **Netzwerk:** Erreichbar im Subnetz `172.16.0.0/22`.
|
||||
- **IPC:** Automatische Konfiguration von System V IPC (wichtig für Postgres Performance).
|
||||
- **Auto-Setup:** Erstellt automatisch den User `homelab` und die Datenbank `homelabdb`.
|
||||
|
||||
## Voraussetzungen
|
||||
|
||||
### 1. Jail erstellen
|
||||
Das Jail sollte idealerweise mit dem `-B` Flag erstellt werden, um Standard-Parameter zu setzen:
|
||||
|
||||
```bash
|
||||
bastille create -B homelabdb 14.2-RELEASE 172.16.0.10
|
||||
Reference in New Issue
Block a user