GitOps-driven delivery infrastructure for the Doratou frontend & backend applications
Helm Β· Argo CD Β· Ansible Β· GitHub Actions Β· Gitleaks Β· SonarQube
- π Doratou DevOps
- π Table of Contents
- π Overview
- ποΈ Architecture
- π Repository Structure
- π§° Technology Stack
- β Helm Chart (
helm/app) - ποΈ Database Migration Job
- π Secrets Management
- π GitOps with Argo CD
- π€ Ansible Automation
- β CI & Security Gates
- π¦ Getting Started
- π§Ύ Useful Commands
- πΊοΈ Project Status & Roadmap
- π License
This repository is the single source of truth for deploying and operating the Doratou application stack. It connects the separate frontend and backend repositories to the server by packaging them as a Helm chart and delivering them through Argo CD (GitOps).
Everything that runs on the server is described declaratively in this repository:
| What | Where |
|---|---|
| Application packaging (frontend, backend, migration job) | helm/app |
| Continuous delivery definitions (Argo CD) | gitops/ |
| Server / environment provisioning | ansible/ |
| CI pipelines | .github/ |
| Secret-leak scanning rules | .gitleaks.toml |
| Code quality analysis config | sonar-project.properties |
- π¦ Helm packaging β one chart deploys the frontend, the backend and the PostgreSQL migration Job.
- π GitOps delivery β Argo CD continuously reconciles the cluster with what is in Git.
- ποΈ Safe schema migrations β migrations run as an Argo CD Sync hook before the backend starts.
- π No secrets in Git β credentials live in a Kubernetes Secret that is referenced, never rendered by the chart.
- π‘οΈ Automated quality & security gates β Gitleaks secret scanning and SonarQube analysis.
- π€ Ansible automation β repeatable server preparation.
flowchart LR
DEV([π©βπ» Developer]) -->|push| FE_REPO[Frontend repo]
DEV -->|push| BE_REPO[Backend repo]
DEV -->|push| OPS_REPO[DevOps repo<br/>this repository]
FE_REPO -->|build image| REG[(Container Registry)]
BE_REPO -->|build image| REG
OPS_REPO --> CI[GitHub Actions]
CI --> GL[Gitleaks<br/>secret scan]
CI --> SQ[SonarQube<br/>code quality]
OPS_REPO -->|watched by| ARGO[Argo CD]
ARGO -->|helm/app| K8S
subgraph K8S[βΈοΈ Kubernetes Server]
direction TB
CM[ConfigMap]
MIG[Migration Job<br/>Argo CD Sync hook]
FE[Frontend]
BE[Backend]
PG[(PostgreSQL)]
RD[(Redis)]
SEC[[Secret<br/>app-db-credentials]]
CM --> MIG
MIG -->|migrate schema| PG
MIG -.->|then| BE
FE --> BE
BE --> PG
BE --> RD
SEC -.-> MIG
SEC -.-> BE
end
REG -.->|pull images| K8S
The migration Job is guaranteed to run after the ConfigMap exists and before the backend Deployment is updated.
sequenceDiagram
autonumber
participant Git as Git (this repo)
participant Argo as Argo CD
participant K8s as Kubernetes
participant Job as Migration Job
participant DB as PostgreSQL
Git->>Argo: New commit detected
Argo->>K8s: Apply ConfigMap
Argo->>Job: Run migration (Sync hook)
Job->>DB: Apply schema migrations
Job-->>Argo: Succeeded β
Argo->>K8s: Delete Job (hook cleanup)
Argo->>K8s: Roll out Backend & Frontend
.
βββ .github/ # GitHub Actions workflows (CI / quality gates)
βββ ansible/ # Ansible automation for server provisioning
βββ gitops/ # Argo CD / GitOps definitions
βββ helm/
β βββ app/ # Main Helm chart
β # ββ frontend
β # ββ backend
β # ββ PostgreSQL migration Job
βββ .gitignore
βββ .gitleaks.toml # Gitleaks (secret scanning) configuration
βββ LICENSE # MIT
βββ README.md
βββ sonar-project.properties # SonarQube project configuration
π‘ Tip: keep this tree in sync with the repository. If you add new folders (e.g.
docs/,scripts/), add them here too.
| Category | Tools | Purpose |
|---|---|---|
| Orchestration & Packaging | Kubernetes, Helm | Run and package the applications |
| GitOps / CD | Argo CD | Continuous delivery and drift correction |
| CI | GitHub Actions | Automated pipelines |
| Automation / IaC | Ansible | Server and environment provisioning |
| Security | Gitleaks | Detect leaked secrets in code and history |
| Code Quality | SonarQube | Static analysis and quality gate |
| Data | PostgreSQL, Redis | Persistent storage and caching |
| Workloads | Frontend app, Backend API | The Doratou application |
A single chart deploys the whole application:
| Component | Kind | Description |
|---|---|---|
| Frontend | Deployment | User-facing web application |
| Backend | Deployment | API service, configured through a ConfigMap and a Secret |
| Migration Job | Job (Argo CD hook) | Applies the PostgreSQL schema before the backend rolls out |
| ConfigMap | ConfigMap | Non-sensitive backend configuration (e.g. PDB_USER) |
Render and inspect the chart locally:
helm lint ./helm/app
helm template app ./helm/appThe migration is intentionally decoupled from the application runtime, so schema changes never depend on a backend pod starting up.
| Property | Behaviour |
|---|---|
| Trigger | Argo CD Sync hook |
| Ordering | Runs after the chart ConfigMap and before the backend Deployment |
| Frequency | Runs on every sync |
| Cleanup | Deleted automatically after a successful run |
| DB user | PDB_USER, read from the backend ConfigMap |
| DB password | Read from the app-db-credentials Secret |
| Independence | Does not depend on doratou-secrets |
Secrets are never stored in this repository β the chart only references an existing Kubernetes Secret.
Secret key (in app-db-credentials) |
Injected as env var | Used for |
|---|---|---|
postgresql-password |
PDB_PASSWORD |
PostgreSQL password |
redis-password |
RDB_PASSWORD |
Redis password |
- The Secret name and the source keys can be overridden in
values.yamlviabackend.databaseCredentials.existingSecret(default:app-db-credentials). - The raw example Secret manifest contains placeholder values only and is intentionally not rendered by the chart.
.gitleaks.tomlis used to scan for accidentally committed credentials.
Create the Secret on the cluster before the first sync:
kubectl create secret generic app-db-credentials \
--namespace <your-namespace> \
--from-literal=postgresql-password='<postgres-password>' \
--from-literal=redis-password='<redis-password>'Argo CD watches this repository and keeps the cluster in sync with helm/app.
- Git is the source of truth β the cluster state is always reconciled to what is committed.
- Ordered rollout β ConfigMap β Migration Job (hook) β Backend β Frontend.
- Self-cleaning hooks β successful migration Jobs are removed automatically.
- Application definitions live in the
gitops/directory.
The Argo CD Application manifest is gitops/doratou.yaml.
| Setting | Value |
|---|---|
| Application name | doratou |
| Argo CD namespace | argocd |
| Target namespace | doratou (created automatically) |
| Source | https://github.com/Doratou/Devops.git, branch main, path helm/app |
| Destination server | https://kubernetes.default.svc (in-cluster Kubernetes API) |
| Sync policy | Automated; pruning and self-healing enabled |
| Sync option | CreateNamespace=true |
The Argo CD server is installed in the argocd namespace by the helm_bootstrap role. It is configured with --insecure and can be reached locally with kubectl port-forward svc/argocd-server -n argocd 8080:80 (open http://localhost:8080).
The ansible/ directory contains playbooks and roles used to prepare the server so the cluster and Argo CD can run on it in a repeatable way.
The main playbook is ansible/site.yml. It targets all hosts, gathers facts, and runs with privilege escalation. Its roles run in this order:
| Role | Responsibility |
|---|---|
common |
Updates the apt cache, installs base and Kubernetes support packages, disables swap, and configures kernel modules and network parameters. |
xray |
Optionally installs and configures Xray from a local config.json, then configures the proxy; skipped when no local config is present. |
k3s |
Installs and starts the K3s server, configures kubeconfig and proxy settings, and waits for the Kubernetes API. |
helm_cli |
Installs the Helm CLI when it is not already present. |
headlamp |
Installs Headlamp in the cluster using Helm. |
sealed_secret |
Installs the Sealed Secrets controller and waits for it to become available. |
helm_bootstrap |
Installs Argo CD, waits for its resources, and applies the Doratou Application manifest. |
Role tags are defined in site.yml (for example, common, k3s, secret, and gitops) and can be used to select parts of the playbook. The repository includes development and CI inventories under ansible/inventories/.
cd ansible
ansible-playbook -i <inventory> <playbook>.ymlPipelines are defined in .github/ and run on GitHub Actions.
| Gate | Tool | What it protects against |
|---|---|---|
| π Secret scanning | Gitleaks (.gitleaks.toml) |
Leaked passwords, tokens and API keys |
| π§ͺ Code quality | SonarQube (sonar-project.properties) |
Bugs, code smells and vulnerabilities |
The repository contains these GitHub Actions workflows:
| Workflow | Scope and checks |
|---|---|
CI-Chart.yml |
Gitleaks secret scanning; Helm dependency build and lint; strict kubeconform validation of rendered manifests; Trivy IaC configuration scan; and a KinD chart installation test. |
CI-Ansible.yml |
Ansible playbook syntax check and ansible-lint, followed by a K3s and bootstrap integration test. |
CI-SonarQube.yml |
SonarQube scan on pull requests. |
- A Kubernetes cluster with Argo CD installed
kubectlandhelminstalled locally- Access to the frontend and backend container images
git clone https://github.com/Doratou/Devops.git
cd DevopsSee Secrets Management.
Option A β through Argo CD (recommended): register this repository and the gitops/ application in Argo CD; every push to main will be synced automatically.
Option B β directly with Helm:
helm upgrade --install app ./helm/app \
--namespace <your-namespace> --create-namespace# Check everything running in the namespace
kubectl get pods -n <your-namespace>
# Follow backend logs
kubectl logs -n <your-namespace> deploy/<backend-deployment> -f
# Check the migration Job (exists only during a sync)
kubectl get jobs -n <your-namespace>
# List Helm releases
helm list -A
# Render the chart without installing
helm template app ./helm/app- Helm chart for frontend, backend and PostgreSQL migration Job
- Argo CD (GitOps) delivery
- Migration Job as an ordered Argo CD Sync hook with automatic cleanup
- Database credentials via an existing Kubernetes Secret (no secrets in Git)
- Ansible automation
- Gitleaks secret scanning
- SonarQube code-quality analysis
- Monitoring & logging stack (Prometheus / Grafana / Loki)
- Secret management with External Secrets Operator or Vault
- Horizontal Pod Autoscaler (HPA)
- Multi-environment setup (staging / production)
Distributed under the MIT License. See LICENSE for details.
Maintained by @Doratou