move scripts to own dir
This commit is contained in:
72
README.md
72
README.md
@@ -18,10 +18,10 @@ cat /etc/os-release
|
|||||||
|
|
||||||
Create these A records pointing to your VPS IP:
|
Create these A records pointing to your VPS IP:
|
||||||
|
|
||||||
| Record | Value |
|
| Record | Value |
|
||||||
|--------|-------|
|
|-------------------------|------------|
|
||||||
| `nextcloud.t-gstone.de` | `<VPS_IP>` |
|
| `nextcloud.t-gstone.de` | `<VPS_IP>` |
|
||||||
| `git.t-gstone.de` | `<VPS_IP>` |
|
| `git.t-gstone.de` | `<VPS_IP>` |
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
@@ -40,17 +40,17 @@ cp monitoring/.env.example monitoring/.env
|
|||||||
# - Add Grafana Cloud credentials to monitoring/.env
|
# - Add Grafana Cloud credentials to monitoring/.env
|
||||||
|
|
||||||
# 4. Deploy
|
# 4. Deploy
|
||||||
./deploy.sh
|
./scripts/deploy.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
## Services
|
## Services
|
||||||
|
|
||||||
| Service | Subdomain | Stack |
|
| Service | Subdomain | Stack |
|
||||||
|---------|-----------|-------|
|
|------------|-------------------------|-------------------------------------|
|
||||||
| Nextcloud | `nextcloud.t-gstone.de` | Nextcloud + PostgreSQL 16 + Redis 7 |
|
| Nextcloud | `nextcloud.t-gstone.de` | Nextcloud + PostgreSQL 16 + Redis 7 |
|
||||||
| Gitea | `git.t-gstone.de` | Gitea (SQLite) |
|
| Gitea | `git.t-gstone.de` | Gitea (SQLite) |
|
||||||
| Caddy | — | Reverse proxy, auto HTTPS |
|
| Caddy | — | Reverse proxy, auto HTTPS |
|
||||||
| Monitoring | — | Grafana Alloy -> Grafana Cloud |
|
| Monitoring | — | Grafana Alloy -> Grafana Cloud |
|
||||||
|
|
||||||
## Data Layout
|
## Data Layout
|
||||||
|
|
||||||
@@ -88,9 +88,9 @@ done
|
|||||||
|
|
||||||
1. Create a new directory: `mkdir myapp/`
|
1. Create a new directory: `mkdir myapp/`
|
||||||
2. Create `myapp/docker-compose.yml`:
|
2. Create `myapp/docker-compose.yml`:
|
||||||
- Join the `proxy` external network
|
- Join the `proxy` external network
|
||||||
- Bind mount data to `${DATA_ROOT}/myapp/`
|
- Bind mount data to `${DATA_ROOT}/myapp/`
|
||||||
- Add `myapp/.env.example` if the service needs secrets
|
- Add `myapp/.env.example` if the service needs secrets
|
||||||
3. Add a reverse proxy entry in `caddy/Caddyfile`:
|
3. Add a reverse proxy entry in `caddy/Caddyfile`:
|
||||||
```
|
```
|
||||||
myapp.t-gstone.de {
|
myapp.t-gstone.de {
|
||||||
@@ -99,47 +99,51 @@ done
|
|||||||
```
|
```
|
||||||
4. Reload Caddy: `docker exec caddy caddy reload --config /etc/caddy/Caddyfile`
|
4. Reload Caddy: `docker exec caddy caddy reload --config /etc/caddy/Caddyfile`
|
||||||
5. Add a DNS A record for `myapp.t-gstone.de` -> VPS IP
|
5. Add a DNS A record for `myapp.t-gstone.de` -> VPS IP
|
||||||
6. Add data directory creation to `deploy.sh`
|
6. Add data directory creation to `scripts/deploy.sh`
|
||||||
7. Add backup steps to `backup.sh` if the service has persistent data
|
7. Add backup steps to `scripts/backup.sh` if the service has persistent data
|
||||||
|
|
||||||
## Backup & Restore
|
## Backup & Restore
|
||||||
|
|
||||||
### Creating Backups
|
### Creating Backups
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./backup.sh
|
./scripts/backup.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
This dumps the Nextcloud Postgres database, archives Nextcloud data/config and Gitea data, and stores them in `/opt/backups/` with date-stamped filenames. Backups older than 7 days are automatically removed.
|
This dumps the Nextcloud Postgres database, archives Nextcloud data/config and Gitea data, and stores them in
|
||||||
|
`/opt/backups/` with date-stamped filenames. Backups older than 7 days are automatically removed.
|
||||||
|
|
||||||
Schedule daily backups:
|
Schedule daily backups:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
crontab -e
|
crontab -e
|
||||||
# Add:
|
# Add:
|
||||||
0 3 * * * /path/to/backup.sh >> /var/log/backup.log 2>&1
|
0 3 * * * /path/to/scripts/backup.sh >> /var/log/backup.log 2>&1
|
||||||
```
|
```
|
||||||
|
|
||||||
### Restoring
|
### Restoring
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./restore.sh 2026-03-22
|
./scripts/restore.sh 2026-03-22
|
||||||
```
|
```
|
||||||
|
|
||||||
This stops services, restores data from the specified date's backup files, restores the database, and restarts everything.
|
This stops services, restores data from the specified date's backup files, restores the database, and restarts
|
||||||
|
everything.
|
||||||
|
|
||||||
### Backup Strategy Options
|
### Backup Strategy Options
|
||||||
|
|
||||||
The current setup stores backups locally on the same VPS. For production use, consider an off-site strategy:
|
The current setup stores backups locally on the same VPS. For production use, consider an off-site strategy:
|
||||||
|
|
||||||
| Option | Pros | Cons |
|
| Option | Pros | Cons |
|
||||||
|--------|------|------|
|
|---------------------------------------------------------------------------------|--------------------------------------|---------------------------|
|
||||||
| **Local only** (`/opt/backups/`) | Simplest, no extra cost | Lost if VPS dies |
|
| **Local only** (`/opt/backups/`) | Simplest, no extra cost | Lost if VPS dies |
|
||||||
| **rsync to second VPS or home server** | Simple, full control | Need a second machine |
|
| **rsync to second VPS or home server** | Simple, full control | Need a second machine |
|
||||||
| **S3-compatible object storage** (Backblaze B2, Hetzner Object Storage, Wasabi) | Cheap, durable, off-site | Monthly cost (~$0.005/GB) |
|
| **S3-compatible object storage** (Backblaze B2, Hetzner Object Storage, Wasabi) | Cheap, durable, off-site | Monthly cost (~$0.005/GB) |
|
||||||
| **Restic or BorgBackup** to any remote target | Encrypted, deduplicated, incremental | More setup complexity |
|
| **Restic or BorgBackup** to any remote target | Encrypted, deduplicated, incremental | More setup complexity |
|
||||||
|
|
||||||
Recommendation for a personal setup: **Backblaze B2 or Hetzner Object Storage with Restic**. Both offer free egress (B2) or low cost, and Restic handles encryption + deduplication automatically. A cron job running `restic backup` after `backup.sh` completes the pipeline.
|
Recommendation for a personal setup: **Backblaze B2 or Hetzner Object Storage with Restic**. Both offer free egress (B2)
|
||||||
|
or low cost, and Restic handles encryption + deduplication automatically. A cron job running `restic backup` after
|
||||||
|
`backup.sh` completes the pipeline.
|
||||||
|
|
||||||
## Monitoring
|
## Monitoring
|
||||||
|
|
||||||
@@ -155,13 +159,13 @@ Recommendation for a personal setup: **Backblaze B2 or Hetzner Object Storage wi
|
|||||||
|
|
||||||
Set these up in Grafana Cloud UI (**Alerting** -> **Alert rules**):
|
Set these up in Grafana Cloud UI (**Alerting** -> **Alert rules**):
|
||||||
|
|
||||||
| Alert | Condition | Severity |
|
| Alert | Condition | Severity |
|
||||||
|-------|-----------|----------|
|
|----------------------|-----------------------------------------------------------------------|----------|
|
||||||
| Disk usage high | `node_filesystem_avail_bytes` / `node_filesystem_size_bytes` < 0.2 | Critical |
|
| Disk usage high | `node_filesystem_avail_bytes` / `node_filesystem_size_bytes` < 0.2 | Critical |
|
||||||
| Container restarting | Container restart count > 3 in 10 min | Warning |
|
| Container restarting | Container restart count > 3 in 10 min | Warning |
|
||||||
| High memory usage | `node_memory_MemAvailable_bytes` / `node_memory_MemTotal_bytes` < 0.1 | Warning |
|
| High memory usage | `node_memory_MemAvailable_bytes` / `node_memory_MemTotal_bytes` < 0.1 | Warning |
|
||||||
| High CPU usage | `node_cpu_seconds_total` idle < 10% sustained 5 min | Warning |
|
| High CPU usage | `node_cpu_seconds_total` idle < 10% sustained 5 min | Warning |
|
||||||
| Nextcloud cron stale | No log line from `nextcloud-cron` in 15 min | Warning |
|
| Nextcloud cron stale | No log line from `nextcloud-cron` in 15 min | Warning |
|
||||||
|
|
||||||
### Recommended Dashboards
|
### Recommended Dashboards
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user