The Wayback Machine - https://web.archive.org/web/20200907121619/https://github.com/anbo-de/PythonClientForSpringBootAdmin/
Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Python Client for Spring Boot Admin

Spring Boot Admin is a great tool written to show an admin interface for Spring Boot® applications. However, in a world driven by microservices, other programming languages might also be used to develop components. This project provides a simple executable template of a Python Flask application registering itself as a component to a Spring Boot Admin server. Thereafter, it's monitored by the Spring Boot Admin server (alive status) that also provides access to the shared meta information. Your advantage: Spring Boot and Python applications are monitored using the same tool.

Python v3.6 Flask v1 License

Getting Started

Prepare the Project

git clone https://github.com/anbo-de/PythonClientForSpringBootAdmin.git
cd PythonClientForSpringBootAdmin
pip install -r requirements.txt

Setup your Service

Copy the template configuration file app.conf to create a custom configuration file (e.g., cp app.conf app.local.conf).

Edit your custom configuration file (e.g., app.local.conf) and define your environment values. Thereafter, the file might look like this:

[ServiceConfiguration]
springbootadminserverurl = http://localhost:8080/
springbootadminserveruser = admin
springbootadminserverpassword = admin
servicename = myname
serviceport = 5000
servicehost = http://127.0.0.1
servicedescription = my component is doing some magic

Run the Service

A typical start of the service using the previously defined custom configuration app.local.conf might be done via:

python3 app.py -c app.local.conf

Now, check your Spring Boot Admin server UI. There should be a component visible having the name you had defined in your configuration file.

Test the Service

The service template already provides some endpoints. For example, a GET endpoint is available at the route /. If you have defined you run your service at http://127.0.0.1 (servicehost) and port 5000 (serviceport), then you can open http://127.0.0.1:5000/ using your browser. The response will be Hello, World! as defined in myservice.py.

Additionally, a basic HTML file is provided using the data defined in the configuration file. Following the previously mentioned examplary configuration it would be available at: http://127.0.0.1:5000/about

Customize your Service

Project Structure

The following files are contained in the project.

.
├── app.conf
├── app.py
├── configuration.py
├── myservice.py
├── registration.py
├── registrator.py
├── requirements.txt
└── templates
    └── about.html

Typically, only the file myservice.py will be customized.

Implement your own Service Functionality

Implementing a customized service is possible using the Flask functionality. See the Flash documentation for details.

Features

The template service provides the following functionality:

  • calls the Spring Boot Admin server iteratively (by default: every 10 seconds)
    • some meta data is send to the server, too
  • provides a health interface availabe at /health which will be called by Spring Boot Admin server (callback)
    • the endpoint is used by the Spring Boot Admin server to check if the component is still available
  • provides an HTML page (available at /about) containing information about the component (see templates/about.html)
    • the presented data is taking from the (custom) config file

Contributing

You might:

About

a simple executable template of a Python Flask application registering itself as a component to a Spring Boot Admin server

Topics

Resources

License

You can’t perform that action at this time.