makeporngreatagain.pro
yeahporn.top
hd xxx

CI/CD For Java Project Using Git, Jenkins & Docker

971

Before you start:

  1. Make sure you have Jenkins installed, here the reference link
  2. Make sure you have pushed java code to your git repo, here the java code
  3. Make sure you have Docker is installed, here the reference link
  4. Make sure you have installed & configuredbelow plugin:
    1. Configure Git Plugin On Jenkins
    2. Install & configure Maven build tool on Jenkins

Here we start:

  1. Install “publish Over SSH”
    Manage Jenkins > Manage Plugins > Available > Publish over SSH
  2. Enable connection between Ansible and Jenkins
    Manage Jenkins > Configure System > Publish Over SSH > SSH Servers

    • SSH Servers:
      Hostname:<DockerServerIP>
      username: dockeradmin
    • Now do test configuration. if you getting failed in test configuration then run following on Docker host
      • Add below lines to visudo
        visudo
        
        ansadmin ALL=(ALL) NOPASSWD: ALL
      • Using key-based authentication is advised. If you are still at learning stage use password based authentication:
        sed -ie 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
      • Restart sshd service
        service sshd restart
  3. In your docker server, login with dockeradmin & under /home/dockeradmin

    #create a directory
    mkdir docker
    
    #Download ansible playbook which will copy java application to tomcat server
    wget https://s3.amazonaws.com/webmagicinformatica.com/DevOpsTrainingInMumbai/Docker/Dockerfile
  4. Create Jenkins job, Fill the following details
    1. Login to your Jenkins Dashboard and click New Item
    2. Enter an Item name
      Select Maven project
    3. Under Source Code Management
      Select Git & input your jave program git repo URL
    4. Under Build
      Select Maven
      Goals and options: clean install package
    5. Add post-build steps
      • Send files or execute commands over SSH
        • SSH Server : docker_server
        • Source fiels: webapp/target/*.war
        • Remove prefix: webapp/target
        • Remote directory: //home//dockeradmin//docker
    6. Add post-build steps
      • Send files or execute commands over SSH
        • SSH Server : ansible_server
          docker stop webmagic_demo;
          docker rm -f webmagic_demo;
          docker image rm -f webmagic_demo;
          cd /home/dockeradmin/docker;
          docker build -t webmagic_demo .;
          docker run -d --name webmagic_demo -p 8090:8080 webmagic_demo

    7. Access web application from browser which is running on container
      <docker_host_Public_IP>:8090/webapp
Leave A Reply

Your email address will not be published.

baseofporn.com https://www.opoptube.com
Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.