From 7a4f0557ef6b56019e5bae3772d0ff70dad48490 Mon Sep 17 00:00:00 2001 From: drew Date: Thu, 1 Jan 2026 03:15:21 +0000 Subject: [PATCH] Add cheat-sheet.md --- cheat-sheet.md | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 cheat-sheet.md diff --git a/cheat-sheet.md b/cheat-sheet.md new file mode 100644 index 0000000..72d5a2a --- /dev/null +++ b/cheat-sheet.md @@ -0,0 +1,71 @@ +# ⚡ My Cloud Hub: 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` + +## 🐳 Docker Maintenance +Essential commands for managing your container stack. + +# View all running containers and their health +`docker ps` + +# Restart a specific service (e.g., memos) +`cd /opt/docker/memos && docker compose restart` + +# 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; +``` + +## ☁️ 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: +```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;" +``` \ No newline at end of file