You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+25-16
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,8 @@
1
-
# Python Client for Spring Boot Admin
1
+
# Python/Flask Web Service Component connecting to Spring Boot Admin
2
2
3
-
[Spring Boot Admin](https://github.com/codecentric/spring-boot-admin"Spring Boot Admin GitHub repository") is a great tool written to show an admin interface for [Spring Boot<sup>®</sup>](http://projects.spring.io/spring-boot/"Official Spring-Boot website") 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.
3
+
[Spring Boot Admin](https://github.com/codecentric/spring-boot-admin"Spring Boot Admin GitHub repository") is a great tool implemented to provide an admin interface for [Spring Boot<sup>®</sup>](http://projects.spring.io/spring-boot/"Official Spring-Boot website") applications. However, in a world driven by microservices, other programming languages than Java might also be used to develop components.
4
+
5
+
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.
Copy the template configuration file [app.conf](./app.conf) to create a custom configuration file (e.g., `cp app.conf app.local.conf`).
23
24
24
-
Edit your custom configuration file (e.g., `app.local.conf`) and define your environment values. Thereafter, the file might look like this:
25
+
Edit your custom configuration file (e.g., `app.local.conf`) and define your environment values.
26
+
Thereafter, the file might look like this:
27
+
25
28
```ini
26
29
[ServiceConfiguration]
27
30
springbootadminserverurl = http://localhost:8080/
@@ -36,20 +39,24 @@ servicedescription = my component is doing some magic
36
39
### Run the Service
37
40
38
41
A typical start of the service using the previously defined custom configuration `app.local.conf` might be done via:
42
+
39
43
```sh
40
44
python3 app.py -c app.local.conf
41
45
```
42
-
Now, check your Spring Boot Admin server UI. There should be a component visible having the name you had defined in your configuration file.
43
46
47
+
Now, check your Spring Boot Admin server UI.
48
+
There should be a component visible having the same name as you had defined in your configuration file.
44
49
45
-
### Test the Service
46
-
47
-
The service template already provides some endpoints. For example, a GET endpoint is available at the route `/`.
48
-
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](./myservice.py).
49
50
50
-
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
51
+
### Test the Service
51
52
53
+
The service template already provides some endpoints.
54
+
For example, a GET endpoint is available at the route `/`.
55
+
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.
56
+
The response will be `Hello, World!` as defined in [myservice.py](./myservice.py).
52
57
58
+
Additionally, a basic HTML file is provided using the data defined in the configuration file.
59
+
Following the previously mentioned exemplary configuration, it would be available at: http://127.0.0.1:5000/about
53
60
54
61
## Customize your Service
55
62
@@ -69,20 +76,22 @@ The following files are contained in the project.
69
76
└── templates
70
77
└── about.html
71
78
```
79
+
72
80
Typically, only the file `myservice.py` will be customized.
73
81
74
82
### Implement your own Service Functionality
75
83
76
-
Implementing a customized service is possible using the Flask functionality. See the [Flash documentation](https://palletsprojects.com/p/flask/) for details.
84
+
Implementing a customized service is possible using the Flask functionality.
85
+
See the [Flask documentation](https://palletsprojects.com/p/flask/) for details.
77
86
78
87
79
88
80
89
## Features
81
90
82
91
The template service provides the following functionality:
83
92
* calls the Spring Boot Admin server iteratively (by default: every 10 seconds)
84
-
* some meta data is send to the server, too
85
-
* provides a health interface availabe at `/health` which will be called by Spring Boot Admin server (callback)
93
+
* some metadata is sent to the server, too
94
+
* provides a health interface available at `/health` which will be called by Spring Boot Admin server (callback)
86
95
* the endpoint is used by the Spring Boot Admin server to check if the component is still available
87
96
* provides an HTML page (available at `/about`) containing information about the component (see [templates/about.html](templates/about.html))
88
97
* the presented data is taking from the (custom) config file
0 commit comments