docs: Consolidate homelab documentation and update SSH guide
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 2s
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 2s
This commit is contained in:
106
cheat-sheet.md
106
cheat-sheet.md
@@ -1,71 +1,53 @@
|
||||
# ⚡ My Cloud Hub: Daily Cheat Sheet
|
||||
# ⚡ Daily Cheat Sheet
|
||||
|
||||
## 🚀 Dashboard Updates
|
||||
Run this after pushing changes from your local PC to Gitea.
|
||||
|
||||
# Using the alias we created
|
||||
`updatedash`
|
||||
|
||||
# Or manually:
|
||||
`cd /opt/docker/dashboard && ./update-dash.sh`
|
||||
Quick commands for common homelab tasks. For detailed procedures, see the [Operations](./operations/) directory.
|
||||
|
||||
## 🐳 Docker Maintenance
|
||||
Essential commands for managing your container stack.
|
||||
```bash
|
||||
# View running containers
|
||||
docker ps
|
||||
|
||||
# View all running containers and their health
|
||||
`docker ps`
|
||||
# Restart a service
|
||||
cd /opt/docker/[service] && docker compose restart
|
||||
|
||||
# Restart a specific service (e.g., memos)
|
||||
`cd /opt/docker/memos && docker compose restart`
|
||||
# View live logs
|
||||
docker compose logs -f [service]
|
||||
|
||||
# View live logs for a service to troubleshoot
|
||||
`docker compose logs -f [service_name]`
|
||||
|
||||
# Clean up unused images/volumes (Run this if disk gets full)
|
||||
`docker system prune -a --volumes`
|
||||
|
||||
## 🐘 Database (Postgres) Operations
|
||||
Quick commands for interacting with your Universal DB.
|
||||
|
||||
# Access the Postgres CLI as the superuser
|
||||
`docker exec -it global_postgres psql -U postgres`
|
||||
```sql
|
||||
# SQL Commands (run these inside psql):
|
||||
# \l -- List all databases
|
||||
# \du -- List all users/roles
|
||||
# SELECT datname, pg_size_pretty(pg_database_size(datname)) FROM pg_database;
|
||||
# Cleanup unused data
|
||||
docker system prune -a --volumes
|
||||
```
|
||||
|
||||
## ☁️ Backup & Cloud Storage
|
||||
Manual triggers and verification for your S3 backups.
|
||||
|
||||
# Run a manual backup immediately
|
||||
`/opt/docker/backups/backup-homelab.sh`
|
||||
|
||||
# List files in your Linode Object Storage bucket
|
||||
`rclone ls linode-s3:davisdre-backups-chicago`
|
||||
|
||||
# Check the backup log for errors
|
||||
`tail -n 20 /opt/docker/backups/backup.log`
|
||||
|
||||
## 🖥️ System Health & Monitoring
|
||||
Keep an eye on that 2GB RAM limit and swap space.
|
||||
|
||||
# The 'Gold Standard' for real-time monitoring
|
||||
`htop`
|
||||
|
||||
# Check disk space usage
|
||||
`df -h`
|
||||
|
||||
# Check swap utilization specifically
|
||||
`swapon --show`
|
||||
|
||||
## 🛠️ Infrastructure SOP: Adding a New App
|
||||
1. Update global-db/compose.yaml environment list.
|
||||
2. Manually provision the DB on the live instance:
|
||||
## 🐘 Database Operations
|
||||
```bash
|
||||
docker exec -it global_postgres psql -U postgres -c "CREATE DATABASE app_name;"
|
||||
docker exec -it global_postgres psql -U postgres -c "CREATE USER app_name WITH PASSWORD 'my-custom-password';"
|
||||
docker exec -it global_postgres psql -U postgres -c "GRANT ALL PRIVILEGES ON DATABASE app_name TO app_name;"
|
||||
docker exec -it global_postgres psql -U postgres -c "ALTER DATABASE app_name OWNER TO app_name;"
|
||||
```
|
||||
# Access Postgres CLI
|
||||
docker exec -it global_postgres psql -U postgres
|
||||
```
|
||||
*SQL inside psql:* `\l` (list DBs), `\du` (list users).
|
||||
|
||||
## ☁️ Backup & Cloud Storage
|
||||
```bash
|
||||
# Manual backup trigger
|
||||
/opt/docker/backups/backup-homelab.sh
|
||||
|
||||
# List remote backups
|
||||
rclone ls linode-s3:davisdre-backups-chicago
|
||||
|
||||
# View logs
|
||||
tail -n 20 /opt/docker/backups/backup.log
|
||||
```
|
||||
|
||||
## 🖥️ System Health
|
||||
```bash
|
||||
# Real-time monitoring
|
||||
htop
|
||||
|
||||
# Disk usage
|
||||
df -h
|
||||
|
||||
# Swap space
|
||||
swapon --show
|
||||
```
|
||||
|
||||
## 🚀 Quick Actions
|
||||
- **Update Dashboard:** `updatedash` (on Linode)
|
||||
- **New App:** See [New App Deployment](./operations/new-app-deployment.md)
|
||||
|
||||
Reference in New Issue
Block a user