Files
api7-demo/web/README.md
d.viti a2eef9efde
Some checks failed
Build and Push Docker Images / build-web (push) Failing after 1m3s
Build and Push Docker Images / build-api (push) Failing after 1m1s
first commit
2025-10-03 01:20:15 +02:00

169 lines
3.7 KiB
Markdown

# Web Application with Documentation
FastAPI web application serving a demo dashboard and comprehensive MkDocs documentation.
## Features
- **Web Dashboard**: Simple HTML interface with metrics display
- **Documentation Site**: Complete API7 Enterprise setup guide at `/docs`
- **Health Checks**: Monitoring endpoint at `/health`
## Documentation
The application includes comprehensive documentation built with MkDocs Material theme, covering:
- **Architecture Overview**: Complete infrastructure and component details
- **Getting Started**: Quick setup and deployment guide
- **API7 Configuration**: Route and service configuration with examples
- **Kubernetes Resources**: Complete resource reference
- **CI/CD Pipeline**: Gitea Actions workflow documentation
- **Troubleshooting**: Common issues and solutions
## Running Locally
### Prerequisites
```bash
pip install -r requirements.txt
```
### Start Application
```bash
python main.py
```
**Access**:
- Main Page: http://localhost:8000
- Documentation: http://localhost:8000/docs/
- Health Check: http://localhost:8000/health
### Build Documentation Manually
```bash
mkdocs build -f docs/mkdocs.yml -d site
```
## Docker
### Build Image
```bash
docker build -t web-app .
```
The Dockerfile:
1. Installs Python dependencies
2. Copies application and documentation source
3. Builds static documentation site with MkDocs
4. Serves both the app and docs
### Run Container
```bash
docker run -p 8000:8000 web-app
```
## Kubernetes Deployment
```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: web
namespace: api7ee
spec:
replicas: 2
selector:
matchLabels:
app: web
template:
metadata:
labels:
app: web
spec:
containers:
- name: web
image: git.commandware.com/demos/api7-demo/web:main
ports:
- containerPort: 8000
name: http
livenessProbe:
httpGet:
path: /health
port: 8000
readinessProbe:
httpGet:
path: /health
port: 8000
---
apiVersion: v1
kind: Service
metadata:
name: web-service
namespace: api7ee
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 8000
name: http
selector:
app: web
```
## Documentation Structure
```
docs/
├── mkdocs.yml # MkDocs configuration
├── index.md # Documentation home
├── getting-started.md # Quick start guide
├── architecture.md # Infrastructure architecture
├── kubernetes-resources.md # K8s resources reference
├── api7-configuration.md # API7 Gateway config guide
├── cicd-pipeline.md # CI/CD documentation
└── troubleshooting.md # Troubleshooting guide
```
## Endpoints
| Endpoint | Description |
| --------- | --------------------------- |
| `/` | Main web dashboard |
| `/docs/` | Documentation site (MkDocs) |
| `/health` | Health check endpoint |
## CI/CD
Images are automatically built and pushed to Gitea registry on every push:
**Registry**: `git.commandware.com/demos/api7-demo/web:<branch>`
See [CI/CD Pipeline documentation](docs/cicd-pipeline.md) for details.
## Development
### Update Documentation
1. Edit markdown files in `docs/` directory
2. Test locally:
```bash
mkdocs serve -f docs/mkdocs.yml
```
3. View at http://localhost:8001
4. Rebuild with `mkdocs build` or rebuild Docker image
### Dependencies
- **fastapi**: Web framework
- **uvicorn**: ASGI server
- **mkdocs**: Documentation site generator
- **mkdocs-material**: Material theme for MkDocs
---
_FastAPI web application with integrated MkDocs documentation for API7 Enterprise demo._