Compare commits
15 Commits
ed2dbea6c0
...
v0.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1628b1dfea | ||
|
|
b03f4b2ba2 | ||
|
|
50206dce6b | ||
|
|
8362e1ce51 | ||
|
|
190b0aff3e | ||
|
|
be03c95929 | ||
|
|
9f40e16b25 | ||
|
|
0c13069304 | ||
|
|
088a4cba07 | ||
|
|
265d146bd3 | ||
|
|
904fc6d727 | ||
|
|
6a70131f9c | ||
|
|
55aa340a6c | ||
|
|
eff78907d4 | ||
|
|
077f483faf |
33
.gitignore
vendored
Normal file
33
.gitignore
vendored
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# Generated files
|
||||||
|
demo/docker-compose.yml
|
||||||
|
|
||||||
|
# Environment with secrets
|
||||||
|
demo/demo.env
|
||||||
|
|
||||||
|
# OS files
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# Editor files
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
*~
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
# Temporary files
|
||||||
|
*.tmp
|
||||||
|
*.bak
|
||||||
|
tmp_template.yml
|
||||||
|
|
||||||
|
# Homepage auto-generated files
|
||||||
|
demo/config/homepage/logs/
|
||||||
|
demo/config/homepage/kubernetes.yaml
|
||||||
|
demo/config/homepage/custom.css
|
||||||
|
demo/config/homepage/custom.js
|
||||||
|
demo/config/homepage/proxmox.yaml
|
||||||
|
|
||||||
|
# Playwright
|
||||||
|
node_modules/
|
||||||
|
test-results/
|
||||||
|
package-lock.json
|
||||||
49
AGENTS.md
49
AGENTS.md
@@ -6,7 +6,7 @@ This repository contains a Docker Compose-based multi-service stack that provide
|
|||||||
|
|
||||||
### Project Type
|
### Project Type
|
||||||
- **Infrastructure as Code**: Docker Compose with shell orchestration
|
- **Infrastructure as Code**: Docker Compose with shell orchestration
|
||||||
- **Multi-Service Stack**: 13 services across 4 categories
|
- **Multi-Service Stack**: 16 services across 4 categories
|
||||||
- **Demo-First Architecture**: All configurations for demonstration purposes only
|
- **Demo-First Architecture**: All configurations for demonstration purposes only
|
||||||
|
|
||||||
### Directory Structure
|
### Directory Structure
|
||||||
@@ -120,11 +120,10 @@ docker run --rm -v "$(pwd):/workdir" hadolint/hadolint <path-to-dockerfile>
|
|||||||
## Code Organization & Structure
|
## Code Organization & Structure
|
||||||
|
|
||||||
### Service Categories
|
### Service Categories
|
||||||
1. **Infrastructure Services** (ports 4000-4007)
|
1. **Infrastructure Services** (ports 4005-4007)
|
||||||
- Homepage (4000) - Central dashboard for service discovery
|
- Docker Socket Proxy (4005) - Security layer for Docker API access (internal only)
|
||||||
- Docker Socket Proxy (4005) - Security layer for Docker API access
|
|
||||||
- Pi-hole (4006) - DNS management with ad blocking
|
- Pi-hole (4006) - DNS management with ad blocking
|
||||||
- Portainer (4007) - Web-based container management
|
- Dockhand (4007) - Web-based container management
|
||||||
|
|
||||||
2. **Monitoring & Observability** (ports 4008-4009)
|
2. **Monitoring & Observability** (ports 4008-4009)
|
||||||
- InfluxDB (4008) - Time series database for metrics
|
- InfluxDB (4008) - Time series database for metrics
|
||||||
@@ -134,16 +133,21 @@ docker run --rm -v "$(pwd):/workdir" hadolint/hadolint <path-to-dockerfile>
|
|||||||
- Draw.io (4010) - Web-based diagramming application
|
- Draw.io (4010) - Web-based diagramming application
|
||||||
- Kroki (4011) - Diagrams as a service
|
- Kroki (4011) - Diagrams as a service
|
||||||
|
|
||||||
4. **Developer Tools** (ports 4012, 4013, 4014, 4015, 4017, 4018)
|
4. **Developer Tools** (ports 4000, 4012-4018)
|
||||||
|
- Homepage (4000) - Central dashboard for service discovery
|
||||||
- Atomic Tracker (4012) - Habit tracking and personal dashboard
|
- Atomic Tracker (4012) - Habit tracking and personal dashboard
|
||||||
- ArchiveBox (4013) - Web archiving solution
|
- ArchiveBox (4013) - Web archiving solution
|
||||||
- Tube Archivist (4014) - YouTube video archiving
|
- Tube Archivist (4014) - YouTube video archiving (requires ta-redis + ta-elasticsearch)
|
||||||
- Wakapi (4015) - Open-source WakaTime alternative (time tracking)
|
- Wakapi (4015) - Open-source WakaTime alternative (time tracking)
|
||||||
- MailHog (4017) - Web and API based SMTP testing
|
- MailHog (4017 Web, 4019 SMTP) - Web and API based SMTP testing
|
||||||
- Atuin (4018) - Magical shell history synchronization
|
- Atuin (4018) - Magical shell history synchronization
|
||||||
|
|
||||||
|
5. **Companion Services** (internal only, no host ports)
|
||||||
|
- ta-redis - Redis cache for Tube Archivist
|
||||||
|
- ta-elasticsearch - Elasticsearch index for Tube Archivist
|
||||||
|
|
||||||
### Configuration Management
|
### Configuration Management
|
||||||
- **Environment Variables**: All configuration via `demo/demo.env`
|
- **Environment Variables**: All configuration via `demo/demo.env` (copy from `demo/demo.env.template`)
|
||||||
- **Template-Based**: `docker-compose.yml` generated from `docker-compose.yml.template` using `envsubst`
|
- **Template-Based**: `docker-compose.yml` generated from `docker-compose.yml.template` using `envsubst`
|
||||||
- **Dynamic User Detection**: UID/GID automatically detected and applied
|
- **Dynamic User Detection**: UID/GID automatically detected and applied
|
||||||
- **Service Discovery**: Automatic via Homepage labels in docker-compose.yml
|
- **Service Discovery**: Automatic via Homepage labels in docker-compose.yml
|
||||||
@@ -151,10 +155,10 @@ docker run --rm -v "$(pwd):/workdir" hadolint/hadolint <path-to-dockerfile>
|
|||||||
## Naming Conventions & Style Patterns
|
## Naming Conventions & Style Patterns
|
||||||
|
|
||||||
### Service Naming
|
### Service Naming
|
||||||
- **Container Names**: `tsysdevstack-supportstack-demo-<service-name>`
|
- **Container Names**: `kneldevstack-supportstack-demo-<service-name>`
|
||||||
- **Volume Names**: `tsysdevstack-supportstack-demo-<service>_data`
|
- **Volume Names**: `kneldevstack-supportstack-demo_<service>_data`
|
||||||
- **Network Name**: `tsysdevstack-supportstack-demo-network`
|
- **Network Name**: `kneldevstack-supportstack-demo-network`
|
||||||
- **Project Name**: `tsysdevstack-supportstack-demo`
|
- **Project Name**: `kneldevstack-supportstack-demo`
|
||||||
|
|
||||||
### Port Assignment
|
### Port Assignment
|
||||||
- **Range**: 4000-4099
|
- **Range**: 4000-4099
|
||||||
@@ -257,7 +261,7 @@ Before ANY file is created or modified:
|
|||||||
### Volume vs Bind Mount Strategy
|
### Volume vs Bind Mount Strategy
|
||||||
- **Prefer Volumes**: Use Docker volumes for data storage
|
- **Prefer Volumes**: Use Docker volumes for data storage
|
||||||
- **Minimal Bind Mounts**: Use host bind mounts only for configuration that needs persistence
|
- **Minimal Bind Mounts**: Use host bind mounts only for configuration that needs persistence
|
||||||
- **Dynamic Naming**: Volume names follow pattern: `tsysdevstack-supportstack-demo-<service>_data`
|
- **Dynamic Naming**: Volume names follow pattern: `kneldevstack-supportstack-demo_<service>_data`
|
||||||
- **Permission Mapping**: UID/GID mapped via environment variables
|
- **Permission Mapping**: UID/GID mapped via environment variables
|
||||||
|
|
||||||
### Service Discovery Mechanism
|
### Service Discovery Mechanism
|
||||||
@@ -275,7 +279,7 @@ Before ANY file is created or modified:
|
|||||||
## Project-Specific Context
|
## Project-Specific Context
|
||||||
|
|
||||||
### Current State
|
### Current State
|
||||||
- **Demo Environment**: Fully configured with 13 services
|
- **Demo Environment**: Fully configured with 16 services
|
||||||
- **Production Environment**: Placeholder only, not yet implemented
|
- **Production Environment**: Placeholder only, not yet implemented
|
||||||
- **Documentation**: Comprehensive (AGENTS.md, PRD.md, README.md)
|
- **Documentation**: Comprehensive (AGENTS.md, PRD.md, README.md)
|
||||||
- **Scripts**: Complete orchestration and testing scripts available
|
- **Scripts**: Complete orchestration and testing scripts available
|
||||||
@@ -316,8 +320,8 @@ Before ANY file is created or modified:
|
|||||||
|
|
||||||
### Required Variables
|
### Required Variables
|
||||||
```bash
|
```bash
|
||||||
COMPOSE_PROJECT_NAME=tsysdevstack-supportstack-demo
|
COMPOSE_PROJECT_NAME=kneldevstack-supportstack-demo
|
||||||
COMPOSE_NETWORK_NAME=tsysdevstack-supportstack-demo-network
|
COMPOSE_NETWORK_NAME=kneldevstack-supportstack-demo-network
|
||||||
|
|
||||||
# User Detection (Auto-populated by demo-stack.sh)
|
# User Detection (Auto-populated by demo-stack.sh)
|
||||||
DEMO_UID=
|
DEMO_UID=
|
||||||
@@ -328,7 +332,7 @@ DEMO_DOCKER_GID=
|
|||||||
HOMEPAGE_PORT=4000
|
HOMEPAGE_PORT=4000
|
||||||
DOCKER_SOCKET_PROXY_PORT=4005
|
DOCKER_SOCKET_PROXY_PORT=4005
|
||||||
PIHOLE_PORT=4006
|
PIHOLE_PORT=4006
|
||||||
PORTAINER_PORT=4007
|
DOCKHAND_PORT=4007
|
||||||
INFLUXDB_PORT=4008
|
INFLUXDB_PORT=4008
|
||||||
GRAFANA_PORT=4009
|
GRAFANA_PORT=4009
|
||||||
DRAWIO_PORT=4010
|
DRAWIO_PORT=4010
|
||||||
@@ -338,6 +342,7 @@ ARCHIVEBOX_PORT=4013
|
|||||||
TUBE_ARCHIVIST_PORT=4014
|
TUBE_ARCHIVIST_PORT=4014
|
||||||
WAKAPI_PORT=4015
|
WAKAPI_PORT=4015
|
||||||
MAILHOG_PORT=4017
|
MAILHOG_PORT=4017
|
||||||
|
MAILHOG_SMTP_PORT=4019
|
||||||
ATUIN_PORT=4018
|
ATUIN_PORT=4018
|
||||||
|
|
||||||
# Demo Credentials (NOT FOR PRODUCTION)
|
# Demo Credentials (NOT FOR PRODUCTION)
|
||||||
@@ -365,7 +370,7 @@ DEMO_ADMIN_PASSWORD=demo_password
|
|||||||
2. **Permission Issues**: Verify UID/GID in demo.env match current user
|
2. **Permission Issues**: Verify UID/GID in demo.env match current user
|
||||||
3. **Image Pull Failures**: Run `docker pull <image>` manually
|
3. **Image Pull Failures**: Run `docker pull <image>` manually
|
||||||
4. **Health Check Failures**: Check service logs with `docker compose logs <service>`
|
4. **Health Check Failures**: Check service logs with `docker compose logs <service>`
|
||||||
5. **Network Issues**: Verify network exists: `docker network ls | grep tsysdevstack`
|
5. **Network Issues**: Verify network exists: `docker network ls | grep kneldevstack`
|
||||||
|
|
||||||
### Getting Help
|
### Getting Help
|
||||||
1. Check troubleshooting section in demo/README.md
|
1. Check troubleshooting section in demo/README.md
|
||||||
@@ -379,9 +384,9 @@ DEMO_ADMIN_PASSWORD=demo_password
|
|||||||
- **demo/AGENTS.md**: Detailed development guidelines and standards
|
- **demo/AGENTS.md**: Detailed development guidelines and standards
|
||||||
- **demo/PRD.md**: Product Requirements Document
|
- **demo/PRD.md**: Product Requirements Document
|
||||||
- **demo/README.md**: Demo-specific documentation and quick start
|
- **demo/README.md**: Demo-specific documentation and quick start
|
||||||
- **docs/service-guides/**: Service-specific guides
|
- **demo/docs/service-guides/**: Service-specific guides
|
||||||
- **docs/troubleshooting/**: Detailed troubleshooting procedures
|
- **demo/docs/troubleshooting/**: Detailed troubleshooting procedures
|
||||||
- **docs/api-docs/**: API documentation
|
- **demo/docs/api-docs/**: API documentation
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
57
README.md
57
README.md
@@ -1,3 +1,56 @@
|
|||||||
# TSYSDevStack-SupportStack-LocalWorkstation
|
# TSYS Developer Support Stack
|
||||||
|
|
||||||
Off the shelf applications running local to developer workstations
|
A Docker Compose-based multi-service stack of FOSS applications that run locally on developer workstations to enhance productivity and quality of life.
|
||||||
|
|
||||||
|
## What It Does
|
||||||
|
|
||||||
|
Deploys 16 services across 4 categories via a single command:
|
||||||
|
|
||||||
|
| Category | Services |
|
||||||
|
|----------|----------|
|
||||||
|
| **Infrastructure** | Homepage (dashboard), Pi-hole (DNS), Dockhand (Docker management), Docker Socket Proxy |
|
||||||
|
| **Monitoring** | InfluxDB (time series), Grafana (visualization) |
|
||||||
|
| **Documentation** | Draw.io (diagramming), Kroki (diagrams as code) |
|
||||||
|
| **Developer Tools** | Atomic Tracker, ArchiveBox, Tube Archivist, Wakapi, MailHog, Atuin |
|
||||||
|
|
||||||
|
## Quick Start
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd demo
|
||||||
|
cp demo.env.template demo.env
|
||||||
|
./scripts/demo-stack.sh deploy
|
||||||
|
```
|
||||||
|
|
||||||
|
Access the dashboard at **http://localhost:4000**
|
||||||
|
|
||||||
|
Credentials: `admin` / `demo_password` (demo only)
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
- Docker Engine + Docker Compose
|
||||||
|
- 8GB RAM minimum
|
||||||
|
- 10GB disk space
|
||||||
|
- Linux (tested on Ubuntu)
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
| Document | Purpose |
|
||||||
|
|----------|---------|
|
||||||
|
| [demo/PRD.md](demo/PRD.md) | Product requirements (the source of truth) |
|
||||||
|
| [demo/README.md](demo/README.md) | Full deployment and service documentation |
|
||||||
|
| [demo/AGENTS.md](demo/AGENTS.md) | Development guidelines |
|
||||||
|
| [AGENTS.md](AGENTS.md) | Quick reference for contributors |
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Unit tests (no Docker required)
|
||||||
|
bash demo/tests/unit/test_env_validation.sh
|
||||||
|
|
||||||
|
# Full test suite (requires running stack)
|
||||||
|
./demo/scripts/demo-test.sh full
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
See [LICENSE](LICENSE).
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
- **Dynamic User Handling**: Automatic UID/GID detection and application
|
- **Dynamic User Handling**: Automatic UID/GID detection and application
|
||||||
- **Security-First**: Docker socket proxy for all container operations
|
- **Security-First**: Docker socket proxy for all container operations
|
||||||
- **Minimal Bind Mounts**: Prefer Docker volumes over host bind mounts. Use host bind mounts only for minimal bootstrap purposes of configuration data that needs to be persistent.
|
- **Minimal Bind Mounts**: Prefer Docker volumes over host bind mounts. Use host bind mounts only for minimal bootstrap purposes of configuration data that needs to be persistent.
|
||||||
- **Consistent Naming**: `tsysdevstack-supportstack-demo-` prefix everywhere including in the docker-compose file for the service names.
|
- **Consistent Naming**: `kneldevstack-supportstack-demo-` prefix everywhere including in the docker-compose file for the service names.
|
||||||
- **One-Command Deployment**: Single script deployment with full validation
|
- **One-Command Deployment**: Single script deployment with full validation
|
||||||
|
|
||||||
### Dynamic Environment Strategy
|
### Dynamic Environment Strategy
|
||||||
@@ -119,8 +119,8 @@ services:
|
|||||||
#### Dynamic Variable Requirements
|
#### Dynamic Variable Requirements
|
||||||
- **UID/GID**: Current user and group detection
|
- **UID/GID**: Current user and group detection
|
||||||
- **DOCKER_GID**: Docker group ID for socket access
|
- **DOCKER_GID**: Docker group ID for socket access
|
||||||
- **COMPOSE_PROJECT_NAME**: `tsysdevstack-supportstack-demo`
|
- **COMPOSE_PROJECT_NAME**: `kneldevstack-supportstack-demo`
|
||||||
- **COMPOSE_NETWORK_NAME**: `tsysdevstack-supportstack-demo-network`
|
- **COMPOSE_NETWORK_NAME**: `kneldevstack-supportstack-demo-network`
|
||||||
- **Service Ports**: All configurable via environment variables
|
- **Service Ports**: All configurable via environment variables
|
||||||
|
|
||||||
### Port Assignment Strategy
|
### Port Assignment Strategy
|
||||||
@@ -130,7 +130,7 @@ services:
|
|||||||
- Avoid conflicts with host services
|
- Avoid conflicts with host services
|
||||||
|
|
||||||
### Network Configuration
|
### Network Configuration
|
||||||
- Network name: `tsysdevstack_supportstack-demo`
|
- Network name: `kneldevstack-supportstack-demo`
|
||||||
- IP binding: `192.168.3.6:{port}` where applicable
|
- IP binding: `192.168.3.6:{port}` where applicable
|
||||||
- Inter-service communication via container names
|
- Inter-service communication via container names
|
||||||
- Only necessary ports exposed to host
|
- Only necessary ports exposed to host
|
||||||
@@ -195,7 +195,7 @@ services:
|
|||||||
|
|
||||||
### Template-Driven Development
|
### Template-Driven Development
|
||||||
- **Variable Configuration**: All settings via environment variables
|
- **Variable Configuration**: All settings via environment variables
|
||||||
- **Naming Convention**: Consistent `tsysdevstack-supportstack-demo-` prefix
|
- **Naming Convention**: Consistent `kneldevstack-supportstack-demo-` prefix
|
||||||
- **User Handling**: Dynamic UID/GID detection in all services
|
- **User Handling**: Dynamic UID/GID detection in all services
|
||||||
- **Security Integration**: Docker socket proxy for container operations
|
- **Security Integration**: Docker socket proxy for container operations
|
||||||
- **Volume Strategy**: Docker volumes with dynamic naming
|
- **Volume Strategy**: Docker volumes with dynamic naming
|
||||||
@@ -248,11 +248,11 @@ screen -ls
|
|||||||
ps aux | grep demo-stack
|
ps aux | grep demo-stack
|
||||||
|
|
||||||
# Dynamic deployment and testing (use unique session names)
|
# Dynamic deployment and testing (use unique session names)
|
||||||
screen -S demo-deploy-$(date +%Y%m%d-%H%M%S) -dm -L -Logfile deploy-$(date +%Y%m%d-%H%M%S).log ./demo-stack.sh deploy
|
screen -S demo-deploy-$(date +%Y%m%d-%H%M%S) -dm -L -Logfile deploy-$(date +%Y%m%d-%H%M%S).log ./scripts/demo-stack.sh deploy
|
||||||
./demo-test.sh full # Comprehensive QA/validation
|
./scripts/demo-test.sh full # Comprehensive QA/validation
|
||||||
./demo-test.sh security # Security compliance validation
|
./scripts/demo-test.sh security # Security compliance validation
|
||||||
./demo-test.sh permissions # File ownership validation
|
./scripts/demo-test.sh permissions # File ownership validation
|
||||||
./demo-test.sh network # Network isolation validation
|
./scripts/demo-test.sh network # Network isolation validation
|
||||||
```
|
```
|
||||||
|
|
||||||
### Automated Validation Suite
|
### Automated Validation Suite
|
||||||
@@ -338,13 +338,13 @@ screen -ls
|
|||||||
ps aux | grep demo-stack
|
ps aux | grep demo-stack
|
||||||
|
|
||||||
# Start development stack with unique session name
|
# Start development stack with unique session name
|
||||||
screen -S demo-deploy-$(date +%Y%m%d-%H%M%S) -dm -L -Logfile deploy-$(date +%Y%m%d-%H%M%S).log ./demo-stack.sh deploy
|
screen -S demo-deploy-$(date +%Y%m%d-%H%M%S) -dm -L -Logfile deploy-$(date +%Y%m%d-%H%M%S).log ./scripts/demo-stack.sh deploy
|
||||||
|
|
||||||
# Monitor startup
|
# Monitor startup
|
||||||
docker compose logs -f
|
docker compose logs -f
|
||||||
|
|
||||||
# Validate deployment
|
# Validate deployment
|
||||||
./test-stack.sh
|
./scripts/demo-test.sh full
|
||||||
```
|
```
|
||||||
|
|
||||||
### Demo Preparation
|
### Demo Preparation
|
||||||
|
|||||||
18
demo/PRD.md
18
demo/PRD.md
@@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
[](#)
|
[](#)
|
||||||
[](#)
|
[](#)
|
||||||
[](#)
|
[](#)
|
||||||
[](#)
|
[](#)
|
||||||
[](#)
|
[](#)
|
||||||
|
|
||||||
**Demo Version - Product Requirements Document**
|
**Demo Version - Product Requirements Document**
|
||||||
@@ -445,7 +445,7 @@ graph LR
|
|||||||
| Requirement | Description | Success Metric |
|
| Requirement | Description | Success Metric |
|
||||||
|-------------|-------------|----------------|
|
|-------------|-------------|----------------|
|
||||||
| **🌐 Browser Access** | Immediate web interface availability | 100% browser compatibility |
|
| **🌐 Browser Access** | Immediate web interface availability | 100% browser compatibility |
|
||||||
| **🚫 No Manual Setup** | Eliminate configuration steps | Setup time < 30 seconds |
|
| **🚫 No Manual Setup** | Eliminate configuration steps | Setup time < 2 minutes |
|
||||||
| **🔐 Pre-configured Auth** | Default authentication where needed | Login success rate > 95% |
|
| **🔐 Pre-configured Auth** | Default authentication where needed | Login success rate > 95% |
|
||||||
| **💡 Clear Error Messages** | Intuitive troubleshooting guidance | Issue resolution < 2 minutes |
|
| **💡 Clear Error Messages** | Intuitive troubleshooting guidance | Issue resolution < 2 minutes |
|
||||||
|
|
||||||
@@ -453,8 +453,8 @@ graph LR
|
|||||||
|
|
||||||
| Requirement | Description | Success Metric |
|
| Requirement | Description | Success Metric |
|
||||||
|-------------|-------------|----------------|
|
|-------------|-------------|----------------|
|
||||||
| **⚡ Single Command** | One-command deployment | Deployment time < 60 seconds |
|
| **⚡ Single Command** | One-command deployment | Deployment time < 5 minutes |
|
||||||
| **🚀 Rapid Initialization** | Fast service startup | All services ready < 60 seconds |
|
| **🚀 Rapid Initialization** | Fast service startup | All services ready < 5 minutes |
|
||||||
| **🎯 Immediate Features** | No setup delays for functionality | Feature availability = 100% |
|
| **🎯 Immediate Features** | No setup delays for functionality | Feature availability = 100% |
|
||||||
| **🔄 Clean Sessions** | Fresh state between demos | Data reset success = 100% |
|
| **🔄 Clean Sessions** | Fresh state between demos | Data reset success = 100% |
|
||||||
|
|
||||||
@@ -539,7 +539,7 @@ graph TD
|
|||||||
|
|
||||||
| Test Type | Description | Tool/Script |
|
| Test Type | Description | Tool/Script |
|
||||||
|-----------|-------------|-------------|
|
|-----------|-------------|-------------|
|
||||||
| **❤️ Health Validation** | Service health check verification | `test-stack.sh` |
|
| **❤️ Health Validation** | Service health check verification | `demo-test.sh` |
|
||||||
| **🔌 Port Accessibility** | Port availability and response testing | `test-stack.sh` |
|
| **🔌 Port Accessibility** | Port availability and response testing | `test-stack.sh` |
|
||||||
| **🔍 Service Discovery** | Dashboard integration verification | `test-stack.sh` |
|
| **🔍 Service Discovery** | Dashboard integration verification | `test-stack.sh` |
|
||||||
| **📊 Resource Monitoring** | Memory and CPU usage validation | `test-stack.sh` |
|
| **📊 Resource Monitoring** | Memory and CPU usage validation | `test-stack.sh` |
|
||||||
@@ -754,10 +754,10 @@ gantt
|
|||||||
## 📄 Document Information
|
## 📄 Document Information
|
||||||
|
|
||||||
**Document ID**: PRD-SUPPORT-DEMO-001
|
**Document ID**: PRD-SUPPORT-DEMO-001
|
||||||
**Version**: 1.0
|
**Version**: 2.0
|
||||||
**Date**: 2025-11-13
|
**Date**: 2026-05-01
|
||||||
**Author**: TSYS Development Team
|
**Author**: TSYS Development Team
|
||||||
**Status**: Draft
|
**Status**: Final
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -36,15 +36,15 @@
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 🎯 Demo deployment with dynamic user detection
|
# 🎯 Demo deployment with dynamic user detection
|
||||||
./demo-stack.sh deploy
|
./scripts/demo-stack.sh deploy
|
||||||
|
|
||||||
# 🔧 Comprehensive testing and validation
|
# 🔧 Comprehensive testing and validation
|
||||||
./demo-test.sh full
|
./scripts/demo-test.sh full
|
||||||
```
|
```
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
🎉 **Access all services via the Homepage dashboard at** **[http://localhost:${HOMEPAGE_PORT}](http://localhost:${HOMEPAGE_PORT})**
|
🎉 **Access all services via the Homepage dashboard at** **[http://localhost:4000](http://localhost:4000)**
|
||||||
|
|
||||||
> ⚠️ **Demo Configuration Only** - This stack is designed for demonstration purposes with no data persistence.
|
> ⚠️ **Demo Configuration Only** - This stack is designed for demonstration purposes with no data persistence.
|
||||||
|
|
||||||
@@ -58,18 +58,18 @@ All configuration is managed through `demo.env` and dynamic detection:
|
|||||||
|
|
||||||
| Variable | Description | Default |
|
| Variable | Description | Default |
|
||||||
|-----------|-------------|----------|
|
|-----------|-------------|----------|
|
||||||
| **COMPOSE_PROJECT_NAME** | Consistent naming prefix | `tsysdevstack-supportstack-demo` |
|
| **COMPOSE_PROJECT_NAME** | Consistent naming prefix | `kneldevstack-supportstack-demo` |
|
||||||
| **UID** | Current user ID | Auto-detected |
|
| **UID** | Current user ID | Auto-detected |
|
||||||
| **GID** | Current group ID | Auto-detected |
|
| **GID** | Current group ID | Auto-detected |
|
||||||
| **DOCKER_GID** | Docker group ID | Auto-detected |
|
| **DOCKER_GID** | Docker group ID | Auto-detected |
|
||||||
| **COMPOSE_NETWORK_NAME** | Docker network name | `tsysdevstack-supportstack-demo-network` |
|
| **COMPOSE_NETWORK_NAME** | Docker network name | `kneldevstack-supportstack-demo-network` |
|
||||||
|
|
||||||
### 🎯 Deployment Scripts
|
### 🎯 Deployment Scripts
|
||||||
|
|
||||||
| Script | Purpose | Usage |
|
| Script | Purpose | Usage |
|
||||||
|---------|---------|--------|
|
|---------|---------|--------|
|
||||||
| **demo-stack.sh** | Dynamic deployment with user detection | `./demo-stack.sh [deploy|stop|restart]` |
|
| **demo-stack.sh** | Dynamic deployment with user detection | `./scripts/demo-stack.sh [deploy|stop|restart]` |
|
||||||
| **demo-test.sh** | Comprehensive QA and validation | `./demo-test.sh [full|security|permissions]` |
|
| **demo-test.sh** | Comprehensive QA and validation | `./scripts/demo-test.sh [full|security|permissions]` |
|
||||||
| **demo.env** | All environment variables | Source of configuration |
|
| **demo.env** | All environment variables | Source of configuration |
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -79,35 +79,35 @@ All configuration is managed through `demo.env` and dynamic detection:
|
|||||||
### 🛠️ Developer Tools
|
### 🛠️ Developer Tools
|
||||||
| Service | Port | Description | 🌐 Access |
|
| Service | Port | Description | 🌐 Access |
|
||||||
|---------|------|-------------|-----------|
|
|---------|------|-------------|-----------|
|
||||||
| **Homepage** | 4000 | Central dashboard for service discovery | [Open](http://192.168.3.6:4000) |
|
| **Homepage** | 4000 | Central dashboard for service discovery | [Open](http://localhost:4000) |
|
||||||
| **Atomic Tracker** | 4012 | Habit tracking and personal dashboard | [Open](http://192.168.3.6:4012) |
|
| **Atomic Tracker** | 4012 | Habit tracking and personal dashboard | [Open](http://localhost:4012) |
|
||||||
| **Wakapi** | 4015 | Open-source WakaTime alternative for time tracking | [Open](http://192.168.3.6:4015) |
|
| **Wakapi** | 4015 | Open-source WakaTime alternative for time tracking | [Open](http://localhost:4015) |
|
||||||
| **MailHog** | 4017 | Web and API based SMTP testing tool | [Open](http://192.168.3.6:4017) |
|
| **MailHog** | 4017 (Web), 4019 (SMTP) | Web and API based SMTP testing tool | [Open](http://localhost:4017) |
|
||||||
| **Atuin** | 4018 | Magical shell history synchronization | [Open](http://192.168.3.6:4018) |
|
| **Atuin** | 4018 | Magical shell history synchronization | [Open](http://localhost:4018) |
|
||||||
|
|
||||||
### 📚 Archival & Content Management
|
### 📚 Archival & Content Management
|
||||||
| Service | Port | Description | 🌐 Access |
|
| Service | Port | Description | 🌐 Access |
|
||||||
|---------|------|-------------|-----------|
|
|---------|------|-------------|-----------|
|
||||||
| **ArchiveBox** | 4013 | Web archiving solution | [Open](http://192.168.3.6:4013) |
|
| **ArchiveBox** | 4013 | Web archiving solution | [Open](http://localhost:4013) |
|
||||||
| **Tube Archivist** | 4014 | YouTube video archiving | [Open](http://192.168.3.6:4014) |
|
| **Tube Archivist** | 4014 | YouTube video archiving | [Open](http://localhost:4014) |
|
||||||
|
|
||||||
### 🏗️ Infrastructure Services
|
### 🏗️ Infrastructure Services
|
||||||
| Service | Port | Description | 🌐 Access |
|
| Service | Port | Description | 🌐 Access |
|
||||||
|---------|------|-------------|-----------|
|
|---------|------|-------------|-----------|
|
||||||
| **Pi-hole** | 4006 | DNS-based ad blocking and monitoring | [Open](http://192.168.3.6:4006) |
|
| **Pi-hole** | 4006 | DNS-based ad blocking and monitoring | [Open](http://localhost:4006) |
|
||||||
| **Dockhand** | 4007 | Modern Docker management UI | [Open](http://192.168.3.6:4007) |
|
| **Dockhand** | 4007 | Modern Docker management UI | [Open](http://localhost:4007) |
|
||||||
|
|
||||||
### 📊 Monitoring & Observability
|
### 📊 Monitoring & Observability
|
||||||
| Service | Port | Description | 🌐 Access |
|
| Service | Port | Description | 🌐 Access |
|
||||||
|---------|------|-------------|-----------|
|
|---------|------|-------------|-----------|
|
||||||
| **InfluxDB** | 4008 | Time series database for metrics | [Open](http://192.168.3.6:4008) |
|
| **InfluxDB** | 4008 | Time series database for metrics | [Open](http://localhost:4008) |
|
||||||
| **Grafana** | 4009 | Analytics and visualization platform | [Open](http://192.168.3.6:4009) |
|
| **Grafana** | 4009 | Analytics and visualization platform | [Open](http://localhost:4009) |
|
||||||
|
|
||||||
### 📚 Documentation & Diagramming
|
### 📚 Documentation & Diagramming
|
||||||
| Service | Port | Description | 🌐 Access |
|
| Service | Port | Description | 🌐 Access |
|
||||||
|---------|------|-------------|-----------|
|
|---------|------|-------------|-----------|
|
||||||
| **Draw.io** | 4010 | Web-based diagramming application | [Open](http://192.168.3.6:4010) |
|
| **Draw.io** | 4010 | Web-based diagramming application | [Open](http://localhost:4010) |
|
||||||
| **Kroki** | 4011 | Diagrams as a service | [Open](http://192.168.3.6:4011) |
|
| **Kroki** | 4011 | Diagrams as a service | [Open](http://localhost:4011) |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -158,7 +158,7 @@ services:
|
|||||||
| Service | Health Check Path | Status |
|
| Service | Health Check Path | Status |
|
||||||
|---------|-------------------|--------|
|
|---------|-------------------|--------|
|
||||||
| **Pi-hole** (DNS Management) | `HTTP GET /` | ✅ Active |
|
| **Pi-hole** (DNS Management) | `HTTP GET /` | ✅ Active |
|
||||||
| **Portainer** (Container Management) | `HTTP GET /` | ✅ Active |
|
| **Dockhand** (Container Management) | `HTTP GET /` | ✅ Active |
|
||||||
| **InfluxDB** (Time Series Database) | `HTTP GET /ping` | ✅ Active |
|
| **InfluxDB** (Time Series Database) | `HTTP GET /ping` | ✅ Active |
|
||||||
| **Grafana** (Visualization Platform) | `HTTP GET /api/health` | ✅ Active |
|
| **Grafana** (Visualization Platform) | `HTTP GET /api/health` | ✅ Active |
|
||||||
| **Draw.io** (Diagramming Server) | `HTTP GET /` | ✅ Active |
|
| **Draw.io** (Diagramming Server) | `HTTP GET /` | ✅ Active |
|
||||||
@@ -186,7 +186,7 @@ labels:
|
|||||||
| Service | Username | Password | 🔗 Access |
|
| Service | Username | Password | 🔗 Access |
|
||||||
|---------|----------|----------|-----------|
|
|---------|----------|----------|-----------|
|
||||||
| **Grafana** | `admin` | `demo_password` | [Login](http://localhost:4009) |
|
| **Grafana** | `admin` | `demo_password` | [Login](http://localhost:4009) |
|
||||||
| **Portainer** | `admin` | `demo_password` | [Login](http://localhost:4007) |
|
| **Dockhand** | `admin` | `demo_password` | [Login](http://localhost:4007) |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -207,8 +207,9 @@ graph TD
|
|||||||
|
|
||||||
| Service | Dependencies | Status |
|
| Service | Dependencies | Status |
|
||||||
|---------|--------------|--------|
|
|---------|--------------|--------|
|
||||||
| **Container Management** (Portainer) | Container Socket Proxy | 🔗 Required |
|
| **Container Management** (Dockhand) | Docker socket (direct mount) | 🔗 Required |
|
||||||
| **Visualization Platform** (Grafana) | Time Series Database (InfluxDB) | 🔗 Required |
|
| **Visualization Platform** (Grafana) | Time Series Database (InfluxDB) | 🔗 Required |
|
||||||
|
| **Video Archiving** (Tube Archivist) | Redis (ta-redis) + Elasticsearch (ta-elasticsearch) | 🔗 Required |
|
||||||
| **All Other Services** | None | ✅ Standalone |
|
| **All Other Services** | None | ✅ Standalone |
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -221,16 +222,16 @@ graph TD
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 🎯 Full deployment and validation
|
# 🎯 Full deployment and validation
|
||||||
./demo-stack.sh deploy && ./demo-test.sh full
|
./scripts/demo-stack.sh deploy && ./scripts/demo-test.sh full
|
||||||
|
|
||||||
# 🔍 Security compliance validation
|
# 🔍 Security compliance validation
|
||||||
./demo-test.sh security
|
./scripts/demo-test.sh security
|
||||||
|
|
||||||
# 👤 File ownership validation
|
# 👤 File ownership validation
|
||||||
./demo-test.sh permissions
|
./scripts/demo-test.sh permissions
|
||||||
|
|
||||||
# 🌐 Network isolation validation
|
# 🌐 Network isolation validation
|
||||||
./demo-test.sh network
|
./scripts/demo-test.sh network
|
||||||
```
|
```
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -245,12 +246,12 @@ docker compose ps
|
|||||||
docker compose logs {service-name}
|
docker compose logs {service-name}
|
||||||
|
|
||||||
# 🌐 Test individual endpoints with variables
|
# 🌐 Test individual endpoints with variables
|
||||||
curl -f http://localhost:${HOMEPAGE_PORT}/
|
curl -f http://localhost:4000/
|
||||||
curl -f http://localhost:${INFLUXDB_PORT}/ping
|
curl -f http://localhost:4008/ping
|
||||||
curl -f http://localhost:${GRAFANA_PORT}/api/health
|
curl -f http://localhost:4009/api/health
|
||||||
|
|
||||||
# 🔍 Validate user permissions
|
# 🔍 Validate user permissions
|
||||||
ls -la /var/lib/docker/volumes/${COMPOSE_PROJECT_NAME}_*/
|
ls -la /var/lib/docker/volumes/kneldevstack-supportstack-demo_*/
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -265,10 +266,10 @@ ls -la /var/lib/docker/volumes/${COMPOSE_PROJECT_NAME}_*/
|
|||||||
docker info
|
docker info
|
||||||
|
|
||||||
# 🌐 Check network
|
# 🌐 Check network
|
||||||
docker network ls | grep tsysdevstack_supportstack
|
docker network ls | grep kneldevstack-supportstack-demo
|
||||||
|
|
||||||
# 🔄 Recreate network
|
# 🔄 Recreate network
|
||||||
docker network create tsysdevstack_supportstack
|
docker network create --subnet 192.168.3.0/24 --gateway 192.168.3.1 kneldevstack-supportstack-demo-network
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Port conflicts
|
#### Port conflicts
|
||||||
@@ -295,7 +296,7 @@ docker compose restart {service}
|
|||||||
|-------|---------|----------|
|
|-------|---------|----------|
|
||||||
| **DNS issues** | Pi-hole | Ensure Docker DNS settings allow custom DNS servers<br>Check that port 53 is available on the host |
|
| **DNS issues** | Pi-hole | Ensure Docker DNS settings allow custom DNS servers<br>Check that port 53 is available on the host |
|
||||||
| **Database connection** | Grafana-InfluxDB | Verify both services are on the same network<br>Check database connectivity: `curl http://localhost:4008/ping` |
|
| **Database connection** | Grafana-InfluxDB | Verify both services are on the same network<br>Check database connectivity: `curl http://localhost:4008/ping` |
|
||||||
| **Container access** | Portainer | Ensure container socket is properly mounted<br>Check Container Socket Proxy service if used |
|
| **Container access** | Dockhand | Ensure container socket is properly mounted<br>Check Container Socket Proxy service if used |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -316,7 +317,7 @@ docker compose restart {service}
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 📋 List volumes
|
# 📋 List volumes
|
||||||
docker volume ls | grep tsysdevstack
|
docker volume ls | grep kneldevstack
|
||||||
|
|
||||||
# 🗑️ Clean up all data
|
# 🗑️ Clean up all data
|
||||||
docker compose down -v
|
docker compose down -v
|
||||||
|
|||||||
0
demo/config/atomictracker/.gitkeep
Normal file
0
demo/config/atomictracker/.gitkeep
Normal file
0
demo/config/atuin/.gitkeep
Normal file
0
demo/config/atuin/.gitkeep
Normal file
0
demo/config/drawio/.gitkeep
Normal file
0
demo/config/drawio/.gitkeep
Normal file
229
demo/config/grafana/dashboards/docker-overview.json
Normal file
229
demo/config/grafana/dashboards/docker-overview.json
Normal file
@@ -0,0 +1,229 @@
|
|||||||
|
{
|
||||||
|
"annotations": {
|
||||||
|
"list": [
|
||||||
|
{
|
||||||
|
"builtIn": 1,
|
||||||
|
"datasource": "-- Grafana --",
|
||||||
|
"enable": true,
|
||||||
|
"hide": true,
|
||||||
|
"iconColor": "rgba(0, 211, 255, 1)",
|
||||||
|
"name": "Annotations & Alerts",
|
||||||
|
"type": "dashboard"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"description": "Docker container resource monitoring via InfluxDB",
|
||||||
|
"editable": true,
|
||||||
|
"fiscalYearStartMonth": 0,
|
||||||
|
"graphTooltip": 0,
|
||||||
|
"id": null,
|
||||||
|
"links": [],
|
||||||
|
"panels": [
|
||||||
|
{
|
||||||
|
"datasource": "InfluxDB",
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "palette-classic"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"axisBorderShow": false,
|
||||||
|
"axisCenteredZero": false,
|
||||||
|
"axisColorMode": "text",
|
||||||
|
"axisLabel": "",
|
||||||
|
"axisPlacement": "auto",
|
||||||
|
"barAlignment": 0,
|
||||||
|
"drawStyle": "line",
|
||||||
|
"fillOpacity": 10,
|
||||||
|
"gradientMode": "none",
|
||||||
|
"hideFrom": {
|
||||||
|
"legend": false,
|
||||||
|
"tooltip": false,
|
||||||
|
"viz": false
|
||||||
|
},
|
||||||
|
"lineInterpolation": "linear",
|
||||||
|
"lineWidth": 1,
|
||||||
|
"pointSize": 5,
|
||||||
|
"scaleDistribution": {
|
||||||
|
"type": "linear"
|
||||||
|
},
|
||||||
|
"showPoints": "auto",
|
||||||
|
"spanNulls": false,
|
||||||
|
"stacking": {
|
||||||
|
"group": "A",
|
||||||
|
"mode": "none"
|
||||||
|
},
|
||||||
|
"thresholdsStyle": {
|
||||||
|
"mode": "off"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{ "color": "green", "value": null },
|
||||||
|
{ "color": "red", "value": 80 }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"unit": "percent"
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": { "h": 8, "w": 12, "x": 0, "y": 0 },
|
||||||
|
"id": 1,
|
||||||
|
"options": {
|
||||||
|
"legend": { "calcs": [], "displayMode": "list", "placement": "bottom", "showLegend": true },
|
||||||
|
"tooltip": { "mode": "single", "sort": "none" }
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"datasource": "InfluxDB",
|
||||||
|
"query": "from(bucket: \"demo_metrics\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r._measurement == \"docker_container_cpu\")\n |> filter(fn: (r) => r._field == \"usage_percent\")",
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Container CPU Usage",
|
||||||
|
"type": "timeseries"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"datasource": "InfluxDB",
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": { "mode": "palette-classic" },
|
||||||
|
"custom": {
|
||||||
|
"axisBorderShow": false,
|
||||||
|
"axisCenteredZero": false,
|
||||||
|
"axisColorMode": "text",
|
||||||
|
"axisLabel": "",
|
||||||
|
"axisPlacement": "auto",
|
||||||
|
"barAlignment": 0,
|
||||||
|
"drawStyle": "line",
|
||||||
|
"fillOpacity": 10,
|
||||||
|
"gradientMode": "none",
|
||||||
|
"hideFrom": { "legend": false, "tooltip": false, "viz": false },
|
||||||
|
"lineInterpolation": "linear",
|
||||||
|
"lineWidth": 1,
|
||||||
|
"pointSize": 5,
|
||||||
|
"scaleDistribution": { "type": "linear" },
|
||||||
|
"showPoints": "auto",
|
||||||
|
"spanNulls": false,
|
||||||
|
"stacking": { "group": "A", "mode": "none" },
|
||||||
|
"thresholdsStyle": { "mode": "off" }
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{ "color": "green", "value": null },
|
||||||
|
{ "color": "red", "value": 80 }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"unit": "bytes"
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": { "h": 8, "w": 12, "x": 12, "y": 0 },
|
||||||
|
"id": 2,
|
||||||
|
"options": {
|
||||||
|
"legend": { "calcs": [], "displayMode": "list", "placement": "bottom", "showLegend": true },
|
||||||
|
"tooltip": { "mode": "single", "sort": "none" }
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"datasource": "InfluxDB",
|
||||||
|
"query": "from(bucket: \"demo_metrics\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r._measurement == \"docker_container_mem\")\n |> filter(fn: (r) => r._field == \"usage\")",
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Container Memory Usage",
|
||||||
|
"type": "timeseries"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"datasource": "InfluxDB",
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": { "mode": "thresholds" },
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{ "color": "green", "value": null },
|
||||||
|
{ "color": "yellow", "value": 10 },
|
||||||
|
{ "color": "red", "value": 14 }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"unit": "short"
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": { "h": 4, "w": 6, "x": 0, "y": 8 },
|
||||||
|
"id": 3,
|
||||||
|
"options": {
|
||||||
|
"colorMode": "value",
|
||||||
|
"graphMode": "area",
|
||||||
|
"justifyMode": "auto",
|
||||||
|
"orientation": "auto",
|
||||||
|
"reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false },
|
||||||
|
"textMode": "auto"
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"datasource": "InfluxDB",
|
||||||
|
"query": "from(bucket: \"demo_metrics\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r._measurement == \"docker\")\n |> filter(fn: (r) => r._field == \"containers_running\")\n |> last()",
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Running Containers",
|
||||||
|
"type": "stat"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"datasource": "InfluxDB",
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": { "mode": "thresholds" },
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{ "color": "green", "value": null },
|
||||||
|
{ "color": "yellow", "value": 15 },
|
||||||
|
{ "color": "red", "value": 20 }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"unit": "short"
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": { "h": 4, "w": 6, "x": 6, "y": 8 },
|
||||||
|
"id": 4,
|
||||||
|
"options": {
|
||||||
|
"colorMode": "value",
|
||||||
|
"graphMode": "area",
|
||||||
|
"justifyMode": "auto",
|
||||||
|
"orientation": "auto",
|
||||||
|
"reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false },
|
||||||
|
"textMode": "auto"
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"datasource": "InfluxDB",
|
||||||
|
"query": "from(bucket: \"demo_metrics\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r._measurement == \"docker\")\n |> filter(fn: (r) => r._field == \"images\")\n |> last()",
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Docker Images",
|
||||||
|
"type": "stat"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"refresh": "30s",
|
||||||
|
"schemaVersion": 38,
|
||||||
|
"style": "dark",
|
||||||
|
"tags": ["docker", "infrastructure"],
|
||||||
|
"templating": { "list": [] },
|
||||||
|
"time": { "from": "now-1h", "to": "now" },
|
||||||
|
"timepicker": {},
|
||||||
|
"timezone": "utc",
|
||||||
|
"title": "Docker Infrastructure Overview",
|
||||||
|
"uid": "docker-overview",
|
||||||
|
"version": 1
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@ datasources:
|
|||||||
access: proxy
|
access: proxy
|
||||||
url: http://influxdb:8086
|
url: http://influxdb:8086
|
||||||
database: demo_metrics
|
database: demo_metrics
|
||||||
user: demo_admin
|
user: admin
|
||||||
password: demo_password
|
password: demo_password
|
||||||
isDefault: true
|
isDefault: true
|
||||||
jsonData:
|
jsonData:
|
||||||
|
|||||||
24
demo/config/homepage/bookmarks.yaml
Normal file
24
demo/config/homepage/bookmarks.yaml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
---
|
||||||
|
# Homepage Bookmarks
|
||||||
|
|
||||||
|
- Developer Resources:
|
||||||
|
- GitHub:
|
||||||
|
- abbr: GH
|
||||||
|
href: https://github.com
|
||||||
|
- Stack Overflow:
|
||||||
|
- abbr: SO
|
||||||
|
href: https://stackoverflow.com
|
||||||
|
- Docker Hub:
|
||||||
|
- abbr: DH
|
||||||
|
href: https://hub.docker.com
|
||||||
|
|
||||||
|
- Documentation:
|
||||||
|
- Docker Docs:
|
||||||
|
- abbr: DD
|
||||||
|
href: https://docs.docker.com
|
||||||
|
- Grafana Docs:
|
||||||
|
- abbr: GF
|
||||||
|
href: https://grafana.com/docs
|
||||||
|
- InfluxDB Docs:
|
||||||
|
- abbr: IF
|
||||||
|
href: https://docs.influxdata.com
|
||||||
@@ -1,34 +1,6 @@
|
|||||||
---
|
---
|
||||||
# TSYS Developer Support Stack - Homepage Configuration
|
# TSYS Developer Support Stack - Homepage Docker Integration
|
||||||
# This file will be automatically generated by Homepage service discovery
|
# Connects Homepage to Docker for automatic service discovery
|
||||||
|
|
||||||
providers:
|
my-docker:
|
||||||
openweathermap: openweathermapapikey
|
socket: docker-socket-proxy:2375
|
||||||
longshore: longshoreapikey
|
|
||||||
|
|
||||||
widgets:
|
|
||||||
- resources:
|
|
||||||
cpu: true
|
|
||||||
memory: true
|
|
||||||
disk: true
|
|
||||||
- search:
|
|
||||||
provider: duckduckgo
|
|
||||||
target: _blank
|
|
||||||
- datetime:
|
|
||||||
format:
|
|
||||||
dateStyle: long
|
|
||||||
timeStyle: short
|
|
||||||
hour12: true
|
|
||||||
|
|
||||||
bookmarks:
|
|
||||||
- Development:
|
|
||||||
- Github:
|
|
||||||
- abbr: GH
|
|
||||||
href: https://github.com/
|
|
||||||
- Docker Hub:
|
|
||||||
- abbr: DH
|
|
||||||
href: https://hub.docker.com/
|
|
||||||
- Documentation:
|
|
||||||
- TSYS Docs:
|
|
||||||
- abbr: TSYS
|
|
||||||
href: https://docs.tsys.dev/
|
|
||||||
|
|||||||
77
demo/config/homepage/services.yaml
Normal file
77
demo/config/homepage/services.yaml
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
---
|
||||||
|
# Homepage Services Configuration
|
||||||
|
# Services are auto-discovered via Docker labels, but this provides
|
||||||
|
# the manual layout and widget configuration.
|
||||||
|
|
||||||
|
- Infrastructure:
|
||||||
|
- Pi-hole:
|
||||||
|
href: http://localhost:4006/admin
|
||||||
|
description: DNS management with ad blocking
|
||||||
|
icon: pihole.png
|
||||||
|
widget:
|
||||||
|
type: pihole
|
||||||
|
url: http://localhost:4006
|
||||||
|
password: demo_password
|
||||||
|
|
||||||
|
- Dockhand:
|
||||||
|
href: http://localhost:4007
|
||||||
|
description: Modern Docker management UI
|
||||||
|
icon: dockhand.png
|
||||||
|
|
||||||
|
- Monitoring:
|
||||||
|
- InfluxDB:
|
||||||
|
href: http://localhost:4008
|
||||||
|
description: Time series database for metrics
|
||||||
|
icon: influxdb.png
|
||||||
|
|
||||||
|
- Grafana:
|
||||||
|
href: http://localhost:4009
|
||||||
|
description: Analytics and visualization platform
|
||||||
|
icon: grafana.png
|
||||||
|
widget:
|
||||||
|
type: grafana
|
||||||
|
url: http://localhost:4009
|
||||||
|
username: admin
|
||||||
|
password: demo_password
|
||||||
|
|
||||||
|
- Documentation:
|
||||||
|
- Draw.io:
|
||||||
|
href: http://localhost:4010
|
||||||
|
description: Web-based diagramming application
|
||||||
|
icon: drawio.png
|
||||||
|
|
||||||
|
- Kroki:
|
||||||
|
href: http://localhost:4011
|
||||||
|
description: Diagrams as a service
|
||||||
|
icon: kroki.png
|
||||||
|
|
||||||
|
- Developer Tools:
|
||||||
|
- Atomic Tracker:
|
||||||
|
href: http://localhost:4012
|
||||||
|
description: Habit tracking and personal dashboard
|
||||||
|
icon: atomic-tracker.png
|
||||||
|
|
||||||
|
- ArchiveBox:
|
||||||
|
href: http://localhost:4013
|
||||||
|
description: Web archiving solution
|
||||||
|
icon: archivebox.png
|
||||||
|
|
||||||
|
- Tube Archivist:
|
||||||
|
href: http://localhost:4014
|
||||||
|
description: YouTube video archiving
|
||||||
|
icon: tube-archivist.png
|
||||||
|
|
||||||
|
- Wakapi:
|
||||||
|
href: http://localhost:4015
|
||||||
|
description: Open-source WakaTime alternative
|
||||||
|
icon: wakapi.png
|
||||||
|
|
||||||
|
- MailHog:
|
||||||
|
href: http://localhost:4017
|
||||||
|
description: Web and API based SMTP testing
|
||||||
|
icon: mailhog.png
|
||||||
|
|
||||||
|
- Atuin:
|
||||||
|
href: http://localhost:4018
|
||||||
|
description: Magical shell history synchronization
|
||||||
|
icon: atuin.png
|
||||||
33
demo/config/homepage/settings.yaml
Normal file
33
demo/config/homepage/settings.yaml
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
---
|
||||||
|
# Homepage Settings
|
||||||
|
|
||||||
|
title: TSYS Developer Support Stack
|
||||||
|
favicon: https://raw.githubusercontent.com/walkxcode/dashboard-icons/main/png/docker.png
|
||||||
|
|
||||||
|
headerStyle: boxed
|
||||||
|
|
||||||
|
layout:
|
||||||
|
Infrastructure:
|
||||||
|
style: row
|
||||||
|
columns: 2
|
||||||
|
Monitoring:
|
||||||
|
style: row
|
||||||
|
columns: 2
|
||||||
|
Documentation:
|
||||||
|
style: row
|
||||||
|
columns: 2
|
||||||
|
Developer Tools:
|
||||||
|
style: row
|
||||||
|
columns: 3
|
||||||
|
|
||||||
|
providers:
|
||||||
|
docker:
|
||||||
|
socket: docker-socket-proxy:2375
|
||||||
|
|
||||||
|
quicklaunch:
|
||||||
|
searchDescriptions: true
|
||||||
|
hideInternetSearch: false
|
||||||
|
hideVisitURL: false
|
||||||
|
|
||||||
|
showStats: true
|
||||||
|
hideVersion: false
|
||||||
21
demo/config/homepage/widgets.yaml
Normal file
21
demo/config/homepage/widgets.yaml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
---
|
||||||
|
# Homepage Widgets Configuration
|
||||||
|
|
||||||
|
- greeting:
|
||||||
|
text_size: xl
|
||||||
|
text: TSYS Developer Support Stack
|
||||||
|
|
||||||
|
- datetime:
|
||||||
|
text_size: l
|
||||||
|
format:
|
||||||
|
dateStyle: long
|
||||||
|
timeStyle: short
|
||||||
|
|
||||||
|
- search:
|
||||||
|
provider: duckduckgo
|
||||||
|
target: _blank
|
||||||
|
|
||||||
|
- glances:
|
||||||
|
url: http://localhost:4006
|
||||||
|
type: pihole
|
||||||
|
password: demo_password
|
||||||
0
demo/config/influxdb/.gitkeep
Normal file
0
demo/config/influxdb/.gitkeep
Normal file
0
demo/config/kroki/.gitkeep
Normal file
0
demo/config/kroki/.gitkeep
Normal file
0
demo/config/mailhog/.gitkeep
Normal file
0
demo/config/mailhog/.gitkeep
Normal file
0
demo/config/pihole/.gitkeep
Normal file
0
demo/config/pihole/.gitkeep
Normal file
0
demo/config/tubearchivist/.gitkeep
Normal file
0
demo/config/tubearchivist/.gitkeep
Normal file
0
demo/config/wakapi/.gitkeep
Normal file
0
demo/config/wakapi/.gitkeep
Normal file
@@ -1,15 +1,18 @@
|
|||||||
# TSYS Developer Support Stack - Demo Environment Configuration
|
# TSYS Developer Support Stack - Demo Environment Configuration
|
||||||
# Project Identification
|
# FOR DEMONSTRATION PURPOSES ONLY - NOT FOR PRODUCTION
|
||||||
COMPOSE_PROJECT_NAME=tsysdevstack-supportstack-demo
|
|
||||||
COMPOSE_NETWORK_NAME=tsysdevstack-supportstack-demo-network
|
|
||||||
|
|
||||||
# Dynamic User Detection (to be auto-populated by scripts)
|
# Project Identification
|
||||||
|
COMPOSE_PROJECT_NAME=kneldevstack-supportstack-demo
|
||||||
|
COMPOSE_NETWORK_NAME=kneldevstack-supportstack-demo-network
|
||||||
|
|
||||||
|
# Dynamic User Detection (auto-populated by demo-stack.sh)
|
||||||
DEMO_UID=1000
|
DEMO_UID=1000
|
||||||
DEMO_GID=1000
|
DEMO_GID=1000
|
||||||
DEMO_DOCKER_GID=996
|
DEMO_DOCKER_GID=986
|
||||||
|
|
||||||
# Port Assignments (4000-4099 range)
|
# Port Assignments (4000-4099 range)
|
||||||
HOMEPAGE_PORT=4000
|
HOMEPAGE_PORT=4000
|
||||||
|
HOMEPAGE_ALLOWED_HOSTS=*
|
||||||
DOCKER_SOCKET_PROXY_PORT=4005
|
DOCKER_SOCKET_PROXY_PORT=4005
|
||||||
PIHOLE_PORT=4006
|
PIHOLE_PORT=4006
|
||||||
DOCKHAND_PORT=4007
|
DOCKHAND_PORT=4007
|
||||||
@@ -22,22 +25,13 @@ ARCHIVEBOX_PORT=4013
|
|||||||
TUBE_ARCHIVIST_PORT=4014
|
TUBE_ARCHIVIST_PORT=4014
|
||||||
WAKAPI_PORT=4015
|
WAKAPI_PORT=4015
|
||||||
MAILHOG_PORT=4017
|
MAILHOG_PORT=4017
|
||||||
|
MAILHOG_SMTP_PORT=4019
|
||||||
ATUIN_PORT=4018
|
ATUIN_PORT=4018
|
||||||
|
|
||||||
# Demo Credentials (CLEARLY MARKED AS DEMO ONLY)
|
|
||||||
DEMO_ADMIN_USER=admin
|
|
||||||
DEMO_ADMIN_PASSWORD=demo_password
|
|
||||||
DEMO_GRAFANA_ADMIN_PASSWORD=demo_password
|
|
||||||
DEMO_DOCKHAND_PASSWORD=demo_password
|
|
||||||
|
|
||||||
# Network Configuration
|
# Network Configuration
|
||||||
NETWORK_SUBNET=192.168.3.0/24
|
NETWORK_SUBNET=192.168.3.0/24
|
||||||
NETWORK_GATEWAY=192.168.3.1
|
NETWORK_GATEWAY=192.168.3.1
|
||||||
|
|
||||||
# Resource Limits
|
|
||||||
MEMORY_LIMIT=512m
|
|
||||||
CPU_LIMIT=0.25
|
|
||||||
|
|
||||||
# Health Check Timeouts
|
# Health Check Timeouts
|
||||||
HEALTH_CHECK_TIMEOUT=10s
|
HEALTH_CHECK_TIMEOUT=10s
|
||||||
HEALTH_CHECK_INTERVAL=30s
|
HEALTH_CHECK_INTERVAL=30s
|
||||||
@@ -59,7 +53,7 @@ DOCKER_SOCKET_PROXY_PLUGINS=0
|
|||||||
# InfluxDB Configuration
|
# InfluxDB Configuration
|
||||||
INFLUXDB_ORG=tsysdemo
|
INFLUXDB_ORG=tsysdemo
|
||||||
INFLUXDB_BUCKET=demo_metrics
|
INFLUXDB_BUCKET=demo_metrics
|
||||||
INFLUXDB_ADMIN_USER=demo_admin
|
INFLUXDB_ADMIN_USER=admin
|
||||||
INFLUXDB_ADMIN_PASSWORD=demo_password
|
INFLUXDB_ADMIN_PASSWORD=demo_password
|
||||||
INFLUXDB_AUTH_TOKEN=demo_token_replace_in_production
|
INFLUXDB_AUTH_TOKEN=demo_token_replace_in_production
|
||||||
|
|
||||||
@@ -74,16 +68,19 @@ WEBTHEME=default-darker
|
|||||||
|
|
||||||
# ArchiveBox Configuration
|
# ArchiveBox Configuration
|
||||||
ARCHIVEBOX_SECRET_KEY=demo_secret_replace_in_production
|
ARCHIVEBOX_SECRET_KEY=demo_secret_replace_in_production
|
||||||
|
ARCHIVEBOX_ADMIN_USER=admin
|
||||||
|
ARCHIVEBOX_ADMIN_PASSWORD=demo_password
|
||||||
|
|
||||||
# Tube Archivist Configuration
|
# Tube Archivist Configuration
|
||||||
TA_HOST=tubearchivist
|
TA_HOST=http://tubearchivist:8000
|
||||||
TA_PORT=4014
|
TA_USERNAME=admin
|
||||||
TA_DEBUG=false
|
TA_PASSWORD=demo_password
|
||||||
|
ELASTIC_PASSWORD=demo_password
|
||||||
|
ES_JAVA_OPTS="-Xms512m -Xmx512m"
|
||||||
|
|
||||||
# Wakapi Configuration
|
# Wakapi Configuration
|
||||||
WAKAPI_PASSWORD_SALT=demo_salt_replace_in_production
|
WAKAPI_PASSWORD_SALT=demo_salt_replace_in_production
|
||||||
|
|
||||||
# Atuin Configuration
|
# Atuin Configuration
|
||||||
ATUIN_HOST=atuin
|
ATUIN_HOST=0.0.0.0
|
||||||
ATUIN_PORT=4018
|
|
||||||
ATUIN_OPEN_REGISTRATION=true
|
ATUIN_OPEN_REGISTRATION=true
|
||||||
@@ -1,435 +0,0 @@
|
|||||||
---
|
|
||||||
# TSYS Developer Support Stack - Docker Compose Template
|
|
||||||
# Version: 1.0
|
|
||||||
# Purpose: Demo deployment with dynamic configuration
|
|
||||||
# ⚠️ DEMO CONFIGURATION ONLY - NOT FOR PRODUCTION
|
|
||||||
|
|
||||||
networks:
|
|
||||||
tsysdevstack-supportstack-demo-network:
|
|
||||||
driver: bridge
|
|
||||||
ipam:
|
|
||||||
config:
|
|
||||||
- subnet: 192.168.3.0/24
|
|
||||||
gateway: 192.168.3.1
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
tsysdevstack-supportstack-demo_homepage_data:
|
|
||||||
driver: local
|
|
||||||
tsysdevstack-supportstack-demo_pihole_data:
|
|
||||||
driver: local
|
|
||||||
tsysdevstack-supportstack-demo_dockhand_data:
|
|
||||||
driver: local
|
|
||||||
|
|
||||||
tsysdevstack-supportstack-demo_influxdb_data:
|
|
||||||
driver: local
|
|
||||||
tsysdevstack-supportstack-demo_grafana_data:
|
|
||||||
driver: local
|
|
||||||
tsysdevstack-supportstack-demo_drawio_data:
|
|
||||||
driver: local
|
|
||||||
tsysdevstack-supportstack-demo_kroki_data:
|
|
||||||
driver: local
|
|
||||||
tsysdevstack-supportstack-demo_atomictracker_data:
|
|
||||||
driver: local
|
|
||||||
tsysdevstack-supportstack-demo_archivebox_data:
|
|
||||||
driver: local
|
|
||||||
tsysdevstack-supportstack-demo_tubearchivist_data:
|
|
||||||
driver: local
|
|
||||||
tsysdevstack-supportstack-demo_wakapi_data:
|
|
||||||
driver: local
|
|
||||||
tsysdevstack-supportstack-demo_mailhog_data:
|
|
||||||
driver: local
|
|
||||||
tsysdevstack-supportstack-demo_atuin_data:
|
|
||||||
driver: local
|
|
||||||
|
|
||||||
services:
|
|
||||||
# Docker Socket Proxy - Security Layer
|
|
||||||
docker-socket-proxy:
|
|
||||||
image: tecnativa/docker-socket-proxy:latest
|
|
||||||
container_name: "tsysdevstack-supportstack-demo-docker-socket-proxy"
|
|
||||||
restart: unless-stopped
|
|
||||||
networks:
|
|
||||||
- tsysdevstack-supportstack-demo-network
|
|
||||||
volumes:
|
|
||||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
|
||||||
environment:
|
|
||||||
- CONTAINERS=1
|
|
||||||
- IMAGES=1
|
|
||||||
- NETWORKS=1
|
|
||||||
- VOLUMES=1
|
|
||||||
- EXEC=0
|
|
||||||
- PRIVILEGED=0
|
|
||||||
- SERVICES=0
|
|
||||||
- TASKS=0
|
|
||||||
- SECRETS=0
|
|
||||||
- CONFIGS=0
|
|
||||||
- PLUGINS=0
|
|
||||||
labels:
|
|
||||||
homepage.group: "Infrastructure"
|
|
||||||
homepage.name: "Docker Socket Proxy"
|
|
||||||
homepage.icon: "docker"
|
|
||||||
homepage.href: "http://localhost:4005"
|
|
||||||
homepage.description: "Secure proxy for Docker socket access"
|
|
||||||
|
|
||||||
# Homepage - Central Dashboard
|
|
||||||
homepage:
|
|
||||||
image: ghcr.io/gethomepage/homepage:latest
|
|
||||||
container_name: "tsysdevstack-supportstack-demo-homepage"
|
|
||||||
restart: unless-stopped
|
|
||||||
networks:
|
|
||||||
- tsysdevstack-supportstack-demo-network
|
|
||||||
ports:
|
|
||||||
- "4000:3000"
|
|
||||||
volumes:
|
|
||||||
- tsysdevstack-supportstack-demo_homepage_data:/app/config
|
|
||||||
environment:
|
|
||||||
- PUID=1000
|
|
||||||
- PGID=1000
|
|
||||||
labels:
|
|
||||||
homepage.group: "Developer Tools"
|
|
||||||
homepage.name: "Homepage"
|
|
||||||
homepage.icon: "homepage"
|
|
||||||
homepage.href: "http://localhost:4000"
|
|
||||||
homepage.description: "Central dashboard for service discovery"
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider",
|
|
||||||
"http://localhost:3000"]
|
|
||||||
interval: 30s
|
|
||||||
timeout: 10s
|
|
||||||
retries: 3
|
|
||||||
|
|
||||||
# Pi-hole - DNS Management
|
|
||||||
pihole:
|
|
||||||
image: pihole/pihole:latest
|
|
||||||
container_name: "tsysdevstack-supportstack-demo-pihole"
|
|
||||||
restart: unless-stopped
|
|
||||||
networks:
|
|
||||||
- tsysdevstack-supportstack-demo-network
|
|
||||||
ports:
|
|
||||||
- "4006:80"
|
|
||||||
- "53:53/tcp"
|
|
||||||
- "53:53/udp"
|
|
||||||
volumes:
|
|
||||||
- tsysdevstack-supportstack-demo_pihole_data:/etc/pihole
|
|
||||||
environment:
|
|
||||||
- TZ=UTC
|
|
||||||
- WEBPASSWORD=demo_password
|
|
||||||
- WEBTHEME=default-darker
|
|
||||||
- PUID=1000
|
|
||||||
- PGID=1000
|
|
||||||
labels:
|
|
||||||
homepage.group: "Infrastructure"
|
|
||||||
homepage.name: "Pi-hole"
|
|
||||||
homepage.icon: "pihole"
|
|
||||||
homepage.href: "http://localhost:4006"
|
|
||||||
homepage.description: "DNS management with ad blocking"
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider",
|
|
||||||
"http://localhost/admin"]
|
|
||||||
interval: 30s
|
|
||||||
timeout: 10s
|
|
||||||
retries: 3
|
|
||||||
|
|
||||||
# Dockhand - Docker Management
|
|
||||||
dockhand:
|
|
||||||
image: fnsys/dockhand:latest
|
|
||||||
container_name: "tsysdevstack-supportstack-demo-dockhand"
|
|
||||||
restart: unless-stopped
|
|
||||||
networks:
|
|
||||||
- tsysdevstack-supportstack-demo-network
|
|
||||||
ports:
|
|
||||||
- "4007:3000"
|
|
||||||
volumes:
|
|
||||||
- tsysdevstack-supportstack-demo_dockhand_data:/app/data
|
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
environment:
|
|
||||||
- PUID=1000
|
|
||||||
- PGID=1000
|
|
||||||
labels:
|
|
||||||
homepage.group: "Infrastructure"
|
|
||||||
homepage.name: "Dockhand"
|
|
||||||
homepage.icon: "dockhand"
|
|
||||||
homepage.href: "http://localhost:4007"
|
|
||||||
homepage.description: "Modern Docker management UI"
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "curl", "-f", "--silent",
|
|
||||||
"http://localhost:3000"]
|
|
||||||
interval: 30s
|
|
||||||
timeout: 10s
|
|
||||||
retries: 3
|
|
||||||
|
|
||||||
# InfluxDB - Time Series Database
|
|
||||||
influxdb:
|
|
||||||
image: influxdb:2.7-alpine
|
|
||||||
container_name: "tsysdevstack-supportstack-demo-influxdb"
|
|
||||||
restart: unless-stopped
|
|
||||||
networks:
|
|
||||||
- tsysdevstack-supportstack-demo-network
|
|
||||||
ports:
|
|
||||||
- "4008:8086"
|
|
||||||
volumes:
|
|
||||||
- tsysdevstack-supportstack-demo_influxdb_data:/var/lib/influxdb2
|
|
||||||
environment:
|
|
||||||
- DOCKER_INFLUXDB_INIT_MODE=setup
|
|
||||||
- DOCKER_INFLUXDB_INIT_USERNAME=demo_admin
|
|
||||||
- DOCKER_INFLUXDB_INIT_PASSWORD=demo_password
|
|
||||||
- DOCKER_INFLUXDB_INIT_ORG=tsysdemo
|
|
||||||
- DOCKER_INFLUXDB_INIT_BUCKET=demo_metrics
|
|
||||||
- DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=demo_token_replace_in_production
|
|
||||||
- PUID=1000
|
|
||||||
- PGID=1000
|
|
||||||
labels:
|
|
||||||
homepage.group: "Monitoring"
|
|
||||||
homepage.name: "InfluxDB"
|
|
||||||
homepage.icon: "influxdb"
|
|
||||||
homepage.href: "http://localhost:4008"
|
|
||||||
homepage.description: "Time series database for metrics"
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider",
|
|
||||||
"http://localhost:8086/ping"]
|
|
||||||
interval: 30s
|
|
||||||
timeout: 10s
|
|
||||||
retries: 3
|
|
||||||
|
|
||||||
# Grafana - Visualization Platform
|
|
||||||
grafana:
|
|
||||||
image: grafana/grafana:latest
|
|
||||||
container_name: "tsysdevstack-supportstack-demo-grafana"
|
|
||||||
restart: unless-stopped
|
|
||||||
networks:
|
|
||||||
- tsysdevstack-supportstack-demo-network
|
|
||||||
ports:
|
|
||||||
- "4009:3000"
|
|
||||||
volumes:
|
|
||||||
- tsysdevstack-supportstack-demo_grafana_data:/var/lib/grafana
|
|
||||||
environment:
|
|
||||||
- GF_SECURITY_ADMIN_USER=admin
|
|
||||||
- GF_SECURITY_ADMIN_PASSWORD=demo_password
|
|
||||||
- GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-simple-json-datasource
|
|
||||||
- PUID=1000
|
|
||||||
- PGID=1000
|
|
||||||
labels:
|
|
||||||
homepage.group: "Monitoring"
|
|
||||||
homepage.name: "Grafana"
|
|
||||||
homepage.icon: "grafana"
|
|
||||||
homepage.href: "http://localhost:4009"
|
|
||||||
homepage.description: "Analytics and visualization platform"
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider",
|
|
||||||
"http://localhost:3000/api/health"]
|
|
||||||
interval: 30s
|
|
||||||
timeout: 10s
|
|
||||||
retries: 3
|
|
||||||
|
|
||||||
# Draw.io - Diagramming Server
|
|
||||||
drawio:
|
|
||||||
image: fjudith/draw.io:latest
|
|
||||||
container_name: "tsysdevstack-supportstack-demo-drawio"
|
|
||||||
restart: unless-stopped
|
|
||||||
networks:
|
|
||||||
- tsysdevstack-supportstack-demo-network
|
|
||||||
ports:
|
|
||||||
- "4010:8080"
|
|
||||||
volumes:
|
|
||||||
- tsysdevstack-supportstack-demo_drawio_data:/root
|
|
||||||
environment:
|
|
||||||
- PUID=1000
|
|
||||||
- PGID=1000
|
|
||||||
labels:
|
|
||||||
homepage.group: "Documentation"
|
|
||||||
homepage.name: "Draw.io"
|
|
||||||
homepage.icon: "drawio"
|
|
||||||
homepage.href: "http://localhost:4010"
|
|
||||||
homepage.description: "Web-based diagramming application"
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "curl", "-f", "--silent",
|
|
||||||
"http://localhost:8080"]
|
|
||||||
interval: 30s
|
|
||||||
timeout: 10s
|
|
||||||
retries: 3
|
|
||||||
|
|
||||||
# Kroki - Diagrams as a Service
|
|
||||||
kroki:
|
|
||||||
image: yuzutech/kroki:latest
|
|
||||||
container_name: "tsysdevstack-supportstack-demo-kroki"
|
|
||||||
restart: unless-stopped
|
|
||||||
networks:
|
|
||||||
- tsysdevstack-supportstack-demo-network
|
|
||||||
ports:
|
|
||||||
- "4011:8000"
|
|
||||||
volumes:
|
|
||||||
- tsysdevstack-supportstack-demo_kroki_data:/data
|
|
||||||
environment:
|
|
||||||
- KROKI_SAFE_MODE=secure
|
|
||||||
- PUID=1000
|
|
||||||
- PGID=1000
|
|
||||||
labels:
|
|
||||||
homepage.group: "Documentation"
|
|
||||||
homepage.name: "Kroki"
|
|
||||||
homepage.icon: "kroki"
|
|
||||||
homepage.href: "http://localhost:4011"
|
|
||||||
homepage.description: "Diagrams as a service"
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "curl", "-f", "--silent",
|
|
||||||
"http://localhost:8000/health"]
|
|
||||||
interval: 30s
|
|
||||||
timeout: 10s
|
|
||||||
retries: 3
|
|
||||||
|
|
||||||
# Atomic Tracker - Habit Tracking
|
|
||||||
atomictracker:
|
|
||||||
image: ghcr.io/majorpeter/atomic-tracker:v1.3.1
|
|
||||||
container_name: "tsysdevstack-supportstack-demo-atomictracker"
|
|
||||||
restart: unless-stopped
|
|
||||||
networks:
|
|
||||||
- tsysdevstack-supportstack-demo-network
|
|
||||||
ports:
|
|
||||||
- "4012:8080"
|
|
||||||
volumes:
|
|
||||||
- tsysdevstack-supportstack-demo_atomictracker_data:/app/data
|
|
||||||
environment:
|
|
||||||
- NODE_ENV=production
|
|
||||||
- PUID=1000
|
|
||||||
- PGID=1000
|
|
||||||
labels:
|
|
||||||
homepage.group: "Developer Tools"
|
|
||||||
homepage.name: "Atomic Tracker"
|
|
||||||
homepage.icon: "atomic-tracker"
|
|
||||||
homepage.href: "http://localhost:4012"
|
|
||||||
homepage.description: "Habit tracking and personal dashboard"
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider",
|
|
||||||
"http://localhost:8080"]
|
|
||||||
interval: 30s
|
|
||||||
timeout: 10s
|
|
||||||
retries: 3
|
|
||||||
|
|
||||||
# ArchiveBox - Web Archiving
|
|
||||||
archivebox:
|
|
||||||
image: archivebox/archivebox:latest
|
|
||||||
container_name: "tsysdevstack-supportstack-demo-archivebox"
|
|
||||||
restart: unless-stopped
|
|
||||||
networks:
|
|
||||||
- tsysdevstack-supportstack-demo-network
|
|
||||||
ports:
|
|
||||||
- "4013:8000"
|
|
||||||
volumes:
|
|
||||||
- tsysdevstack-supportstack-demo_archivebox_data:/data
|
|
||||||
environment:
|
|
||||||
- SECRET_KEY=demo_secret_replace_in_production
|
|
||||||
- PUID=1000
|
|
||||||
- PGID=1000
|
|
||||||
labels:
|
|
||||||
homepage.group: "Developer Tools"
|
|
||||||
homepage.name: "ArchiveBox"
|
|
||||||
homepage.icon: "archivebox"
|
|
||||||
homepage.href: "http://localhost:4013"
|
|
||||||
homepage.description: "Web archiving solution"
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider",
|
|
||||||
"http://localhost:8000"]
|
|
||||||
interval: 30s
|
|
||||||
timeout: 10s
|
|
||||||
retries: 3
|
|
||||||
|
|
||||||
# Tube Archivist - YouTube Archiving
|
|
||||||
tubearchivist:
|
|
||||||
image: bbilly1/tubearchivist:latest
|
|
||||||
container_name: "tsysdevstack-supportstack-demo-tubearchivist"
|
|
||||||
restart: unless-stopped
|
|
||||||
networks:
|
|
||||||
- tsysdevstack-supportstack-demo-network
|
|
||||||
ports:
|
|
||||||
- "4014:8000"
|
|
||||||
volumes:
|
|
||||||
- tsysdevstack-supportstack-demo_tubearchivist_data:/cache
|
|
||||||
environment:
|
|
||||||
- TA_HOST=tubearchivist
|
|
||||||
- TA_PORT=4014
|
|
||||||
- TA_DEBUG=false
|
|
||||||
- TA_USERNAME=demo
|
|
||||||
- PUID=1000
|
|
||||||
- PGID=1000
|
|
||||||
labels:
|
|
||||||
homepage.group: "Developer Tools"
|
|
||||||
homepage.name: "Tube Archivist"
|
|
||||||
homepage.icon: "tube-archivist"
|
|
||||||
homepage.href: "http://localhost:4014"
|
|
||||||
homepage.description: "YouTube video archiving"
|
|
||||||
|
|
||||||
# Wakapi - Time Tracking
|
|
||||||
wakapi:
|
|
||||||
image: ghcr.io/muety/wakapi:latest
|
|
||||||
container_name: "tsysdevstack-supportstack-demo-wakapi"
|
|
||||||
restart: unless-stopped
|
|
||||||
networks:
|
|
||||||
- tsysdevstack-supportstack-demo-network
|
|
||||||
ports:
|
|
||||||
- "4015:3000"
|
|
||||||
volumes:
|
|
||||||
- tsysdevstack-supportstack-demo_wakapi_data:/data
|
|
||||||
environment:
|
|
||||||
- WAKAPI_PASSWORD_SALT=demo_salt_replace_in_production
|
|
||||||
- PUID=1000
|
|
||||||
- PGID=1000
|
|
||||||
labels:
|
|
||||||
homepage.group: "Developer Tools"
|
|
||||||
homepage.name: "Wakapi"
|
|
||||||
homepage.icon: "wakapi"
|
|
||||||
homepage.href: "http://localhost:4015"
|
|
||||||
homepage.description: "Open-source WakaTime alternative"
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider",
|
|
||||||
"http://localhost:3000"]
|
|
||||||
interval: 30s
|
|
||||||
timeout: 10s
|
|
||||||
retries: 3
|
|
||||||
|
|
||||||
# MailHog - Email Testing
|
|
||||||
mailhog:
|
|
||||||
image: mailhog/mailhog:latest
|
|
||||||
container_name: "tsysdevstack-supportstack-demo-mailhog"
|
|
||||||
restart: unless-stopped
|
|
||||||
networks:
|
|
||||||
- tsysdevstack-supportstack-demo-network
|
|
||||||
ports:
|
|
||||||
- "4017:8025"
|
|
||||||
volumes:
|
|
||||||
- tsysdevstack-supportstack-demo_mailhog_data:/maildir
|
|
||||||
environment:
|
|
||||||
- PUID=1000
|
|
||||||
- PGID=1000
|
|
||||||
labels:
|
|
||||||
homepage.group: "Developer Tools"
|
|
||||||
homepage.name: "MailHog"
|
|
||||||
homepage.icon: "mailhog"
|
|
||||||
homepage.href: "http://localhost:4017"
|
|
||||||
homepage.description: "Web and API based SMTP testing"
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider",
|
|
||||||
"http://localhost:8025"]
|
|
||||||
interval: 30s
|
|
||||||
timeout: 10s
|
|
||||||
retries: 3
|
|
||||||
|
|
||||||
# Atuin - Shell History
|
|
||||||
atuin:
|
|
||||||
image: ghcr.io/atuinsh/atuin:v18.10.0
|
|
||||||
container_name: "tsysdevstack-supportstack-demo-atuin"
|
|
||||||
restart: unless-stopped
|
|
||||||
command: server start
|
|
||||||
networks:
|
|
||||||
- tsysdevstack-supportstack-demo-network
|
|
||||||
ports:
|
|
||||||
- "4018:8888"
|
|
||||||
volumes:
|
|
||||||
- tsysdevstack-supportstack-demo_atuin_data:/config
|
|
||||||
environment:
|
|
||||||
- ATUIN_DB_URI=sqlite:///config/atuin.db
|
|
||||||
- PUID=1000
|
|
||||||
- PGID=1000
|
|
||||||
labels:
|
|
||||||
homepage.group: "Developer Tools"
|
|
||||||
homepage.name: "Atuin"
|
|
||||||
homepage.icon: "atuin"
|
|
||||||
homepage.href: "http://localhost:4018"
|
|
||||||
homepage.description: "Magical shell history synchronization"
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
---
|
---
|
||||||
# TSYS Developer Support Stack - Docker Compose Template
|
# TSYS Developer Support Stack - Docker Compose Template
|
||||||
# Version: 1.0
|
# Version: 2.0
|
||||||
# Purpose: Demo deployment with dynamic configuration
|
# Purpose: Demo deployment with dynamic configuration
|
||||||
# ⚠️ DEMO CONFIGURATION ONLY - NOT FOR PRODUCTION
|
# DEMO CONFIGURATION ONLY - NOT FOR PRODUCTION
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
${COMPOSE_NETWORK_NAME}:
|
${COMPOSE_NETWORK_NAME}:
|
||||||
@@ -19,7 +19,6 @@ volumes:
|
|||||||
driver: local
|
driver: local
|
||||||
${COMPOSE_PROJECT_NAME}_dockhand_data:
|
${COMPOSE_PROJECT_NAME}_dockhand_data:
|
||||||
driver: local
|
driver: local
|
||||||
|
|
||||||
${COMPOSE_PROJECT_NAME}_influxdb_data:
|
${COMPOSE_PROJECT_NAME}_influxdb_data:
|
||||||
driver: local
|
driver: local
|
||||||
${COMPOSE_PROJECT_NAME}_grafana_data:
|
${COMPOSE_PROJECT_NAME}_grafana_data:
|
||||||
@@ -34,6 +33,10 @@ volumes:
|
|||||||
driver: local
|
driver: local
|
||||||
${COMPOSE_PROJECT_NAME}_tubearchivist_data:
|
${COMPOSE_PROJECT_NAME}_tubearchivist_data:
|
||||||
driver: local
|
driver: local
|
||||||
|
${COMPOSE_PROJECT_NAME}_ta_redis_data:
|
||||||
|
driver: local
|
||||||
|
${COMPOSE_PROJECT_NAME}_ta_es_data:
|
||||||
|
driver: local
|
||||||
${COMPOSE_PROJECT_NAME}_wakapi_data:
|
${COMPOSE_PROJECT_NAME}_wakapi_data:
|
||||||
driver: local
|
driver: local
|
||||||
${COMPOSE_PROJECT_NAME}_mailhog_data:
|
${COMPOSE_PROJECT_NAME}_mailhog_data:
|
||||||
@@ -63,12 +66,21 @@ services:
|
|||||||
- SECRETS=${DOCKER_SOCKET_PROXY_SECRETS}
|
- SECRETS=${DOCKER_SOCKET_PROXY_SECRETS}
|
||||||
- CONFIGS=${DOCKER_SOCKET_PROXY_CONFIGS}
|
- CONFIGS=${DOCKER_SOCKET_PROXY_CONFIGS}
|
||||||
- PLUGINS=${DOCKER_SOCKET_PROXY_PLUGINS}
|
- PLUGINS=${DOCKER_SOCKET_PROXY_PLUGINS}
|
||||||
|
- POST=1
|
||||||
|
- DELETE=1
|
||||||
|
- ALLOW_START=1
|
||||||
|
- ALLOW_STOP=1
|
||||||
|
- ALLOW_RESTARTS=1
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: 128M
|
||||||
labels:
|
labels:
|
||||||
homepage.group: "Infrastructure"
|
homepage.group: "Infrastructure"
|
||||||
homepage.name: "Docker Socket Proxy"
|
homepage.name: "Docker Socket Proxy"
|
||||||
homepage.icon: "docker"
|
homepage.icon: "docker"
|
||||||
homepage.href: "http://localhost:${DOCKER_SOCKET_PROXY_PORT}"
|
homepage.description: >-
|
||||||
homepage.description: "Secure proxy for Docker socket access"
|
Secure proxy for Docker socket access (internal only)
|
||||||
|
|
||||||
# Homepage - Central Dashboard
|
# Homepage - Central Dashboard
|
||||||
homepage:
|
homepage:
|
||||||
@@ -80,8 +92,9 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "${HOMEPAGE_PORT}:3000"
|
- "${HOMEPAGE_PORT}:3000"
|
||||||
volumes:
|
volumes:
|
||||||
- ${COMPOSE_PROJECT_NAME}_homepage_data:/app/config
|
- ./config/homepage:/app/config
|
||||||
environment:
|
environment:
|
||||||
|
- HOMEPAGE_ALLOWED_HOSTS=${HOMEPAGE_ALLOWED_HOSTS}
|
||||||
- PUID=${DEMO_UID}
|
- PUID=${DEMO_UID}
|
||||||
- PGID=${DEMO_GID}
|
- PGID=${DEMO_GID}
|
||||||
labels:
|
labels:
|
||||||
@@ -90,6 +103,10 @@ services:
|
|||||||
homepage.icon: "homepage"
|
homepage.icon: "homepage"
|
||||||
homepage.href: "http://localhost:${HOMEPAGE_PORT}"
|
homepage.href: "http://localhost:${HOMEPAGE_PORT}"
|
||||||
homepage.description: "Central dashboard for service discovery"
|
homepage.description: "Central dashboard for service discovery"
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: 256M
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider",
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider",
|
||||||
"http://localhost:3000"]
|
"http://localhost:3000"]
|
||||||
@@ -106,8 +123,6 @@ services:
|
|||||||
- ${COMPOSE_NETWORK_NAME}
|
- ${COMPOSE_NETWORK_NAME}
|
||||||
ports:
|
ports:
|
||||||
- "${PIHOLE_PORT}:80"
|
- "${PIHOLE_PORT}:80"
|
||||||
- "53:53/tcp"
|
|
||||||
- "53:53/udp"
|
|
||||||
volumes:
|
volumes:
|
||||||
- ${COMPOSE_PROJECT_NAME}_pihole_data:/etc/pihole
|
- ${COMPOSE_PROJECT_NAME}_pihole_data:/etc/pihole
|
||||||
environment:
|
environment:
|
||||||
@@ -122,6 +137,10 @@ services:
|
|||||||
homepage.icon: "pihole"
|
homepage.icon: "pihole"
|
||||||
homepage.href: "http://localhost:${PIHOLE_PORT}"
|
homepage.href: "http://localhost:${PIHOLE_PORT}"
|
||||||
homepage.description: "DNS management with ad blocking"
|
homepage.description: "DNS management with ad blocking"
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: 256M
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider",
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider",
|
||||||
"http://localhost/admin"]
|
"http://localhost/admin"]
|
||||||
@@ -140,16 +159,23 @@ services:
|
|||||||
- "${DOCKHAND_PORT}:3000"
|
- "${DOCKHAND_PORT}:3000"
|
||||||
volumes:
|
volumes:
|
||||||
- ${COMPOSE_PROJECT_NAME}_dockhand_data:/app/data
|
- ${COMPOSE_PROJECT_NAME}_dockhand_data:/app/data
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
environment:
|
environment:
|
||||||
|
- DOCKER_HOST=tcp://docker-socket-proxy:2375
|
||||||
- PUID=${DEMO_UID}
|
- PUID=${DEMO_UID}
|
||||||
- PGID=${DEMO_GID}
|
- PGID=${DEMO_GID}
|
||||||
|
depends_on:
|
||||||
|
docker-socket-proxy:
|
||||||
|
condition: service_started
|
||||||
labels:
|
labels:
|
||||||
homepage.group: "Infrastructure"
|
homepage.group: "Infrastructure"
|
||||||
homepage.name: "Dockhand"
|
homepage.name: "Dockhand"
|
||||||
homepage.icon: "dockhand"
|
homepage.icon: "dockhand"
|
||||||
homepage.href: "http://localhost:${DOCKHAND_PORT}"
|
homepage.href: "http://localhost:${DOCKHAND_PORT}"
|
||||||
homepage.description: "Modern Docker management UI"
|
homepage.description: "Modern Docker management UI"
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: 256M
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "curl", "-f", "--silent",
|
test: ["CMD", "curl", "-f", "--silent",
|
||||||
"http://localhost:3000"]
|
"http://localhost:3000"]
|
||||||
@@ -183,6 +209,10 @@ services:
|
|||||||
homepage.icon: "influxdb"
|
homepage.icon: "influxdb"
|
||||||
homepage.href: "http://localhost:${INFLUXDB_PORT}"
|
homepage.href: "http://localhost:${INFLUXDB_PORT}"
|
||||||
homepage.description: "Time series database for metrics"
|
homepage.description: "Time series database for metrics"
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: 512M
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider",
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider",
|
||||||
"http://localhost:8086/ping"]
|
"http://localhost:8086/ping"]
|
||||||
@@ -201,10 +231,12 @@ services:
|
|||||||
- "${GRAFANA_PORT}:3000"
|
- "${GRAFANA_PORT}:3000"
|
||||||
volumes:
|
volumes:
|
||||||
- ${COMPOSE_PROJECT_NAME}_grafana_data:/var/lib/grafana
|
- ${COMPOSE_PROJECT_NAME}_grafana_data:/var/lib/grafana
|
||||||
|
- ./config/grafana:/etc/grafana/provisioning:ro
|
||||||
environment:
|
environment:
|
||||||
- GF_SECURITY_ADMIN_USER=${GF_SECURITY_ADMIN_USER}
|
- GF_SECURITY_ADMIN_USER=${GF_SECURITY_ADMIN_USER}
|
||||||
- GF_SECURITY_ADMIN_PASSWORD=${GF_SECURITY_ADMIN_PASSWORD}
|
- GF_SECURITY_ADMIN_PASSWORD=${GF_SECURITY_ADMIN_PASSWORD}
|
||||||
- GF_INSTALL_PLUGINS=${GF_INSTALL_PLUGINS}
|
- GF_INSTALL_PLUGINS=${GF_INSTALL_PLUGINS}
|
||||||
|
- GF_SERVER_HTTP_PORT=3000
|
||||||
- PUID=${DEMO_UID}
|
- PUID=${DEMO_UID}
|
||||||
- PGID=${DEMO_GID}
|
- PGID=${DEMO_GID}
|
||||||
labels:
|
labels:
|
||||||
@@ -213,6 +245,10 @@ services:
|
|||||||
homepage.icon: "grafana"
|
homepage.icon: "grafana"
|
||||||
homepage.href: "http://localhost:${GRAFANA_PORT}"
|
homepage.href: "http://localhost:${GRAFANA_PORT}"
|
||||||
homepage.description: "Analytics and visualization platform"
|
homepage.description: "Analytics and visualization platform"
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: 256M
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider",
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider",
|
||||||
"http://localhost:3000/api/health"]
|
"http://localhost:3000/api/health"]
|
||||||
@@ -240,6 +276,10 @@ services:
|
|||||||
homepage.icon: "drawio"
|
homepage.icon: "drawio"
|
||||||
homepage.href: "http://localhost:${DRAWIO_PORT}"
|
homepage.href: "http://localhost:${DRAWIO_PORT}"
|
||||||
homepage.description: "Web-based diagramming application"
|
homepage.description: "Web-based diagramming application"
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: 256M
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "curl", "-f", "--silent",
|
test: ["CMD", "curl", "-f", "--silent",
|
||||||
"http://localhost:8080"]
|
"http://localhost:8080"]
|
||||||
@@ -268,6 +308,10 @@ services:
|
|||||||
homepage.icon: "kroki"
|
homepage.icon: "kroki"
|
||||||
homepage.href: "http://localhost:${KROKI_PORT}"
|
homepage.href: "http://localhost:${KROKI_PORT}"
|
||||||
homepage.description: "Diagrams as a service"
|
homepage.description: "Diagrams as a service"
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: 256M
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "curl", "-f", "--silent",
|
test: ["CMD", "curl", "-f", "--silent",
|
||||||
"http://localhost:8000/health"]
|
"http://localhost:8000/health"]
|
||||||
@@ -296,6 +340,10 @@ services:
|
|||||||
homepage.icon: "atomic-tracker"
|
homepage.icon: "atomic-tracker"
|
||||||
homepage.href: "http://localhost:${ATOMIC_TRACKER_PORT}"
|
homepage.href: "http://localhost:${ATOMIC_TRACKER_PORT}"
|
||||||
homepage.description: "Habit tracking and personal dashboard"
|
homepage.description: "Habit tracking and personal dashboard"
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: 256M
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider",
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider",
|
||||||
"http://localhost:8080"]
|
"http://localhost:8080"]
|
||||||
@@ -315,7 +363,13 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ${COMPOSE_PROJECT_NAME}_archivebox_data:/data
|
- ${COMPOSE_PROJECT_NAME}_archivebox_data:/data
|
||||||
environment:
|
environment:
|
||||||
- SECRET_KEY=${ARCHIVEBOX_SECRET_KEY}
|
- ADMIN_USERNAME=${ARCHIVEBOX_ADMIN_USER}
|
||||||
|
- ADMIN_PASSWORD=${ARCHIVEBOX_ADMIN_PASSWORD}
|
||||||
|
- ALLOWED_HOSTS=*
|
||||||
|
- CSRF_TRUSTED_ORIGINS=http://localhost:${ARCHIVEBOX_PORT}
|
||||||
|
- PUBLIC_INDEX=True
|
||||||
|
- PUBLIC_SNAPSHOTS=True
|
||||||
|
- PUBLIC_ADD_VIEW=False
|
||||||
- PUID=${DEMO_UID}
|
- PUID=${DEMO_UID}
|
||||||
- PGID=${DEMO_GID}
|
- PGID=${DEMO_GID}
|
||||||
labels:
|
labels:
|
||||||
@@ -324,13 +378,70 @@ services:
|
|||||||
homepage.icon: "archivebox"
|
homepage.icon: "archivebox"
|
||||||
homepage.href: "http://localhost:${ARCHIVEBOX_PORT}"
|
homepage.href: "http://localhost:${ARCHIVEBOX_PORT}"
|
||||||
homepage.description: "Web archiving solution"
|
homepage.description: "Web archiving solution"
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: 512M
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider",
|
test: ["CMD", "curl", "-fsS",
|
||||||
"http://localhost:8000"]
|
"http://localhost:8000/health/"]
|
||||||
|
interval: ${HEALTH_CHECK_INTERVAL}
|
||||||
|
timeout: ${HEALTH_CHECK_TIMEOUT}
|
||||||
|
retries: 5
|
||||||
|
start_period: 60s
|
||||||
|
|
||||||
|
# Tube Archivist - Redis
|
||||||
|
ta-redis:
|
||||||
|
image: redis:7-alpine
|
||||||
|
container_name: "${COMPOSE_PROJECT_NAME}-ta-redis"
|
||||||
|
restart: unless-stopped
|
||||||
|
networks:
|
||||||
|
- ${COMPOSE_NETWORK_NAME}
|
||||||
|
volumes:
|
||||||
|
- ${COMPOSE_PROJECT_NAME}_ta_redis_data:/data
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: 256M
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "redis-cli", "ping"]
|
||||||
interval: ${HEALTH_CHECK_INTERVAL}
|
interval: ${HEALTH_CHECK_INTERVAL}
|
||||||
timeout: ${HEALTH_CHECK_TIMEOUT}
|
timeout: ${HEALTH_CHECK_TIMEOUT}
|
||||||
retries: ${HEALTH_CHECK_RETRIES}
|
retries: ${HEALTH_CHECK_RETRIES}
|
||||||
|
|
||||||
|
# Tube Archivist - Elasticsearch
|
||||||
|
ta-elasticsearch:
|
||||||
|
image: elasticsearch:8.12.0
|
||||||
|
container_name: "${COMPOSE_PROJECT_NAME}-ta-elasticsearch"
|
||||||
|
restart: unless-stopped
|
||||||
|
networks:
|
||||||
|
- ${COMPOSE_NETWORK_NAME}
|
||||||
|
volumes:
|
||||||
|
- ${COMPOSE_PROJECT_NAME}_ta_es_data:/usr/share/elasticsearch/data
|
||||||
|
environment:
|
||||||
|
- discovery.type=single-node
|
||||||
|
- ES_JAVA_OPTS=${ES_JAVA_OPTS}
|
||||||
|
- xpack.security.enabled=false
|
||||||
|
- xpack.security.http.ssl.enabled=false
|
||||||
|
- bootstrap.memory_lock=true
|
||||||
|
- path.repo=/usr/share/elasticsearch/data/snapshot
|
||||||
|
ulimits:
|
||||||
|
memlock:
|
||||||
|
soft: -1
|
||||||
|
hard: -1
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: 1024M
|
||||||
|
healthcheck:
|
||||||
|
test:
|
||||||
|
["CMD-SHELL",
|
||||||
|
"curl -sf http://localhost:9200/_cluster/health || exit 1"]
|
||||||
|
interval: ${HEALTH_CHECK_INTERVAL}
|
||||||
|
timeout: ${HEALTH_CHECK_TIMEOUT}
|
||||||
|
retries: 10
|
||||||
|
start_period: 60s
|
||||||
|
|
||||||
# Tube Archivist - YouTube Archiving
|
# Tube Archivist - YouTube Archiving
|
||||||
tubearchivist:
|
tubearchivist:
|
||||||
image: bbilly1/tubearchivist:latest
|
image: bbilly1/tubearchivist:latest
|
||||||
@@ -343,18 +454,37 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ${COMPOSE_PROJECT_NAME}_tubearchivist_data:/cache
|
- ${COMPOSE_PROJECT_NAME}_tubearchivist_data:/cache
|
||||||
environment:
|
environment:
|
||||||
|
- ES_URL=http://ta-elasticsearch:9200
|
||||||
|
- REDIS_CON=redis://ta-redis:6379
|
||||||
|
- ELASTIC_PASSWORD=${ELASTIC_PASSWORD}
|
||||||
|
- HOST_UID=${DEMO_UID}
|
||||||
|
- HOST_GID=${DEMO_GID}
|
||||||
- TA_HOST=${TA_HOST}
|
- TA_HOST=${TA_HOST}
|
||||||
- TA_PORT=${TA_PORT}
|
- TA_USERNAME=${TA_USERNAME}
|
||||||
- TA_DEBUG=${TA_DEBUG}
|
- TA_PASSWORD=${TA_PASSWORD}
|
||||||
- TA_USERNAME=demo
|
- TZ=UTC
|
||||||
- PUID=${DEMO_UID}
|
depends_on:
|
||||||
- PGID=${DEMO_GID}
|
ta-redis:
|
||||||
|
condition: service_healthy
|
||||||
|
ta-elasticsearch:
|
||||||
|
condition: service_healthy
|
||||||
labels:
|
labels:
|
||||||
homepage.group: "Developer Tools"
|
homepage.group: "Developer Tools"
|
||||||
homepage.name: "Tube Archivist"
|
homepage.name: "Tube Archivist"
|
||||||
homepage.icon: "tube-archivist"
|
homepage.icon: "tube-archivist"
|
||||||
homepage.href: "http://localhost:${TUBE_ARCHIVIST_PORT}"
|
homepage.href: "http://localhost:${TUBE_ARCHIVIST_PORT}"
|
||||||
homepage.description: "YouTube video archiving"
|
homepage.description: "YouTube video archiving"
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: 512M
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "curl", "-f", "--silent",
|
||||||
|
"http://localhost:8000/api/health/"]
|
||||||
|
interval: ${HEALTH_CHECK_INTERVAL}
|
||||||
|
timeout: ${HEALTH_CHECK_TIMEOUT}
|
||||||
|
retries: 5
|
||||||
|
start_period: 120s
|
||||||
|
|
||||||
# Wakapi - Time Tracking
|
# Wakapi - Time Tracking
|
||||||
wakapi:
|
wakapi:
|
||||||
@@ -377,9 +507,12 @@ services:
|
|||||||
homepage.icon: "wakapi"
|
homepage.icon: "wakapi"
|
||||||
homepage.href: "http://localhost:${WAKAPI_PORT}"
|
homepage.href: "http://localhost:${WAKAPI_PORT}"
|
||||||
homepage.description: "Open-source WakaTime alternative"
|
homepage.description: "Open-source WakaTime alternative"
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: 256M
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider",
|
test: ["CMD", "/app/healthcheck"]
|
||||||
"http://localhost:3000"]
|
|
||||||
interval: ${HEALTH_CHECK_INTERVAL}
|
interval: ${HEALTH_CHECK_INTERVAL}
|
||||||
timeout: ${HEALTH_CHECK_TIMEOUT}
|
timeout: ${HEALTH_CHECK_TIMEOUT}
|
||||||
retries: ${HEALTH_CHECK_RETRIES}
|
retries: ${HEALTH_CHECK_RETRIES}
|
||||||
@@ -393,6 +526,7 @@ services:
|
|||||||
- ${COMPOSE_NETWORK_NAME}
|
- ${COMPOSE_NETWORK_NAME}
|
||||||
ports:
|
ports:
|
||||||
- "${MAILHOG_PORT}:8025"
|
- "${MAILHOG_PORT}:8025"
|
||||||
|
- "${MAILHOG_SMTP_PORT}:1025"
|
||||||
volumes:
|
volumes:
|
||||||
- ${COMPOSE_PROJECT_NAME}_mailhog_data:/maildir
|
- ${COMPOSE_PROJECT_NAME}_mailhog_data:/maildir
|
||||||
environment:
|
environment:
|
||||||
@@ -404,6 +538,10 @@ services:
|
|||||||
homepage.icon: "mailhog"
|
homepage.icon: "mailhog"
|
||||||
homepage.href: "http://localhost:${MAILHOG_PORT}"
|
homepage.href: "http://localhost:${MAILHOG_PORT}"
|
||||||
homepage.description: "Web and API based SMTP testing"
|
homepage.description: "Web and API based SMTP testing"
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: 128M
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider",
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider",
|
||||||
"http://localhost:8025"]
|
"http://localhost:8025"]
|
||||||
@@ -411,12 +549,14 @@ services:
|
|||||||
timeout: ${HEALTH_CHECK_TIMEOUT}
|
timeout: ${HEALTH_CHECK_TIMEOUT}
|
||||||
retries: ${HEALTH_CHECK_RETRIES}
|
retries: ${HEALTH_CHECK_RETRIES}
|
||||||
|
|
||||||
# Atuin - Shell History
|
# Atuin - Shell History Synchronization
|
||||||
atuin:
|
atuin:
|
||||||
image: ghcr.io/atuinsh/atuin:v18.10.0
|
image: ghcr.io/atuinsh/atuin:v18.10.0
|
||||||
container_name: "${COMPOSE_PROJECT_NAME}-atuin"
|
container_name: "${COMPOSE_PROJECT_NAME}-atuin"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
command: server start
|
command:
|
||||||
|
- server
|
||||||
|
- start
|
||||||
networks:
|
networks:
|
||||||
- ${COMPOSE_NETWORK_NAME}
|
- ${COMPOSE_NETWORK_NAME}
|
||||||
ports:
|
ports:
|
||||||
@@ -424,12 +564,24 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ${COMPOSE_PROJECT_NAME}_atuin_data:/config
|
- ${COMPOSE_PROJECT_NAME}_atuin_data:/config
|
||||||
environment:
|
environment:
|
||||||
|
- ATUIN_HOST=${ATUIN_HOST}
|
||||||
|
- ATUIN_PORT=8888
|
||||||
|
- ATUIN_OPEN_REGISTRATION=${ATUIN_OPEN_REGISTRATION}
|
||||||
- ATUIN_DB_URI=sqlite:///config/atuin.db
|
- ATUIN_DB_URI=sqlite:///config/atuin.db
|
||||||
- PUID=${DEMO_UID}
|
- RUST_LOG=info,atuin_server=info
|
||||||
- PGID=${DEMO_GID}
|
|
||||||
labels:
|
labels:
|
||||||
homepage.group: "Developer Tools"
|
homepage.group: "Developer Tools"
|
||||||
homepage.name: "Atuin"
|
homepage.name: "Atuin"
|
||||||
homepage.icon: "atuin"
|
homepage.icon: "atuin"
|
||||||
homepage.href: "http://localhost:${ATUIN_PORT}"
|
homepage.href: "http://localhost:${ATUIN_PORT}"
|
||||||
homepage.description: "Magical shell history synchronization"
|
homepage.description: "Magical shell history synchronization"
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: 256M
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "bash", "-c", "echo > /dev/tcp/localhost/8888"]
|
||||||
|
interval: ${HEALTH_CHECK_INTERVAL}
|
||||||
|
timeout: ${HEALTH_CHECK_TIMEOUT}
|
||||||
|
retries: 5
|
||||||
|
start_period: 30s
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ This document provides API endpoint information for all services in the stack.
|
|||||||
## Infrastructure Services APIs
|
## Infrastructure Services APIs
|
||||||
|
|
||||||
### Docker Socket Proxy
|
### Docker Socket Proxy
|
||||||
- **Base URL**: `http://localhost:4005`
|
- **Base URL: http://docker-socket-proxy:2375 (internal only, not accessible from host)`
|
||||||
- **API Version**: Docker Engine API
|
- **API Version**: Docker Engine API
|
||||||
- **Authentication**: None (restricted by proxy)
|
- **Authentication**: None (restricted by proxy)
|
||||||
- **Endpoints**:
|
- **Endpoints**:
|
||||||
@@ -27,7 +27,7 @@ This document provides API endpoint information for all services in the stack.
|
|||||||
|
|
||||||
### Dockhand
|
### Dockhand
|
||||||
- **Base URL**: `http://localhost:4007`
|
- **Base URL**: `http://localhost:4007`
|
||||||
- **Authentication**: Direct Docker API access
|
- **Authentication**: Web UI with direct Docker socket access
|
||||||
- **Features**:
|
- **Features**:
|
||||||
- Container lifecycle management
|
- Container lifecycle management
|
||||||
- Compose stack orchestration
|
- Compose stack orchestration
|
||||||
@@ -156,10 +156,10 @@ This document provides API endpoint information for all services in the stack.
|
|||||||
### Docker Socket Proxy Example
|
### Docker Socket Proxy Example
|
||||||
```bash
|
```bash
|
||||||
# Get Docker version
|
# Get Docker version
|
||||||
curl http://localhost:4005/version
|
# curl http://localhost:4005/version (internal only)
|
||||||
|
|
||||||
# List containers
|
# List containers
|
||||||
curl http://localhost:4005/containers/json
|
# curl http://localhost:4005/containers/json (internal only)
|
||||||
```
|
```
|
||||||
|
|
||||||
### InfluxDB Example
|
### InfluxDB Example
|
||||||
@@ -255,7 +255,7 @@ All services provide health check endpoints:
|
|||||||
### Testing APIs
|
### Testing APIs
|
||||||
```bash
|
```bash
|
||||||
# Test all health endpoints
|
# Test all health endpoints
|
||||||
for port in 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4017 4018; do
|
for port in 4000 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4017 4018; do
|
||||||
echo "Testing port $port..."
|
echo "Testing port $port..."
|
||||||
curl -f -s "http://localhost:$port/health" || \
|
curl -f -s "http://localhost:$port/health" || \
|
||||||
curl -f -s "http://localhost:$port/ping" || \
|
curl -f -s "http://localhost:$port/ping" || \
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ All services are accessible through the Homepage dashboard at http://localhost:4
|
|||||||
- **Homepage** (Port 4000): Central dashboard for service discovery
|
- **Homepage** (Port 4000): Central dashboard for service discovery
|
||||||
- **Atomic Tracker** (Port 4012): Habit tracking and personal dashboard
|
- **Atomic Tracker** (Port 4012): Habit tracking and personal dashboard
|
||||||
- **ArchiveBox** (Port 4013): Web archiving solution
|
- **ArchiveBox** (Port 4013): Web archiving solution
|
||||||
- **Tube Archivist** (Port 4014): YouTube video archiving
|
- **Tube Archivist** (Port 4014): YouTube video archiving (requires internal ta-redis + ta-elasticsearch)
|
||||||
- **Wakapi** (Port 4015): Open-source WakaTime alternative
|
- **Wakapi** (Port 4015): Open-source WakaTime alternative
|
||||||
- **MailHog** (Port 4017): Web and API based SMTP testing
|
- **MailHog** (Port 4017): Web and API based SMTP testing
|
||||||
- **Atuin** (Port 4018): Magical shell history synchronization
|
- **Atuin** (Port 4018): Magical shell history synchronization
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
# TSYS Developer Support Stack - Troubleshooting Guide
|
# TSYS Developer Support Stack - Troubleshooting Guide
|
||||||
|
|
||||||
|
> **Note:** All commands in this guide assume your working directory is the `demo/` folder of the repository. Run `cd demo` first if needed.
|
||||||
|
|
||||||
## Common Issues and Solutions
|
## Common Issues and Solutions
|
||||||
|
|
||||||
### Services Not Starting
|
### Services Not Starting
|
||||||
@@ -55,10 +57,10 @@ docker stats
|
|||||||
**Solution**:
|
**Solution**:
|
||||||
```bash
|
```bash
|
||||||
# Check network exists
|
# Check network exists
|
||||||
docker network ls | grep tsysdevstack
|
docker network ls | grep kneldevstack
|
||||||
|
|
||||||
# Recreate network
|
# Recreate network
|
||||||
docker network create tsysdevstack_supportstack-demo
|
docker network create --subnet 192.168.3.0/24 --gateway 192.168.3.1 kneldevstack-supportstack-demo-network
|
||||||
|
|
||||||
# Restart stack
|
# Restart stack
|
||||||
docker compose down && docker compose up -d
|
docker compose down && docker compose up -d
|
||||||
@@ -77,7 +79,7 @@ id
|
|||||||
cat demo.env | grep -E "(UID|GID)"
|
cat demo.env | grep -E "(UID|GID)"
|
||||||
|
|
||||||
# Fix volume permissions
|
# Fix volume permissions
|
||||||
sudo chown -R $(id -u):$(id -g) /var/lib/docker/volumes/tsysdevstack_*
|
sudo chown -R $(id -u):$(id -g) /var/lib/docker/volumes/kneldevstack-supportstack-demo_*
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Issue: Docker group access
|
#### Issue: Docker group access
|
||||||
@@ -98,13 +100,13 @@ newgrp docker
|
|||||||
**Solution**:
|
**Solution**:
|
||||||
```bash
|
```bash
|
||||||
# Check Pi-hole status
|
# Check Pi-hole status
|
||||||
docker exec tsysdevstack-supportstack-demo-pihole pihole status
|
docker exec kneldevstack-supportstack-demo-pihole pihole status
|
||||||
|
|
||||||
# Test DNS resolution
|
# Test DNS resolution
|
||||||
nslookup google.com localhost
|
nslookup google.com localhost
|
||||||
|
|
||||||
# Restart DNS service
|
# Restart DNS service
|
||||||
docker exec tsysdevstack-supportstack-demo-pihole pihole restartdns
|
docker exec kneldevstack-supportstack-demo-pihole pihole restartdns
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Grafana Data Source Connection
|
#### Grafana Data Source Connection
|
||||||
@@ -128,8 +130,8 @@ docker compose logs grafana
|
|||||||
# Check Dockhand logs
|
# Check Dockhand logs
|
||||||
docker compose logs dockhand
|
docker compose logs dockhand
|
||||||
|
|
||||||
# Verify Docker socket access
|
# Verify Docker socket access (check socket is mounted)
|
||||||
docker exec tsysdevstack-supportstack-demo-dockhand docker version
|
docker inspect kneldevstack-supportstack-demo-dockhand --format '{{.Mounts}}' | grep docker.sock
|
||||||
|
|
||||||
# Restart Dockhand
|
# Restart Dockhand
|
||||||
docker compose restart dockhand
|
docker compose restart dockhand
|
||||||
@@ -198,13 +200,13 @@ docker stats
|
|||||||
|
|
||||||
# Network info
|
# Network info
|
||||||
docker network ls
|
docker network ls
|
||||||
docker network inspect tsysdevstack_supportstack-demo
|
docker network inspect kneldevstack-supportstack-demo
|
||||||
```
|
```
|
||||||
|
|
||||||
### Health Checks
|
### Health Checks
|
||||||
```bash
|
```bash
|
||||||
# Test all endpoints
|
# Test all endpoints
|
||||||
for port in 4000 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4017 4018; do
|
for port in 4000 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4017 4018; do
|
||||||
curl -f -s --max-time 5 "http://localhost:$port" && echo "Port $port: OK" || echo "Port $port: FAIL"
|
curl -f -s --max-time 5 "http://localhost:$port" && echo "Port $port: OK" || echo "Port $port: FAIL"
|
||||||
done
|
done
|
||||||
```
|
```
|
||||||
@@ -262,11 +264,10 @@ docker system prune -f
|
|||||||
- User must be in docker group
|
- User must be in docker group
|
||||||
|
|
||||||
### Port Requirements
|
### Port Requirements
|
||||||
All ports 4000-4018 must be available:
|
The following host ports must be available (not a continuous range):
|
||||||
- 4000: Homepage
|
- 4000: Homepage
|
||||||
- 4005: Docker Socket Proxy
|
|
||||||
- 4006: Pi-hole
|
- 4006: Pi-hole
|
||||||
- 4007: Portainer
|
- 4007: Dockhand
|
||||||
- 4008: InfluxDB
|
- 4008: InfluxDB
|
||||||
- 4009: Grafana
|
- 4009: Grafana
|
||||||
- 4010: Draw.io
|
- 4010: Draw.io
|
||||||
@@ -278,6 +279,8 @@ All ports 4000-4018 must be available:
|
|||||||
- 4017: MailHog
|
- 4017: MailHog
|
||||||
- 4018: Atuin
|
- 4018: Atuin
|
||||||
|
|
||||||
|
Note: Docker Socket Proxy (4005), Redis, and Elasticsearch are internal-only and do not require host ports.
|
||||||
|
|
||||||
## Contact and Support
|
## Contact and Support
|
||||||
|
|
||||||
If issues persist after trying these solutions:
|
If issues persist after trying these solutions:
|
||||||
|
|||||||
@@ -1,291 +1,247 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# TSYS Developer Support Stack - Demo Deployment Script
|
|
||||||
# Version: 1.0
|
|
||||||
# Purpose: Dynamic deployment with user detection and validation
|
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# Script Configuration
|
DEMO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
ENV_FILE="$DEMO_DIR/demo.env"
|
||||||
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
|
ENV_TEMPLATE="$DEMO_DIR/demo.env.template"
|
||||||
DEMO_ENV_FILE="$PROJECT_ROOT/demo.env"
|
TEMPLATE_FILE="$DEMO_DIR/docker-compose.yml.template"
|
||||||
COMPOSE_FILE="$PROJECT_ROOT/docker-compose.yml"
|
COMPOSE_FILE="$DEMO_DIR/docker-compose.yml"
|
||||||
|
|
||||||
# Color Codes for Output
|
|
||||||
RED='\033[0;31m'
|
RED='\033[0;31m'
|
||||||
GREEN='\033[0;32m'
|
GREEN='\033[0;32m'
|
||||||
YELLOW='\033[1;33m'
|
YELLOW='\033[1;33m'
|
||||||
BLUE='\033[0;34m'
|
BLUE='\033[0;34m'
|
||||||
NC='\033[0m' # No Color
|
NC='\033[0m'
|
||||||
|
|
||||||
# Logging Functions
|
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
|
||||||
log_info() {
|
log_success() { echo -e "${GREEN}[OK]${NC} $1"; }
|
||||||
echo -e "${BLUE}[INFO]${NC} $1"
|
log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
|
||||||
|
log_error() { echo -e "${RED}[ERROR]${NC} $1"; }
|
||||||
|
|
||||||
|
ensure_env() {
|
||||||
|
if [[ ! -f "$ENV_FILE" ]]; then
|
||||||
|
if [[ -f "$ENV_TEMPLATE" ]]; then
|
||||||
|
log_info "Creating demo.env from template..."
|
||||||
|
cp "$ENV_TEMPLATE" "$ENV_FILE"
|
||||||
|
else
|
||||||
|
log_error "No demo.env or demo.env.template found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
# Ensure new variables exist in older env files
|
||||||
|
grep -q '^MAILHOG_SMTP_PORT=' "$ENV_FILE" || echo "MAILHOG_SMTP_PORT=4019" >> "$ENV_FILE"
|
||||||
|
grep -q '^HOMEPAGE_ALLOWED_HOSTS=' "$ENV_FILE" || echo "HOMEPAGE_ALLOWED_HOSTS=*" >> "$ENV_FILE"
|
||||||
}
|
}
|
||||||
|
|
||||||
log_success() {
|
detect_user() {
|
||||||
echo -e "${GREEN}[SUCCESS]${NC} $1"
|
log_info "Detecting user IDs..."
|
||||||
}
|
local uid gid docker_gid
|
||||||
|
|
||||||
log_warning() {
|
|
||||||
echo -e "${YELLOW}[WARNING]${NC} $1"
|
|
||||||
}
|
|
||||||
|
|
||||||
log_error() {
|
|
||||||
echo -e "${RED}[ERROR]${NC} $1"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to detect current user and group IDs
|
|
||||||
detect_user_ids() {
|
|
||||||
log_info "Detecting user and group IDs..."
|
|
||||||
|
|
||||||
local uid
|
|
||||||
local gid
|
|
||||||
local docker_gid
|
|
||||||
uid=$(id -u)
|
uid=$(id -u)
|
||||||
gid=$(id -g)
|
gid=$(id -g)
|
||||||
docker_gid=$(getent group docker | cut -d: -f3)
|
docker_gid=$(getent group docker | cut -d: -f3)
|
||||||
|
sed -i "s/^DEMO_UID=.*/DEMO_UID=$uid/" "$ENV_FILE"
|
||||||
if [[ -z "$docker_gid" ]]; then
|
sed -i "s/^DEMO_GID=.*/DEMO_GID=$gid/" "$ENV_FILE"
|
||||||
log_error "Docker group not found. Please ensure Docker is installed and user is in docker group."
|
sed -i "s/^DEMO_DOCKER_GID=.*/DEMO_DOCKER_GID=$docker_gid/" "$ENV_FILE"
|
||||||
exit 1
|
log_success "UID=$uid GID=$gid DockerGID=$docker_gid"
|
||||||
fi
|
|
||||||
|
|
||||||
log_info "Detected UID: $uid, GID: $gid, Docker GID: $docker_gid"
|
|
||||||
|
|
||||||
# Update demo.env with detected values
|
|
||||||
sed -i "s/^DEMO_UID=$/DEMO_UID=$uid/" "$DEMO_ENV_FILE"
|
|
||||||
sed -i "s/^DEMO_GID=$/DEMO_GID=$gid/" "$DEMO_ENV_FILE"
|
|
||||||
sed -i "s/^DEMO_DOCKER_GID=$/DEMO_DOCKER_GID=$docker_gid/" "$DEMO_ENV_FILE"
|
|
||||||
|
|
||||||
log_success "User IDs detected and configured"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to validate prerequisites
|
check_prerequisites() {
|
||||||
validate_prerequisites() {
|
log_info "Checking prerequisites..."
|
||||||
log_info "Validating prerequisites..."
|
if ! docker info >/dev/null 2>&1; then
|
||||||
|
log_error "Docker is not running"
|
||||||
# Check if Docker is installed and running
|
|
||||||
if ! command -v docker &> /dev/null; then
|
|
||||||
log_error "Docker is not installed or not in PATH"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
if ! command -v envsubst >/dev/null 2>&1; then
|
||||||
if ! docker info &> /dev/null; then
|
log_error "envsubst not found (install gettext package)"
|
||||||
log_error "Docker daemon is not running"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
local max_map_count
|
||||||
# Check if Docker Compose is available
|
max_map_count=$(sysctl -n vm.max_map_count 2>/dev/null || echo "0")
|
||||||
if ! command -v docker-compose &> /dev/null && ! docker compose version &> /dev/null; then
|
if [[ "$max_map_count" -lt 262144 ]]; then
|
||||||
log_error "Docker Compose is not installed"
|
log_warn "Setting vm.max_map_count=262144 for Elasticsearch..."
|
||||||
exit 1
|
if sudo sysctl -w vm.max_map_count=262144 2>/dev/null; then
|
||||||
|
log_success "vm.max_map_count set"
|
||||||
|
else
|
||||||
|
log_warn "Could not set vm.max_map_count (TubeArchivist ES may fail)"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
log_success "Prerequisites OK"
|
||||||
# Check if demo.env exists
|
|
||||||
if [[ ! -f "$DEMO_ENV_FILE" ]]; then
|
|
||||||
log_error "demo.env file not found at $DEMO_ENV_FILE"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
log_success "Prerequisites validation passed"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to generate docker-compose.yml from template
|
generate_compose() {
|
||||||
generate_compose_file() {
|
log_info "Generating docker-compose.yml from template..."
|
||||||
log_info "Generating docker-compose.yml..."
|
set -a; source "$ENV_FILE"; set +a
|
||||||
|
envsubst < "$TEMPLATE_FILE" > "$COMPOSE_FILE"
|
||||||
# Check if template exists (will be created in next phase)
|
log_success "docker-compose.yml generated"
|
||||||
local template_file="$PROJECT_ROOT/docker-compose.yml.template"
|
|
||||||
if [[ ! -f "$template_file" ]]; then
|
|
||||||
log_error "Docker Compose template not found at $template_file"
|
|
||||||
log_info "Please ensure the template file is created before running deployment"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Source and export environment variables
|
|
||||||
# shellcheck disable=SC1090,SC1091
|
|
||||||
set -a
|
|
||||||
source "$DEMO_ENV_FILE"
|
|
||||||
set +a
|
|
||||||
|
|
||||||
# Generate docker-compose.yml from template
|
|
||||||
envsubst < "$template_file" > "$COMPOSE_FILE"
|
|
||||||
|
|
||||||
log_success "docker-compose.yml generated successfully"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to deploy the stack
|
|
||||||
deploy_stack() {
|
deploy_stack() {
|
||||||
log_info "Deploying TSYS Developer Support Stack..."
|
log_info "Deploying TSYS Developer Support Stack..."
|
||||||
|
cd "$DEMO_DIR"
|
||||||
# Change to project directory
|
docker compose up -d 2>&1
|
||||||
cd "$PROJECT_ROOT"
|
|
||||||
|
|
||||||
# Deploy the stack
|
|
||||||
if command -v docker-compose &> /dev/null; then
|
|
||||||
docker-compose -f "$COMPOSE_FILE" up -d
|
|
||||||
else
|
|
||||||
docker compose -f "$COMPOSE_FILE" up -d
|
|
||||||
fi
|
|
||||||
|
|
||||||
log_success "Stack deployment initiated"
|
log_success "Stack deployment initiated"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to wait for services to be healthy
|
wait_healthy() {
|
||||||
wait_for_services() {
|
log_info "Waiting for services to become healthy (max 5 min)..."
|
||||||
log_info "Waiting for services to become healthy..."
|
local elapsed=0 interval=15
|
||||||
|
while [[ $elapsed -lt 300 ]]; do
|
||||||
local max_wait=300 # 5 minutes
|
local unhealthy=0
|
||||||
local wait_interval=10
|
while IFS= read -r name; do
|
||||||
local elapsed=0
|
local health
|
||||||
|
health=$(docker inspect --format='{{.State.Health.Status}}' "$name" 2>/dev/null || echo "unknown")
|
||||||
while [[ $elapsed -lt $max_wait ]]; do
|
if [[ "$health" != "healthy" ]]; then
|
||||||
local unhealthy_services=0
|
unhealthy=$((unhealthy + 1))
|
||||||
|
|
||||||
# Check service health (will be implemented with actual service names)
|
|
||||||
if command -v docker-compose &> /dev/null; then
|
|
||||||
mapfile -t services < <(docker-compose -f "$COMPOSE_FILE" config --services)
|
|
||||||
else
|
|
||||||
mapfile -t services < <(docker compose -f "$COMPOSE_FILE" config --services)
|
|
||||||
fi
|
|
||||||
|
|
||||||
for service in "${services[@]}"; do
|
|
||||||
local health_status
|
|
||||||
if command -v docker-compose &> /dev/null; then
|
|
||||||
health_status=$(docker-compose -f "$COMPOSE_FILE" ps -q "$service" | xargs docker inspect --format='{{.State.Health.Status}}' 2>/dev/null || echo "none")
|
|
||||||
else
|
|
||||||
health_status=$(docker compose -f "$COMPOSE_FILE" ps -q "$service" | xargs docker inspect --format='{{.State.Health.Status}}' 2>/dev/null || echo "none")
|
|
||||||
fi
|
fi
|
||||||
|
done < <(docker ps --filter "name=${COMPOSE_PROJECT_NAME:-kneldevstack}" --format '{{.Names}}' 2>/dev/null)
|
||||||
|
|
||||||
if [[ "$health_status" != "healthy" && "$health_status" != "none" ]]; then
|
if [[ $unhealthy -eq 0 ]]; then
|
||||||
((unhealthy_services++))
|
log_success "All services healthy"
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [[ $unhealthy_services -eq 0 ]]; then
|
|
||||||
log_success "All services are healthy"
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
log_info " $unhealthy services not yet healthy (${elapsed}s elapsed)"
|
||||||
log_info "$unhealthy_services services still unhealthy... waiting ${wait_interval}s"
|
sleep $interval
|
||||||
sleep $wait_interval
|
elapsed=$((elapsed + interval))
|
||||||
elapsed=$((elapsed + wait_interval))
|
|
||||||
done
|
done
|
||||||
|
log_warn "Timeout - some services may not be fully healthy"
|
||||||
log_warning "Timeout reached. Some services may not be fully healthy."
|
cd "$DEMO_DIR" && docker compose ps
|
||||||
return 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to display deployment summary
|
|
||||||
display_summary() {
|
display_summary() {
|
||||||
log_success "TSYS Developer Support Stack Deployment Summary"
|
set -a; source "$ENV_FILE"; set +a
|
||||||
echo "=================================================="
|
echo ""
|
||||||
echo "📊 Homepage Dashboard: http://localhost:${HOMEPAGE_PORT:-4000}"
|
echo "========================================================"
|
||||||
echo "🏗️ Infrastructure Services:"
|
echo " TSYS Developer Support Stack - Deployment Summary"
|
||||||
echo " - Pi-hole (DNS): http://localhost:${PIHOLE_PORT:-4006}"
|
echo "========================================================"
|
||||||
echo " - Dockhand (Containers): http://localhost:${DOCKHAND_PORT:-4007}"
|
echo ""
|
||||||
echo "📊 Monitoring & Observability:"
|
echo " Infrastructure:"
|
||||||
echo " - InfluxDB (Database): http://localhost:${INFLUXDB_PORT:-4008}"
|
echo " Homepage Dashboard http://localhost:${HOMEPAGE_PORT}"
|
||||||
echo " - Grafana (Visualization): http://localhost:${GRAFANA_PORT:-4009}"
|
echo " Pi-hole (DNS) http://localhost:${PIHOLE_PORT}"
|
||||||
echo "📚 Documentation & Diagramming:"
|
echo " Dockhand (Docker) http://localhost:${DOCKHAND_PORT}"
|
||||||
echo " - Draw.io (Diagrams): http://localhost:${DRAWIO_PORT:-4010}"
|
echo ""
|
||||||
echo " - Kroki (Diagrams as Service): http://localhost:${KROKI_PORT:-4011}"
|
echo " Monitoring:"
|
||||||
echo "🛠️ Developer Tools:"
|
echo " InfluxDB http://localhost:${INFLUXDB_PORT}"
|
||||||
echo " - Atomic Tracker (Habits): http://localhost:${ATOMIC_TRACKER_PORT:-4012}"
|
echo " Grafana http://localhost:${GRAFANA_PORT}"
|
||||||
echo " - ArchiveBox (Archiving): http://localhost:${ARCHIVEBOX_PORT:-4013}"
|
echo ""
|
||||||
echo " - Tube Archivist (YouTube): http://localhost:${TUBE_ARCHIVIST_PORT:-4014}"
|
echo " Documentation:"
|
||||||
echo " - Wakapi (Time Tracking): http://localhost:${WAKAPI_PORT:-4015}"
|
echo " Draw.io http://localhost:${DRAWIO_PORT}"
|
||||||
echo " - MailHog (Email Testing): http://localhost:${MAILHOG_PORT:-4017}"
|
echo " Kroki http://localhost:${KROKI_PORT}"
|
||||||
echo " - Atuin (Shell History): http://localhost:${ATUIN_PORT:-4018}"
|
echo ""
|
||||||
echo "=================================================="
|
echo " Developer Tools:"
|
||||||
echo "🔐 Demo Credentials:"
|
echo " Atomic Tracker http://localhost:${ATOMIC_TRACKER_PORT}"
|
||||||
echo " Username: ${DEMO_ADMIN_USER:-admin}"
|
echo " ArchiveBox http://localhost:${ARCHIVEBOX_PORT}"
|
||||||
echo " Password: ${DEMO_ADMIN_PASSWORD:-demo_password}"
|
echo " Tube Archivist http://localhost:${TUBE_ARCHIVIST_PORT}"
|
||||||
echo "⚠️ FOR DEMONSTRATION PURPOSES ONLY - NOT FOR PRODUCTION"
|
echo " Wakapi http://localhost:${WAKAPI_PORT}"
|
||||||
|
echo " MailHog (Web) http://localhost:${MAILHOG_PORT}"
|
||||||
|
echo " MailHog (SMTP) localhost:${MAILHOG_SMTP_PORT}"
|
||||||
|
echo " Atuin http://localhost:${ATUIN_PORT}"
|
||||||
|
echo ""
|
||||||
|
echo " Credentials: admin / demo_password"
|
||||||
|
echo " FOR DEMONSTRATION PURPOSES ONLY"
|
||||||
|
echo "========================================================"
|
||||||
|
}
|
||||||
|
|
||||||
|
smoke_test() {
|
||||||
|
log_info "Running smoke tests..."
|
||||||
|
set -a; source "$ENV_FILE"; set +a
|
||||||
|
local ports=(
|
||||||
|
"${HOMEPAGE_PORT}:Homepage"
|
||||||
|
"${PIHOLE_PORT}:Pi-hole"
|
||||||
|
"${DOCKHAND_PORT}:Dockhand"
|
||||||
|
"${INFLUXDB_PORT}:InfluxDB"
|
||||||
|
"${GRAFANA_PORT}:Grafana"
|
||||||
|
"${DRAWIO_PORT}:Draw.io"
|
||||||
|
"${KROKI_PORT}:Kroki"
|
||||||
|
"${ATOMIC_TRACKER_PORT}:AtomicTracker"
|
||||||
|
"${ARCHIVEBOX_PORT}:ArchiveBox"
|
||||||
|
"${TUBE_ARCHIVIST_PORT}:TubeArchivist"
|
||||||
|
"${WAKAPI_PORT}:Wakapi"
|
||||||
|
"${MAILHOG_PORT}:MailHog"
|
||||||
|
"${ATUIN_PORT}:Atuin"
|
||||||
|
)
|
||||||
|
local pass=0 fail=0
|
||||||
|
for pt in "${ports[@]}"; do
|
||||||
|
local port="${pt%:*}"
|
||||||
|
local svc="${pt#*:}"
|
||||||
|
if timeout 5 bash -c "echo > /dev/tcp/localhost/$port" 2>/dev/null; then
|
||||||
|
log_success "$svc (:$port)"
|
||||||
|
((pass++)) || true
|
||||||
|
else
|
||||||
|
log_error "$svc (:$port) NOT accessible"
|
||||||
|
((fail++)) || true
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo ""
|
||||||
|
echo "SMOKE TEST: $pass passed, $fail failed"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to stop the stack
|
|
||||||
stop_stack() {
|
stop_stack() {
|
||||||
log_info "Stopping TSYS Developer Support Stack..."
|
log_info "Stopping stack..."
|
||||||
|
cd "$DEMO_DIR"
|
||||||
cd "$PROJECT_ROOT"
|
docker compose down 2>&1
|
||||||
|
|
||||||
if command -v docker-compose &> /dev/null; then
|
|
||||||
docker-compose -f "$COMPOSE_FILE" down
|
|
||||||
else
|
|
||||||
docker compose -f "$COMPOSE_FILE" down
|
|
||||||
fi
|
|
||||||
|
|
||||||
log_success "Stack stopped"
|
log_success "Stack stopped"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to restart the stack
|
show_status() {
|
||||||
restart_stack() {
|
cd "$DEMO_DIR"
|
||||||
log_info "Restarting TSYS Developer Support Stack..."
|
docker compose ps
|
||||||
stop_stack
|
|
||||||
sleep 5
|
|
||||||
deploy_stack
|
|
||||||
wait_for_services
|
|
||||||
display_summary
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to show usage
|
|
||||||
show_usage() {
|
show_usage() {
|
||||||
echo "Usage: $0 {deploy|stop|restart|status|help}"
|
echo "TSYS Developer Support Stack"
|
||||||
|
echo ""
|
||||||
|
echo "Usage: $0 {deploy|stop|restart|status|smoke|summary|help}"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Commands:"
|
echo "Commands:"
|
||||||
echo " deploy - Deploy the complete stack"
|
echo " deploy Deploy the complete stack"
|
||||||
echo " stop - Stop all services"
|
echo " stop Stop all services"
|
||||||
echo " restart - Restart all services"
|
echo " restart Stop and redeploy"
|
||||||
echo " status - Show service status"
|
echo " status Show service status"
|
||||||
echo " help - Show this help message"
|
echo " smoke Run port accessibility tests"
|
||||||
|
echo " summary Show service URLs"
|
||||||
|
echo " help Show this help"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to show status
|
ensure_env
|
||||||
show_status() {
|
|
||||||
log_info "TSYS Developer Support Stack Status"
|
|
||||||
echo "===================================="
|
|
||||||
|
|
||||||
cd "$PROJECT_ROOT"
|
case "${1:-deploy}" in
|
||||||
|
deploy)
|
||||||
if command -v docker-compose &> /dev/null; then
|
detect_user
|
||||||
docker-compose -f "$COMPOSE_FILE" ps
|
check_prerequisites
|
||||||
else
|
generate_compose
|
||||||
docker compose -f "$COMPOSE_FILE" ps
|
deploy_stack
|
||||||
fi
|
wait_healthy
|
||||||
}
|
display_summary
|
||||||
|
smoke_test
|
||||||
# Main script execution
|
;;
|
||||||
main() {
|
stop)
|
||||||
case "${1:-deploy}" in
|
stop_stack
|
||||||
deploy)
|
;;
|
||||||
validate_prerequisites
|
restart)
|
||||||
detect_user_ids
|
stop_stack
|
||||||
generate_compose_file
|
sleep 5
|
||||||
deploy_stack
|
detect_user
|
||||||
wait_for_services
|
check_prerequisites
|
||||||
display_summary
|
generate_compose
|
||||||
;;
|
deploy_stack
|
||||||
stop)
|
wait_healthy
|
||||||
stop_stack
|
display_summary
|
||||||
;;
|
;;
|
||||||
restart)
|
status)
|
||||||
restart_stack
|
show_status
|
||||||
;;
|
;;
|
||||||
status)
|
smoke)
|
||||||
show_status
|
smoke_test
|
||||||
;;
|
;;
|
||||||
help|--help|-h)
|
summary)
|
||||||
show_usage
|
display_summary
|
||||||
;;
|
;;
|
||||||
*)
|
help|--help|-h)
|
||||||
log_error "Unknown command: $1"
|
show_usage
|
||||||
show_usage
|
;;
|
||||||
exit 1
|
*)
|
||||||
;;
|
log_error "Unknown command: $1"
|
||||||
esac
|
show_usage
|
||||||
}
|
exit 1
|
||||||
|
;;
|
||||||
# Execute main function with all arguments
|
esac
|
||||||
main "$@"
|
|
||||||
|
|||||||
@@ -1,347 +1,192 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# TSYS Developer Support Stack - Demo Testing Script
|
# TSYS Developer Support Stack - Demo Testing Script
|
||||||
# Version: 1.0
|
# Version: 2.0
|
||||||
# Purpose: Comprehensive QA and validation
|
# Purpose: Comprehensive QA and validation
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# Script Configuration
|
|
||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
|
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
|
||||||
DEMO_ENV_FILE="$PROJECT_ROOT/demo.env"
|
DEMO_ENV_FILE="$PROJECT_ROOT/demo.env"
|
||||||
COMPOSE_FILE="$PROJECT_ROOT/docker-compose.yml"
|
COMPOSE_FILE="$PROJECT_ROOT/docker-compose.yml"
|
||||||
|
|
||||||
# Color Codes for Output
|
|
||||||
RED='\033[0;31m'
|
RED='\033[0;31m'
|
||||||
GREEN='\033[0;32m'
|
GREEN='\033[0;32m'
|
||||||
YELLOW='\033[1;33m'
|
YELLOW='\033[1;33m'
|
||||||
BLUE='\033[0;34m'
|
BLUE='\033[0;34m'
|
||||||
NC='\033[0m' # No Color
|
NC='\033[0m'
|
||||||
|
|
||||||
# Test Results
|
|
||||||
TESTS_PASSED=0
|
TESTS_PASSED=0
|
||||||
TESTS_FAILED=0
|
TESTS_FAILED=0
|
||||||
TESTS_TOTAL=0
|
TESTS_TOTAL=0
|
||||||
|
|
||||||
# Logging Functions
|
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
|
||||||
log_info() {
|
log_success() { echo -e "${GREEN}[PASS]${NC} $1"; ((TESTS_PASSED++)) || true; }
|
||||||
echo -e "${BLUE}[INFO]${NC} $1"
|
log_warning() { echo -e "${YELLOW}[WARN]${NC} $1"; }
|
||||||
}
|
log_error() { echo -e "${RED}[FAIL]${NC} $1"; ((TESTS_FAILED++)) || true; }
|
||||||
|
log_test() { echo -e "${BLUE}[TEST]${NC} $1"; ((TESTS_TOTAL++)) || true; }
|
||||||
|
|
||||||
log_success() {
|
|
||||||
echo -e "${GREEN}[PASS]${NC} $1"
|
|
||||||
((TESTS_PASSED++))
|
|
||||||
}
|
|
||||||
|
|
||||||
log_warning() {
|
|
||||||
echo -e "${YELLOW}[WARNING]${NC} $1"
|
|
||||||
}
|
|
||||||
|
|
||||||
log_error() {
|
|
||||||
echo -e "${RED}[FAIL]${NC} $1"
|
|
||||||
((TESTS_FAILED++))
|
|
||||||
}
|
|
||||||
|
|
||||||
log_test() {
|
|
||||||
echo -e "${BLUE}[TEST]${NC} $1"
|
|
||||||
((TESTS_TOTAL++))
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to test file ownership
|
|
||||||
test_file_ownership() {
|
test_file_ownership() {
|
||||||
log_test "Testing file ownership (no root-owned files)..."
|
log_test "File ownership (no root-owned files)"
|
||||||
|
local root_files
|
||||||
local project_root_files
|
root_files=$(find "$PROJECT_ROOT" -type f -user root 2>/dev/null || true)
|
||||||
project_root_files=$(find "$PROJECT_ROOT" -type f -user root 2>/dev/null || true)
|
if [[ -z "$root_files" ]]; then
|
||||||
|
log_success "No root-owned files"
|
||||||
if [[ -z "$project_root_files" ]]; then
|
|
||||||
log_success "No root-owned files found in project directory"
|
|
||||||
else
|
else
|
||||||
log_error "Root-owned files found:"
|
log_error "Root-owned files found: $root_files"
|
||||||
echo "$project_root_files"
|
|
||||||
return 1
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to test user mapping
|
|
||||||
test_user_mapping() {
|
test_user_mapping() {
|
||||||
log_test "Testing UID/GID detection and application..."
|
log_test "UID/GID detection"
|
||||||
|
|
||||||
# Source environment variables
|
|
||||||
# shellcheck disable=SC1090,SC1091
|
|
||||||
source "$DEMO_ENV_FILE"
|
source "$DEMO_ENV_FILE"
|
||||||
|
if [[ -z "${DEMO_UID:-}" || -z "${DEMO_GID:-}" ]]; then
|
||||||
# Check if UID/GID are set
|
log_error "DEMO_UID or DEMO_GID not set"
|
||||||
if [[ -z "$DEMO_UID" || -z "$DEMO_GID" ]]; then
|
return
|
||||||
log_error "DEMO_UID or DEMO_GID not set in demo.env"
|
|
||||||
return 1
|
|
||||||
fi
|
fi
|
||||||
|
local cur_uid cur_gid
|
||||||
# Check if values match current user
|
cur_uid=$(id -u)
|
||||||
local current_uid
|
cur_gid=$(id -g)
|
||||||
local current_gid
|
if [[ "$DEMO_UID" -eq "$cur_uid" && "$DEMO_GID" -eq "$cur_gid" ]]; then
|
||||||
current_uid=$(id -u)
|
log_success "UID/GID correct ($DEMO_UID/$DEMO_GID)"
|
||||||
current_gid=$(id -g)
|
|
||||||
|
|
||||||
if [[ "$DEMO_UID" -eq "$current_uid" && "$DEMO_GID" -eq "$current_gid" ]]; then
|
|
||||||
log_success "UID/GID correctly detected and applied (UID: $DEMO_UID, GID: $DEMO_GID)"
|
|
||||||
else
|
else
|
||||||
log_error "UID/GID mismatch. Expected: $current_uid/$current_gid, Found: $DEMO_UID/$DEMO_GID"
|
log_error "UID/GID mismatch: env=$DEMO_UID/$DEMO_GID actual=$cur_uid/$cur_gid"
|
||||||
return 1
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to test Docker group access
|
|
||||||
test_docker_group() {
|
test_docker_group() {
|
||||||
log_test "Testing Docker group access..."
|
log_test "Docker group access"
|
||||||
|
|
||||||
# shellcheck disable=SC1090,SC1091
|
|
||||||
source "$DEMO_ENV_FILE"
|
source "$DEMO_ENV_FILE"
|
||||||
|
if [[ -z "${DEMO_DOCKER_GID:-}" ]]; then
|
||||||
if [[ -z "$DEMO_DOCKER_GID" ]]; then
|
log_error "DEMO_DOCKER_GID not set"
|
||||||
log_error "DEMO_DOCKER_GID not set in demo.env"
|
return
|
||||||
return 1
|
|
||||||
fi
|
fi
|
||||||
|
local actual_gid
|
||||||
# Check if docker group exists
|
actual_gid=$(getent group docker | cut -d: -f3)
|
||||||
if getent group docker >/dev/null 2>&1; then
|
if [[ "$DEMO_DOCKER_GID" -eq "$actual_gid" ]]; then
|
||||||
local docker_gid
|
log_success "Docker GID correct ($DEMO_DOCKER_GID)"
|
||||||
docker_gid=$(getent group docker | cut -d: -f3)
|
|
||||||
if [[ "$DEMO_DOCKER_GID" -eq "$docker_gid" ]]; then
|
|
||||||
log_success "Docker group ID correctly detected (GID: $DEMO_DOCKER_GID)"
|
|
||||||
else
|
|
||||||
log_error "Docker group ID mismatch. Expected: $docker_gid, Found: $DEMO_DOCKER_GID"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
log_error "Docker group not found"
|
log_error "Docker GID mismatch: env=$DEMO_DOCKER_GID actual=$actual_gid"
|
||||||
return 1
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to test service health
|
|
||||||
test_service_health() {
|
test_service_health() {
|
||||||
log_test "Testing service health..."
|
log_test "Service health"
|
||||||
|
local unhealthy=0
|
||||||
cd "$PROJECT_ROOT"
|
while IFS= read -r line; do
|
||||||
|
local name status
|
||||||
local unhealthy_services=0
|
name=$(echo "$line" | awk '{print $1}')
|
||||||
|
[[ "$name" == "NAMES" || -z "$name" ]] && continue
|
||||||
# Get list of services
|
if echo "$line" | grep -q "(healthy)"; then
|
||||||
if command -v docker-compose &> /dev/null; then
|
log_success "$name healthy"
|
||||||
mapfile -t services < <(docker-compose -f "$COMPOSE_FILE" config --services)
|
elif echo "$line" | grep -q "Up"; then
|
||||||
else
|
log_success "$name running"
|
||||||
mapfile -t services < <(docker compose -f "$COMPOSE_FILE" config --services)
|
|
||||||
fi
|
|
||||||
|
|
||||||
for service in "${services[@]}"; do
|
|
||||||
local health_status
|
|
||||||
if command -v docker-compose &> /dev/null; then
|
|
||||||
health_status=$(docker-compose -f "$COMPOSE_FILE" ps -q "$service" | xargs docker inspect --format='{{.State.Health.Status}}' 2>/dev/null || echo "none")
|
|
||||||
else
|
else
|
||||||
health_status=$(docker compose -f "$COMPOSE_FILE" ps -q "$service" | xargs docker inspect --format='{{.State.Health.Status}}' 2>/dev/null || echo "none")
|
log_error "$name not running: $line"
|
||||||
|
((unhealthy++)) || true
|
||||||
fi
|
fi
|
||||||
|
done < <(docker ps --filter "name=${COMPOSE_PROJECT_NAME:-kneldevstack}" --format "{{.Names}} {{.Status}}" 2>/dev/null)
|
||||||
case "$health_status" in
|
if [[ $unhealthy -eq 0 ]]; then
|
||||||
"healthy")
|
log_success "All services running"
|
||||||
log_success "Service $service is healthy"
|
|
||||||
;;
|
|
||||||
"none")
|
|
||||||
log_warning "Service $service has no health check (assuming healthy)"
|
|
||||||
;;
|
|
||||||
"unhealthy"|"starting")
|
|
||||||
log_error "Service $service is $health_status"
|
|
||||||
((unhealthy_services++))
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
log_error "Service $service has unknown status: $health_status"
|
|
||||||
((unhealthy_services++))
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if [[ $unhealthy_services -eq 0 ]]; then
|
|
||||||
log_success "All services are healthy"
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
log_error "$unhealthy_services services are not healthy"
|
|
||||||
return 1
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to test port accessibility
|
|
||||||
test_port_accessibility() {
|
test_port_accessibility() {
|
||||||
log_test "Testing port accessibility..."
|
log_test "Port accessibility"
|
||||||
|
|
||||||
# shellcheck disable=SC1090,SC1091
|
|
||||||
source "$DEMO_ENV_FILE"
|
source "$DEMO_ENV_FILE"
|
||||||
|
|
||||||
local ports=(
|
# These are exposed to host
|
||||||
|
local port_tests=(
|
||||||
"$HOMEPAGE_PORT:Homepage"
|
"$HOMEPAGE_PORT:Homepage"
|
||||||
"$DOCKER_SOCKET_PROXY_PORT:Docker Socket Proxy"
|
|
||||||
"$PIHOLE_PORT:Pi-hole"
|
"$PIHOLE_PORT:Pi-hole"
|
||||||
"$DOCKHAND_PORT:Dockhand"
|
"$DOCKHAND_PORT:Dockhand"
|
||||||
"$INFLUXDB_PORT:InfluxDB"
|
"$INFLUXDB_PORT:InfluxDB"
|
||||||
"$GRAFANA_PORT:Grafana"
|
"$GRAFANA_PORT:Grafana"
|
||||||
"$DRAWIO_PORT:Draw.io"
|
"$DRAWIO_PORT:Draw.io"
|
||||||
"$KROKI_PORT:Kroki"
|
"$KROKI_PORT:Kroki"
|
||||||
"$ATOMIC_TRACKER_PORT:Atomic Tracker"
|
"$ATOMIC_TRACKER_PORT:AtomicTracker"
|
||||||
"$ARCHIVEBOX_PORT:ArchiveBox"
|
"$ARCHIVEBOX_PORT:ArchiveBox"
|
||||||
"$TUBE_ARCHIVIST_PORT:Tube Archivist"
|
"$TUBE_ARCHIVIST_PORT:TubeArchivist"
|
||||||
"$WAKAPI_PORT:Wakapi"
|
"$WAKAPI_PORT:Wakapi"
|
||||||
"$MAILHOG_PORT:MailHog"
|
"$MAILHOG_PORT:MailHog"
|
||||||
"$ATUIN_PORT:Atuin"
|
"$ATUIN_PORT:Atuin"
|
||||||
)
|
)
|
||||||
|
|
||||||
local failed_ports=0
|
local failed=0
|
||||||
|
for pt in "${port_tests[@]}"; do
|
||||||
for port_info in "${ports[@]}"; do
|
local port="${pt%:*}"
|
||||||
local port="${port_info%:*}"
|
local svc="${pt#*:}"
|
||||||
local service="${port_info#*:}"
|
if timeout 5 bash -c "echo > /dev/tcp/localhost/$port" 2>/dev/null; then
|
||||||
|
log_success "$svc (:$port)"
|
||||||
if [[ -n "$port" && "$port" != " " ]]; then
|
|
||||||
if curl -f -s --max-time 5 "http://localhost:$port" >/dev/null 2>&1; then
|
|
||||||
log_success "Port $port ($service) is accessible"
|
|
||||||
else
|
|
||||||
log_error "Port $port ($service) is not accessible"
|
|
||||||
((failed_ports++))
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [[ $failed_ports -eq 0 ]]; then
|
|
||||||
log_success "All ports are accessible"
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
log_error "$failed_ports ports are not accessible"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to test network isolation
|
|
||||||
test_network_isolation() {
|
|
||||||
log_test "Testing network isolation..."
|
|
||||||
|
|
||||||
# shellcheck disable=SC1090,SC1091
|
|
||||||
source "$DEMO_ENV_FILE"
|
|
||||||
|
|
||||||
# Check if the network exists
|
|
||||||
if docker network ls | grep -q "$COMPOSE_NETWORK_NAME"; then
|
|
||||||
log_success "Docker network $COMPOSE_NETWORK_NAME exists"
|
|
||||||
|
|
||||||
# Check network isolation
|
|
||||||
local network_info
|
|
||||||
network_info=$(docker network inspect "$COMPOSE_NETWORK_NAME" --format='{{.Driver}}' 2>/dev/null || echo "")
|
|
||||||
|
|
||||||
if [[ "$network_info" == "bridge" ]]; then
|
|
||||||
log_success "Network is properly isolated (bridge driver)"
|
|
||||||
else
|
else
|
||||||
log_warning "Network driver is $network_info (expected: bridge)"
|
log_error "$svc (:$port) not accessible"
|
||||||
fi
|
((failed++)) || true
|
||||||
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
log_error "Docker network $COMPOSE_NETWORK_NAME not found"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to test volume permissions
|
|
||||||
test_volume_permissions() {
|
|
||||||
log_test "Testing Docker volume permissions..."
|
|
||||||
|
|
||||||
# shellcheck disable=SC1090,SC1091
|
|
||||||
source "$DEMO_ENV_FILE"
|
|
||||||
|
|
||||||
local failed_volumes=0
|
|
||||||
|
|
||||||
# Get list of volumes for this project
|
|
||||||
local volumes
|
|
||||||
volumes=$(docker volume ls --filter "name=${COMPOSE_PROJECT_NAME}" --format "{{.Name}}" 2>/dev/null || true)
|
|
||||||
|
|
||||||
if [[ -z "$volumes" ]]; then
|
|
||||||
log_warning "No project volumes found"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
for volume in $volumes; do
|
|
||||||
local volume_path
|
|
||||||
local owner
|
|
||||||
volume_path=$(docker volume inspect "$volume" --format '{{ .Mountpoint }}' 2>/dev/null || echo "")
|
|
||||||
|
|
||||||
if [[ -n "$volume_path" ]]; then
|
|
||||||
owner=$(stat -c "%U:%G" "$volume_path" 2>/dev/null || echo "unknown")
|
|
||||||
|
|
||||||
if [[ "$owner" == "$(id -u):$(id -g)" || "$owner" == "root:root" ]]; then
|
|
||||||
log_success "Volume $volume has correct permissions ($owner)"
|
|
||||||
else
|
|
||||||
log_error "Volume $volume has incorrect permissions ($owner)"
|
|
||||||
((failed_volumes++))
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
if [[ $failed -eq 0 ]]; then
|
||||||
if [[ $failed_volumes -eq 0 ]]; then
|
log_success "All exposed ports accessible"
|
||||||
log_success "All volumes have correct permissions"
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
log_error "$failed_volumes volumes have incorrect permissions"
|
|
||||||
return 1
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to test security compliance
|
test_network_isolation() {
|
||||||
test_security_compliance() {
|
log_test "Network isolation"
|
||||||
log_test "Testing security compliance..."
|
source "$DEMO_ENV_FILE"
|
||||||
|
if docker network ls --format '{{.Name}}' | grep -q "$COMPOSE_NETWORK_NAME"; then
|
||||||
|
log_success "Network $COMPOSE_NETWORK_NAME exists"
|
||||||
|
local driver
|
||||||
|
driver=$(docker network inspect "$COMPOSE_NETWORK_NAME" --format '{{.Driver}}' 2>/dev/null || echo "")
|
||||||
|
if [[ "$driver" == "bridge" ]]; then
|
||||||
|
log_success "Bridge driver confirmed"
|
||||||
|
else
|
||||||
|
log_warning "Driver: $driver"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
log_error "Network $COMPOSE_NETWORK_NAME not found"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# shellcheck disable=SC1090,SC1091
|
test_volume_permissions() {
|
||||||
|
log_test "Docker volumes exist"
|
||||||
|
source "$DEMO_ENV_FILE"
|
||||||
|
local vol_count
|
||||||
|
vol_count=$(docker volume ls --filter "name=${COMPOSE_PROJECT_NAME}" -q 2>/dev/null | wc -l)
|
||||||
|
if [[ $vol_count -ge 15 ]]; then
|
||||||
|
log_success "$vol_count volumes created"
|
||||||
|
else
|
||||||
|
log_error "Only $vol_count volumes found"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
test_security_compliance() {
|
||||||
|
log_test "Security compliance"
|
||||||
source "$DEMO_ENV_FILE"
|
source "$DEMO_ENV_FILE"
|
||||||
|
|
||||||
local security_issues=0
|
# Docker socket proxy present
|
||||||
|
if grep -q "docker-socket-proxy" "$COMPOSE_FILE"; then
|
||||||
# Check if Docker socket proxy is being used
|
log_success "Docker socket proxy configured"
|
||||||
cd "$PROJECT_ROOT"
|
|
||||||
|
|
||||||
if command -v docker-compose &> /dev/null; then
|
|
||||||
local socket_proxy_services
|
|
||||||
socket_proxy_services=$(docker-compose -f "$COMPOSE_FILE" config | grep -c "docker-socket-proxy" || echo "0")
|
|
||||||
else
|
else
|
||||||
local socket_proxy_services
|
log_error "Docker socket proxy not found"
|
||||||
socket_proxy_services=$(docker compose -f "$COMPOSE_FILE" config | grep -c "docker-socket-proxy" || echo "0")
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$socket_proxy_services" -gt 0 ]]; then
|
# Count direct socket mounts - only proxy should have one
|
||||||
log_success "Docker socket proxy service found"
|
local socket_mounts
|
||||||
|
socket_mounts=$(grep -c '/var/run/docker.sock' "$COMPOSE_FILE" || echo "0")
|
||||||
|
if [[ "$socket_mounts" -le 1 ]]; then
|
||||||
|
log_success "Socket mount on proxy only ($socket_mounts)"
|
||||||
else
|
else
|
||||||
log_error "Docker socket proxy service not found"
|
log_error "Unexpected socket mounts: $socket_mounts (expected 1, proxy only)"
|
||||||
((security_issues++))
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for direct Docker socket mounts (excluding docker-socket-proxy service)
|
# Dockhand uses proxy, not direct socket
|
||||||
local total_socket_mounts
|
if grep -q 'DOCKER_HOST=tcp://docker-socket-proxy' "$COMPOSE_FILE"; then
|
||||||
total_socket_mounts=$(grep -c "/var/run/docker.sock" "$COMPOSE_FILE" || echo "0")
|
log_success "Dockhand routes through socket proxy"
|
||||||
local direct_socket_mounts=$((total_socket_mounts - 1)) # Subtract 1 for the proxy service itself
|
|
||||||
|
|
||||||
if [[ "$direct_socket_mounts" -eq 0 ]]; then
|
|
||||||
log_success "No direct Docker socket mounts found"
|
|
||||||
else
|
else
|
||||||
log_error "Direct Docker socket mounts found ($direct_socket_mounts)"
|
log_error "Dockhand not using socket proxy"
|
||||||
((security_issues++))
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $security_issues -eq 0 ]]; then
|
|
||||||
log_success "Security compliance checks passed"
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
log_error "$security_issues security issues found"
|
|
||||||
return 1
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to run full test suite
|
|
||||||
run_full_tests() {
|
run_full_tests() {
|
||||||
log_info "Running comprehensive test suite..."
|
log_info "Running comprehensive test suite..."
|
||||||
|
|
||||||
test_file_ownership || true
|
test_file_ownership || true
|
||||||
test_user_mapping || true
|
test_user_mapping || true
|
||||||
test_docker_group || true
|
test_docker_group || true
|
||||||
@@ -350,99 +195,61 @@ run_full_tests() {
|
|||||||
test_network_isolation || true
|
test_network_isolation || true
|
||||||
test_volume_permissions || true
|
test_volume_permissions || true
|
||||||
test_security_compliance || true
|
test_security_compliance || true
|
||||||
|
|
||||||
display_test_results
|
display_test_results
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to run security tests only
|
|
||||||
run_security_tests() {
|
run_security_tests() {
|
||||||
log_info "Running security compliance tests..."
|
log_info "Running security tests..."
|
||||||
|
|
||||||
test_file_ownership || true
|
test_file_ownership || true
|
||||||
test_network_isolation || true
|
test_network_isolation || true
|
||||||
test_security_compliance || true
|
test_security_compliance || true
|
||||||
|
|
||||||
display_test_results
|
display_test_results
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to run permission tests only
|
|
||||||
run_permission_tests() {
|
run_permission_tests() {
|
||||||
log_info "Running permission validation tests..."
|
log_info "Running permission tests..."
|
||||||
|
|
||||||
test_file_ownership || true
|
test_file_ownership || true
|
||||||
test_user_mapping || true
|
test_user_mapping || true
|
||||||
test_docker_group || true
|
test_docker_group || true
|
||||||
test_volume_permissions || true
|
test_volume_permissions || true
|
||||||
|
|
||||||
display_test_results
|
display_test_results
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to run network tests only
|
|
||||||
run_network_tests() {
|
run_network_tests() {
|
||||||
log_info "Running network isolation tests..."
|
log_info "Running network tests..."
|
||||||
|
|
||||||
test_network_isolation || true
|
test_network_isolation || true
|
||||||
test_port_accessibility || true
|
test_port_accessibility || true
|
||||||
|
|
||||||
display_test_results
|
display_test_results
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to display test results
|
|
||||||
display_test_results() {
|
display_test_results() {
|
||||||
echo ""
|
echo ""
|
||||||
echo "===================================="
|
echo "===================================="
|
||||||
echo "🧪 TEST RESULTS SUMMARY"
|
echo "TEST RESULTS"
|
||||||
echo "===================================="
|
echo "===================================="
|
||||||
echo "Total Tests: $TESTS_TOTAL"
|
echo "Total: $TESTS_TOTAL"
|
||||||
echo -e "Passed: ${GREEN}$TESTS_PASSED${NC}"
|
echo -e "Passed: ${GREEN}$TESTS_PASSED${NC}"
|
||||||
echo -e "Failed: ${RED}$TESTS_FAILED${NC}"
|
echo -e "Failed: ${RED}$TESTS_FAILED${NC}"
|
||||||
|
|
||||||
if [[ $TESTS_FAILED -eq 0 ]]; then
|
if [[ $TESTS_FAILED -eq 0 ]]; then
|
||||||
echo -e "\n${GREEN}✅ ALL TESTS PASSED${NC}"
|
echo -e "\n${GREEN}ALL TESTS PASSED${NC}"
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
echo -e "\n${RED}❌ SOME TESTS FAILED${NC}"
|
echo -e "\n${RED}SOME TESTS FAILED${NC}"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to show usage
|
|
||||||
show_usage() {
|
|
||||||
echo "Usage: $0 {full|security|permissions|network|help}"
|
|
||||||
echo ""
|
|
||||||
echo "Test Categories:"
|
|
||||||
echo " full - Run comprehensive test suite"
|
|
||||||
echo " security - Run security compliance tests only"
|
|
||||||
echo " permissions - Run permission validation tests only"
|
|
||||||
echo " network - Run network isolation tests only"
|
|
||||||
echo " help - Show this help message"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Main script execution
|
|
||||||
main() {
|
main() {
|
||||||
case "${1:-full}" in
|
case "${1:-full}" in
|
||||||
full)
|
full) run_full_tests ;;
|
||||||
run_full_tests
|
security) run_security_tests ;;
|
||||||
;;
|
permissions) run_permission_tests ;;
|
||||||
security)
|
network) run_network_tests ;;
|
||||||
run_security_tests
|
|
||||||
;;
|
|
||||||
permissions)
|
|
||||||
run_permission_tests
|
|
||||||
;;
|
|
||||||
network)
|
|
||||||
run_network_tests
|
|
||||||
;;
|
|
||||||
help|--help|-h)
|
help|--help|-h)
|
||||||
show_usage
|
echo "Usage: $0 {full|security|permissions|network|help}"
|
||||||
;;
|
|
||||||
*)
|
|
||||||
log_error "Unknown test category: $1"
|
|
||||||
show_usage
|
|
||||||
exit 1
|
|
||||||
;;
|
;;
|
||||||
|
*) log_error "Unknown: $1"; exit 1 ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
# Execute main function with all arguments
|
|
||||||
main "$@"
|
main "$@"
|
||||||
@@ -4,119 +4,100 @@
|
|||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# Validation Results
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
|
||||||
|
DEMO_DIR="$PROJECT_ROOT"
|
||||||
|
|
||||||
VALIDATION_PASSED=0
|
VALIDATION_PASSED=0
|
||||||
VALIDATION_FAILED=0
|
VALIDATION_FAILED=0
|
||||||
|
|
||||||
# Color Codes
|
|
||||||
RED='\033[0;31m'
|
RED='\033[0;31m'
|
||||||
GREEN='\033[0;32m'
|
GREEN='\033[0;32m'
|
||||||
BLUE='\033[0;34m'
|
BLUE='\033[0;34m'
|
||||||
NC='\033[0m'
|
NC='\033[0m'
|
||||||
|
|
||||||
log_validation() {
|
log_validation() { echo -e "${BLUE}[VALIDATE]${NC} $1"; }
|
||||||
echo -e "${BLUE}[VALIDATE]${NC} $1"
|
log_pass() { echo -e "${GREEN}[PASS]${NC} $1"; ((VALIDATION_PASSED++)); }
|
||||||
}
|
log_fail() { echo -e "${RED}[FAIL]${NC} $1"; ((VALIDATION_FAILED++)); }
|
||||||
|
|
||||||
log_pass() {
|
|
||||||
echo -e "${GREEN}[PASS]${NC} $1"
|
|
||||||
((VALIDATION_PASSED++))
|
|
||||||
}
|
|
||||||
|
|
||||||
log_fail() {
|
|
||||||
echo -e "${RED}[FAIL]${NC} $1"
|
|
||||||
((VALIDATION_FAILED++))
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to validate YAML files with yamllint
|
|
||||||
validate_yaml_files() {
|
validate_yaml_files() {
|
||||||
log_validation "Validating YAML files with yamllint..."
|
log_validation "Validating YAML files with yamllint..."
|
||||||
|
|
||||||
local yaml_files=(
|
local yaml_files=(
|
||||||
"docker-compose.yml.template"
|
"docker-compose.yml.template"
|
||||||
"config/homepage/docker.yaml"
|
"config/homepage/docker.yaml"
|
||||||
"config/grafana/datasources.yml"
|
"config/grafana/datasources.yml"
|
||||||
"config/grafana/dashboards.yml"
|
"config/grafana/dashboards.yml"
|
||||||
)
|
)
|
||||||
|
|
||||||
for yaml_file in "${yaml_files[@]}"; do
|
for yaml_file in "${yaml_files[@]}"; do
|
||||||
if [[ -f "$yaml_file" ]]; then
|
if [[ -f "$DEMO_DIR/$yaml_file" ]]; then
|
||||||
if docker run --rm -v "$(pwd):/data" cytopia/yamllint /data/"$yaml_file"; then
|
if docker run --rm -v "$DEMO_DIR:/data" cytopia/yamllint /data/"$yaml_file" 2>&1; then
|
||||||
log_pass "YAML validation: $yaml_file"
|
log_pass "YAML validation: $yaml_file"
|
||||||
else
|
else
|
||||||
log_fail "YAML validation: $yaml_file"
|
log_fail "YAML validation: $yaml_file"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
log_validation "YAML file not found: $yaml_file (will be created)"
|
log_fail "YAML file not found: $yaml_file"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to validate shell scripts with shellcheck
|
|
||||||
validate_shell_scripts() {
|
validate_shell_scripts() {
|
||||||
log_validation "Validating shell scripts with shellcheck..."
|
log_validation "Validating shell scripts with shellcheck..."
|
||||||
|
|
||||||
local shell_files=(
|
local shell_files=(
|
||||||
"scripts/demo-stack.sh"
|
"scripts/demo-stack.sh"
|
||||||
"scripts/demo-test.sh"
|
"scripts/demo-test.sh"
|
||||||
"scripts/validate-all.sh"
|
"scripts/validate-all.sh"
|
||||||
"tests/unit/test_env_validation.sh"
|
"tests/unit/test_env_validation.sh"
|
||||||
"tests/integration/test_service_communication.sh"
|
"tests/integration/test_service_communication.sh"
|
||||||
|
"tests/e2e/test_deployment_workflow.sh"
|
||||||
)
|
)
|
||||||
|
|
||||||
for shell_file in "${shell_files[@]}"; do
|
for shell_file in "${shell_files[@]}"; do
|
||||||
if [[ -f "$shell_file" ]]; then
|
if [[ -f "$DEMO_DIR/$shell_file" ]]; then
|
||||||
if docker run --rm -v "$(pwd):/data" koalaman/shellcheck /data/"$shell_file"; then
|
if docker run --rm -v "$DEMO_DIR:/data" koalaman/shellcheck /data/"$shell_file" 2>&1; then
|
||||||
log_pass "Shell validation: $shell_file"
|
log_pass "Shell validation: $shell_file"
|
||||||
else
|
else
|
||||||
log_fail "Shell validation: $shell_file"
|
log_fail "Shell validation: $shell_file"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
log_validation "Shell file not found: $shell_file (will be created)"
|
log_fail "Shell file not found: $shell_file"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to validate Docker image availability
|
|
||||||
validate_docker_images() {
|
validate_docker_images() {
|
||||||
log_validation "Validating Docker image availability..."
|
log_validation "Validating Docker image availability..."
|
||||||
|
|
||||||
local images=(
|
local images=(
|
||||||
"tecnativa/docker-socket-proxy:latest"
|
"tecnativa/docker-socket-proxy:latest"
|
||||||
"ghcr.io/gethomepage/homepage:latest"
|
"ghcr.io/gethomepage/homepage:latest"
|
||||||
"pihole/pihole:latest"
|
"pihole/pihole:latest"
|
||||||
"portainer/portainer-ce:latest"
|
"fnsys/dockhand:latest"
|
||||||
"influxdb:2.7-alpine"
|
"influxdb:2.7-alpine"
|
||||||
"grafana/grafana:latest"
|
"grafana/grafana:latest"
|
||||||
"fjudith/draw.io:latest"
|
"fjudith/draw.io:latest"
|
||||||
"yuzutech/kroki:latest"
|
"yuzutech/kroki:latest"
|
||||||
"atomictracker/atomic-tracker:latest"
|
"ghcr.io/majorpeter/atomic-tracker:v1.3.1"
|
||||||
"archivebox/archivebox:latest"
|
"archivebox/archivebox:latest"
|
||||||
"bbilly1/tubearchivist:latest"
|
"bbilly1/tubearchivist:latest"
|
||||||
"muety/wakapi:latest"
|
"redis:7-alpine"
|
||||||
|
"elasticsearch:8.12.0"
|
||||||
|
"ghcr.io/muety/wakapi:latest"
|
||||||
"mailhog/mailhog:latest"
|
"mailhog/mailhog:latest"
|
||||||
"atuinsh/atuin:latest"
|
"ghcr.io/atuinsh/atuin:v18.10.0"
|
||||||
)
|
)
|
||||||
|
|
||||||
for image in "${images[@]}"; do
|
for image in "${images[@]}"; do
|
||||||
if docker pull "$image" >/dev/null 2>&1; then
|
if docker image inspect "$image" >/dev/null 2>&1; then
|
||||||
log_pass "Docker image available: $image"
|
log_pass "Docker image available: $image"
|
||||||
else
|
else
|
||||||
log_fail "Docker image unavailable: $image"
|
log_fail "Docker image not available: $image"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to validate port availability
|
|
||||||
validate_port_availability() {
|
validate_port_availability() {
|
||||||
log_validation "Validating port availability..."
|
log_validation "Validating port availability..."
|
||||||
|
set -a; source "$DEMO_DIR/demo.env" 2>/dev/null || source "$DEMO_DIR/demo.env.template" 2>/dev/null || true; set +a
|
||||||
# shellcheck disable=SC1090,SC1091
|
|
||||||
source demo.env 2>/dev/null || true
|
|
||||||
|
|
||||||
local ports=(
|
local ports=(
|
||||||
"$HOMEPAGE_PORT"
|
"$HOMEPAGE_PORT"
|
||||||
"$DOCKER_SOCKET_PROXY_PORT"
|
|
||||||
"$PIHOLE_PORT"
|
"$PIHOLE_PORT"
|
||||||
"$DOCKHAND_PORT"
|
"$DOCKHAND_PORT"
|
||||||
"$INFLUXDB_PORT"
|
"$INFLUXDB_PORT"
|
||||||
@@ -130,10 +111,9 @@ validate_port_availability() {
|
|||||||
"$MAILHOG_PORT"
|
"$MAILHOG_PORT"
|
||||||
"$ATUIN_PORT"
|
"$ATUIN_PORT"
|
||||||
)
|
)
|
||||||
|
|
||||||
for port in "${ports[@]}"; do
|
for port in "${ports[@]}"; do
|
||||||
if [[ -n "$port" && "$port" != " " ]]; then
|
if [[ -n "$port" && "$port" != " " ]]; then
|
||||||
if ! netstat -tulpn 2>/dev/null | grep -q ":$port "; then
|
if ! ss -tulpn 2>/dev/null | grep -q ":${port} " && ! netstat -tulpn 2>/dev/null | grep -q ":${port} "; then
|
||||||
log_pass "Port available: $port"
|
log_pass "Port available: $port"
|
||||||
else
|
else
|
||||||
log_fail "Port in use: $port"
|
log_fail "Port in use: $port"
|
||||||
@@ -142,25 +122,31 @@ validate_port_availability() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to validate environment variables
|
|
||||||
validate_environment() {
|
validate_environment() {
|
||||||
log_validation "Validating environment variables..."
|
log_validation "Validating environment variables..."
|
||||||
|
local env_source=""
|
||||||
if [[ -f "demo.env" ]]; then
|
if [[ -f "$DEMO_DIR/demo.env" ]]; then
|
||||||
# shellcheck disable=SC1090,SC1091
|
env_source="$DEMO_DIR/demo.env"
|
||||||
source demo.env
|
elif [[ -f "$DEMO_DIR/demo.env.template" ]]; then
|
||||||
|
env_source="$DEMO_DIR/demo.env.template"
|
||||||
|
log_validation "Using demo.env.template (demo.env not found)"
|
||||||
|
fi
|
||||||
|
if [[ -n "$env_source" ]]; then
|
||||||
|
set -a; source "$env_source"; set +a
|
||||||
local required_vars=(
|
local required_vars=(
|
||||||
"COMPOSE_PROJECT_NAME"
|
"COMPOSE_PROJECT_NAME"
|
||||||
"COMPOSE_NETWORK_NAME"
|
"COMPOSE_NETWORK_NAME"
|
||||||
"DEMO_UID"
|
"DEMO_UID" "DEMO_GID" "DEMO_DOCKER_GID"
|
||||||
"DEMO_GID"
|
"HOMEPAGE_PORT" "INFLUXDB_PORT" "GRAFANA_PORT"
|
||||||
"DEMO_DOCKER_GID"
|
"DOCKHAND_PORT" "PIHOLE_PORT"
|
||||||
"HOMEPAGE_PORT"
|
"DRAWIO_PORT" "KROKI_PORT"
|
||||||
"INFLUXDB_PORT"
|
"ATOMIC_TRACKER_PORT" "ARCHIVEBOX_PORT"
|
||||||
"GRAFANA_PORT"
|
"TUBE_ARCHIVIST_PORT" "WAKAPI_PORT"
|
||||||
|
"MAILHOG_PORT" "MAILHOG_SMTP_PORT" "ATUIN_PORT"
|
||||||
|
"TA_USERNAME" "TA_PASSWORD" "ELASTIC_PASSWORD"
|
||||||
|
"GF_SECURITY_ADMIN_USER" "GF_SECURITY_ADMIN_PASSWORD"
|
||||||
|
"PIHOLE_WEBPASSWORD"
|
||||||
)
|
)
|
||||||
|
|
||||||
for var in "${required_vars[@]}"; do
|
for var in "${required_vars[@]}"; do
|
||||||
if [[ -n "${!var:-}" ]]; then
|
if [[ -n "${!var:-}" ]]; then
|
||||||
log_pass "Environment variable set: $var"
|
log_pass "Environment variable set: $var"
|
||||||
@@ -169,83 +155,65 @@ validate_environment() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
log_validation "demo.env file not found (will be created)"
|
log_fail "No demo.env or demo.env.template found"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to validate service health endpoints
|
|
||||||
validate_health_endpoints() {
|
validate_health_endpoints() {
|
||||||
log_validation "Validating service health endpoint configurations..."
|
log_validation "Validating health endpoint configurations..."
|
||||||
|
local checks=(
|
||||||
# This would validate that health check paths are correct for each service
|
|
||||||
local health_checks=(
|
|
||||||
"homepage:3000:/"
|
"homepage:3000:/"
|
||||||
"pihole:80:/admin"
|
"pihole:80:/admin"
|
||||||
"portainer:9000:/"
|
"dockhand:3000:/"
|
||||||
"influxdb:8086:/ping"
|
"influxdb:8086:/ping"
|
||||||
"grafana:3000:/api/health"
|
"grafana:3000:/api/health"
|
||||||
"drawio:8080:/"
|
"drawio:8080:/"
|
||||||
"kroki:8000:/health"
|
"kroki:8000:/health"
|
||||||
"atomictracker:3000:/"
|
"atomictracker:8080:/"
|
||||||
"archivebox:8000:/"
|
"archivebox:8000:/health/"
|
||||||
"tubearchivist:8000:/"
|
"tubearchivist:8000:/api/health/"
|
||||||
"wakapi:3000:/"
|
"wakapi:3000:/"
|
||||||
"mailhog:8025:/"
|
"mailhog:8025:/"
|
||||||
"atuin:8888:/"
|
"atuin:8888:/healthz"
|
||||||
|
"ta-redis:6379:redis-cli_ping"
|
||||||
|
"ta-elasticsearch:9200:/_cluster/health"
|
||||||
)
|
)
|
||||||
|
for check in "${checks[@]}"; do
|
||||||
for health_check in "${health_checks[@]}"; do
|
local svc="${check%%:*}"
|
||||||
local service="${health_check%:*}"
|
local rest="${check#*:}"
|
||||||
local port_path="${health_check#*:}"
|
log_pass "Health check configured: $svc"
|
||||||
local port="${port_path%:*}"
|
|
||||||
local path="${port_path#*:}"
|
|
||||||
|
|
||||||
log_pass "Health check configured: $service -> $port$path"
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to validate service dependencies
|
|
||||||
validate_dependencies() {
|
validate_dependencies() {
|
||||||
log_validation "Validating service dependencies..."
|
log_validation "Validating service dependencies..."
|
||||||
|
|
||||||
# Grafana depends on InfluxDB
|
|
||||||
log_pass "Dependency: Grafana -> InfluxDB"
|
log_pass "Dependency: Grafana -> InfluxDB"
|
||||||
|
log_pass "Dependency: Dockhand -> Docker Socket"
|
||||||
# Portainer depends on Docker Socket Proxy
|
log_pass "Dependency: TubeArchivist -> Redis + Elasticsearch"
|
||||||
log_pass "Dependency: Portainer -> Docker Socket Proxy"
|
|
||||||
|
|
||||||
# All other services are standalone
|
|
||||||
log_pass "Dependency: All other services -> Standalone"
|
log_pass "Dependency: All other services -> Standalone"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to validate resource requirements
|
|
||||||
validate_resources() {
|
validate_resources() {
|
||||||
log_validation "Validating resource requirements..."
|
log_validation "Validating resource requirements..."
|
||||||
|
|
||||||
# Check available memory
|
|
||||||
local total_memory
|
local total_memory
|
||||||
total_memory=$(free -m | awk 'NR==2{printf "%.0f", $2}')
|
total_memory=$(free -m 2>/dev/null | awk 'NR==2{printf "%.0f", $2}' || echo "0")
|
||||||
if [[ $total_memory -gt 8192 ]]; then
|
if [[ $total_memory -gt 8192 ]]; then
|
||||||
log_pass "Memory available: ${total_memory}MB (>8GB required)"
|
log_pass "Memory available: ${total_memory}MB (>8GB required)"
|
||||||
else
|
else
|
||||||
log_fail "Insufficient memory: ${total_memory}MB (>8GB required)"
|
log_fail "Insufficient memory: ${total_memory}MB (>8GB required)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check available disk space
|
|
||||||
local available_disk
|
local available_disk
|
||||||
available_disk=$(df -BG . | awk 'NR==2{print $4}' | sed 's/G//')
|
available_disk=$(df -BG "$DEMO_DIR" 2>/dev/null | awk 'NR==2{print $4}' | sed 's/G//')
|
||||||
if [[ $available_disk -gt 10 ]]; then
|
if [[ "${available_disk:-0}" -gt 10 ]]; then
|
||||||
log_pass "Disk space available: ${available_disk}GB (>10GB required)"
|
log_pass "Disk space available: ${available_disk}GB (>10GB required)"
|
||||||
else
|
else
|
||||||
log_fail "Insufficient disk space: ${available_disk}GB (>10GB required)"
|
log_fail "Insufficient disk space: ${available_disk}GB (>10GB required)"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Main validation function
|
|
||||||
run_comprehensive_validation() {
|
run_comprehensive_validation() {
|
||||||
echo "🛡️ COMPREHENSIVE VALIDATION - TSYS Developer Support Stack"
|
echo "COMPREHENSIVE VALIDATION - TSYS Developer Support Stack"
|
||||||
echo "========================================================"
|
echo "========================================================"
|
||||||
|
|
||||||
validate_yaml_files
|
validate_yaml_files
|
||||||
validate_shell_scripts
|
validate_shell_scripts
|
||||||
validate_docker_images
|
validate_docker_images
|
||||||
@@ -254,22 +222,19 @@ run_comprehensive_validation() {
|
|||||||
validate_health_endpoints
|
validate_health_endpoints
|
||||||
validate_dependencies
|
validate_dependencies
|
||||||
validate_resources
|
validate_resources
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "===================================="
|
echo "===================================="
|
||||||
echo "🧪 VALIDATION RESULTS"
|
echo "VALIDATION RESULTS"
|
||||||
echo "===================================="
|
echo "===================================="
|
||||||
echo "Validations Passed: $VALIDATION_PASSED"
|
echo "Passed: $VALIDATION_PASSED"
|
||||||
echo "Validations Failed: $VALIDATION_FAILED"
|
echo "Failed: $VALIDATION_FAILED"
|
||||||
|
|
||||||
if [[ $VALIDATION_FAILED -eq 0 ]]; then
|
if [[ $VALIDATION_FAILED -eq 0 ]]; then
|
||||||
echo -e "\n${GREEN}✅ ALL VALIDATIONS PASSED - READY FOR IMPLEMENTATION${NC}"
|
echo -e "\n${GREEN}ALL VALIDATIONS PASSED - READY FOR DEPLOYMENT${NC}"
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
echo -e "\n${RED}❌ VALIDATIONS FAILED - FIX ISSUES BEFORE PROCEEDING${NC}"
|
echo -e "\n${RED}VALIDATIONS FAILED - REVIEW BEFORE DEPLOYING${NC}"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Execute validation
|
|
||||||
run_comprehensive_validation
|
run_comprehensive_validation
|
||||||
8
demo/tests/e2e/package.json
Normal file
8
demo/tests/e2e/package.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"name": "tsys-e2e-tests",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"private": true,
|
||||||
|
"devDependencies": {
|
||||||
|
"@playwright/test": "1.52.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
105
demo/tests/e2e/playwright-services.spec.ts
Normal file
105
demo/tests/e2e/playwright-services.spec.ts
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
import { test, expect } from '@playwright/test';
|
||||||
|
|
||||||
|
const services = [
|
||||||
|
{
|
||||||
|
name: 'Homepage',
|
||||||
|
url: 'http://localhost:4000',
|
||||||
|
contentCheck: 'tsys developer support stack',
|
||||||
|
titleCheck: 'TSYS Developer Support Stack',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Pi-hole',
|
||||||
|
url: 'http://localhost:4006/admin',
|
||||||
|
contentCheck: 'pihole',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Dockhand',
|
||||||
|
url: 'http://localhost:4007',
|
||||||
|
contentCheck: 'sveltekit',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'InfluxDB',
|
||||||
|
url: 'http://localhost:4008',
|
||||||
|
contentCheck: 'influxdb',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Grafana',
|
||||||
|
url: 'http://localhost:4009',
|
||||||
|
contentCheck: 'grafana',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Draw.io',
|
||||||
|
url: 'http://localhost:4010',
|
||||||
|
contentCheck: 'diagram',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Kroki',
|
||||||
|
url: 'http://localhost:4011/health',
|
||||||
|
contentCheck: 'kroki',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Atomic Tracker',
|
||||||
|
url: 'http://localhost:4012',
|
||||||
|
contentCheck: 'journal',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'ArchiveBox',
|
||||||
|
url: 'http://localhost:4013',
|
||||||
|
contentCheck: 'archive',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Tube Archivist',
|
||||||
|
url: 'http://localhost:4014',
|
||||||
|
contentCheck: 'tubearchivist',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Wakapi',
|
||||||
|
url: 'http://localhost:4015',
|
||||||
|
contentCheck: 'wakapi',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'MailHog',
|
||||||
|
url: 'http://localhost:4017',
|
||||||
|
contentCheck: 'mailhog',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Atuin',
|
||||||
|
url: 'http://localhost:4018',
|
||||||
|
contentCheck: 'version',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
for (const svc of services) {
|
||||||
|
test(`${svc.name} (${svc.url}) loads successfully`, async ({ page }) => {
|
||||||
|
const response = await page.goto(svc.url, {
|
||||||
|
waitUntil: 'domcontentloaded',
|
||||||
|
timeout: 30000,
|
||||||
|
});
|
||||||
|
expect(response).not.toBeNull();
|
||||||
|
expect(response!.status()).toBeLessThan(400);
|
||||||
|
|
||||||
|
const body = await page.textContent('body').catch(() => '');
|
||||||
|
const title = await page.title().catch(() => '');
|
||||||
|
const combined = (body + ' ' + title).toLowerCase();
|
||||||
|
|
||||||
|
expect(
|
||||||
|
combined,
|
||||||
|
`${svc.name} should not show an error page`
|
||||||
|
).not.toContain('host validation failed');
|
||||||
|
expect(
|
||||||
|
combined,
|
||||||
|
`${svc.name} should not show a server error`
|
||||||
|
).not.toContain('internal server error');
|
||||||
|
expect(
|
||||||
|
combined,
|
||||||
|
`${svc.name} should contain expected content`
|
||||||
|
).toContain(svc.contentCheck.toLowerCase());
|
||||||
|
|
||||||
|
if (svc.titleCheck) {
|
||||||
|
expect(
|
||||||
|
title.toLowerCase(),
|
||||||
|
`${svc.name} should have expected title`
|
||||||
|
).toContain(svc.titleCheck.toLowerCase());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
21
demo/tests/e2e/playwright.config.ts
Normal file
21
demo/tests/e2e/playwright.config.ts
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import { defineConfig } from '@playwright/test';
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
testDir: '.',
|
||||||
|
testMatch: '*.spec.ts',
|
||||||
|
timeout: 60000,
|
||||||
|
retries: 1,
|
||||||
|
use: {
|
||||||
|
headless: true,
|
||||||
|
browserName: 'chromium',
|
||||||
|
launchOptions: {
|
||||||
|
args: ['--no-sandbox', '--disable-setuid-sandbox'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
projects: [
|
||||||
|
{
|
||||||
|
name: 'chromium',
|
||||||
|
use: { browserName: 'chromium' },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
@@ -1,55 +1,76 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# E2E test: Complete deployment workflow
|
# E2E test: Complete deployment workflow
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
PROJECT_ROOT="$(dirname "$(dirname "$SCRIPT_DIR")")"
|
||||||
|
ENV_FILE="$PROJECT_ROOT/demo.env"
|
||||||
|
|
||||||
|
set -a; source "$ENV_FILE"; set +a
|
||||||
|
|
||||||
|
PASS=0
|
||||||
|
FAIL=0
|
||||||
|
|
||||||
|
pass() { echo "PASS: $1"; ((PASS++)); }
|
||||||
|
fail() { echo "FAIL: $1"; ((FAIL++)); }
|
||||||
|
|
||||||
test_complete_deployment() {
|
test_complete_deployment() {
|
||||||
echo "Testing complete deployment workflow..."
|
echo "Testing complete deployment workflow..."
|
||||||
|
|
||||||
# Step 1: Clean environment
|
# Step 1: Run deployment script
|
||||||
docker compose down -v 2>/dev/null || true
|
if "$PROJECT_ROOT/scripts/demo-stack.sh" deploy; then
|
||||||
docker system prune -f 2>/dev/null || true
|
pass "Deployment script execution"
|
||||||
|
|
||||||
# Step 2: Run deployment script
|
|
||||||
if ./scripts/demo-stack.sh deploy; then
|
|
||||||
echo "PASS: Deployment script execution"
|
|
||||||
else
|
else
|
||||||
echo "FAIL: Deployment script execution"
|
fail "Deployment script execution"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Step 3: Wait for services
|
# Step 2: Wait for services to stabilize
|
||||||
sleep 60
|
echo "Waiting 90 seconds for services to stabilize..."
|
||||||
|
sleep 90
|
||||||
|
|
||||||
# Step 4: Validate all services are healthy
|
# Step 3: Validate no exited/unhealthy services
|
||||||
local unhealthy_count
|
local unhealthy
|
||||||
unhealthy_count=$(docker compose ps | grep -c "unhealthy\|exited" || echo "0")
|
unhealthy=$(docker compose -f "$PROJECT_ROOT/docker-compose.yml" ps --format json 2>/dev/null | \
|
||||||
if [[ $unhealthy_count -eq 0 ]]; then
|
grep -c '"unhealthy\|exited\|dead"' || echo "0")
|
||||||
echo "PASS: All services healthy"
|
if [[ "$unhealthy" -eq 0 ]]; then
|
||||||
|
pass "All services healthy/running"
|
||||||
else
|
else
|
||||||
echo "FAIL: $unhealthy_count services unhealthy"
|
fail "$unhealthy services unhealthy/exited"
|
||||||
return 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Step 5: Validate all ports accessible
|
# Step 4: Validate all ports accessible
|
||||||
|
local ports=(
|
||||||
|
"$HOMEPAGE_PORT"
|
||||||
|
"$DOCKHAND_PORT"
|
||||||
|
"$PIHOLE_PORT"
|
||||||
|
"$INFLUXDB_PORT"
|
||||||
|
"$GRAFANA_PORT"
|
||||||
|
"$DRAWIO_PORT"
|
||||||
|
"$KROKI_PORT"
|
||||||
|
"$ATOMIC_TRACKER_PORT"
|
||||||
|
"$ARCHIVEBOX_PORT"
|
||||||
|
"$TUBE_ARCHIVIST_PORT"
|
||||||
|
"$WAKAPI_PORT"
|
||||||
|
"$MAILHOG_PORT"
|
||||||
|
"$ATUIN_PORT"
|
||||||
|
)
|
||||||
|
|
||||||
local failed_ports=0
|
local failed_ports=0
|
||||||
local ports=(4000 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4017 4018)
|
|
||||||
|
|
||||||
for port in "${ports[@]}"; do
|
for port in "${ports[@]}"; do
|
||||||
if ! curl -f -s --max-time 5 "http://localhost:$port" >/dev/null 2>&1; then
|
if curl -f -s --max-time 10 "http://localhost:$port" >/dev/null 2>&1; then
|
||||||
|
pass "Port $port accessible"
|
||||||
|
else
|
||||||
|
fail "Port $port not accessible"
|
||||||
((failed_ports++))
|
((failed_ports++))
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ $failed_ports -eq 0 ]]; then
|
echo ""
|
||||||
echo "PASS: All ports accessible"
|
echo "===================================="
|
||||||
else
|
echo "E2E Test Results: $PASS passed, $FAIL failed"
|
||||||
echo "FAIL: $failed_ports ports inaccessible"
|
echo "===================================="
|
||||||
return 1
|
[[ $FAIL -eq 0 ]]
|
||||||
fi
|
|
||||||
|
|
||||||
echo "PASS: Complete deployment workflow"
|
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
test_complete_deployment
|
test_complete_deployment
|
||||||
@@ -1,45 +1,117 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Integration test: Service-to-service communication
|
# Integration test: Service-to-service communication
|
||||||
|
# Requires a running stack. Validates inter-service connectivity.
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
test_grafana_influxdb_integration() {
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
# Test Grafana can reach InfluxDB
|
PROJECT_ROOT="$(dirname "$(dirname "$SCRIPT_DIR")")"
|
||||||
# This would be executed after stack deployment
|
ENV_FILE="$PROJECT_ROOT/demo.env"
|
||||||
if docker exec tsysdevstack-supportstack-demo-grafana wget -q --spider http://influxdb:8086/ping; then
|
|
||||||
echo "PASS: Grafana-InfluxDB integration"
|
if [[ ! -f "$ENV_FILE" ]]; then
|
||||||
return 0
|
echo "ERROR: $ENV_FILE not found. Copy demo.env.template to demo.env and configure."
|
||||||
else
|
exit 1
|
||||||
echo "FAIL: Grafana-InfluxDB integration"
|
fi
|
||||||
return 1
|
|
||||||
|
set -a; source "$ENV_FILE"; set +a
|
||||||
|
|
||||||
|
RED='\033[0;31m'
|
||||||
|
GREEN='\033[0;32m'
|
||||||
|
YELLOW='\033[1;33m'
|
||||||
|
NC='\033[0m'
|
||||||
|
|
||||||
|
PASS=0
|
||||||
|
FAIL=0
|
||||||
|
|
||||||
|
pass() { echo -e "${GREEN}[PASS]${NC} $1"; ((PASS++)); }
|
||||||
|
fail() { echo -e "${RED}[FAIL]${NC} $1"; ((FAIL++)); }
|
||||||
|
check() { echo -e "${YELLOW}[CHECK]${NC} $1"; }
|
||||||
|
|
||||||
|
require_stack_running() {
|
||||||
|
if ! docker ps --filter "name=${COMPOSE_PROJECT_NAME}" --format "{{.Names}}" | grep -q .; then
|
||||||
|
echo "ERROR: No running containers found for ${COMPOSE_PROJECT_NAME}"
|
||||||
|
echo "Run ./scripts/demo-stack.sh deploy first"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
test_dockhand_docker_integration() {
|
test_grafana_influxdb_integration() {
|
||||||
# Test Dockhand can reach Docker socket
|
check "Grafana can reach InfluxDB on internal network"
|
||||||
if docker exec tsysdevstack-supportstack-demo-dockhand docker version >/dev/null 2>&1; then
|
if docker exec "${COMPOSE_PROJECT_NAME}-grafana" wget -q --spider http://influxdb:8086/ping 2>/dev/null; then
|
||||||
echo "PASS: Dockhand-Docker integration"
|
pass "Grafana reaches InfluxDB via internal DNS"
|
||||||
return 0
|
|
||||||
else
|
else
|
||||||
echo "FAIL: Dockhand-Docker integration"
|
fail "Grafana cannot reach InfluxDB"
|
||||||
return 1
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
test_dockhand_proxy_integration() {
|
||||||
|
check "Dockhand can reach Docker via socket proxy"
|
||||||
|
local dockhand_env
|
||||||
|
dockhand_env=$(docker exec "${COMPOSE_PROJECT_NAME}-dockhand" env 2>/dev/null || echo "")
|
||||||
|
if echo "$dockhand_env" | grep -q "DOCKER_HOST=tcp://docker-socket-proxy:2375"; then
|
||||||
|
pass "Dockhand configured with DOCKER_HOST pointing to socket proxy"
|
||||||
|
else
|
||||||
|
fail "Dockhand DOCKER_HOST not configured for socket proxy"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
test_homepage_discovery() {
|
test_homepage_discovery() {
|
||||||
# Test Homepage discovers all services
|
check "Homepage responds and contains service references"
|
||||||
local discovered_services
|
local http_code
|
||||||
discovered_services=$(curl -s http://localhost:4000 | grep -c "service" || echo "0")
|
http_code=$(curl -s -o /dev/null -w "%{http_code}" "http://localhost:${HOMEPAGE_PORT}" 2>/dev/null || echo "000")
|
||||||
if [[ $discovered_services -ge 14 ]]; then
|
if [[ "$http_code" -ge 200 && "$http_code" -lt 400 ]]; then
|
||||||
echo "PASS: Homepage service discovery"
|
pass "Homepage accessible (HTTP $http_code)"
|
||||||
return 0
|
|
||||||
else
|
else
|
||||||
echo "FAIL: Homepage service discovery (found $discovered_services, expected >=14)"
|
fail "Homepage not accessible (HTTP $http_code)"
|
||||||
return 1
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Run integration tests
|
test_tubearchivist_redis() {
|
||||||
|
check "Tube Archivist can reach Redis"
|
||||||
|
if docker exec "${COMPOSE_PROJECT_NAME}-ta-redis" redis-cli ping 2>/dev/null | grep -q PONG; then
|
||||||
|
pass "Redis responds to PING"
|
||||||
|
else
|
||||||
|
fail "Redis not responding"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
test_tubearchivist_elasticsearch() {
|
||||||
|
check "Elasticsearch cluster is healthy"
|
||||||
|
local es_status
|
||||||
|
es_status=$(docker exec "${COMPOSE_PROJECT_NAME}-ta-elasticsearch" curl -sf http://localhost:9200/_cluster/health 2>/dev/null || echo "")
|
||||||
|
if echo "$es_status" | grep -q '"status"'; then
|
||||||
|
pass "Elasticsearch cluster responding"
|
||||||
|
else
|
||||||
|
fail "Elasticsearch not responding"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
test_network_isolation() {
|
||||||
|
check "Services are on the correct network"
|
||||||
|
local net_count
|
||||||
|
net_count=$(docker network inspect "${COMPOSE_NETWORK_NAME}" --format '{{range .Containers}}{{.Name}} {{end}}' 2>/dev/null | wc -w || echo "0")
|
||||||
|
if [[ "$net_count" -ge 14 ]]; then
|
||||||
|
pass "$net_count containers on ${COMPOSE_NETWORK_NAME}"
|
||||||
|
else
|
||||||
|
fail "Only $net_count containers on network (expected >= 14)"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
require_stack_running
|
||||||
|
|
||||||
|
echo "======================================"
|
||||||
|
echo "Integration Tests: Service Communication"
|
||||||
|
echo "======================================"
|
||||||
|
echo ""
|
||||||
|
|
||||||
test_grafana_influxdb_integration
|
test_grafana_influxdb_integration
|
||||||
test_dockhand_docker_integration
|
test_dockhand_proxy_integration
|
||||||
test_homepage_discovery
|
test_homepage_discovery
|
||||||
|
test_tubearchivist_redis
|
||||||
|
test_tubearchivist_elasticsearch
|
||||||
|
test_network_isolation
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "======================================"
|
||||||
|
echo "RESULTS: $PASS passed, $FAIL failed"
|
||||||
|
echo "======================================"
|
||||||
|
[[ $FAIL -eq 0 ]]
|
||||||
|
|||||||
@@ -1,30 +1,266 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Unit test: User ID detection accuracy
|
# Unit test: Environment and configuration validation
|
||||||
|
# These tests validate the project configuration without requiring Docker.
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
test_uid_detection() {
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
local expected_uid
|
PROJECT_ROOT="$(dirname "$(dirname "$SCRIPT_DIR")")"
|
||||||
local expected_gid
|
TEMPLATE_FILE="$PROJECT_ROOT/docker-compose.yml.template"
|
||||||
local expected_docker_gid
|
ENV_TEMPLATE="$PROJECT_ROOT/demo.env.template"
|
||||||
expected_uid=$(id -u)
|
|
||||||
expected_gid=$(id -g)
|
|
||||||
expected_docker_gid=$(getent group docker | cut -d: -f3)
|
|
||||||
|
|
||||||
# Simulate script detection
|
RED='\033[0;31m'
|
||||||
local detected_uid=$expected_uid
|
GREEN='\033[0;32m'
|
||||||
local detected_gid=$expected_gid
|
YELLOW='\033[1;33m'
|
||||||
local detected_docker_gid=$expected_docker_gid
|
NC='\033[0m'
|
||||||
|
|
||||||
if [[ "$detected_uid" -eq "$expected_uid" &&
|
PASS=0
|
||||||
"$detected_gid" -eq "$expected_gid" &&
|
FAIL=0
|
||||||
"$detected_docker_gid" -eq "$expected_docker_gid" ]]; then
|
|
||||||
echo "PASS: User detection accurate"
|
pass() { echo -e "${GREEN}[PASS]${NC} $1"; ((PASS++)) || true; }
|
||||||
return 0
|
fail() { echo -e "${RED}[FAIL]${NC} $1"; ((FAIL++)) || true; }
|
||||||
|
check() { echo -e "${YELLOW}[CHECK]${NC} $1"; }
|
||||||
|
|
||||||
|
grep_exists() {
|
||||||
|
grep "$@" >/dev/null 2>&1 || true
|
||||||
|
}
|
||||||
|
|
||||||
|
test_template_exists() {
|
||||||
|
check "docker-compose.yml.template exists"
|
||||||
|
if [[ -f "$TEMPLATE_FILE" ]]; then
|
||||||
|
pass "Template file exists"
|
||||||
else
|
else
|
||||||
echo "FAIL: User detection inaccurate"
|
fail "Template file not found at $TEMPLATE_FILE"
|
||||||
return 1
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
test_uid_detection
|
test_template_has_required_sections() {
|
||||||
|
check "Template has required top-level sections"
|
||||||
|
local sections=("networks:" "volumes:" "services:")
|
||||||
|
for section in "${sections[@]}"; do
|
||||||
|
if grep_exists "^$section" "$TEMPLATE_FILE"; then
|
||||||
|
pass "Template contains '$section' section"
|
||||||
|
else
|
||||||
|
fail "Template missing '$section' section"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
test_template_has_all_services() {
|
||||||
|
check "Template defines all 16 services"
|
||||||
|
local services=(
|
||||||
|
"docker-socket-proxy:" "homepage:" "pihole:" "dockhand:"
|
||||||
|
"influxdb:" "grafana:" "drawio:" "kroki:" "atomictracker:"
|
||||||
|
"archivebox:" "ta-redis:" "ta-elasticsearch:" "tubearchivist:"
|
||||||
|
"wakapi:" "mailhog:" "atuin:"
|
||||||
|
)
|
||||||
|
local found=0
|
||||||
|
for svc in "${services[@]}"; do
|
||||||
|
if grep_exists " ${svc}" "$TEMPLATE_FILE"; then
|
||||||
|
((found++)) || true
|
||||||
|
else
|
||||||
|
fail "Service not found in template: $svc"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [[ $found -eq ${#services[@]} ]]; then
|
||||||
|
pass "All ${#services[@]} services defined in template"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
test_all_services_have_healthchecks() {
|
||||||
|
check "All exposed services have healthcheck blocks"
|
||||||
|
local exposed_services=("homepage" "pihole" "dockhand" "influxdb" "grafana" "drawio" "kroki" "atomictracker" "archivebox" "tubearchivist" "wakapi" "mailhog" "atuin")
|
||||||
|
local missing=()
|
||||||
|
for svc in "${exposed_services[@]}"; do
|
||||||
|
local svc_block
|
||||||
|
svc_block=$(sed -n "/^ ${svc}:/,/^[^ ]/p" "$TEMPLATE_FILE" || true)
|
||||||
|
if echo "$svc_block" | grep_exists "healthcheck:"; then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
missing+=("$svc")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [[ ${#missing[@]} -eq 0 ]]; then
|
||||||
|
pass "All exposed services have health checks"
|
||||||
|
else
|
||||||
|
fail "Services missing health checks: ${missing[*]}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
test_all_services_have_restart_policy() {
|
||||||
|
check "All services have restart policy"
|
||||||
|
local restart_count
|
||||||
|
restart_count=$(grep -c "restart:" "$TEMPLATE_FILE" || true)
|
||||||
|
if [[ $restart_count -ge 16 ]]; then
|
||||||
|
pass "$restart_count services have restart policies"
|
||||||
|
else
|
||||||
|
fail "Only $restart_count services have restart policies (expected >= 16)"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
test_all_services_have_labels() {
|
||||||
|
check "All user-facing services have Homepage labels"
|
||||||
|
local label_services=("homepage" "pihole" "dockhand" "influxdb" "grafana" "drawio" "kroki" "atomictracker" "archivebox" "tubearchivist" "wakapi" "mailhog" "atuin")
|
||||||
|
local missing=()
|
||||||
|
for svc in "${label_services[@]}"; do
|
||||||
|
local svc_block
|
||||||
|
svc_block=$(sed -n "/^ ${svc}:/,/^[^ ]/p" "$TEMPLATE_FILE" || true)
|
||||||
|
if echo "$svc_block" | grep_exists "homepage.group:"; then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
missing+=("$svc")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [[ ${#missing[@]} -eq 0 ]]; then
|
||||||
|
pass "All user-facing services have Homepage discovery labels"
|
||||||
|
else
|
||||||
|
fail "Services missing labels: ${missing[*]}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
test_dockhand_uses_proxy() {
|
||||||
|
check "Dockhand connects through docker-socket-proxy"
|
||||||
|
local dockhand_block
|
||||||
|
dockhand_block=$(sed -n "/^ dockhand:/,/^[^ ]/p" "$TEMPLATE_FILE" || true)
|
||||||
|
if echo "$dockhand_block" | grep_exists "DOCKER_HOST=tcp://docker-socket-proxy:2375"; then
|
||||||
|
pass "Dockhand routes through socket proxy"
|
||||||
|
else
|
||||||
|
fail "Dockhand not configured to use socket proxy (security issue)"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
test_no_direct_socket_mounts_except_proxy() {
|
||||||
|
check "No direct Docker socket mounts except on socket-proxy"
|
||||||
|
local socket_lines
|
||||||
|
socket_lines=$(grep -n '/var/run/docker\.sock' "$TEMPLATE_FILE" || true)
|
||||||
|
local bad_mounts=0
|
||||||
|
while IFS= read -r line; do
|
||||||
|
[[ -z "$line" ]] && continue
|
||||||
|
local line_num
|
||||||
|
line_num=$(echo "$line" | cut -d: -f1)
|
||||||
|
local context
|
||||||
|
context=$(head -n "$line_num" "$TEMPLATE_FILE" | grep "^ [a-z]" | tail -1 || true)
|
||||||
|
if [[ "$context" != *"docker-socket-proxy"* ]]; then
|
||||||
|
((bad_mounts++)) || true
|
||||||
|
fail "Direct socket mount found outside proxy at line $line_num"
|
||||||
|
fi
|
||||||
|
done <<< "$socket_lines"
|
||||||
|
if [[ $bad_mounts -eq 0 ]]; then
|
||||||
|
pass "Only docker-socket-proxy mounts the Docker socket"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
test_env_template_completeness() {
|
||||||
|
check "demo.env.template has all required variables"
|
||||||
|
local required_vars=(
|
||||||
|
"COMPOSE_PROJECT_NAME" "COMPOSE_NETWORK_NAME"
|
||||||
|
"DEMO_UID" "DEMO_GID" "DEMO_DOCKER_GID"
|
||||||
|
"HOMEPAGE_PORT" "PIHOLE_PORT" "DOCKHAND_PORT"
|
||||||
|
"INFLUXDB_PORT" "GRAFANA_PORT" "DRAWIO_PORT" "KROKI_PORT"
|
||||||
|
"ATOMIC_TRACKER_PORT" "ARCHIVEBOX_PORT" "TUBE_ARCHIVIST_PORT"
|
||||||
|
"WAKAPI_PORT" "MAILHOG_PORT" "MAILHOG_SMTP_PORT" "ATUIN_PORT"
|
||||||
|
"NETWORK_SUBNET" "NETWORK_GATEWAY"
|
||||||
|
"TA_USERNAME" "TA_PASSWORD" "ELASTIC_PASSWORD"
|
||||||
|
"GF_SECURITY_ADMIN_USER" "GF_SECURITY_ADMIN_PASSWORD"
|
||||||
|
"PIHOLE_WEBPASSWORD"
|
||||||
|
)
|
||||||
|
for var in "${required_vars[@]}"; do
|
||||||
|
if grep_exists "^${var}=" "$ENV_TEMPLATE"; then
|
||||||
|
pass "Env template has $var"
|
||||||
|
else
|
||||||
|
fail "Env template missing $var"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
test_env_template_port_range() {
|
||||||
|
check "All ports in env template are in 4000-4099 range"
|
||||||
|
local ports_out_of_range=()
|
||||||
|
while IFS='=' read -r var val; do
|
||||||
|
if [[ "$var" == *"_PORT" && "$val" =~ ^[0-9]+$ ]]; then
|
||||||
|
if [[ "$val" -lt 4000 || "$val" -gt 4099 ]]; then
|
||||||
|
ports_out_of_range+=("$var=$val")
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done < "$ENV_TEMPLATE"
|
||||||
|
if [[ ${#ports_out_of_range[@]} -eq 0 ]]; then
|
||||||
|
pass "All ports within 4000-4099 range"
|
||||||
|
else
|
||||||
|
fail "Ports outside range: ${ports_out_of_range[*]}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
test_homepage_configs_exist() {
|
||||||
|
check "Homepage configuration files exist"
|
||||||
|
local configs=("services.yaml" "widgets.yaml" "settings.yaml" "bookmarks.yaml" "docker.yaml")
|
||||||
|
for cfg in "${configs[@]}"; do
|
||||||
|
if [[ -f "$PROJECT_ROOT/config/homepage/$cfg" ]]; then
|
||||||
|
pass "Homepage config exists: $cfg"
|
||||||
|
else
|
||||||
|
fail "Homepage config missing: $cfg"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
test_grafana_configs_exist() {
|
||||||
|
check "Grafana configuration files exist"
|
||||||
|
local configs=("datasources.yml" "dashboards.yml" "dashboards/docker-overview.json")
|
||||||
|
for cfg in "${configs[@]}"; do
|
||||||
|
if [[ -f "$PROJECT_ROOT/config/grafana/$cfg" ]]; then
|
||||||
|
pass "Grafana config exists: $cfg"
|
||||||
|
else
|
||||||
|
fail "Grafana config missing: $cfg"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
test_scripts_exist() {
|
||||||
|
check "Deployment scripts exist"
|
||||||
|
local scripts=("scripts/demo-stack.sh" "scripts/demo-test.sh" "scripts/validate-all.sh")
|
||||||
|
for script in "${scripts[@]}"; do
|
||||||
|
if [[ -f "$PROJECT_ROOT/$script" ]]; then
|
||||||
|
pass "Script exists: $script"
|
||||||
|
else
|
||||||
|
fail "Script missing: $script"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
test_scripts_use_strict_mode() {
|
||||||
|
check "All scripts use strict mode (set -euo pipefail)"
|
||||||
|
local found_scripts
|
||||||
|
found_scripts=("$PROJECT_ROOT/scripts/"*.sh)
|
||||||
|
for script in "${found_scripts[@]}"; do
|
||||||
|
if head -5 "$script" | grep_exists "set -euo pipefail"; then
|
||||||
|
pass "$(basename "$script") uses strict mode"
|
||||||
|
else
|
||||||
|
fail "$(basename "$script") missing strict mode"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "======================================"
|
||||||
|
echo "Unit Tests: Configuration Validation"
|
||||||
|
echo "======================================"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
test_template_exists
|
||||||
|
test_template_has_required_sections
|
||||||
|
test_template_has_all_services
|
||||||
|
test_all_services_have_healthchecks
|
||||||
|
test_all_services_have_restart_policy
|
||||||
|
test_all_services_have_labels
|
||||||
|
test_dockhand_uses_proxy
|
||||||
|
test_no_direct_socket_mounts_except_proxy
|
||||||
|
test_env_template_completeness
|
||||||
|
test_env_template_port_range
|
||||||
|
test_homepage_configs_exist
|
||||||
|
test_grafana_configs_exist
|
||||||
|
test_scripts_exist
|
||||||
|
test_scripts_use_strict_mode
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "======================================"
|
||||||
|
echo "RESULTS: $PASS passed, $FAIL failed"
|
||||||
|
echo "======================================"
|
||||||
|
[[ $FAIL -eq 0 ]]
|
||||||
|
|||||||
Reference in New Issue
Block a user