π Conduit CI/CD Deployment
This page documents how I configured my very first cloud server instance in the Developer Akademie DevSecOps Course.
TOCβ
π Conduit CI/CD Deployment
This repository contains everything you need to deploy Conduit (RealWorld Example App) with a Django backend and an Angular frontend using Docker Compose and GitHub Actions.
π Featuresβ
- β Automated CI/CD pipeline with GitHub Actions
- β Docker images built and pushed to GitHub Container Registry (GHCR)
- β Automatic deployment to your own server via SSH
- β Django backend + Angular frontend fully containerized
π§ Prerequisitesβ
Before you start, make sure you have:
- A Linux server with Docker & Docker Compose installed
- A GitHub repository fork of this project
- GitHub Secrets configured (see below)
βοΈ Setupβ
1οΈβ£ Clone the repositoryβ
git clone https://github.com/Gosia2024/conduit-deployment.git
cd conduit-deployment
2οΈβ£ Configure .env
Create a .env file with your settings (example):
SECRET_KEY=your-django-secret DEBUG=False BACKEND_EXTERNAL_PORT=8000 FRONTEND_EXTERNAL_PORT=80 DJANGO_SUPERUSER_USERNAME=admin DJANGO_SUPERUSER_PASSWORD=admin123 DJANGO_SUPERUSER_EMAIL=admin@example.com ALLOWED_HOSTS=127.0.0.1,localhost,your-server-ip CORS_ORIGIN_WHITELIST=http://localhost,http://your-server-ip
3οΈβ£ Deploy with Docker Compose
Run:
docker compose up -d --build
- Backend β available on http://your-server-ip:8000/api/
- Frontend β available on http://your-server-ip/
π€ CI/CD with GitHub Actions
The workflow in .github/workflows/deploy.yml automates deployment:
1.Build job
-
Runs on push to branch ci-cd-ghcr-deployment
-
Builds & pushes Docker images (frontend + backend) to GHCR
-
Uploads .env and compose.yaml as artifacts
2.Remote Deploy job
Copies config files to your server via SCP
Connects via SSH
Runs:
docker compose down --remove-orphans
docker system prune -af
docker compose up -d
π Required GitHub Secrets
Add these secrets in your repository β Settings β Secrets and variables β Actions:
-
SECRET_KEY, DEBUG
-
BACKEND_EXTERNAL_PORT, FRONTEND_EXTERNAL_PORT
-
DJANGO_SUPERUSER_USERNAME, DJANGO_SUPERUSER_PASSWORD, DJANGO_SUPERUSER_EMAIL
-
ALLOWED_HOSTS, CORS_ORIGIN_WHITELIST
-
API_URL (frontend β backend URL)
-
SERVER_HOST, SERVER_USER, SERVER_SSH_KEY, DEPLOY_DIR
β Result
Push to ci-cd-ghcr-deployment β π automatic deployment
Django backend + Angular frontend running on your server
No manual rebuilds needed
πΌοΈ Architecture Developer β GitHub β GitHub Actions β GHCR β Server β Docker Compose β Backend + Frontend
π§ͺ Test
Check if backend is working:
curl http://<server-ip>:8000/api/
Expected response:
{"articles": "http://<server-ip>:8000/api/articles"}
π Frontend
http://<your-server-ip>
π Thatβs it! You now have Conduit running with a full CI/CD pipeline.