Coder Social home page Coder Social logo

ci-pipeline-for-website's Introduction

About

This repository contains code for my portfolio web pplication.

This projects builds a Jenkins CI pipeline. Every time I commit changes to this repository. Jenkins will build the docker image of my web application, push it to the Docker hub to a specific repository, and update the version of the web application in the GitHub.

Read this blog for a better understanding of this project.

OS

  • use Ubuntu version 18.04 lts for the host server machine.

Firewall config of droplet:

  • port 22 : ssh - add only your device's ip address
  • port 8080: jenkins - this is where your jenkins server is running

SSH into the server

  • ssh root@<ipAddressServer>

Beautify your prompt

  • echo 'PS1="\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ "' >> .bashrc && source .bashrc

Host Server

  • Install docker: apt update -y && apt install docker.io -y

Run Jenkins container:

  • docker run -d -p 8080:8080 -p 5000:5000 -v jenkins_home:/var/jenkins_home -v /usr/bin/docker:/usr/bin/docker -v /var/run/docker.sock:/var/run/docker.sock --name jenkins jenkins/jenkins:lts-jdk11

Give read permission to the jenkins user for docker.sock file:

  • docker exec -it -u 0 jenkins bash
  • chmod 666 /var/run/docker.sock
  • exit

Passwword to login into Jenkins as a admin

  • This file can be accessed by root user as well
  • docker exec -it jenkins bash
  • cat /var/lib/jenkins/secrets/initialAdminPassword

Pipeline

  • Create below creadentials IDs:
    1. github (git repository)
    2. dockerhub (artifact repository)

Trigger Jenkins pipeline

Github Webhooks

  • Ad webhook in github
  • <ipAddressOfHostServer>:<portNoOfJenkins>/github-webhook/
    • E.g.-> 143.110.184.204:8080/github-webhook/

Jenkins

  • Add GitHub SCM trigger
  • Add 'jenkins' user to the list of Polling ignores commits from certain users!

ci-pipeline-for-website's People

Contributors

bhairavisanskriti avatar 1jenkins avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.