Files
nuc/commands.md
Alejandro Gutiérrez 390eda1595 Initial commit - NUC server configuration and docs
- CLAUDE.md: Server instructions and service reference
- docs/: Persistent documentation (architecture, guides)
- .artifacts/: Session-generated notes
- playwriter-browser/: Remote browser container config

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 20:49:20 +00:00

172 lines
3.5 KiB
Markdown

# Quick Reference Commands
## SSH Connection
```bash
ssh nuc
```
## Docker Commands
### List Running Containers
```bash
ssh nuc "docker ps --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}'"
```
### View Logs
```bash
# Last 100 lines
ssh nuc "docker logs <container> --tail 100"
# Follow logs
ssh nuc "docker logs <container> -f"
# With timestamps
ssh nuc "docker logs <container> --tail 50 -t"
```
### Container Management
```bash
# Restart
ssh nuc "docker restart <container>"
# Stop
ssh nuc "docker stop <container>"
# Start
ssh nuc "docker start <container>"
# Remove
ssh nuc "docker rm <container>"
```
### Execute Commands in Container
```bash
ssh nuc "docker exec <container> <command>"
# Interactive shell
ssh nuc -t "docker exec -it <container> /bin/sh"
```
### Network Inspection
```bash
# Find container's network
ssh nuc "docker inspect <container> --format '{{range .NetworkSettings.Networks}}{{.NetworkID}}{{end}}'"
# List networks
ssh nuc "docker network ls"
```
## Coolify Management
### Restart a Service
```bash
ssh nuc "docker exec coolify php artisan tinker --execute=\"
use App\\Actions\\Service\\StartService;
use App\\Models\\Service;
\\\$service = Service::find(<SERVICE_ID>);
StartService::run(\\\$service);
\""
```
### List Services
```bash
ssh nuc "docker exec coolify php artisan tinker --execute=\"
use App\\Models\\Service;
Service::all(['id','name','uuid'])->toJson();
\""
```
### Update Environment Variable
```bash
ssh nuc "docker exec coolify php artisan tinker --execute=\"
use App\\Models\\EnvironmentVariable;
\\\$var = EnvironmentVariable::where('key', 'VAR_NAME')
->where('resourceable_id', <SERVICE_ID>)
->where('resourceable_type', 'App\\\\\\\\Models\\\\\\\\Service')
->first();
\\\$var->value = encrypt('new_value');
\\\$var->save();
echo 'Updated';
\""
```
## Port Forwarding
### Create socat forwarder
```bash
ssh nuc "docker run -d \
--name port-fwd-<name> \
--network <network_id> \
-p <external_port>:<internal_port> \
alpine/socat \
tcp-listen:<internal_port>,fork,reuseaddr \
tcp-connect:<container>:<container_port>"
```
### Create nginx forwarder (with HSTS stripping)
```bash
ssh nuc "docker run -d \
--name port-fwd-<name> \
--network <network_id> \
-p <external_port>:<proxy_port> \
nginx:alpine \
sh -c 'echo \"server { listen <proxy_port>; location / { proxy_pass http://<container>:<port>; proxy_set_header Host \\\$host; proxy_hide_header Strict-Transport-Security; } }\" > /etc/nginx/conf.d/default.conf && nginx -g \"daemon off;\"'"
```
## Service URLs
| Service | URL |
|---------|-----|
| Homepage | http://192.168.1.3:3000 |
| Coolify | http://192.168.1.3:8000 |
| Gitea | http://192.168.1.3:3030 |
| Outline | http://192.168.1.3:3080 |
| n8n | http://192.168.1.3:5678 |
| Vaultwarden | http://192.168.1.3:8222 |
| Ntfy | http://192.168.1.3:8333 |
| MinIO | http://192.168.1.3:9001 |
| Uptime Kuma | http://192.168.1.3:3001 |
| Dozzle | http://192.168.1.3:9999 |
| Adminer | http://192.168.1.3:8088 |
| Kopia | http://192.168.1.3:51515 |
| FileBrowser | http://192.168.1.3:8085 |
## Backup & Recovery
### Kopia Web UI
http://192.168.1.3:51515
### Manual Backup Check
```bash
ssh nuc "docker exec kopia kopia snapshot list"
```
## Troubleshooting
### Check disk space
```bash
ssh nuc "df -h"
```
### Check memory
```bash
ssh nuc "free -h"
```
### Check Docker disk usage
```bash
ssh nuc "docker system df"
```
### Clean up Docker
```bash
# Remove unused images
ssh nuc "docker image prune -a"
# Remove unused volumes
ssh nuc "docker volume prune"
# Full cleanup
ssh nuc "docker system prune -a"
```