Skip to content

Latest commit

Β 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Jenkins CI/CD Standard Specification Stack

This repository contains a full boilerplate application stack with a Vite + React (TypeScript) frontend, a Node.js Express backend, MongoDB & PostgreSQL databases, and a production-grade Jenkins CI/CD Pipeline complete with formatted Telegram notifications.


Architecture Overview

graph TD
    subgraph Users
        client[Vite Frontend - Port 3000]
    end
    subgraph Backend Services
        api[NodeJS Express Server - Port 5000]
    end
    subgraph Databases
        pg[(PostgreSQL - Port 5432)]
        mongo[(MongoDB - Port 27017)]
    end
    
    client -->|APIs| api
    api -->|SQL Query| pg
    api -->|Mongoose Connection| mongo
Loading

Folder Structure

.
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   └── index.js      # Express server entry point with MongoDB & Postgres connections
β”‚   β”œβ”€β”€ Dockerfile        # Node lightweight docker environment
β”‚   └── package.json
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ App.tsx       # Live status dashboard with build simulation
β”‚   β”‚   └── main.tsx
β”‚   β”œβ”€β”€ Dockerfile        # Multi-stage docker file serving Vite static builds with Nginx
β”‚   └── package.json
β”œβ”€β”€ jenkins/
β”‚   └── scripts/
β”‚       └── telegram-notify.sh  # Script executing curl payload to Telegram API
β”œβ”€β”€ docker-compose.yml          # Core orchestrator running the entire stack locally
β”œβ”€β”€ Jenkinsfile                 # Jenkins Declarative Pipeline definition
└── README.md

Local Development Setup

To run the application locally outside of Jenkins:

  1. Make sure you have Docker and Docker Compose installed.
  2. Clone the repository and run:
    docker compose up --build
  3. Open http://localhost:3000 to view the live dashboard. The dashboard will automatically ping the backend container at http://localhost:5000/api/health and display the status of PostgreSQL and MongoDB connections.

Jenkins CI/CD Setup

1. Configure Telegram Bot

To receive status notifications, you need a Telegram Bot token and Chat ID.

  • Create a bot via @BotFather and copy the HTTP API Token.
  • Create a channel or group chat, add the bot as an administrator, and get the chat ID (e.g. using @raw_data_bot or query https://api.telegram.org/bot<TOKEN>/getUpdates).

2. Configure Jenkins Credentials

Add two Secret Text credentials in your Jenkins Credentials Manager:

  1. ID: TELEGRAM_BOT_TOKEN, Secret: YOUR_TELEGRAM_BOT_TOKEN
  2. ID: TELEGRAM_CHAT_ID, Secret: YOUR_TELEGRAM_CHAT_ID

3. Create Pipeline

  • In Jenkins, create a new Pipeline job.
  • Under Pipeline Definition, select Pipeline script from SCM.
  • Select Git, enter your repository URL, set the branch to main, and type Jenkinsfile as the Script Path.
  • Trigger the build!

Telegram Message Template

The pipeline outputs formatted alerts to your Telegram chat containing rich information:

🟒 Jenkins Build #15 SUCCESS
πŸ“‚ Repository: company-project
🌿 Branch: main (commit: d8a71c3)
πŸ‘€ Author: namnk
πŸ’¬ Message: feat: add postgres backend integration
⏱ Duration: 1m 24s
πŸ”— Jenkins UI Link

About

πŸš€ Automated CI/CD pipeline infrastructure using Jenkins, Docker, and GitHub Webhooks with real-time Telegram notifications for seamless deployment.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages