Deployment Overview of Jenkins on Server¶
Prerequisites and Basic Requirements¶
-
Operating System: Ubuntu (Debian-based distribution).
-
Privileges: Root access is required for installation and service management.
-
Domain: The application is configured to run on the
hostkey.inzone. -
Ports:
-
Internal port:
8080. -
External port:
443. -
Runtime Environment: OpenJDK 21 JRE (
openjdk-21-jre) andfontconfigare required for the Jenkins application to function correctly.
FQDN of the Final Panel¶
The application is accessible via the Fully Qualified Domain Name (FQDN) following the pattern: jenkins-marketplace-app<Server ID>.hostkey.in:443
Replace <Server ID> with the specific identifier assigned to the server instance. The connection is established over HTTPS (port 443).
File and Directory Structure¶
The deployment creates and utilizes the following directories for configuration and data storage:
-
/root/nginx: Directory containing the Nginx container configuration files. -
/data/nginx/user_conf.d: Directory storing custom Nginx configuration files for the specific domain. -
/data/nginx: Base directory for Nginx data and environment variables. -
/usr/share/keyrings/jenkins-keyring.asc: Location of the GPG key for the Jenkins repository.
Application Installation Process¶
The Jenkins application is installed via the standard Debian package manager using the official Jenkins repository. The installation process includes:
-
Adding the Jenkins GPG key from
https://pkg.jenkins.io/debian-stable/jenkins.io-2026.key. -
Configuring the official Jenkins repository (
https://pkg.jenkins.io/debian-stable binary/). -
Installing the
jenkinspackage. -
Installing required dependencies:
fontconfigandopenjdk-21-jre. -
Enabling and starting the
jenkinsservice viasystemd.
Access Rights and Security¶
-
Firewall: Access is controlled by the external port
443(HTTPS). The internal service runs on port8080and is not directly exposed to the external network; it is proxied through Nginx. -
Proxy Configuration: A reverse proxy is configured to forward traffic from the external port to the internal Jenkins instance at
127.0.0.1:8080. -
SSL/TLS: SSL certificates are managed via Certbot through the Nginx container.
Docker Containers and Their Deployment¶
The proxy and SSL management are handled by Docker containers. The container is deployed using docker compose from a configuration file located at /root/nginx/compose.yml.
The container details are as follows:
-
Service Name:
nginx -
Image:
jonasal/nginx-certbot:latest -
Restart Policy:
unless-stopped -
Network Mode:
host -
Environment Variable:
[email protected] -
Volumes:
-
nginx_secrets(external) mapped to/etc/letsencryptfor SSL certificates. -
/data/nginx/user_conf.dmapped to/etc/nginx/user_conf.dfor custom configuration.
The command used to start the container stack is docker compose up -d executed from the /root/nginx directory.
Proxy Servers¶
Nginx is utilized as the reverse proxy to secure and route traffic to the Jenkins application.
-
Domain Configuration: Custom domain configuration files are stored in
/data/nginx/user_conf.d. -
Proxy Pass: The Nginx configuration includes a directive to forward requests to
http://127.0.0.1:8080. -
SSL Management: The Nginx container integrates with Certbot to automatically handle SSL certificate generation and renewal for the configured domain.
Permission Settings¶
-
The directory
/root/nginxis owned byrootwith permissions0755. -
The compose configuration file
/root/nginx/compose.ymlis owned byrootwith permissions0644. -
The Nginx user configuration directory
/data/nginx/user_conf.dis accessible by the Docker container volume mount.
Location of Configuration Files and Data¶
-
Docker Compose:
/root/nginx/compose.yml. -
Nginx Custom Configs:
/data/nginx/user_conf.d/<domain>.conf. -
Nginx Environment:
/data/nginx/nginx-certbot.env. -
Jenkins Repository Key:
/usr/share/keyrings/jenkins-keyring.asc. -
Jenkins Repository List:
/etc/apt/sources.list.d/jenkins.list.
Available Ports for Connection¶
| Port | Protocol | Usage |
|---|---|---|
8080 | HTTP | Internal communication between Nginx proxy and Jenkins. Not exposed externally. |
443 | HTTPS | External user access via the configured domain name. |
Starting, Stopping, and Updating¶
The Jenkins application service is managed by systemd, while the Nginx proxy is managed via docker compose.
Jenkins Service Management:
-
Start the service:
-
Enable the service on boot:
-
Check service status:
Nginx Proxy Management:
-
Start the proxy container:
-
Stop the proxy container:
-
View container logs: