DevOps Classroom Series – 11/May/2021

Deploying spring boot application to ubuntu

  • In this we will try to deploy a sample spring boot application
  • For application Refer Here
  • Steps are
    • Install OpenJDK 11
    • Copy the file from the above mentioned location to /usr/share/springpetclinic
    • Create a user springbootuser
    • Configure the spring boot application as Linux service Refer Here
      [Unit]
      Description=Spring Pet Clinic
      After=syslog.target
      
      [Service]
      User=springbootuser
      ExecStart=/usr/bin/java -jar /usr/share/springpetclinic/spring-petclinic-2.4.2.jar
      SuccessExitStatus=143 
      
      [Install] 
      WantedBy=multi-user.target
      
      
    • List of Linux commands
      1  sudo apt update
      2  sudo apt install openjdk-11-jdk -y
      3  sudo mkdir /usr/share/springpetclinic
      4  wget https://referenceapplicationskhaja.s3-us-west-2.amazonaws.com/spring-petclinic-2.4.2.jar
      5  sudo cp spring-petclinic-2.4.2.jar /usr/share/springpetclinic/
      6  sudo adduser springbootuser
      7  sudo chown springbootuser:springbootuser /usr/share/springpetclinic/spring-petclinic-2.4.2.jar
      8  sudo chmod 500 /usr/share/springpetclinic/spring-petclinic-2.4.2.jar
      9  sudo vi /etc/systemd/system/springpetclinic.service
     10  sudo systemctl enable springpetclinic.service
     11  sudo systemctl start springpetclinic.service
     12  sudo systemctl status springpetclinic.service
    
  • Refer Here for the changes made and executed Preview
  • Refer Here for the user addition
  • Refer Here to see the file permissions added Preview
  • Refer Here to view the steps added for configuring springpetclinic as Linux service Preview

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About learningthoughtsadmin