Skip to content

Commit

Permalink
chore: clean up for release
Browse files Browse the repository at this point in the history
  • Loading branch information
nik-sta committed Jan 28, 2022
1 parent e045c7c commit 8b85abd
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 75 deletions.
50 changes: 36 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,27 @@
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.viascom.devutils/spring-boot-starter-maintenance/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.viascom.devutils/spring-boot-starter-maintenance/)


spring-boot-starter-maintenance is a maintenance mode library and auto-configuration for spring boot web and security projects.
**spring-boot-starter-maintenance** is an extensible auto-configuration library for spring boot web and security projects supporting Java and Kotlin applications to block access to this application during maintenances and still provide an open door for the maintainers.

With spring-boot-starter-maintenance anyone can easily use best practices during maintenance work on their applications. In fact, every HTTP client will receive a response with status code 503 - Service Unavailable during maintenance. This library provides injection points for alert- and clean-up tasks and detailed metrics. Everything is customizable and extendable programmed.
With spring-boot-starter-maintenance anyone can easily use best practices during maintenance work on their applications. In fact, every HTTP client will receive a response with status code 503 - Service Unavailable during maintenance. This library provides injection points for alert- and clean-up tasks.

### Requirements
spring-boot-starter-maintenance is ready to use out of the box for most common setups. Even for uncommon applications and technologies, it should be simple to implement the necessary interfaces to connect a library/framework/etc. to it.

## Requirements

JDK >= 1.8

spring-boot-starter-maintenance depends on the following two dependencies and will not start without them present.

- org.springframework.boot:spring-boot-starter-web *(required)*
- org.springframework.boot:spring-boot-starter-security *(required)*
- org.springframework.boot:spring-boot-starter-data-jpa *(optional, needed only if you enable metrics)*

### Download
## Download

Gradle:
```gradle
dependencies {
implementation 'io.viascom.devutils:spring-boot-starter-maintenance:0.0.2'
implementation 'io.viascom.devutils:spring-boot-starter-maintenance:0.0.1'
}
```

Expand All @@ -32,13 +33,13 @@ Maven:
<dependency>
<groupId>io.viascom.devutils</groupId>
<artifactId>spring-boot-starter-maintenance</artifactId>
<version>0.0.2</version>
<version>0.0.1</version>
</dependency>
```

[spring-boot-starter-maintenance jar downloads](https://maven-badges.herokuapp.com/maven-central/io.viascom.devutils/spring-boot-starter-maintenance) are available from Maven Central.

### Getting Started
## Getting Started

Open your implementation of the WebSecurityConfigurerAdapter (f.e. named WebSecurityConfig) and add the following three parts:

Expand All @@ -59,7 +60,29 @@ private Maintenance maintenance;
.exceptionHandling()
.accessDeniedHandler(new DefaultMaintenanceAccessDeniedHandler(maintenance))
```
## Configuration Properties

### Basic configuration example

```yaml
maintenance:
enabled: true
roles:
- MAINTAINER
```
### Full configuration example
```yaml
maintenance:
enabled: true
roles:
- MAINTAINER
- ADMIN
alert: true
clean: true
retry-after: 30
events: true
```
### Maintenance properties
All properties can be accessed under the property `maintenance`.
Expand All @@ -72,29 +95,28 @@ All properties can be accessed under the property `maintenance`.
| clean | Enable to run all classes implementing the MaintenanceCleaner interface during the stop maintenance process. | false |
| retry-after | Default value for the "Retry-After" response HTTP header in seconds, which is used in the DefaultMaintenanceAccessDeniedHandler. | 60 |
| events | Enable to publish spring events for maintenance events. | false |
| metrics | Enable to persist metrics for maintenances. Requires spring-boot-starter-data-jpa to work. | false |

### Versioning 🔖 [![GitHub release](https://img.shields.io/github/release/viascom/spring-boot-starter-maintenance/all?logo=GitHub)](https://github.com/viascom/spring-boot-starter-maintenance/releases/latest)
## Versioning 🔖 [![GitHub release](https://img.shields.io/github/release/viascom/spring-boot-starter-maintenance/all?logo=GitHub)](https://github.com/viascom/spring-boot-starter-maintenance/releases/latest)

This project is developed by [Viascom](https://github.com/viascom) using the [Semantic Versioning specification](https://semver.org). For the versions available, see the [releases on this repository](https://github.com/viascom/spring-boot-starter-maintenance/releases).

### Change log 📝
## Change log 📝

See the [CHANGELOG](CHANGELOG.md) file for details.

### Authors 🖥️
## Authors 🖥️

* **Nikola Stanković** - *Initial work* - [botscripter](https://github.com/botscripter)
* **Patrick Bösch** - *Initial work* - [itsmefox](https://github.com/itsmefox)

See also the list of [contributors](https://github.com/viascom/spring-boot-starter-maintenance/contributors) who participated in this project. 💕

### Contributing
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md) file.

🙏 If you like spring-boot-starter-maintenance you can show support by starring ⭐ this repository.

### License
## License

spring-boot-starter-maintenance is released under the [Unlicense](LICENSE).

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {
}

group "io.viascom.devutils"
version "0.0.2"
version "0.0.1"

sourceCompatibility = 1.8
targetCompatibility = 1.8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ open class MaintenanceAutoConfiguration(
properties.alert,
properties.clean,
properties.retryAfter,
properties.events,
properties.metrics
properties.events
),
alerts,
cleaners,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,4 @@ open class MaintenanceConfigurationProperties {
* Enable to publish spring events for maintenance events.
*/
var events: Boolean = false

/**
* Enable to persist metrics for maintenances.
*/
var metrics: Boolean = false
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
package io.viascom.devutils.springbootstartermaintenance.core.config

import java.time.Duration

data class MaintenanceProperties(
val enabled: Boolean,
val roles: MutableList<String>,
val alert: Boolean,
val clean: Boolean,
val retryAfter: Int,
val events: Boolean,
val metrics: Boolean,
val events: Boolean
)

This file was deleted.

0 comments on commit 8b85abd

Please sign in to comment.