All Projects β†’ Voronenko β†’ devops-jenkins-box-template

Voronenko / devops-jenkins-box-template

Licence: other
Bootstrap template to provision your agency own Jenkins server

Programming Languages

shell
77523 projects
python
139335 projects - #7 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to devops-jenkins-box-template

jenni
πŸ‘©β€πŸ’» Jenkins Personal Assistant - CLI to interact with Jenkins server
Stars: ✭ 40 (+81.82%)
Mutual labels:  jenkins
Real Time Social Media Mining
DevOps pipeline for Real Time Social/Web Mining
Stars: ✭ 22 (+0%)
Mutual labels:  jenkins
event-recommender-festa
[SI -> 였늘회, νŽ«ν”„λ Œλ“œ 이직, 연봉 35% μƒμŠΉ] λ‚΄ μ£Όλ³€μ§€μ—­μ˜ μ΄λ²€νŠΈμ™€ 행사λ₯Ό μΆ”μ²œν•΄μ£ΌλŠ” μ„œλΉ„μŠ€
Stars: ✭ 64 (+190.91%)
Mutual labels:  jenkins
ecutest-plugin
This plugin integrates Jenkins with ECU-TEST and generates reports on automated test execution.
Stars: ✭ 23 (+4.55%)
Mutual labels:  jenkins
aliyun-oss-uploader-plugin
Aliyun/AliCloud OSS uploader
Stars: ✭ 26 (+18.18%)
Mutual labels:  jenkins
black-postoffice
[무신사 μ‹ μž…] 읡λͺ…μœΌλ‘œ νŽΈν•˜κ²Œ κ³ λ―Ό, 일상을 κ³΅μœ ν•˜λŠ” μ†Œμ…œ λ„€νŠΈμ›Œν¬ μ„œλΉ„μŠ€μž…λ‹ˆλ‹€.
Stars: ✭ 31 (+40.91%)
Mutual labels:  jenkins
aqua-microscanner-plugin
Enables scanning of docker builds in Jenkins for OS package vulnerabilities.
Stars: ✭ 37 (+68.18%)
Mutual labels:  jenkins
SeleniumTDD
A Selenium TDD framework that incorporates key features of Selenium and TestNG which can be used to create web-based automation scripts.
Stars: ✭ 23 (+4.55%)
Mutual labels:  jenkins
mailer-plugin
This plugin allows you to configure email notifications for build results
Stars: ✭ 35 (+59.09%)
Mutual labels:  jenkins
jira-trigger-plugin
Triggers a build when a certain condition is matched in JIRA
Stars: ✭ 112 (+409.09%)
Mutual labels:  jenkins
jenkins-pipeline
Jenkins Pipeline Shared Library
Stars: ✭ 16 (-27.27%)
Mutual labels:  jenkins
kubetools
Kubetools - Curated List of Kubernetes Tools
Stars: ✭ 674 (+2963.64%)
Mutual labels:  jenkins
intelirest-cli
A cli interpreter for intelliJ .http files
Stars: ✭ 23 (+4.55%)
Mutual labels:  jenkins
audit-log-plugin
Audit logging plugin for Jenkins based on Apache Log4j Audit
Stars: ✭ 19 (-13.64%)
Mutual labels:  jenkins
up
UP - Ultimate Provisioner CLI
Stars: ✭ 43 (+95.45%)
Mutual labels:  jenkins
artifact-promotion-plugin
A simple Jenkins plugin to promote artifacts.
Stars: ✭ 29 (+31.82%)
Mutual labels:  jenkins
cloud-s4-sdk-pipeline
The Cloud SDK pipeline uses the Cloud SDK continuous delivery server for building, checking, and deploying extension applications. Projects based on the SAP Cloud SDK archetype will automatically use this pipeline.
Stars: ✭ 65 (+195.45%)
Mutual labels:  jenkins
Hands-On-Serverless-Applications-with-Go
Hands-On Serverless Applications with Go, published by Packt.
Stars: ✭ 92 (+318.18%)
Mutual labels:  jenkins
Containerization-Automation
Study and Use of Containers and Automation Tools
Stars: ✭ 45 (+104.55%)
Mutual labels:  jenkins
cjp-demo-environment
CloudBees CI Demo based on Docker Compose
Stars: ✭ 23 (+4.55%)
Mutual labels:  jenkins

