ArgoCD GitOps Stack
ArgoCD for GitOps continuous delivery with Gitea and sealed secrets
Overview
Argo CD is a declarative GitOps continuous delivery tool for Kubernetes that emerged from Intuit's need for better application deployment practices. Following the GitOps methodology, it uses Git repositories as the single source of truth for application definitions, automatically synchronizing Kubernetes cluster states with Git-stored manifests. This approach revolutionizes how teams manage deployments by making Git commits the primary mechanism for triggering infrastructure changes.
This GitOps stack combines Argo CD with Gitea for self-hosted Git repositories, PostgreSQL for reliable data persistence, and Redis for high-performance caching. Gitea serves as the lightweight Git service hosting your application manifests and Kubernetes YAML files, while Argo CD continuously monitors these repositories and applies changes to your clusters. The stack creates a complete on-premises GitOps pipeline where code commits automatically trigger deployments without complex CI/CD scripting.
Development teams transitioning from traditional deployment methods, platform engineers building internal developer platforms, and organizations requiring air-gapped or self-hosted solutions will find exceptional value in this combination. The stack eliminates the complexity of managing external Git services while providing enterprise-grade GitOps capabilities that scale from single clusters to multi-cluster environments with full audit trails and rollback capabilities.
Key Features
- Declarative GitOps deployments with Git as single source of truth
- Multi-cluster application management from centralized Argo CD interface
- Self-hosted Git service with GitHub-like interface and webhook integration
- Automated drift detection and cluster state reconciliation
- Visual application topology with real-time health monitoring
- Git-based rollback capabilities with complete deployment history
- Pull request workflows for application changes through Gitea
- Resource-efficient PostgreSQL backend with ACID compliance for metadata storage
Common Use Cases
- 1Platform teams building self-hosted GitOps pipelines for Kubernetes deployments
- 2Organizations requiring air-gapped development environments with complete Git hosting
- 3Multi-cluster application delivery across development, staging, and production environments
- 4Teams migrating from Jenkins-based deployments to declarative GitOps workflows
- 5Startups needing cost-effective alternative to GitHub Enterprise plus external GitOps tools
- 6DevOps teams implementing infrastructure-as-code with Kubernetes manifest management
- 7Companies requiring audit trails and compliance tracking for all deployment activities
Prerequisites
- Kubernetes cluster access with kubectl configured for Argo CD connectivity
- Minimum 2GB RAM and 2 CPU cores for running all stack components effectively
- Available ports 3000 (Gitea), 8080 (Argo CD), and 222 (Gitea SSH) on host system
- Understanding of Kubernetes manifests, YAML structure, and GitOps principles
- Git workflow knowledge including branching, pull requests, and webhook concepts
- Basic PostgreSQL administration skills for database maintenance and backups
For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
docker-compose.yml
docker-compose.yml
1services: 2 gitea: 3 image: gitea/gitea:latest4 container_name: gitops-gitea5 restart: unless-stopped6 ports: 7 - "${GITEA_HTTP:-3000}:3000"8 - "${GITEA_SSH:-222}:22"9 environment: 10 - GITEA__database__DB_TYPE=postgres11 - GITEA__database__HOST=db:543212 - GITEA__database__NAME=gitea13 - GITEA__database__USER=gitea14 - GITEA__database__PASSWD=${DB_PASSWORD}15 volumes: 16 - gitea_data:/data17 depends_on: 18 - db1920 argocd: 21 image: quay.io/argoproj/argocd:latest22 container_name: argocd23 restart: unless-stopped24 ports: 25 - "${ARGOCD_PORT:-8080}:8080"26 command: ["argocd-server", "--insecure"]27 environment: 28 - ARGOCD_SERVER_INSECURE=true29 volumes: 30 - argocd_data:/home/argocd3132 argocd-repo-server: 33 image: quay.io/argoproj/argocd:latest34 container_name: argocd-repo-server35 restart: unless-stopped36 command: ["argocd-repo-server"]37 volumes: 38 - argocd_repo:/tmp3940 argocd-application-controller: 41 image: quay.io/argoproj/argocd:latest42 container_name: argocd-controller43 restart: unless-stopped44 command: ["argocd-application-controller"]4546 redis: 47 image: redis:7-alpine48 container_name: argocd-redis49 restart: unless-stopped5051 db: 52 image: postgres:15-alpine53 container_name: gitops-db54 restart: unless-stopped55 environment: 56 - POSTGRES_USER=gitea57 - POSTGRES_PASSWORD=${DB_PASSWORD}58 - POSTGRES_DB=gitea59 volumes: 60 - postgres_data:/var/lib/postgresql/data6162volumes: 63 gitea_data: 64 argocd_data: 65 argocd_repo: 66 postgres_data: .env Template
.env
1# ArgoCD GitOps Stack2GITEA_HTTP=30003GITEA_SSH=2224ARGOCD_PORT=808056# Database7DB_PASSWORD=gitops_passwordUsage Notes
- 1Gitea at http://localhost:3000 for Git repos
- 2ArgoCD at http://localhost:8080
- 3Initial ArgoCD password: argocd admin initial-password
- 4Connect ArgoCD to Gitea repositories
- 5Define applications in Git for GitOps workflow
- 6ArgoCD syncs Kubernetes manifests from Git
Individual Services(6 services)
Copy individual services to mix and match with your existing compose files.
gitea
gitea:
image: gitea/gitea:latest
container_name: gitops-gitea
restart: unless-stopped
ports:
- ${GITEA_HTTP:-3000}:3000
- ${GITEA_SSH:-222}:22
environment:
- GITEA__database__DB_TYPE=postgres
- GITEA__database__HOST=db:5432
- GITEA__database__NAME=gitea
- GITEA__database__USER=gitea
- GITEA__database__PASSWD=${DB_PASSWORD}
volumes:
- gitea_data:/data
depends_on:
- db
argocd
argocd:
image: quay.io/argoproj/argocd:latest
container_name: argocd
restart: unless-stopped
ports:
- ${ARGOCD_PORT:-8080}:8080
command:
- argocd-server
- "--insecure"
environment:
- ARGOCD_SERVER_INSECURE=true
volumes:
- argocd_data:/home/argocd
argocd-repo-server
argocd-repo-server:
image: quay.io/argoproj/argocd:latest
container_name: argocd-repo-server
restart: unless-stopped
command:
- argocd-repo-server
volumes:
- argocd_repo:/tmp
argocd-application-controller
argocd-application-controller:
image: quay.io/argoproj/argocd:latest
container_name: argocd-controller
restart: unless-stopped
command:
- argocd-application-controller
redis
redis:
image: redis:7-alpine
container_name: argocd-redis
restart: unless-stopped
db
db:
image: postgres:15-alpine
container_name: gitops-db
restart: unless-stopped
environment:
- POSTGRES_USER=gitea
- POSTGRES_PASSWORD=${DB_PASSWORD}
- POSTGRES_DB=gitea
volumes:
- postgres_data:/var/lib/postgresql/data
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 gitea:5 image: gitea/gitea:latest6 container_name: gitops-gitea7 restart: unless-stopped8 ports:9 - "${GITEA_HTTP:-3000}:3000"10 - "${GITEA_SSH:-222}:22"11 environment:12 - GITEA__database__DB_TYPE=postgres13 - GITEA__database__HOST=db:543214 - GITEA__database__NAME=gitea15 - GITEA__database__USER=gitea16 - GITEA__database__PASSWD=${DB_PASSWORD}17 volumes:18 - gitea_data:/data19 depends_on:20 - db2122 argocd:23 image: quay.io/argoproj/argocd:latest24 container_name: argocd25 restart: unless-stopped26 ports:27 - "${ARGOCD_PORT:-8080}:8080"28 command: ["argocd-server", "--insecure"]29 environment:30 - ARGOCD_SERVER_INSECURE=true31 volumes:32 - argocd_data:/home/argocd3334 argocd-repo-server:35 image: quay.io/argoproj/argocd:latest36 container_name: argocd-repo-server37 restart: unless-stopped38 command: ["argocd-repo-server"]39 volumes:40 - argocd_repo:/tmp4142 argocd-application-controller:43 image: quay.io/argoproj/argocd:latest44 container_name: argocd-controller45 restart: unless-stopped46 command: ["argocd-application-controller"]4748 redis:49 image: redis:7-alpine50 container_name: argocd-redis51 restart: unless-stopped5253 db:54 image: postgres:15-alpine55 container_name: gitops-db56 restart: unless-stopped57 environment:58 - POSTGRES_USER=gitea59 - POSTGRES_PASSWORD=${DB_PASSWORD}60 - POSTGRES_DB=gitea61 volumes:62 - postgres_data:/var/lib/postgresql/data6364volumes:65 gitea_data:66 argocd_data:67 argocd_repo:68 postgres_data:69EOF7071# 2. Create the .env file72cat > .env << 'EOF'73# ArgoCD GitOps Stack74GITEA_HTTP=300075GITEA_SSH=22276ARGOCD_PORT=80807778# Database79DB_PASSWORD=gitops_password80EOF8182# 3. Start the services83docker compose up -d8485# 4. View logs86docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/argocd-gitops/run | bashTroubleshooting
- Argo CD shows 'Unknown' application health: Verify Kubernetes cluster connectivity and ensure kubectl context is properly configured for the target cluster
- Gitea webhook delivery failures: Check that Argo CD repository server can reach Gitea on port 3000 and webhook URLs use container network names instead of localhost
- Application sync stuck in 'Progressing' state: Examine resource hooks and ensure Kubernetes resources don't have conflicting finalizers or validation errors
- Argo CD login shows 'Failed to get token': Reset admin password using 'argocd admin initial-password' command or check Redis connectivity for session storage
- Repository connection timeout errors: Verify Gitea SSH key configuration and ensure the argocd-repo-server container can resolve Gitea hostname
- PostgreSQL connection refused during Gitea startup: Wait for database initialization to complete or check DB_PASSWORD environment variable matches between services
Community Notes
Loading...
Loading notes...
Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
Components
argocdgiteasealed-secretspostgres
Tags
#argocd#gitops#kubernetes#gitea#cd#devops
Category
DevOps & CI/CDAd Space
Shortcuts: C CopyF FavoriteD Download