GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - WSE-research/Spring-Boot-Admin-Python-component: a simple executable template of a Python Flask application registering itself as a component to a Spring Boot Admin server

BranchesTags
Open more actions menu

Latest commit

 

History

24 Commits
24 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
templates
templates
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
app.conf
app.conf
 
 
app.py
app.py
 
 
configuration.py
configuration.py
 
 
conftest.py
conftest.py
 
 
myservice.py
myservice.py
 
 
pytest.ini
pytest.ini
 
 
registration.py
registration.py
 
 
registrator.py
registrator.py
 
 
requirements-dev.txt
requirements-dev.txt
 
 
requirements.txt
requirements.txt
 
 

Repository files navigation

Python/Flask Web Service Component connecting to Spring Boot Admin

Spring Boot Admin is a great tool implemented to provide an admin interface for Spring Boot® applications. However, in a world driven by microservices, other programming languages than Java 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 [email protected]:WSE-research/Spring-Boot-Admin-Python-component.git
cd Spring-Boot-Admin-Python-component
pip install -r requirements.txt

Set up 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 same name as 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 web 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 exemplary 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 Flask documentation for details.

Features

The template service provides the following functionality:

  • calls the Spring Boot Admin server iteratively (by default: every 10 seconds)
    • some metadata is sent to the server, too
  • provides a health interface available 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:

  • create a pull request (c.f., https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request)
  • create an issue to let us know about problems or feature requests
  • ...

About

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

Topics

python3spring-bootspringbootadminwebservice

Resources

Readme
MIT license
Activity
Custom properties

Stars

4 stars

Watchers

1 watching

Forks

1 fork
Report repository

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.