Git Product home page Git Product logo

springbootasdebianpackagedemo's Introduction

Demo on how to package and install a spring-boot application as a debian package

Spring boot gives you the possibility to package your application as an executable jar. This jar includes your code, all dependencies plus an embedded application server. Since spring boot 1.3 this jar also works as an init script which can be linked to /etc/init.d to have your application started and stopped automatically on boot / shutdown.

This approach has some benefits:

The application will run as the user who owns the jar, will create a pid to track it's state and log to /var/log/. Have a look at the spring boot documentation, too.

To get you started as fast as possible, I created this demo project which will bundle a debian package via jdeb.

The package will:

  • add a system group and a matching user following your artifactId as names
  • create needed default folders
  • set permissions properly
  • follow spring boot's security guidelines which meas that:
    • the user will not be able to log into your system
    • the jar will only be readable and executable (not writable) by the created user

Note: the user, the group and the service will take the name of your mvn artifactId.

Giving it a try

You may build and install your own debian package into a vagrant box now.

prerequisites

Install vagrant, virtualbox, maven

build the debian package with:

mvn clean package

after that you are good to fire up the vagrant box which will install java and the deb package automatically:

vagrant up

Feel free to play around now and when you are done delete your vagrant VM via vagrant destroy.

Patches and comments are welcome.

springbootasdebianpackagedemo's People

Contributors

hennr avatar m4ci3k2 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.