upgrade to Spring Boot 2.2.1

add default periodic scan to prod profile
This commit is contained in:
Gauthier Roebroeck 2019-11-15 15:46:34 +08:00
parent c77d95c0b2
commit 73cd239a77
10 changed files with 31 additions and 21 deletions

View File

@ -51,12 +51,12 @@ In order to make Komga run, you need to specify some mandatory configuration key
- `SPRING_PROFILES_ACTIVE` / `spring.profiles.active`: `prod` - this will enable the database management and upgrades for new versions.
- `SPRING_DATASOURCE_URL` / `spring.datasource.url`: the path of the database file. For Docker I use `jdbc:h2:/config/database.h2`, where `/config/database.h2` is the actual file inside the docker container. You can customize this part if running without docker.
- `KOMGA_LIBRARIES_SCAN_CRON` / `komga.libraries-scan-cron`: a [Spring cron expression](https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/scheduling/support/CronSequenceGenerator.html) for libraries periodic rescans. `0 0 * * * ?` will rescan every hour. `0 */15 * * * ?` will rescan every 15 minutes.
### Optional configuration
You can also use some optional configuration keys:
- `KOMGA_LIBRARIES_SCAN_CRON` / `komga.libraries-scan-cron`: a [Spring cron expression](https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/scheduling/support/CronSequenceGenerator.html) for libraries periodic rescans. `0 0 * * * ?` will rescan every hour. `0 */15 * * * ?` will rescan every 15 minutes. Defaults to `0 */15 * * * ?` in `prod` profile.
- `KOMGA_THREADS_PARSE` / `komga.threads.parse`: the number of worker threads used for book parsing. Defaults to `2`. You can experiment to get better performance.
- `KOMGA_LIBRARIES_SCAN_DIRECTORY_EXCLUSIONS` / `komga.libraries-scan-directory-exclusions`: a list of patterns to exclude directories from the scan. If the full path contains any of the patterns, the directory will be ignored. If using the environment variable form use a comma-separated list.

View File

@ -11,9 +11,9 @@ plugins {
kotlin("plugin.jpa") version kotlinVersion
kotlin("kapt") version kotlinVersion
}
id("org.springframework.boot") version "2.1.9.RELEASE"
id("org.springframework.boot") version "2.2.1.RELEASE"
id("io.spring.dependency-management") version "1.0.8.RELEASE"
id("com.github.ben-manes.versions") version "0.25.0"
id("com.github.ben-manes.versions") version "0.27.0"
id("com.palantir.docker") version "0.22.1"
id("com.github.breadmoirai.github-release") version "2.2.9"
id("com.gorylenko.gradle-git-properties") version "2.2.0"
@ -81,12 +81,9 @@ dependencies {
runtimeOnly("com.h2database:h2")
testImplementation("org.springframework.boot:spring-boot-starter-test") {
exclude(module = "junit")
exclude(module = "mockito-core")
}
testImplementation("org.springframework.security:spring-security-test")
testImplementation("org.junit.jupiter:junit-jupiter-engine")
testImplementation("org.junit.jupiter:junit-jupiter-params")
testImplementation("com.ninja-squad:springmockk:1.1.3")
testImplementation("io.mockk:mockk:1.9.3")
testImplementation("com.google.jimfs:jimfs:1.1")

View File

@ -1,16 +1,11 @@
package org.gotson.komga
import org.gotson.komga.infrastructure.configuration.KomgaProperties
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.boot.runApplication
import org.springframework.data.jpa.repository.config.EnableJpaAuditing
import org.springframework.scheduling.annotation.EnableScheduling
@SpringBootApplication
@EnableConfigurationProperties(
KomgaProperties::class
)
@EnableScheduling
@EnableJpaAuditing
class Application

View File

@ -15,7 +15,7 @@ interface SeriesRepository : JpaRepository<Series, Long>, JpaSpecificationExecut
fun findByLibraryIn(libraries: Collection<Library>, sort: Sort): List<Series>
fun findByLibraryIn(libraries: Collection<Library>, page: Pageable): Page<Series>
fun findByLibraryId(libraryId: Long, sort: Sort): List<Series>
fun findByLibraryIdAndUrlNotIn(libraryId: Long, urls: Iterable<URL>): List<Series>
fun findByLibraryIdAndUrlNotIn(libraryId: Long, urls: Collection<URL>): List<Series>
fun findByLibraryIdAndUrl(libraryId: Long, url: URL): Series?
fun deleteByLibraryId(libraryId: Long)
}

View File

@ -0,0 +1,14 @@
package org.gotson.komga.infrastructure.httptrace
import org.springframework.boot.actuate.trace.http.InMemoryHttpTraceRepository
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
@Configuration
class HttpTraceConfiguration {
private val httpTraceRepository = InMemoryHttpTraceRepository()
@Bean
fun httpTraceRepository() = httpTraceRepository
}

View File

@ -125,7 +125,7 @@ class OpdsController(
}
if (specs.isNotEmpty()) {
seriesRepository.findAll(specs.reduce { acc, spec -> acc.and(spec) }, sort)
seriesRepository.findAll(specs.reduce { acc, spec -> acc.and(spec)!! }, sort)
} else {
seriesRepository.findAll(sort)
}
@ -148,7 +148,7 @@ class OpdsController(
fun getLatestSeries(
@AuthenticationPrincipal principal: KomgaPrincipal
): OpdsFeed {
val sort = Sort(Sort.Direction.DESC, "lastModifiedDate")
val sort = Sort.by(Sort.Direction.DESC, "lastModifiedDate")
val series =
if (principal.user.sharedAllLibraries) {
seriesRepository.findAll(sort)

View File

@ -79,7 +79,7 @@ class SeriesController(
}
if (specs.isNotEmpty()) {
seriesRepository.findAll(specs.reduce { acc, spec -> acc.and(spec) }, pageRequest)
seriesRepository.findAll(specs.reduce { acc, spec -> acc.and(spec)!! }, pageRequest)
} else {
seriesRepository.findAll(pageRequest)
}
@ -94,7 +94,7 @@ class SeriesController(
val pageRequest = PageRequest.of(
page.pageNumber,
page.pageSize,
Sort(Sort.Direction.DESC, "lastModifiedDate")
Sort.by(Sort.Direction.DESC, "lastModifiedDate")
)
return if (principal.user.sharedAllLibraries) {

View File

@ -11,8 +11,9 @@ komga:
spring:
profiles:
include: flyway
logging.file: komga-dev.log
logging:
file.max-history: 1
file:
max-history: 1
name: komga-dev.log
level:
org.gotson.komga: debug

View File

@ -3,6 +3,6 @@ spring:
include: flyway
datasource:
url: jdbc:h2:/config/database.h2
logging.file: /config/logs/komga.log
logging.file.name: /config/logs/komga.log
komga:
libraries-scan-cron: "0 */15 * * * ?"

View File

@ -1,6 +1,9 @@
spring:
profiles:
include: flyway
logging.file: komga.log
logging:
file.max-history: 10
file:
max-history: 10
name: komga.log
komga:
libraries-scan-cron: "0 */15 * * * ?"