Deshwal CICD Documentation: Difference between revisions
Appearance
Auto-created from uploaded PDF text extraction |
mNo edit summary |
||
| Line 1: | Line 1: | ||
[[category:Deshwal]] | |||
''Auto-generated from the uploaded PDF [[:File:Deshwal_CICD_Documentation.pdf|Deshwal_CICD_Documentation.pdf]]. This is an extracted-text rendering for searchability; see the original PDF for exact formatting, diagrams, tables, and images.'' | ''Auto-generated from the uploaded PDF [[:File:Deshwal_CICD_Documentation.pdf|Deshwal_CICD_Documentation.pdf]]. This is an extracted-text rendering for searchability; see the original PDF for exact formatting, diagrams, tables, and images.'' | ||
Latest revision as of 16:34, 26 July 2026
Auto-generated from the uploaded PDF Deshwal_CICD_Documentation.pdf. This is an extracted-text rendering for searchability; see the original PDF for exact formatting, diagrams, tables, and images.
CI/CD Deployment Pipeline
Documentation (Deshwal)
1. Overview
This document describes the CI/CD setup for deploying the Deshwal application using Jenkins.
2. Architecture
- Source Code: GitHub
- CI/CD Tool: Jenkins
- Framework: Yii
- Deployment Path: /var/www/html/deshwal
- Backup Path: /opt/Deshwal_pipeline_code_backup
3. Workflow
Developer pushes code → GitHub → Webhook → Jenkins → Deployment
4. Jenkins Job Configuration
Job Type: Pipeline
Source: GitHub repository
Credentials: GitHub token
Trigger: GitHub webhook
Build Step: Execute shell script
4. Deployment Script
Script present in Jenkins Web UI
Dashboard>oxypc>Configuration inside build steps
TARGET_DIR="/var/www/html/deshwal"
WORKSPACE_DIR="/var/lib/jenkins/workspace/deshwal_dev"
mkdir -p $TARGET_DIR
# Ensure permissions before deployment
sudo chown -R jenkins:www-data $TARGET_DIR
sudo chmod -R 775 $TARGET_DIR
# Deploy code
cp -r $WORKSPACE_DIR/ $TARGET_DIR/
# Fix permissions after deployment sudo chown -R jenkins:www-data
$TARGET_DIR sudo chmod -R 775 $TARGET_DIR
5. Backup Script
Script present in /opt/Deshwal_pipeline_code_backup.sh
#!/bin/bash
TARGET_DIR="/var/www/html/deshwal"
BACKUP_DIR="/opt/Deshwal_pipeline_code_backup"
TIMESTAMP=$(date +%Y-%m-%d_%H-%M-%S)
sudo mkdir -p $BACKUP_DIR
if [ -d "$TARGET_DIR" ]; then
sudo cp -r $TARGET_DIR $BACKUP_DIR/deshwal_backup_$TIMESTAMP
fi
6. Retention Policy
Only last 5 backups are retained.
Retention Script
KEEP=5
cd /opt/Deshwal_pipeline_code_backup
ls -1dt deshwal_backup_* | tail -n +$((KEEP+1)) | while read
backup do
sudo rm -rf "$backup"
done
Sudo Configuration
To allow Jenkins to execute privileged commands:
sudo visudo
Add:
jenkins ALL=(ALL) NOPASSWD: ALL