Update readme's, branches and actions
Build and Push Docker Images / detect-changes (push) Successful in 9s
Build and Push Docker Images / build-auth-api (push) Successful in 1m5s
Build and Push Docker Images / build-employee-api (push) Successful in 1m1s
Build and Push Docker Images / build-transit-api (push) Successful in 57s
Build and Push Docker Images / build-error-log-api (push) Successful in 1m5s
Build and Push Docker Images / build-admin-ui (push) Successful in 1m16s
Build and Push Docker Images / build-monitoring-ui (push) Successful in 1m13s
Build and Push Docker Images / deploy-test-node (push) Successful in 5s
Build and Push Docker Images / detect-changes (push) Successful in 9s
Build and Push Docker Images / build-auth-api (push) Successful in 1m5s
Build and Push Docker Images / build-employee-api (push) Successful in 1m1s
Build and Push Docker Images / build-transit-api (push) Successful in 57s
Build and Push Docker Images / build-error-log-api (push) Successful in 1m5s
Build and Push Docker Images / build-admin-ui (push) Successful in 1m16s
Build and Push Docker Images / build-monitoring-ui (push) Successful in 1m13s
Build and Push Docker Images / deploy-test-node (push) Successful in 5s
This commit is contained in:
@@ -1,86 +1,89 @@
|
||||
# Docker Setup voor Transit Project APIs
|
||||
# Docker Setup for Transit Project APIs
|
||||
|
||||
Dit project bevat Docker-configuratie voor alle APIs, Admin Control Center en PostgreSQL database.
|
||||
This project contains Docker configuration for all APIs, the Admin Control Center, the Monitoring UI, and external/local PostgreSQL databases.
|
||||
|
||||
## Bestanden
|
||||
## Files
|
||||
|
||||
- **auth_api/Dockerfile** - Image voor Authentication API (port 5000)
|
||||
- **employee_api/Dockerfile** - Image voor Employee API (port 4000)
|
||||
- **transit_api/Dockerfile** - Image voor Transit API (port 5001)
|
||||
- **admin_ui/Dockerfile** - Image voor Admin Control Center (port 5174)
|
||||
- **docker-compose.yml** - Orchestratie van alle services
|
||||
- **.dockerignore** - Bestanden die niet in Docker images opgenomen worden
|
||||
- **.env.example** - Template voor environment variabelen
|
||||
- **DEPLOYMENT.md** - Gedetailleerde deployment guide
|
||||
- **auth_api/Dockerfile** - Image for Authentication API (port 5000)
|
||||
- **employee_api/Dockerfile** - Image for Employee API (port 4000)
|
||||
- **transit_api/Dockerfile** - Image for Transit API (port 5001)
|
||||
- **admin_ui/Dockerfile** - Image for Admin Control Center (port 5174)
|
||||
- **monitoring_ui/Dockerfile** - Image for Monitoring UI Dashboard (port 5175)
|
||||
- **docker-compose.yml** - Orchestration for all services
|
||||
- **.dockerignore** - Files excluded from Docker images
|
||||
- **.env.example** - Template for environment variables
|
||||
- **DEPLOYMENT.md** - Detailed deployment guide
|
||||
- **scripts/deploy.sh** - Deployment helper script
|
||||
- **scripts/build-and-push.sh** - Build en push script voor registry
|
||||
- **scripts/build-and-push.sh** - Build and push script for container registry
|
||||
|
||||
## Vereisten
|
||||
## Prerequisites
|
||||
|
||||
- Docker (>=20.10)
|
||||
- Docker Compose (>=2.0)
|
||||
|
||||
## Installatie
|
||||
## Installation & Setup
|
||||
|
||||
### 1. Environment variabelen configureren
|
||||
### 1. Configure Environment Variables
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
# Bewerk .env met je eigen waarden
|
||||
# Edit .env with your specific configuration values
|
||||
```
|
||||
|
||||
### 2. Services starten
|
||||
### 2. Start Services
|
||||
|
||||
```bash
|
||||
# Start alle services (APIs + Admin UI)
|
||||
# Start all services (APIs + Admin UI + Monitoring UI)
|
||||
docker-compose up -d
|
||||
|
||||
# Of build en start tegelijk (als je code hebt aangepast)
|
||||
# Or build and start simultaneously (after code modifications)
|
||||
docker-compose up -d --build
|
||||
|
||||
# Quick start met script
|
||||
# Quick start using helper script
|
||||
./scripts/deploy.sh start
|
||||
```
|
||||
|
||||
### 3. Logs bekijken
|
||||
### 3. View Logs
|
||||
|
||||
```bash
|
||||
# Alle logs
|
||||
# All service logs
|
||||
docker-compose logs -f
|
||||
|
||||
# Logs van specifieke service
|
||||
# Logs for a specific service
|
||||
docker-compose logs -f auth_api
|
||||
docker-compose logs -f transit_api
|
||||
docker-compose logs -f admin_ui
|
||||
|
||||
# Via script
|
||||
# Via helper script
|
||||
./scripts/deploy.sh logs admin_ui
|
||||
```
|
||||
|
||||
## Beschikbare Services
|
||||
## Available Services
|
||||
|
||||
| Service | Port | Beschrijving |
|
||||
|---------|------|--------------|
|
||||
| Service | Port | Description |
|
||||
|---------|------|-------------|
|
||||
| admin_ui | 5174 | Admin Control Center (React + Nginx) |
|
||||
| monitoring_ui | 5175 | Monitoring Dashboard & Docs Hub (React + Nginx) |
|
||||
| auth_api | 5000 | Authentication endpoints |
|
||||
| employee_api | 4000 | Employee management endpoints |
|
||||
| transit_api | 5001 | Transit management endpoints |
|
||||
| error_log_api | 5003 | Centralized error logging API |
|
||||
|
||||
## Commando's
|
||||
## Commands
|
||||
|
||||
### Services beheren (Quick way)
|
||||
### Manage Services (Quick Way)
|
||||
|
||||
```bash
|
||||
# Via helper script
|
||||
./scripts/deploy.sh start # Start alle services
|
||||
./scripts/deploy.sh stop # Stop alle services
|
||||
./scripts/deploy.sh restart # Herstart alle services
|
||||
# Using helper script
|
||||
./scripts/deploy.sh start # Start all services
|
||||
./scripts/deploy.sh stop # Stop all services
|
||||
./scripts/deploy.sh restart # Restart all services
|
||||
./scripts/deploy.sh status # Show status
|
||||
./scripts/deploy.sh logs # Bekijk logs admin_ui
|
||||
./scripts/deploy.sh logs transit_api # Bekijk logs specifieke service
|
||||
./scripts/deploy.sh logs # View admin_ui logs
|
||||
./scripts/deploy.sh logs transit_api # View specific service logs
|
||||
```
|
||||
|
||||
### Services beheren (Docker compose)
|
||||
### Manage Services (Docker Compose)
|
||||
|
||||
```bash
|
||||
# Start services
|
||||
@@ -89,152 +92,154 @@ docker-compose up -d
|
||||
# Stop services
|
||||
docker-compose down
|
||||
|
||||
# Herstart services
|
||||
# Restart services
|
||||
docker-compose restart
|
||||
|
||||
# Verwijder containers en volumes
|
||||
# Remove containers and volumes
|
||||
docker-compose down -v
|
||||
```
|
||||
|
||||
### Individuele services
|
||||
### Individual Services
|
||||
|
||||
```bash
|
||||
# Herstart specifieke service
|
||||
# Restart a specific service
|
||||
docker-compose restart auth_api
|
||||
docker-compose restart admin_ui
|
||||
|
||||
# Build specifieke image
|
||||
# Build a specific image
|
||||
docker-compose build auth_api
|
||||
|
||||
# Logs van specifieke service
|
||||
# Tail logs of a specific service
|
||||
docker-compose logs -f transit_api
|
||||
```
|
||||
|
||||
### Admin UI
|
||||
|
||||
```bash
|
||||
# Bekijk Admin UI
|
||||
# Access Admin UI in browser
|
||||
http://localhost:5174
|
||||
|
||||
# Logs
|
||||
# View logs
|
||||
docker-compose logs -f admin_ui
|
||||
|
||||
# Shell in container
|
||||
# Interactive shell in container
|
||||
docker-compose exec admin_ui sh
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Port al in gebruik
|
||||
### Port Already in Use
|
||||
```bash
|
||||
# Check welke container de port gebruikt
|
||||
# Check which process or container is using the port
|
||||
docker ps
|
||||
# or
|
||||
lsof -i :5000
|
||||
|
||||
# Verander port in docker-compose.yml (e.g., "5000:5000" naar "5010:5000")
|
||||
# Modify the host port in docker-compose.yml (e.g. change "5000:5000" to "5010:5000")
|
||||
```
|
||||
|
||||
### Database connectie fout
|
||||
### Database Connection Error
|
||||
```bash
|
||||
# Check database status
|
||||
# Check database container status (if running local db)
|
||||
docker-compose logs db
|
||||
|
||||
# Herstart database
|
||||
# Restart database
|
||||
docker-compose restart db
|
||||
```
|
||||
|
||||
### API start probleem
|
||||
### API Startup Issue
|
||||
```bash
|
||||
# Check logs
|
||||
# Check service logs
|
||||
docker-compose logs auth_api
|
||||
|
||||
# Controleer environment variabelen in .env
|
||||
# Controleer database connection string
|
||||
# Verify environment variables in .env
|
||||
# Verify database connection string and network reachability
|
||||
```
|
||||
|
||||
### Admin UI niet bereikbaar
|
||||
### Admin UI Not Reachable
|
||||
```bash
|
||||
# Check Admin UI container
|
||||
# Check Admin UI container status
|
||||
docker-compose logs admin_ui
|
||||
|
||||
# Zorg ervoor dat poort 5174 niet in gebruik is
|
||||
# Ensure port 5174 is not bound by another process
|
||||
lsof -i :5174
|
||||
```
|
||||
|
||||
## Admin Control Center
|
||||
|
||||
De Admin UI is een modern React + Vite applicatie die alle admin functies biedt.
|
||||
The Admin UI is a modern React + Vite application that provides administrative management tools.
|
||||
|
||||
### Features
|
||||
|
||||
- **Authenticatie**: JWT-based login met dev token helper
|
||||
- **Stops Management**: Create en beheer transit stops met geo-coördinaten
|
||||
- **Bus Lines**: Define bus routes met start/end stops en reistijd
|
||||
- **Authentication**: JWT-based login with dev token helper
|
||||
- **Stop Management**: Create and manage transit stops with geo-coordinates
|
||||
- **Bus Lines**: Define bus routes with start/end stops and travel duration
|
||||
- **Fleet Management**: Monitor fleet vehicles
|
||||
- **Stop Linking**: Assign stops aan bus lines met volgorde en ETA
|
||||
- **Stop Linking**: Assign stops to bus lines with sequence ordering and ETA
|
||||
|
||||
### Toegang
|
||||
### Access
|
||||
|
||||
```
|
||||
URL: http://localhost:5174
|
||||
```
|
||||
|
||||
### Deployment Configuratie
|
||||
### Deployment Configuration
|
||||
|
||||
Environment variabelen in docker-compose.yml:
|
||||
- `VITE_AUTH_API`: URL naar auth_api (standaard: http://auth_api:5000)
|
||||
- `VITE_TRANSIT_API`: URL naar transit_api (standaard: http://transit_api:5001)
|
||||
Environment variables in `docker-compose.yml`:
|
||||
- `VITE_AUTH_API`: URL to auth_api (default: http://auth_api:5000)
|
||||
- `VITE_TRANSIT_API`: URL to transit_api (default: http://transit_api:5001)
|
||||
|
||||
Voor externe toegang, update de URLs naar je deployment domain.
|
||||
For external access, update URLs to your deployment domain.
|
||||
|
||||
### Build en Deployment
|
||||
### Build and Deployment
|
||||
|
||||
```bash
|
||||
# Build Admin UI image
|
||||
docker-compose build admin_ui
|
||||
|
||||
# Push naar registry
|
||||
# Push to container registry
|
||||
./scripts/build-and-push.sh ghcr.io/your-org/xtransit latest
|
||||
|
||||
# Deploy met updated image
|
||||
# Deploy with updated image
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
### Wijzigingen doorgevoerd in code
|
||||
### Applying Code Changes
|
||||
|
||||
```bash
|
||||
# Rebuild container
|
||||
docker-compose build auth_api
|
||||
|
||||
# Herstart service
|
||||
# Restart service
|
||||
docker-compose restart auth_api
|
||||
```
|
||||
|
||||
### Code reloading (hot reload)
|
||||
### Code Hot-Reloading
|
||||
|
||||
Voor hot reload kunt u volumes toevoegen aan docker-compose.yml:
|
||||
For live reloading during development, you can mount source directories as volumes in `docker-compose.yml`:
|
||||
|
||||
```yaml
|
||||
volumes:
|
||||
- ./auth_api:/app
|
||||
```
|
||||
|
||||
Dit kan performance beïnvloeden. Alleen gebruiken tijdens development.
|
||||
Note: This may impact performance on some host platforms. Use during local development only.
|
||||
|
||||
## Productie Tips
|
||||
## Production Tips
|
||||
|
||||
1. **Veiligheid**: Wijzig alle wachtwoorden en JWT_SECRET in .env
|
||||
2. **Database**: Gebruik een managed database service in productie
|
||||
3. **Logging**: Configureer centralized logging (ELK stack, Splunk, etc.)
|
||||
4. **Backups**: Stel automatische backups in voor de database
|
||||
5. **Health Checks**: Monitoreer de health endpoints van de APIs
|
||||
6. **SSL/TLS**: Gebruik reverse proxy (nginx) voor HTTPS
|
||||
1. **Security**: Change all default passwords and `JWT_SECRET` in `.env`.
|
||||
2. **Database**: Use a managed database service or secured host in production.
|
||||
3. **Logging**: Configure centralized logging via `error_log_api` or log aggregators.
|
||||
4. **Backups**: Configure automated backup procedures for PostgreSQL.
|
||||
5. **Health Checks**: Monitor the `/health` endpoints of all deployed APIs.
|
||||
6. **SSL/TLS**: Use a reverse proxy (Nginx, Traefik) to provide HTTPS.
|
||||
|
||||
## Netwerking
|
||||
## Networking
|
||||
|
||||
De services kunnen elkaar bereiken via:
|
||||
Services communicate internally via:
|
||||
- auth_api: `http://auth_api:5000`
|
||||
- employee_api: `http://employee_api:4000`
|
||||
- transit_api: `http://transit_api:5001`
|
||||
- database: `db:5432`
|
||||
- database: `db:5432` or external host
|
||||
|
||||
Reference in New Issue
Block a user