Code Monkey home page Code Monkey logo

jenkins-playground's Introduction

jenkins-playground

Step 0: Prerequisite

  • AWS account, REF

  • Domain name

Dependencies to be prepared before the workshop,REF

Step 1: Prepare Jenkins

  1. Prepare an EC2 instance

    • Use Ubuntu 18.04

    • Use default ssh key

    • Command to login: ssh ubuntu@PUBLIC_IP

    • Enable the 8080 port

  2. Prepare Jenkins

    A. Install Java

     ```
     sudo apt update
     sudo apt install openjdk-8-jdk
     ```
    

    B. Install repository

     ```
     wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
     sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
     sudo apt update
     sudo apt install jenkins
     ```
    

    C. Start Jenkins

     ```
     sudo systemctl start jenkins
     sudo systemctl status jenkins
     ```
    
  3. Use nginx as reverse proxy and enable https

    A. install nginx

    sudo apt install nginx
    

    B. Configure subdomain pointing to the PUBLIC_IP

    C. enable ssl with certbot

    sudo add-apt-repository ppa:certbot/certbot
    sudo apt update
    sudo apt install python-certbot-nginx
    sudo certbot --nginx -d jenkins-ci.coderbunker.com
    sudo nginx -t
    sudo systemctl reload nginx
    

    D. check https://jenkins-ci.coderbunker.com/ URL

  4. Configure Jenkins

    A. Access Jenkins from PUBLIC_IP:8080

    B. Get the token for login

     ```
     sudo cat /var/lib/jenkins/secrets/initialAdminPassword
     ```    
    

    C. Choose Install suggested plugins

    D. Create admin user

  5. Fix creating Jenkins Job page keeps loading problem, with installing Warnings Plugin

  6. Generate your github token, and add to credential

    image

Step 4: Add slave node

  1. Create a new instance for slave node

    sudo apt update
    sudo apt install openjdk-8-jdk
    sudo apt install nodejs npm
    sudo npm install -g n
    sudo n latest
    sudo apt install awscli
    
  2. Add slave ssh key to credential

  3. Connect Slave Node

    Remote root directory: /home/ubuntu/jenkins

    Labels: jenkins-slave

    Host: PUBLIC_IP

Step 3: Prepare S3 Bucket

  1. Create an IAM user

  2. Create S3 bucket for static site hosting, REF

  3. Set DNS pointing to the S3 bucket

Step 4: Deploy website

  1. Create a react app as Github repo

  2. Add Jenkins configuration

  3. Setup the Github Webhook

Maintenance

  • Upgrade Jenkins on Ubuntu 18.04: sudo apt install --only-upgrade jenkins

Reference

  1. Install Jenkins on Ubuntu 18.04

  2. How To Install Java with apt on Ubuntu 18.04

jenkins-playground's People

Contributors

xuyuji9000 avatar

Watchers

James Cloos avatar  avatar

jenkins-playground's Issues

Install Jenkins on Centos

  1. Prepare Java: sudo yum install java-1.8.0-openjdk-devel

  2. Enable Jenkins reepository:

curl --silent --location http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo | sudo tee /etc/yum.repos.d/jenkins.repo
sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key

Roadmap

  • Setup Jenkins with Packer

  • Run first Jenkins Job with Jenkinsfile

  • Add a slave node

Use the jenkins slave for build

Started by user Coderbunker
17:58:55 Connecting to https://api.github.com using xuyuji9000-bot/******
Obtained Jenkinsfile from f1bcfa6740b8521ca50158bafa453e400ad04dd8
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] stage
[Pipeline] { (Checkout)
[Pipeline] deleteDir
Required context class hudson.FilePath is missing
Perhaps you forgot to surround the code with a step that provides this, such as: node
[Pipeline] error
[Pipeline] }
[Pipeline] // stage
[Pipeline] End of Pipeline

Could not update commit status, please check if your scan credentials belong to a member of the organization or a collaborator of the repository and repo:status scope is selected


GitHub has been notified of this commit’s build result

ERROR: Attempted to execute a step that requires a node context while ‘agent none’ was specified. Be sure to specify your own ‘node { ... }’ blocks when using ‘agent none’.
Finished: FAILURE

Polish the Documented steps for Workshop

  1. Create aws account

  2. Get an instance

  3. Prepare s3 bucket

  4. Get an AWS IAM user for Jenkins deployment

  5. Install Jenkins on the Instance

  6. Pointing the url to the instance

  7. Enable SSL

  8. Create a Reactjs project on Github

  9. Add Jenkinsfile to the Reactjs configuration

  10. Test automatic build and deployment

EXTRA:

  1. Add test step to the pipeline

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.