Add cheat-sheet.md
This commit is contained in:
71
cheat-sheet.md
Normal file
71
cheat-sheet.md
Normal file
@@ -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;"
|
||||
```
|
||||
Reference in New Issue
Block a user