Dive into continious integration with Jenkins.

Background

Nowadays continious integration is the important part of the agile software development life cycle. There is a number of tools on the market: Atlassian Bamboo, Jenkins, Jetbrains TeamCity. In my opinion Jenkins has the most optimal product community and set of really useful plugins that suits most of your software projects: you can build software, deploy software,
websites, portals to various places, including AWS, DigitalOcean, bare metal servers or to run unit tests. It can be integrated with communication tools of your choice, like Slack, HipChat or email.

If you haven't had a chance to try Jenkins earlier, feel free to use tutorial below to start.

Manual installation

In order to install Jenkins, we will need:

  • Unix system. I would recommend debian based, like ubuntu server LTS
  • Java runtime environment installed. I usually use Java 8
  • Get base Jenkins setup
  • Install necessary plugins
  • Put behind web server.

Install Java

Easist way to install Java, is using apt-get package manager

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update

Once you added ppa above, you can install java with the following command:

sudo apt-get install oracle-java8-installer

Get base Jenkins setup

You will need to execut series of the commands, namely: add jenkins signing key, register jenkins apt sources, update package lists, and install Jenkins package.

wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
sudo echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list
sudo apt-get update
sudo apt-get install jenkins

By default, it will install base Jenkins setup, which is insecure. You will need to go to the host were your Jenkins is installed, for example: http://jenkins-host:8080/. Navigate to Manage Jenkins (on the left) and choose "Configure Global Security" item on the page loaded. enable security

Now look below on the Matrix based security (select it, if it is not selected previously), and make sure Anonymous only has the Read right under the View group. Click save at the bottom of the page. After the page load, you'll see a login form, simply ignore that, go to the home page (like, for example, http://jenkins-host:8080/). You'll see this sign up form, the first signed up account will be the administrator.

Power of plugins.

Jenkins would not be so powerful without plugins. Usually I install next plugins by default:

Plugins are installed using Plugin manager on a Manage Jenkins Section. Plugins manager

Put behind web server

Usually I hide Jenkins behind nginx. Typical configuration looks like the one below

server {
  listen 443 ssl;
  server_name jenkins.vagrant.dev;

  ssl_certificate /etc/nginx/jenkins_selfsigned.crt;
  ssl_certificate_key /etc/nginx/jenkins_selfsigned.key;

  location / {
    proxy_pass http://127.0.0.1:8080;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_redirect off;

    proxy_connect_timeout 150;
    proxy_send_timeout 100;
    proxy_read_timeout 100;
  }
  ...
}

Automated installation

Do I install Jenkins manually each time? Of course not, I do it often for my customers. With ansible, and sa-box-jenkins role new Jenkins installation can be deployed while you drink the coffee.

Let's prepare basic bootstrap project, that can be used by you in the future. It includes following files:

  • bootstrap.sh - installs ansible alongside with dependences.
  • init.sh - initializes 3rd party dependencies
  • .projmodules - fully compatible with .gitmodules git syntax, specifies list of the dependencies that will be used by the playbook. In particular, it includes ansible- by default developer_recipes (repository with set of handy deployment recipes) and ansible role called sa-box-bootstrap responsible for box securing steps (assuming you plan to put Jenkins on a remote hosts).
[submodule "public/ansible_developer_recipes"]
	path = public/ansible_developer_recipes
	url = [email protected]:Voronenko/ansible-developer_recipes.git
[submodule "roles/sa-box-bootstrap"]
        path = roles/sa-box-bootstrap
        url = [email protected]:softasap/sa-box-bootstrap.git
[submodule "roles/sa-box-jenkins"]
        path = roles/sa-box-jenkins
        url = [email protected]:softasap/sa-box-jenkins.git
  • hosts - list here the initial box credentials, that were provided to you for the server. Note: jenkins-bootstrap assumes, you have the fresh box with the root access only. If your box already secured, adjust credentials appropriately
