docker.recipes

ArgoCD GitOps Stack

advanced

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:latest
4 container_name: gitops-gitea
5 restart: unless-stopped
6 ports:
7 - "${GITEA_HTTP:-3000}:3000"
8 - "${GITEA_SSH:-222}:22"
9 environment:
10 - GITEA__database__DB_TYPE=postgres
11 - GITEA__database__HOST=db:5432
12 - GITEA__database__NAME=gitea
13 - GITEA__database__USER=gitea
14 - GITEA__database__PASSWD=${DB_PASSWORD}
15 volumes:
16 - gitea_data:/data
17 depends_on:
18 - db
19
20 argocd:
21 image: quay.io/argoproj/argocd:latest
22 container_name: argocd
23 restart: unless-stopped
24 ports:
25 - "${ARGOCD_PORT:-8080}:8080"
26 command: ["argocd-server", "--insecure"]
27 environment:
28 - ARGOCD_SERVER_INSECURE=true
29 volumes:
30 - argocd_data:/home/argocd
31
32 argocd-repo-server:
33 image: quay.io/argoproj/argocd:latest
34 container_name: argocd-repo-server
35 restart: unless-stopped
36 command: ["argocd-repo-server"]
37 volumes:
38 - argocd_repo:/tmp
39
40 argocd-application-controller:
41 image: quay.io/argoproj/argocd:latest
42 container_name: argocd-controller
43 restart: unless-stopped
44 command: ["argocd-application-controller"]
45
46 redis:
47 image: redis:7-alpine
48 container_name: argocd-redis
49 restart: unless-stopped
50
51 db:
52 image: postgres:15-alpine
53 container_name: gitops-db
54 restart: unless-stopped
55 environment:
56 - POSTGRES_USER=gitea
57 - POSTGRES_PASSWORD=${DB_PASSWORD}
58 - POSTGRES_DB=gitea
59 volumes:
60 - postgres_data:/var/lib/postgresql/data
61
62volumes:
63 gitea_data:
64 argocd_data:
65 argocd_repo:
66 postgres_data:

.env Template

.env
1# ArgoCD GitOps Stack
2GITEA_HTTP=3000
3GITEA_SSH=222
4ARGOCD_PORT=8080
5
6# Database
7DB_PASSWORD=gitops_password

Usage Notes

  1. 1Gitea at http://localhost:3000 for Git repos
  2. 2ArgoCD at http://localhost:8080
  3. 3Initial ArgoCD password: argocd admin initial-password
  4. 4Connect ArgoCD to Gitea repositories
  5. 5Define applications in Git for GitOps workflow
  6. 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 file
2cat > docker-compose.yml << 'EOF'
3services:
4 gitea:
5 image: gitea/gitea:latest
6 container_name: gitops-gitea
7 restart: unless-stopped
8 ports:
9 - "${GITEA_HTTP:-3000}:3000"
10 - "${GITEA_SSH:-222}:22"
11 environment:
12 - GITEA__database__DB_TYPE=postgres
13 - GITEA__database__HOST=db:5432
14 - GITEA__database__NAME=gitea
15 - GITEA__database__USER=gitea
16 - GITEA__database__PASSWD=${DB_PASSWORD}
17 volumes:
18 - gitea_data:/data
19 depends_on:
20 - db
21
22 argocd:
23 image: quay.io/argoproj/argocd:latest
24 container_name: argocd
25 restart: unless-stopped
26 ports:
27 - "${ARGOCD_PORT:-8080}:8080"
28 command: ["argocd-server", "--insecure"]
29 environment:
30 - ARGOCD_SERVER_INSECURE=true
31 volumes:
32 - argocd_data:/home/argocd
33
34 argocd-repo-server:
35 image: quay.io/argoproj/argocd:latest
36 container_name: argocd-repo-server
37 restart: unless-stopped
38 command: ["argocd-repo-server"]
39 volumes:
40 - argocd_repo:/tmp
41
42 argocd-application-controller:
43 image: quay.io/argoproj/argocd:latest
44 container_name: argocd-controller
45 restart: unless-stopped
46 command: ["argocd-application-controller"]
47
48 redis:
49 image: redis:7-alpine
50 container_name: argocd-redis
51 restart: unless-stopped
52
53 db:
54 image: postgres:15-alpine
55 container_name: gitops-db
56 restart: unless-stopped
57 environment:
58 - POSTGRES_USER=gitea
59 - POSTGRES_PASSWORD=${DB_PASSWORD}
60 - POSTGRES_DB=gitea
61 volumes:
62 - postgres_data:/var/lib/postgresql/data
63
64volumes:
65 gitea_data:
66 argocd_data:
67 argocd_repo:
68 postgres_data:
69EOF
70
71# 2. Create the .env file
72cat > .env << 'EOF'
73# ArgoCD GitOps Stack
74GITEA_HTTP=3000
75GITEA_SSH=222
76ARGOCD_PORT=8080
77
78# Database
79DB_PASSWORD=gitops_password
80EOF
81
82# 3. Start the services
83docker compose up -d
84
85# 4. View logs
86docker compose logs -f

One-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 | bash

Troubleshooting

  • 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

Ad Space