Skip to content
DaniiL35Public

About

RevRecord - Vehicle maintenance & fuel tracking platform (docs & root)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

RevRecord

RevRecord is a vehicle maintenance tracker deployed on AWS with a full DevOps pipeline. The app lets you track fuel fill-ups and service records for your cars, but the real focus is the infrastructure around it — the project covers the full path from code to production.

The project is split across three repos:

Repository What it does
revrecord-App React + FastAPI application, Dockerfile, Jenkins pipeline, tests
revrecord-infra Terraform modules — VPC, EKS cluster, IAM, KMS, ArgoCD bootstrap
revrecord-gitops Helm charts and K8s manifests — the source of truth ArgoCD watches

Architecture

AWS Infrastructure

AWS Infrastructure

The VPC has two public subnets (for the NAT Gateway and load balancer) and two private subnets where the EKS worker nodes live. The cluster runs a managed node group (instance type, count, and region are all configurable via env/dev.tfvars).

Terraform manages it all — from the VPC and subnets up through the EKS cluster, KMS encryption keys, IAM roles with OIDC (so pods authenticate to AWS without static credentials), and even the initial ArgoCD Helm deployment. A bootstrap module handles the one-time resources: S3 bucket for Terraform state, ECR repository, and Secrets Manager entries.

The EKS public endpoint is locked down to the deployer's IP (auto-detected via api.ipify.org during terraform apply). If you switch networks, just re-run make apply and it updates.

Terraform Modules

Module What it provisions
networking VPC, 2 public + 2 private subnets, Internet Gateway, NAT Gateway, route tables, security groups
eks EKS cluster, managed node group, IAM roles (cluster + nodes + EBS CSI), KMS key for secrets encryption, OIDC provider for IRSA, EBS CSI Driver addon
external-secrets IAM role with OIDC trust policy for ESO, scoped to the 6 Secrets Manager entries
argocd ArgoCD Helm release, GitLab repository credentials, root app-of-apps Application with auto-sync

The bootstrap directory (bootstrap/) creates the long-lived resources separately: S3 state bucket with native locking, ECR repository with scan-on-push, and 6 Secrets Manager entries (app, MongoDB, Elasticsearch, Grafana, ArgoCD, DuckDNS).

Kubernetes

Kubernetes Architecture

ArgoCD runs the app-of-apps pattern with two root applications — one for infrastructure services (ingress, cert-manager, monitoring, logging, secrets) and one for the application itself. This means the platform and app concerns are separated and can sync independently.

Sync waves control the deployment order so dependencies are ready before the things that need them:

Wave Resources
-1 ArgoCD AppProjects (RBAC boundaries for infra vs. apps)
0 Cert-Manager, NGINX Ingress Controller, ArgoCD Ingress
1 ClusterIssuer, External Secrets Operator, Prometheus, Elasticsearch, DuckDNS Updater
2 ClusterSecretStore + ExternalSecrets, Grafana, Kibana, Fluent-Bit
(none) RevRecord application (deployed via the app root)

All credentials flow from AWS Secrets Manager through the External Secrets Operator — nothing sensitive lives in git. TLS is handled by cert-manager with a Let's Encrypt HTTP01 challenge.

ArgoCD Dashboard

ArgoCD Overview


Technology Stack

Category Technologies
Infrastructure Terraform (4 custom modules), AWS VPC, EKS, ECR, KMS, Secrets Manager, S3
CI/CD Jenkins (declarative pipeline), SonarQube, bandit, pip-audit, ECR scan-on-push
GitOps ArgoCD (app-of-apps, Helm, sync waves), External Secrets Operator
Observability Prometheus + Grafana (monitoring), Elasticsearch + Kibana + Fluent-Bit (logging)
Networking NGINX Ingress (NLB), cert-manager + Let's Encrypt
Containerization Docker (multi-stage build, non-root user), NGINX reverse proxy
Security KMS encryption at rest, IRSA, private subnets, container scanning, JWT + bcrypt
Application React, TypeScript, FastAPI, Python, Beanie/Motor, MongoDB
Testing Playwright (E2E + API), Pytest, Vitest

Repository Structure

