A layered Docker Compose architecture for local DevOps development environments.
- Language: Use Traditional Chinese (繁體中文) for responses
- Environment: This is a local development environment - simple passwords are acceptable
- Focus: Prioritize modularity, clear layer separation, and ease of development
This repository provides a comprehensive DevOps stack organized into logical layers:
- Infrastructure Layer: Core services (networking, storage, security, monitoring)
- Platform Layer: Container management and messaging services
- Development Layer: SCM, CI/CD, quality assurance, and collaboration tools
- Application Layer: Business applications and specialized tools
# Create shared Docker network
docker network create devops
# Copy and configure environment variables
cp .env.example .env
# Edit .env with your preferred settings# Start infrastructure layer (must run first)
./scripts/start-infrastructure.sh
# Start specific services using Task
task start development/scm/gitlab
task start platform/containers/harbor2
# Or use Make (legacy support)
make start service=development/scm/gitlabCreate .env file with:
MY_DOMAIN=docker.internal
DEFAULT_NETWORK=devops
BASE_NETWORK_YAML="docker-compose.network.yaml"# Infrastructure layer (required first)
./scripts/start-infrastructure.sh
./scripts/stop-infrastructure.sh
./scripts/restart-infrastructure.sh
# Individual services
docker-compose -f infrastructure/network/docker-compose.yml up -d
docker-compose -f development/scm/gitlab/docker-compose.yml up -d
# Using Task runner
task start <layer>/<category>/<service>
task stop <layer>/<category>/<service># List available services
task search services
# Search by keyword
task search postgres
make search keyword=postgresMost services include health checks and are accessible via:
- HTTP services:
https://{service-name}.docker.internal - Database services: TCP routing through Traefik
- Infrastructure Layer - Start first (networking, storage, security)
- Platform Layer - Depends on Infrastructure
- Development Layer - Can run independently after Infrastructure
- Application Layer - May depend on services from other layers
Each service directory contains:
docker-compose.yml- Service configurationREADME.md(optional) - Service-specific docs- Configuration files and persistent volumes
- All HTTP services use Traefik reverse proxy
- HTTPS with self-signed certificates
- Database services use TCP routing
- Internal service communication via
devopsnetwork
# HTTP Service Traefik labels
labels:
- 'traefik.http.routers.{service}.tls=true'
- 'traefik.http.routers.{service}.rule=Host(`{service}.$MY_DOMAIN`)'
- 'traefik.http.routers.{service}.entrypoints=websecure'
- 'traefik.http.services.{service}.loadbalancer.server.port={port}'
# TCP Service Traefik labels
labels:
- 'traefik.tcp.routers.{service}.rule=HostSNI(`{service}.$MY_DOMAIN`)'
- 'traefik.tcp.routers.{service}.entrypoints={service}'
- 'traefik.tcp.services.{service}.loadBalancer.server.port={port}'- Use consistent directory structure:
layer/category/service/ - Keep secrets in dedicated
secrets/directories - Use Docker Secrets for sensitive data where possible
- Maintain backward compatibility with Make commands
- Simple passwords are acceptable for local development
- Focus on container privilege escalation risks (
privileged: true) - Ensure proper volume mounting permissions
- Use Docker Secrets for production-ready configurations
- Store secrets in
secrets/directories - Implement health checks for critical services
- Configure resource limits to prevent exhaustion
- Use security middleware in Traefik configurations
# Check service health
docker-compose ps
curl -k https://{service}.docker.internal/health
# Validate network connectivity
docker network inspect devops
# Test database connections
# PostgreSQL: https://pgadmin.docker.internal
# Redis: https://redis-ui.docker.internal- Services should start in dependency order
- Infrastructure layer provides foundation for all other layers
- Verify Traefik routing for new services
- Test backup/restore procedures for data services
- All external access goes through Traefik (ports 80/443)
- Database services use custom Traefik entrypoints
- Check for conflicting local services
- Services use
{service-name}.docker.internalformat - CoreDNS (in
core/, host port 10053) answers*.{MY_DOMAIN}with 127.0.0.1; macOS/etc/resolver/{MY_DOMAIN}points to it (./init.shortask dns:setupwrites it) - Add entries to hosts file if needed
- Always start Infrastructure layer first
- Check Docker network connectivity
- Verify environment variables are set correctly
| Service | URL | Default Credentials |
|---|---|---|
| Traefik Dashboard | https://traefik.docker.internal |
N/A |
| pgAdmin | https://pgadmin.docker.internal |
admin@example.com |
| Redis Commander | https://redis-ui.docker.internal |
N/A |
| Keycloak | https://keycloak.docker.internal |
admin/admin |
| Portainer | https://portainer.docker.internal |
admin/admin |
| GitLab | https://gitlab.docker.internal |
root/password |
- Create service directory following layer structure
- Add
docker-compose.ymlwith appropriate Traefik labels - Update relevant layer's main
docker-compose.yml - Add service to
taskfile.ymlandmakefile - Test service startup and connectivity
- Document service-specific configuration
- Test changes in isolated environment
- Verify backward compatibility
- Update documentation if needed
- Test startup/shutdown procedures
- Validate integration with dependent services
This environment is designed for local development and testing. For production deployment, review security configurations and replace development passwords with secure alternatives.