How saurabh352/3tierapplicationdeplydevsecops works
Purpose
This repository is an operational DevSecOps setup for deploying a three-tier application through Jenkins. It is primarily a sequence of shell scripts for provisioning Jenkins, Docker, Python/user prerequisites, vulnerability scanners, SonarQube integration, and Jenkins pipeline execution.
Entry Points and Execution Order
The numbered scripts express the intended bootstrap order:
1. Jenkins installation: 1st-Jenkins.sh
2. Docker installation/configuration: 2nd-Docker.sh
3. User and Python setup: 3rd-Adduser+python.sh
4. Trivy installation/integration: 4th-Trivy.sh
5. Docker Scout installation/integration: 5th-DockerScout.sh
6. SonarQube setup: 6th-RunSonarQube
7. Pipeline variants: 7th-Pipeline-WithoutTrivy, 7th-pipeline-withTrivy
Jenkins CI/CD Control Plane
Jenkins is the central orchestrator. The repository expects Jenkins plugins for pipeline execution, Docker interaction, Docker build steps, and SonarQube scanning. Pipeline definitions appear to be delivered or configured through:
• 7th-Pipeline-WithoutTrivy
• 7th-pipeline-withTrivy
• 1st-Jenkins.sh
The two pipeline variants define a key policy boundary: standard build/deployment versus build/deployment including Trivy security scanning.
Container Build and Runtime Boundary
Docker is the packaging and runtime substrate for the application and likely for SonarQube. Docker setup is separated from Jenkins provisioning:
• 2nd-Docker.sh
• 5th-DockerScout.sh
• 6th-RunSonarQube
Jenkins must be granted Docker access, making the Jenkins-to-Docker socket/API boundary a material privilege and security concern.
Security and Quality Gates
The repository introduces two container-security tools and one source-quality platform:
• Trivy vulnerability scanning: 4th-Trivy.sh
• Docker Scout image analysis: 5th-DockerScout.sh
• SonarQube service startup/integration: 6th-RunSonarQube
The Trivy-enabled pipeline should act as the vulnerability-gating path before image promotion or deployment. SonarQube is an external quality-analysis service invoked from Jenkins through the SonarQube Scanner plugin.
Identity, Credentials, and External Services
Provisioning includes a dedicated user/Python environment in 3rd-Adduser+python.sh, likely supporting Jenkins agent execution or deployment automation. External integrations include Docker Hub authentication and SonarQube token-based access. Credentials should be stored in Jenkins credentials management rather than embedded in scripts or pipeline definitions.
Primary Flow
Infrastructure bootstrap progresses from Jenkins and Docker installation to agent permissions, scanner installation, SonarQube startup, and pipeline configuration. At run time, Jenkins coordinates source analysis with SonarQube, container image build via Docker, security scanning through Trivy and/or Docker Scout, registry authentication/push, and final application deployment. The principal deployment decision point is whether the selected pipeline includes the Trivy security gate.
Main entry points: 7th-pipeline-withTrivy Trivy-gated pipeline · 1st-Jenkins.sh Install Jenkins · 2nd-Docker.sh Install Docker · 3rd-Adduser+python.sh Set up user and Python
Components 17
Bootstrap scripts
Numbered scripts establish the delivery environment.
- Install Jenkins
1st-Jenkins.sh - Install Docker
2nd-Docker.sh - Set up user and Python · Prepares the execution identity and Python environment.
3rd-Adduser+python.sh - Install Trivy
4th-Trivy.sh - Install Docker Scout
5th-DockerScout.sh - Start SonarQube
6th-RunSonarQube
Jenkins control plane
Jenkins runs the selected delivery pipeline.
- Jenkins · Selects and executes the configured pipeline.
- Credentials store · Holds registry authentication and SonarQube tokens.
- Standard pipeline · Builds and deploys without the Trivy gate.
7th-Pipeline-WithoutTrivy - Trivy-gated pipeline · Requires vulnerability scanning before promotion.
7th-pipeline-withTrivy
Quality and security
Analysis services and image-security gates.
- SonarQube
- Trivy
- Docker Scout
Container delivery
Image publication and application rollout.
- Docker engine · Builds images and hosts containerized services.
- Container image
- Docker Hub
- Three-tier application
Connections 19
- Install Jenkins → Jenkins: provisions
- Install Docker → Docker engine: provisions
- Set up user and Python → Jenkins: prepares execution access
- Install Trivy → Trivy: installs
- Install Docker Scout → Docker Scout: installs
- Start SonarQube → SonarQube: starts
- Jenkins → Standard pipeline: runs
- Jenkins → Trivy-gated pipeline: runs
- Jenkins → Credentials store: reads credentials
- Jenkins → SonarQube: runs source analysis
- Jenkins → Docker engine: builds via Docker access · This is the privileged Docker API/socket boundary.
- Docker engine → Container image: builds
- Trivy-gated pipeline → Trivy: enforces scan
- Trivy → Container image: scans
- Jenkins → Docker Scout: analyzes image
- Docker Scout → Container image: assesses
- Container image → Docker Hub: pushes
- Credentials store → Docker Hub: registry authentication
- Container image → Three-tier application: deploys