mirror of
https://github.com/tomasriveral/vps-config.git
synced 2026-08-11 18:18:38 +02:00
rewrote setup
This commit is contained in:
@@ -105,29 +105,11 @@ ssh USERNAME@SERVER_IP
|
||||
---
|
||||
|
||||
# 4. Clone the server configuration
|
||||
|
||||
Create the deployment directory:
|
||||
|
||||
```bash
|
||||
mkdir -p /opt/server
|
||||
cd /opt/server
|
||||
```
|
||||
|
||||
Clone the configuration repository:
|
||||
|
||||
```bash
|
||||
git clone YOUR_REPOSITORY_URL .
|
||||
```
|
||||
|
||||
The structure should look like:
|
||||
|
||||
```
|
||||
server/
|
||||
├── compose.yml
|
||||
├── Caddyfile
|
||||
├── .env
|
||||
├── scripts/
|
||||
└── README.md
|
||||
git clone https://github.com/tomasriveral/vps-config
|
||||
cd vps-config
|
||||
```
|
||||
|
||||
---
|
||||
@@ -142,171 +124,14 @@ Create:
|
||||
nano .env
|
||||
```
|
||||
|
||||
Example:
|
||||
See `.env.example`
|
||||
|
||||
```env
|
||||
DOMAIN=example.com
|
||||
|
||||
FRESHRSS_ADMIN_PASSWORD=change_me
|
||||
|
||||
KDRIVE_USERNAME=user
|
||||
KDRIVE_PASSWORD=password
|
||||
# 6. Init the system
|
||||
```
|
||||
./scripts/init.sh
|
||||
```
|
||||
|
||||
Set permissions:
|
||||
|
||||
```bash
|
||||
chmod 600 .env
|
||||
# 7. Deploy
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 6. Start the Docker stack
|
||||
|
||||
From `/opt/server`:
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
./scripts/deploy.sh
|
||||
```
|
||||
|
||||
Check running containers:
|
||||
|
||||
```bash
|
||||
docker ps
|
||||
```
|
||||
|
||||
View logs:
|
||||
|
||||
```bash
|
||||
docker compose logs -f
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 7. Reverse proxy
|
||||
|
||||
Caddy handles HTTPS automatically.
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
website.com
|
||||
├── freshrss.website.com
|
||||
├── archivebox.website.com
|
||||
├── hledger.website.com
|
||||
├── calendar.website.com
|
||||
└── ntfy.website.com
|
||||
```
|
||||
|
||||
The `Caddyfile` defines where traffic goes.
|
||||
|
||||
After changing it:
|
||||
|
||||
```bash
|
||||
docker compose restart caddy
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 8. Updating services
|
||||
|
||||
Update images:
|
||||
|
||||
```bash
|
||||
docker compose pull
|
||||
```
|
||||
|
||||
Restart:
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
Remove unused images:
|
||||
|
||||
```bash
|
||||
docker image prune
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 9. Backups
|
||||
|
||||
Important data is stored in Docker volumes.
|
||||
|
||||
List volumes:
|
||||
|
||||
```bash
|
||||
docker volume ls
|
||||
```
|
||||
|
||||
Back up using:
|
||||
|
||||
* restic
|
||||
* kDrive
|
||||
* another storage provider
|
||||
|
||||
Recommended backup targets:
|
||||
|
||||
```
|
||||
FreshRSS database
|
||||
ArchiveBox data
|
||||
Calendar/contact data
|
||||
hledger files
|
||||
Caddy configuration
|
||||
.env secrets
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 10. Disaster recovery
|
||||
|
||||
To rebuild:
|
||||
|
||||
1. Install Debian
|
||||
2. Run `bootstrap.sh`
|
||||
3. Clone this repository
|
||||
4. Restore backups
|
||||
5. Restore `.env`
|
||||
6. Start Docker:
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
The complete server should be operational again.
|
||||
|
||||
---
|
||||
|
||||
# Planned services
|
||||
|
||||
Current stack:
|
||||
|
||||
* Caddy
|
||||
* FreshRSS
|
||||
* ArchiveBox
|
||||
* hledger-web
|
||||
* Calendar/contact server
|
||||
* ntfy
|
||||
* Monitoring
|
||||
|
||||
Possible additions:
|
||||
|
||||
* Uptime Kuma
|
||||
* Authelia or Authentik
|
||||
* Vaultwarden
|
||||
* Gitea
|
||||
* Miniflux
|
||||
* Mealie
|
||||
* Paperless-ngx
|
||||
|
||||
---
|
||||
|
||||
# Principles
|
||||
|
||||
* Configuration belongs in Git
|
||||
* Data belongs in backups
|
||||
* Secrets never go into Git
|
||||
* Containers are disposable
|
||||
* Volumes contain persistent data
|
||||
* The server should be reproducible
|
||||
|
||||
@@ -68,19 +68,7 @@ systemctl enable --now ssh
|
||||
systemctl enable --now fail2ban
|
||||
dpkg-reconfigure unattended-upgrades
|
||||
|
||||
echo "== installing systemd systems"
|
||||
mkdir -p /opt/server/archivebox/archivebox-data
|
||||
mkdir -p /mnt/kdrive/
|
||||
rclone config
|
||||
|
||||
cp systemd/kdrive-rclone.service /etc/systemd/system/
|
||||
|
||||
systemctl daemon-reload
|
||||
systemctl enable kdrive-rclone
|
||||
systemctl start kdrive-rclone
|
||||
mountpoint /mnt/kdrive
|
||||
ls /mnt/kdrive
|
||||
echo
|
||||
echo "================================"
|
||||
echo "Bootstrap finished!"
|
||||
echo
|
||||
|
||||
+14
-1
@@ -1,6 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
echo "== installing systemd systems"
|
||||
mkdir -p /opt/server/archivebox/archivebox-data
|
||||
mkdir -p /mnt/kdrive/
|
||||
rclone config
|
||||
|
||||
cp systemd/kdrive-rclone.service /etc/systemd/system/
|
||||
|
||||
systemctl daemon-reload
|
||||
systemctl enable kdrive-rclone
|
||||
systemctl start kdrive-rclone
|
||||
mountpoint /mnt/kdrive
|
||||
ls /mnt/kdrive
|
||||
echo
|
||||
|
||||
echo "== initializing archivebox"
|
||||
docker compose run --rm archivebox init --setup
|
||||
|
||||
Reference in New Issue
Block a user