Back

Self-hosted CI/CD Pipeline

Challenge & Solution

I designed and implemented a complete CI/CD pipeline on self-hosted infrastructure, connecting GitHub Actions, Terraform and Kubernetes. The workflow builds and publishes a FastAPI service, provisions an ECR repository through Floci and updates the cluster using a GitOps pattern, without requiring a real AWS account.

Kubernetes cluster installed with kubeadm on Ubuntu Server, using Flannel as the CNI.
FastAPI service packaged in Docker and deployed with commit-versioned images.
Infrastructure as code with Terraform and remote state in an emulated S3 backend.
End-to-end automation with GitHub Actions and a self-hosted runner.

Pipeline Architecture

01

Push to main

GitHub triggers the workflow.

v
02

Docker build

The runner creates an image tagged with the commit hash.

v
03

Terraform apply

It ensures the emulated ECR and remote state exist.

v
04

Push to ECR

The versioned image is published to the registry.

v
05

GitOps deploy

The manifest is updated, applied and rolled out.

v
06

Commit [skip ci]

Git records the deployed state without creating loops.

Key Decisions

01

GitOps as the single source of truth: the updated manifest is committed back to the repository.

02

Emulated S3 remote backend to preserve Terraform state between pipeline runs.

03

Unique commit tags instead of latest for deterministic Kubernetes deployments.

04

Credentials kept out of version control through variables and external configuration.

Technical Stack

KubernetesTerraformGitHub ActionsDockerFastAPIUbuntu Server