This commit is contained in:
2025-12-02 15:45:09 +01:00
parent 8653c510b7
commit b55fdb532b
7 changed files with 1277 additions and 50 deletions

View File

@@ -25,8 +25,8 @@ This project provides a static web interface for viewing and managing network ar
```bash
# Clone repository
git clone git@git.appmodel.nl:Tour/diagram.git
cd diagram
git clone git@git.appmodel.nl:Tour/viewer.git
cd viewer
# Create virtual environment
python -m venv .venv
@@ -47,7 +47,7 @@ python main.py
### Project Structure
```
diagram/
viewer/
├── Dockerfile # Multi-stage build for production
├── docker-compose.yml # Docker Compose configuration
├── requirements.txt # Python dependencies
@@ -121,11 +121,11 @@ The project uses a fully automated Docker-based deployment pipeline:
```bash
# On server: Create app structure
apps-create diagram static-fe
apps-create viewer static-fe
# This creates:
# - /opt/apps/diagram (git repository)
# - /home/tour/infra/diagram/docker-compose.yml
# - /opt/apps/viewer (git repository)
# - /home/tour/infra/viewer/docker-compose.yml
```
#### 2. Configure Gitea Hook
@@ -134,7 +134,7 @@ In repository **Settings → Git Hooks → post-receive**:
```bash
#!/usr/bin/env bash
/usr/local/bin/app-deploy diagram
/usr/local/bin/app-deploy viewer
```
#### 3. Deploy
@@ -149,7 +149,7 @@ The server automatically:
- Pulls latest code
- Rebuilds Docker image
- Restarts container
- Updates live site at https://diagram.appmodel.nl
- Updates live site at https://viewer.appmodel.nl
### Manual Deployment
@@ -157,24 +157,24 @@ If needed:
```bash
# On server
app-deploy diagram
app-deploy viewer
# Or step-by-step
cd /opt/apps/diagram
cd /opt/apps/viewer
git pull
cd /home/tour/infra/diagram
docker compose up -d --build diagram
cd /home/tour/infra/viewer
docker compose up -d --build viewer
```
### Monitoring
```bash
# View deployment logs
tail -f /var/log/app-deploy-diagram.log
tail -f /var/log/app-deploy-viewer.log
# View container logs
cd /home/tour/infra/diagram
docker compose logs -f diagram
cd /home/tour/infra/viewer
docker compose logs -f viewer
# Check container status
docker compose ps
@@ -193,7 +193,7 @@ docker compose ps
│ │
│ ┌──────────────┐ │
│ │ Gitea │ (Source of Truth) │
│ │ Tour/diagram │ │
│ │ Tour/viewer │ │
│ └──────┬───────┘ │
│ │ git push │
│ ↓ │
@@ -201,10 +201,10 @@ docker compose ps
│ │ Post-Receive │ (Auto-trigger) │
│ │ Hook │ │
│ └──────┬───────┘ │
│ │ app-deploy diagram
│ │ app-deploy viewer
│ ↓ │
│ ┌──────────────────────┐ │
│ │ /opt/apps/diagram/ │ │
│ │ /opt/apps/viewer/ │ │
│ │ (Git Repository) │ │
│ └──────┬───────────────┘ │
│ │ git pull │
@@ -238,7 +238,7 @@ docker compose ps
│ └──────┬───────────────┘ │
│ │ HTTPS │
│ ↓ │
diagram.appmodel.nl │
viewer.appmodel.nl │
│ │
└─────────────────────────────────────────────┘
```
@@ -262,7 +262,7 @@ The diagram viewer documents our home lab infrastructure:
| Service | URL | Description |
|---------|-----|-------------|
| Diagram Viewer | https://diagram.appmodel.nl | This application |
| Diagram Viewer | https://viewer.appmodel.nl | This application |
| Gitea | https://git.appmodel.nl | Git hosting |
| Auction Frontend | https://auction.appmodel.nl | Auction platform |
| Aupi API | https://aupi.appmodel.nl | Backend API |
@@ -328,11 +328,11 @@ pip install --upgrade diagrams
**Solution**:
```bash
# Check deployment logs
tail -f /var/log/app-deploy-diagram.log
tail -f /var/log/app-deploy-viewer.log
# Rebuild manually with verbose output
cd /home/tour/infra/diagram
docker compose build --no-cache --progress=plain diagram
cd /home/tour/infra/viewer
docker compose build --no-cache --progress=plain viewer
```
#### Site Not Accessible
@@ -340,8 +340,8 @@ docker compose build --no-cache --progress=plain diagram
**Problem**: Container runs but site not reachable
**Solution**:
1. Check DNS: `nslookup diagram.appmodel.nl`
2. Verify Traefik labels: `docker inspect diagram-viewer | grep traefik`
1. Check DNS: `nslookup viewer.appmodel.nl`
2. Verify Traefik labels: `docker inspect viewer-viewer | grep traefik`
3. Check Traefik logs: `docker logs traefik`
4. Test container directly: `curl http://localhost:PORT`
@@ -352,9 +352,9 @@ docker compose build --no-cache --progress=plain diagram
**Solution**:
```bash
# Force rebuild on server
cd /home/tour/infra/diagram
cd /home/tour/infra/viewer
docker compose down
docker compose up -d --build --force-recreate diagram
docker compose up -d --build --force-recreate viewer
# Clear browser cache
# Ctrl+Shift+R (Windows/Linux) or Cmd+Shift+R (macOS)