RevRecord/
│
├── revrecord-infra/              # Terraform IaC
│   ├── modules/networking/       #   VPC, 4 subnets, IGW, NAT, routes, SGs
│   ├── modules/eks/              #   EKS cluster, managed node group, KMS, OIDC, EBS CSI
│   ├── modules/external-secrets/ #   ESO IAM role (IRSA) scoped to 6 secrets
│   ├── modules/argocd/           #   Helm install + GitLab creds + root app-of-apps
│   ├── bootstrap/                #   S3 state bucket, ECR repo, Secrets Manager entries
│   ├── scripts/                  #   pre-destroy cleanup (LBs, ENIs, finalizers)
│   └── env/dev.tfvars            #   Environment-specific variables (region, node size, etc.)
│
├── revrecord-gitops/             # K8s manifests (ArgoCD source of truth)
│   ├── root-apps/                #   infra-root-app + app-root-app
│   ├── argocd-apps/infra/        #   13 ArgoCD Applications (ESO, cert-manager,
│   │                             #     ingress, DuckDNS, prometheus, grafana, ES, kibana, etc.)
│   ├── argocd-apps/apps/         #   RevRecord Application definition
│   ├── charts/RevRecord/         #   Helm chart (deployment, service, ingress, HPA,
│   │                             #     external secrets for app + MongoDB)
│   └── manifests/                #   ClusterIssuer, AppProjects, ESO config,
│                                 #     DuckDNS updater, Grafana/Kibana ingress masters
│
└── RevRecord-App/              # The application
    ├── frontend/                 #   React SPA (Vite + TypeScript + Tailwind)
    ├── backend/                  #   FastAPI REST API (Beanie ODM)
    ├── tests/                    #   Playwright E2E + API tests
    ├── docker/                   #   Multi-stage Dockerfile + docker-compose.yml
    ├── nginx/                    #   Reverse proxy config
    └── Jenkins/Jenkinsfile       #   10-stage CI/CD pipeline

Prerequisites


Getting Started

Deploy the infrastructure

cd revrecord-infra

# First time: create S3 state bucket, ECR repo, and Secrets Manager entries
cd bootstrap && terraform init && terraform apply && cd ..

# Stand up the cluster
make init
make plan
make apply

# Connect kubectl
make connect

After make apply finishes, ArgoCD is already installed and watching the GitOps repo. It will automatically deploy everything — the ingress controller, cert-manager, monitoring/logging stacks, External Secrets Operator, and the RevRecord application itself. Give it a few minutes for all sync waves to complete.

# Watch ArgoCD deploy everything
kubectl get applications -n argocd -w

Run locally (for development)

The easiest way is Docker Compose — it starts MongoDB, the backend, and NGINX (serving the frontend) in one command:

cd RevRecord-App/docker
docker compose up

This brings up all three services: MongoDB on port 27017, the backend on port 8000, and NGINX on port 80 (proxying /api to the backend and serving the frontend static files).

Tear down

cd revrecord-infra
make destroy

The pre-destroy script automatically strips ArgoCD finalizers, deletes LoadBalancer services, cleans up orphaned AWS load balancers and ENIs, so the VPC actually deletes without getting stuck.


CI/CD Pipeline

Jenkins Pipeline

The Jenkins pipeline triggers on every push to the App repo:

  1. Set Version — reads the latest git tag, bumps the patch number automatically
  2. Unit Tests — pytest -m unit with parallel execution (-n auto), publishes JUnit results
  3. Code Security — bandit static analysis + pip-audit dependency vulnerability check
  4. Build + SonarQube (parallel) — builds a multi-stage Docker image (Node for frontend, Python for backend, slim runtime with non-root user) while SonarQube analyzes code quality and coverage
  5. Integration Tests — brings up the full stack with docker compose (app + MongoDB), runs pytest -m integration inside the container, tears it down
  6. Git Tag — tags the commit with the new version (main branch only)
  7. Publish to ECR — pushes the image to the project's ECR repository
  8. ECR Scan — waits for AWS to finish the vulnerability scan, fails the build if any CRITICAL findings
  9. Deploy to GitOps — clones the GitOps repo, updates the image tag in charts/revrecord/values.yaml, commits and pushes. ArgoCD detects the change and rolls out the new deployment automatically.

Feature branches run stages 1–5 (build and test) but skip tagging, publishing, and deployment. Slack notifications on success and failure.

End-to-end deployment flow

Developer pushes code
  → Jenkins builds + tests + scans
    → image pushed to ECR
      → GitOps repo updated with new tag
        → ArgoCD auto-syncs
          → new pods roll out on EKS

Multibranch pipeline

