DEV Community

Jonathan Chijioke
Jonathan Chijioke

Posted on

Basic CI/CD Pipeline (For a Web App)

TOOLS

Github Actions/ Jennkins

Function of Github Actions

  • Continuous Integration (CI)
    • Automatically run tests when you push code.
    • Lint, format, or validate your code.
    • Build your app (React, Node, Java, etc.) after every change

  • Continuous Deployment (CD)
    • Deploy your app to:
    • AWS EC2 or S3
    • Heroku, Vercel, Netlify
    • Docker Hub, Kubernetes, etc.
    • Can trigger on branch pushes (e.g., main or production).

  • Automation
    Run tasks like:
    • Sending Slack/email notifications
    • Creating GitHub releases
    • Syncing branches
    • Automatically labeling PRs/issues

WHY GITHUB ACTION

  • Native to GitHub
    • No need for extra tools or integrations.
    • Everything is configured in your repo using simple YAML files.

  • Automation Made Easy
    • Automate tests, builds, deployments, notifications, and more.
    • Triggers on events like push, pull_request, issue, etc.

  • Continuous Integration & Deployment (CI/CD)
    • Run tests automatically every time you push code.
    • Build and deploy to production (e.g., EC2, Netlify, Firebase) right from GitHub.

  • Secure & Scalable
    • Uses GitHub Secrets to safely store credentials.
    • Can scale from small side projects to large teams.

  • Custom Workflows
    • You define what happens and when.
    • Use thousands of community-created actions or write your own.

GitHub Actions saves you time, reduces errors, and gives you full control over your development and deployment pipelines — all inside GitHub.

What to Do:
• Set up GitHub Actions to automate the deployment of a simple web app.
• Deploy the app on AWS EC2 or DigitalOcean.

BEST PRACTICE RECOMMENDATION

  • For individual developers, small teams, and projects hosted on GitHub: GitHub Actions is best practice It’s faster to set up, easier to maintain, and integrates natively with GitHub
  • For large enterprise setups, complex workflows, or non-GitHub codebases: Jenkins is best It gives more control and flexibility, especially in custom pipelines or on-premise requirements.

Conclusion:
Use GitHub Actions if you’re starting out or want speed and simplicity.
Use Jenkins if you need deep customisation and enterprise-level control.

NEW THINGS I LEARNED FROM THIS PROJECT

Tools and Technologies Used
PM2 - Node- Node.js process manager for keeping app alive on EC2
Dotenv - Manages environment variables (.env file)

Important Files Created
.env - Stores sensitive config like PORT (ignored by Git)
Jenkinsfile - pipeline as code script defining automated stages

*How This CI/CD Project Is Useful for Companies
*

  1. Solves the Problem of Manual Deployment 🚨 The Problem:

Many small to mid-sized companies still deploy apps manually — uploading files via FTP, running scripts by hand, or SSH-ing into servers to restart apps. This is slow, error-prone, and not scalable.

✅ Solution:
• With a Jenkinsfile and GitHub integration, every time code is pushed, Jenkins:
• Pulls the latest code
• Installs dependencies
• Runs (optional) tests
• Deploys to production using pm2
• This reduces human error, increases deployment speed, and allows developers to focus on coding, not server maintenance.

  1. Introduces CI/CD Practices to Streamline Development

🚨 The Problem:

Without CI/CD, teams struggle with:
• Unpredictable deployments
• Lack of version control in production
• Difficulty reproducing builds

✅ Your Solution:
• The project introduces Continuous Integration and Continuous Deployment (CI/CD) practices.
• Jenkins acts as a single source of truth for:
• Build history
• Test results
• Deployment logs
• This standardizes the release process and ensures repeatable deployments across environments.

  1. Makes Onboarding New Developers Easier

🚨 The Problem:

New hires often waste days setting up local environments or learning how the deployment works.

✅ Your Solution:
• Your app has a README.md, .gitignore, .env config, and Jenkinsfile — this makes the repo:
• Self-documenting
• Easy to clone and run
• Transparent about CI/CD logic
• New devs can start contributing faster, reducing downtime during onboarding.

  1. Improves Uptime and Error Recovery

🚨 The Problem:

If a Node.js app crashes on a live server, it can go down for hours if there’s no monitoring or recovery tool.

✅ Your Solution:
• You use PM2 to:
• Automatically restart the app if it crashes
• Save and reload the app on server reboots
• This enhances reliability and uptime — a key priority for companies running customer-facing services.

  1. Reduces Infrastructure Cost for Startups or SMEs

🚨 The Problem:

Not every business can afford complex CI/CD tools like CircleCI, GitLab CI/CD, or AWS CodePipeline.

✅ Your Solution:
• Jenkins is open-source and free
• EC2 is pay-as-you-go
• This stack is perfect for:
• Startups
• Non-profits
• Internal apps at larger enterprises
• It provides professional-grade automation at minimal cost.

  1. Lays the Foundation for DevOps Culture

🚨 The Problem:

Many teams operate in silos — developers don’t talk to sysadmins, and releases break due to miscommunication.

✅ Your Solution:
• By using CI/CD and automated deployments, your project:
• Brings Dev and Ops workflows together
• Makes the build & deployment process visible and repeatable
• Encourages a shared understanding of how code gets to production

This promotes a DevOps culture, even in companies that are just starting to adopt modern practices.

Top comments (0)