feat: add TUI environment variables to stack deployments

- Pass TERM=xterm-256color for 256-color terminal support
- Pass COLORTERM=truecolor for 24-bit color support
- Pass LANG and LC_ALL for proper Unicode rendering
- Update ROADMAP.md with TUI feature planning and cleanup automation
This commit is contained in:
Oussama Douhou
2026-01-10 22:38:00 +01:00
parent 3d056f1348
commit 95b6c0a53b
2 changed files with 76 additions and 1 deletions

View File

@@ -13,9 +13,61 @@
- [x] Persistent storage volumes
- [x] Logging infrastructure (log-ingest → Loki → Grafana)
- [x] AI Stack monitoring dashboard at logs.intra.flexinit.nl
- [x] Repository consolidation (3 repos → flexinit/agent-stack)
- [x] Unified CI/CD pipeline (stack + portal images)
## Next
## Next (Priority)
### Automated Cleanup System (HIGH)
**Issue**: Disk space exhaustion on Dokploy server causes CI failures
**Components**:
- [ ] CI workflow cleanup step - prune build cache after each build
- [ ] Server-side cron job - daily Docker system prune
- [ ] Disk monitoring - alert at 80% usage via Grafana
- [ ] Post-deployment cleanup - remove unused resources after stack deploy
**Implementation**:
```yaml
# CI workflows (.gitea/workflows/*.yaml)
- name: Cleanup build artifacts
if: always()
run: |
docker builder prune -f --keep-storage=2GB
docker image prune -f --filter "until=24h"
```
```bash
# Server cron (/etc/cron.d/docker-cleanup on 10.100.0.20)
0 4 * * * root docker system prune -f --volumes --filter "until=72h"
0 4 * * * root docker exec flexinit-runner docker builder prune -f --keep-storage=5GB
```
### Web-based TUI Support (HIGH)
**Feature**: Full TUI (Terminal User Interface) support inside the web browser
**Goal**: Enable rich terminal UI applications (like htop, lazygit, OpenCode TUI mode) to render correctly in the browser-based terminal.
**Components**:
- [ ] xterm.js integration with full TUI support (colors, mouse, resize)
- [ ] Proper TERM environment configuration (xterm-256color)
- [ ] Mouse event passthrough for TUI interactions
- [ ] Font/rendering optimization for box-drawing characters
- [ ] Keyboard shortcut handling (Ctrl+C, Ctrl+Z, etc.)
**Technical Options**:
1. **Upgrade ttyd** - Ensure latest version with full xterm.js features
2. **Custom xterm.js wrapper** - More control over terminal emulation
3. **Gotty alternative** - Consider other web terminal solutions
**Use Cases**:
- OpenCode TUI mode in browser
- lazygit, lazydocker
- htop, btop system monitoring
- vim/neovim with full features
- Any ncurses-based application
### Other Next Items
- [ ] User authentication (protect deployments)
- [ ] Rate limiting (prevent abuse)
- [ ] Stack management UI (list/delete stacks)
@@ -26,3 +78,21 @@
- [ ] Integration tests
- [ ] Resource limits configuration
- [ ] Custom domain support
- [ ] Image versioning (semantic versions + rollback)
- [ ] Auto-cleanup of abandoned stacks (inactive > 30 days)
## Technical Notes
### Disk Space Management
Server: 10.100.0.20 (97GB total)
- Docker images: ~10GB
- Containers: ~1.5GB
- Volumes: ~30GB
- Build cache: Up to 6GB between cleanups
- **Safe threshold**: Keep 15GB+ free (85% max usage)
### Key Infrastructure
- Gitea: git.app.flexinit.nl (repo: flexinit/agent-stack)
- Runner: flexinit-runner container on 10.100.0.20
- Registry: git.app.flexinit.nl/flexinit/agent-stack:latest
- Monitoring: logs.intra.flexinit.nl (dashboard: /d/ai-stack-overview)

View File

@@ -288,6 +288,11 @@ export class ProductionDeployer {
`USAGE_LOGGING_ENABLED=true`,
`LOG_INGEST_URL=${process.env.LOG_INGEST_URL || 'http://10.100.0.20:3102/ingest'}`,
`METRICS_PORT=9090`,
// TUI Support: Terminal environment for proper TUI rendering in web browser
`TERM=xterm-256color`,
`COLORTERM=truecolor`,
`LANG=en_US.UTF-8`,
`LC_ALL=en_US.UTF-8`,
].join('\n');
await this.client.setApplicationEnv(state.resources.applicationId, envVars);