[jenkins-bootstrap]
jenkins_bootstrap ansible_ssh_host=192.168.0.17 ansible_ssh_user=yourrootuser ansible_ssh_pass=yourpassword
[jenkins]
jenkins ansible_ssh_host=192.168.0.17 ansible_ssh_user=jenkins
  • jenkins_vars.yml - set here specific environment overrides, like your preferred deploy user name and keys.
  • jenkins_bootstrap.yml - First step - box securing. Creates jenkins user, and secures the box using sa-box-bootstrap role. See more details about the sa-box-bootstrap role In order, to override params for sa-box-bootstrap - pass the parameters like in example below.
- hosts: all

  vars_files:
    - ./jenkins_vars.yml
  roles:
     - {
         role: "sa-box-bootstrap",
         root_dir: "{{playbook_dir}}/public/ansible_developer_recipes",
         deploy_user: "{{jenkins_user}}",
         deploy_user_keys: "{{jenkins_authorized_keys}}"
       }
  • jenkins.yml provisioning script that configures jenkins with set of plugins and users.
  • jenkins_vars.yml configuration options for jenkins deployment.
  • setup_jenkins.sh shell script that invokes deployment in two steps: initial box bootstraping & jenkins setup
#!/bin/sh

ansible-playbook jenkins_bootstrap.yml --limit jenkins_bootstrap
ansible-playbook jenkins.yml --limit jenkins

Configuration options for automated installation

You need to override:

  • jenkins_authorized_keys (this is list of the keys, that allow you to login to Jenkins box under jenkins)
  • jenkins_domain - your agency domain
  • jenkins_host - name of the jenkins host (Site will be binded to jenkins_host.jenkins_domain)
  • java_version - your Java choice (6,7,8 supported)
jenkins_user: jenkins
jenkins_authorized_keys:
  - "{{playbook_dir}}/components/files/ssh/vyacheslav.pub"

jenkins_domain: "vagrant.dev"
jenkins_host: "jenkins"

java_version: 8

-jenkins_users list of users with passwords to create. Admin and deploy are required users. Admin is used to manage instance, deploy is used to access the artifacts via deployment scripts. If you won't override passwords, default one will be used (per role), which is not the best, for public deployments.

jenkins_users:
  - {
    name: "Admin",
    password: "AAAdmin",
    email: "no-reply@localhost"
    }
  - {
    name: "deploy",
    password: "DeDeDeDeploy",
    email: "no-reply@localhost"
    }
  • jenkins_plugins Your choice of plugins to install. By default:
jenkins_plugins:
  - bitbucket # https://wiki.jenkins-ci.org/display/JENKINS/BitBucket+Plugin
  - bitbucket-pullrequest-builder
  - build-pipeline-plugin
  - copyartifact # https://wiki.jenkins-ci.org/display/JENKINS/Copy+Artifact+Plugin
  - credentials # https://wiki.jenkins-ci.org/display/JENKINS/Credentials+Plugin
  - delivery-pipeline-plugin # https://wiki.jenkins-ci.org/display/JENKINS/Delivery+Pipeline+Plugin
  - environment-script # https://wiki.jenkins-ci.org/display/JENKINS/Environment+Script+Plugin
  - git
  - ghprb # https://wiki.jenkins-ci.org/display/JENKINS/GitHub+pull+request+builder+plugin
  - greenballs # https://wiki.jenkins-ci.org/display/JENKINS/Green+Balls
  - hipchat # https://wiki.jenkins-ci.org/display/JENKINS/HipChat+Plugin
  - junit # https://wiki.jenkins-ci.org/display/JENKINS/JUnit+Plugin
  - matrix-auth # https://wiki.jenkins-ci.org/display/JENKINS/Matrix+Authorization+Strategy+Plugin
  - matrix-project #https://wiki.jenkins-ci.org/display/JENKINS/Matrix+Project+Plugin
  - parameterized-trigger #https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Trigger+Plugin
  - rebuild # https://wiki.jenkins-ci.org/display/JENKINS/Rebuild+Plugin
  - ssh
  - s3 # https://wiki.jenkins-ci.org/display/JENKINS/S3+Plugin
  - throttle-concurrents #https://wiki.jenkins-ci.org/display/JENKINS/Throttle+Concurrent+Builds+Plugin

Code in action

Code can be downloaded from repository https://github.com/Voronenko/devops-jenkins-box-template In order to use it - fork it, adjust parameters to your needs, and use.

Running is as simple as

./setup_jenkins.sh

Welcome to the world of continious integration & deployment.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].