Sparki.tools DevOps Configuration Guide
Last Updated: 2025-12-16 Status: ✅ Complete and Ready for UseOverview
This guide documents the complete DevOps infrastructure for Sparki.tools, including containerization, development environments, and staging configurations.What’s Included
- ✅ Development Container (
.devcontainer/Dockerfile) - Full polyglot dev environment - ✅ Dev Container Config (
.devcontainer/devcontainer.json) - VS Code/Codespaces integration - ✅ Extended Dev Environment (
docker-compose.dev.extended.yml) - Advanced services - ✅ Staging Environment (
docker-compose.staging.yml) - Pre-production replica - ✅ Dockerfiles (web, storm) - Containerized service definitions
- ✅ Ignore Files (
.gitignore,.dockerignore) - Version control optimization - ✅ Helper Scripts (setup.sh, start.sh, update.sh) - Container automation
File Structure
1. Development Container (.devcontainer)
Purpose
Provides a complete, reproducible development environment with all necessary tools pre-installed.Features
Installed Tools:- Go 1.21+
- Rust 1.78+ with clippy, rustfmt, rust-analyzer
- Python 3.11+ with Poetry, pytest, mypy, black, flake8
- Node.js 18+ with pnpm, yarn, Angular CLI, TypeScript
- Database clients (PostgreSQL, MySQL, Redis, SQLite)
- Container tools (Docker, Docker Compose)
- CLI tools (AWS CLI, jq, yq)
- Network tools (curl, wget, ping, traceroute, dnsutils)
- Development utilities (vim, nano, htop, tmux, tree)
- Oh-My-Zsh with Agnoster theme
Configuration Files
.devcontainer/Dockerfile
- Base Image: Ubuntu 22.04 LTS
- Size: ~1.2GB (includes all tooling)
- User: Non-root
sparkiuser with Docker access - Ports Exposed: 8080, 8081, 8000, 3000, 5432, 6379, 9090, 16686, 14268
.devcontainer/devcontainer.json
- Container Image: Built from
.devcontainer/Dockerfile - Mount Points:
- SSH config (read-only)
- Git config (read-only)
- Docker config (read-only)
- Workspace volume
- Port Forwarding: All dev service ports
- VS Code Extensions: 35+ development extensions installed
- Feature Flags: Git, GitHub CLI, AWS CLI, Docker-in-Docker
Setup Scripts
setup.sh - Post-create setup
Runs after container creation to:
- Download Go dependencies
- Verify Rust project
- Install Node.js dependencies (pnpm/npm)
- Install Python dependencies
- Configure pre-commit hooks
- Create
.env.localwith development configuration - Configure SSH and Git
start.sh - Post-start setup
Runs every container start to:
- Verify Docker services are running
- Start Docker Compose services if needed
- Wait for service health checks
- Load environment variables
- Display service status
update.sh - Dependency updates
Updates dependencies when reopening container:
- Update Go modules
- Update Rust dependencies
- Update Node.js packages
- Update Python dependencies
- Auto-update pre-commit hooks
Usage
Opening in VS Code with Dev Containers
Using GitHub Codespaces
Manual Docker Build
2. Docker Compose Environments
docker-compose.dev.yml (Core)
Purpose: Standard development environment Services:- PostgreSQL 16 (data + test)
- Redis 7 (cache + test)
- Docker-in-Docker (executor testing)
- Prometheus (metrics)
- Grafana (visualization)
- Jaeger (tracing)
- PostgreSQL:
localhost:5432(user: sparki) - Redis:
localhost:6379 - Prometheus:
http://localhost:9090 - Grafana:
http://localhost:3000(admin/admin) - Jaeger:
http://localhost:16686
docker-compose.dev.extended.yml (Enhanced)
Purpose: Advanced development with additional services Additional Services:- Elasticsearch + Kibana (log visualization)
- Logstash (log processing)
- MinIO (S3-compatible storage)
- OpenTelemetry Collector
- Envoy (API gateway testing)
- pgAdmin (PostgreSQL management)
- Redis Commander (Redis GUI)
- Adminer (database administration)
- MailHog (email testing)
- LocalStack (AWS services emulation)
- Vault (secrets management)
- k6 (load testing)
- API dev service (hot reload)
- Web dev service (hot reload)
- Elasticsearch:
localhost:9200 - Kibana:
http://localhost:5601 - MinIO:
http://localhost:9000(admin/admin) - pgAdmin:
http://localhost:5050 - Redis Commander:
http://localhost:8081 - Adminer:
http://localhost:8082 - MailHog:
http://localhost:8025 - LocalStack:
localhost:4566 - Vault:
http://localhost:8200 - API (dev):
http://localhost:8080(with hot reload) - Web (dev):
http://localhost:3000(with hot reload)
docker-compose.staging.yml (Pre-production)
Purpose: Mirror production environment for testing Services:- PostgreSQL 16 (production-like)
- Redis 7 (production-like)
- Sparki API (compiled)
- Sparki Web (optimized)
- Prometheus with retention
- Grafana with provisioning
- Jaeger with persistence
- Loki (log aggregation)
- Promtail (log shipping)
- AlertManager (alert management)
- Nginx (reverse proxy)
- Environment variables via .env file
- Persistent volumes
- Health checks
- Restart policies
- Logging configuration
- API:
http://localhost:8080 - Web:
http://localhost:3000 - PostgreSQL:
localhost:5434(staging database) - Redis:
localhost:6380(staging cache) - Prometheus:
http://localhost:9091 - Grafana:
http://localhost:3001 - Jaeger:
http://localhost:16687 - Loki:
http://localhost:3100 - AlertManager:
http://localhost:9093 - Nginx:
http://localhost:80,https://localhost:443
3. Dockerfile Specifications
engine/Dockerfile (API)
Purpose: Build Sparki API service Base Image: Alpine 3.18 Stages: 2 (builder + runtime) Key Features:- Multi-stage build for minimal size
- Go compilation with version info
- Non-root user (
sparki:1000) - Health checks enabled
- Security hardened
web/Dockerfile (Web Application)
Purpose: Build Sparki Web application Base Image: Node 18-Alpine Stages: 3 (dependencies + builder + runtime) Key Features:- Multi-stage build with dependency caching
- Support for pnpm/yarn/npm
- Next.js build optimization
- Non-root user
- Health checks
- Proper signal handling (dumb-init)
storm/Dockerfile (Storm Service)
Purpose: Build Storm observability service Base Image: Alpine 3.18 Key Features:- Template for storm service build
- Flexible for multiple language implementations
- Configuration file management
- Non-root user
- Health checks
4. .gitignore Configuration
Includes:- Environment files with secrets
- IDE & editor configurations
- Build artifacts (bin, dist, build, etc.)
- Language-specific artifacts:
- Go: vendor, *.prof, coverage.out
- Rust: target/, Cargo.lock
- Node: node_modules, pnpm-lock.yaml, yarn.lock
- Python: pycache, *.pyc, venv/
- Docker configuration
- Logs and temporary files
- Database files
- IDE cache
.gitignoreitself.dockerignore.env.example(template for environment).devcontainer/directory
5. .dockerignore Configuration
Includes:- Source control files (.git, .github)
- CI/CD configuration
- IDE & editor config
- Documentation files
- Test files and coverage
- Build artifacts
- Dependencies (let Docker handle)
- Development configuration
- Package manager lock files (let Docker handle fresh installs)
- Dockerfile and docker-entrypoint scripts
- Key application files
6. Common Development Workflows
Scenario 1: Initial Project Setup
Scenario 2: Full Stack Development (Extended)
Scenario 3: Staging Deployment Test
Scenario 4: Load Testing
7. Environment Variables
Development (.env.local)
Staging (.env.staging)
8. Health Checks
All services include health checks configured in docker-compose files:9. Volume Management
Development Volumes
Backup/Restore
10. Networking
Container Networks
All services usesparki-network bridge network for communication:
Port Forwarding
Development Ports (from containers to host):- 5432: PostgreSQL
- 6379: Redis
- 8080: API
- 8081: WebSocket/Relay
- 3000: Web/Grafana
- 9090: Prometheus
- 16686: Jaeger
- 14268: Jaeger Collector
11. Security Considerations
Non-Root Users
All images run with non-root users:- API:
sparki:1000 - Web:
node:1000 - Storm:
storm:1000
Secret Management
- Never commit secrets - Use
.env.local(in .gitignore) - Use environment variables - Pass via docker-compose
- Vault integration - For production secrets
- Secret rotation - Automated via CI/CD
Network Security
- Internal network - Services communicate via bridge network
- Port exposure - Only necessary ports exposed to host
- HTTPS - Nginx reverse proxy for TLS termination
- Firewalls - Configure host firewall for production
Image Security
- Alpine base - Minimal attack surface
- Multi-stage builds - Reduced final image size
- Security scanning - Use Trivy for vulnerability scanning
- Minimal dependencies - Only required packages
12. Troubleshooting
Common Issues
Port already in use:13. Performance Optimization
Memory Management
CPU Management
Disk I/O
14. CI/CD Integration
GitHub Actions Example
15. Maintenance
Regular Tasks
Quick Reference
Essential Commands
Support
For Issues:- Check logs:
docker-compose logs <service> - Review
.envconfiguration - Verify port availability
- Check disk/memory availability
- Reset volumes:
docker-compose down -v && docker-compose up -d
- See
/lab/sparki.tools/docs/for additional documentation - Check existing issues on GitHub
- Review infrastructure configuration files
Generated: 2025-12-16 Status: ✅ Complete Maintainer: Platform Engineering