Jenkins Multibranch Pipeline


Monitoring

Prometheus scrapes the FastAPI /metrics endpoint, NGINX Ingress, kube-state-metrics, and node-exporter. Grafana ships with pre-loaded dashboards (cluster overview, node exporter, pods).

RevRecord Grafana Dashboard MongoDB Grafana Dashboard
RevRecord app metrics — request rate, error rate, DB status, pod count MongoDB metrics — connections, operations, query efficiency
Cert Manager Monitoring NGINX Ingress Monitoring
Cert-Manager — certificate expiry, ACME requests, auto-renewal status NGINX Ingress — request volume, connections, success rate, resource usage

The application exposes custom Prometheus metrics:

  • http_requests_total — request count by method and status code
  • http_request_duration_seconds — latency histogram
  • db_connections_active — MongoDB connection status (1/0), updated on every scrape
  • app_start_time_seconds — process start time
  • app_errors_total — error counter broken down by exception type

Logging

Fluent-Bit runs as a DaemonSet, collecting from /var/log/containers/*.log on every node. It has custom parsers for four log formats (NGINX access logs, Uvicorn/FastAPI, Python, MongoDB) and routes them into separate Elasticsearch indexes:

Index Source
nginx-logs-* NGINX Ingress access logs
app-logs-* RevRecord FastAPI logs
mongodb-logs-* MongoDB container logs

Kibana provides the visualization layer. A PreSync hook job refreshes the Elasticsearch auth token before each ArgoCD sync so Kibana doesn't lose its connection.

RevRecord Kibana Dashboard MongoDB Kibana Dashboard
App logs — error count, log level distribution, error trends per pod MongoDB logs — severity breakdown, slow queries, connection events
NGINX Kibana Dashboard
NGINX logs — request volume, status codes, top endpoints, client IPs

Secrets Management

No secrets in git. The flow:

AWS Secrets Manager → External Secrets Operator (IRSA auth) → Kubernetes Secrets

Six secrets are managed this way:

AWS Secret K8s Secret Used by
revrecord/dev/app-secret revrecord-app-secret FastAPI (JWT secret key, DB URL)
revrecord/dev/mongodb-credentials revrecord-mongodb-credentials MongoDB auth
revrecord/dev/elasticsearch-credentials elasticsearch-master-credentials Elasticsearch, Kibana, Fluent-Bit
revrecord/dev/grafana-credentials grafana-credentials Grafana admin login
revrecord/dev/argocd-credentials argocd-credentials ArgoCD admin password, GitLab repo access
revrecord/dev/duckdns-credentials duckdns-credentials DuckDNS DNS updater

ESO refreshes every hour. The IAM role uses OIDC trust (IRSA) — the ESO pod authenticates to AWS without any static credentials, just a service account annotation pointing to the IAM role ARN.


Security

Layer Implementation
Encryption at rest KMS key for EKS secrets, S3 state encryption, Secrets Manager
Network isolation Worker nodes in private subnets, outbound only via NAT Gateway
Endpoint restriction EKS public API locked to deployer's IP (auto-detected, re-applied on change)
IRSA Pods authenticate to AWS via OIDC — no static credentials anywhere
Secrets pipeline AWS Secrets Manager → ESO → K8s Secrets. Nothing in git.
CI security gates bandit (SAST), pip-audit (dependency check), SonarQube, ECR vulnerability scan
Container hardening Multi-stage build, non-root user, slim base image
App-level auth JWT + bcrypt, rate limiting on auth endpoints, user-scoped data isolation
TLS cert-manager + Let's Encrypt, automated certificate rotation

The Application

The app is a React + FastAPI vehicle maintenance tracker with MongoDB. It's the workload that the DevOps infrastructure above serves.

Key points: JWT authentication, REST API endpoints, license plate lookup via the Israeli Ministry of Transport API (with Hebrew-to-English manufacturer translation), fuel and service logging with odometer validation, analytics dashboard with spending charts. The Docker image is a multi-stage build — Node builds the frontend, Python installs the backend, and a slim runtime stage runs as a non-root user.

Testing: Playwright E2E tests across 5 browsers, Playwright API tests, Pytest unit + integration tests, Vitest frontend unit tests. The Jenkins pipeline runs unit and integration tests on every push.


Contact

Danil - LinkedIn

About

RevRecord - Vehicle maintenance & fuel tracking platform (docs & root)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages