Skip to content

Commit

Permalink
Adapt to sprig-boot-3 (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahoo-Wang authored Jun 19, 2023
1 parent 64e48e4 commit 9a6f4fa
Show file tree
Hide file tree
Showing 62 changed files with 52 additions and 61 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/benchmark-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ jobs:
- name: Checkout
uses: actions/checkout@master

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '17'
distribution: 'adopt'
server-id: github
settings-path: ${{ github.workspace }}
Expand All @@ -69,10 +69,10 @@ jobs:
- name: Checkout
uses: actions/checkout@master

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '17'
distribution: 'adopt'
server-id: github
settings-path: ${{ github.workspace }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
- name: Checkout
uses: actions/checkout@master

- name: Set up JDK 8
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '8'
java-version: '17'
distribution: 'adopt'
server-id: github
settings-path: ${{ github.workspace }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docker-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ jobs:
working-directory: cosky-dashboard
run: npm install && npm install -g @angular/cli && ng build

- name: Set up JDK 8
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '8'
java-version: '17'
distribution: 'adopt'
server-id: github
settings-path: ${{ github.workspace }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ jobs:
- name: Checkout
uses: actions/checkout@master

- name: Set up JDK 8
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '8'
java-version: '17'
distribution: 'adopt'
server-id: github
settings-path: ${{ github.workspace }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/package-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ jobs:
- name: Checkout
uses: actions/checkout@master

- name: Set up JDK 8
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '8'
java-version: '17'
distribution: 'adopt'
server-id: github
settings-path: ${{ github.workspace }}
Expand All @@ -47,10 +47,10 @@ jobs:
- name: Checkout
uses: actions/checkout@master

- name: Set up JDK 8
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '8'
java-version: '17'
distribution: 'adopt'
server-id: github
settings-path: ${{ github.workspace }}
Expand Down
5 changes: 1 addition & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ val coreProjects = setOf(
project(":cosky-discovery"),
)
val restApiProject = project(":cosky-rest-api")
// TODO
// val mirrorProject = project(":cosky-mirror")
// val serverProjects = setOf(restApiProject, mirrorProject)
val serverProjects = setOf(restApiProject)
val exampleProjects = setOf(
project(":cosky-service-provider"),
Expand Down Expand Up @@ -86,7 +83,7 @@ configure(libraryProjects) {
apply<KotlinPlatformJvmPlugin>()
configure<KotlinJvmProjectExtension>() {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(8))
languageVersion.set(JavaLanguageVersion.of(17))
}
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
Expand Down
4 changes: 2 additions & 2 deletions cosky-config/src/main/resources/config_remove.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ end

local currentVersion = redis.call("hget", configKey, versionField)
if currentVersion then
local result = addHistory(currentVersion, configKey, op);
addHistory(currentVersion, configKey, op);
redis.call("publish", configKey, op);
return result;
return 1;
else
return 0;
end
Expand Down
4 changes: 2 additions & 2 deletions cosky-config/src/main/resources/config_rollback.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ addHistory(currentVersion, configKey, op)
local data = targetHistoryConfig["data"];
local createTime = redis.call('time')[1];

local result = redis.call("hmset", configKey, "configId", configId, "data", data, hashField, targetHash, versionField, nextVersion, "createTime", createTime);
redis.call("hmset", configKey, "configId", configId, "data", data, hashField, targetHash, versionField, nextVersion, "createTime", createTime);
redis.call("publish", configKey, op);
return result;
return 1;
4 changes: 2 additions & 2 deletions cosky-config/src/main/resources/config_set.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ else
end

local createTime = redis.call('time')[1];
local result = redis.call("hmset", configKey, "configId", configId, "data", data, hashField, hash, versionField, nextVersion, "createTime", createTime);
redis.call("hmset", configKey, "configId", configId, "data", data, hashField, hash, versionField, nextVersion, "createTime", createTime);
redis.call("publish", configKey, op);
return result;
return 1;
2 changes: 1 addition & 1 deletion cosky-dashboard/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cosky-dashboard",
"version": "3.4.0",
"version": "4.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
Expand Down
10 changes: 5 additions & 5 deletions cosky-dependencies/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
*/

dependencies {
api(platform("org.springframework.boot:spring-boot-dependencies:2.7.12"))
api(platform("org.springframework.cloud:spring-cloud-dependencies:2021.0.7"))
api(platform("me.ahoo.cosid:cosid-bom:1.19.3"))
api(platform("me.ahoo.simba:simba-bom:0.6.6"))
api(platform("me.ahoo.cosec:cosec-bom:1.18.2"))
api(platform("org.springframework.boot:spring-boot-dependencies:3.1.0"))
api(platform("org.springframework.cloud:spring-cloud-dependencies:2022.0.3"))
api(platform("me.ahoo.cosid:cosid-bom:2.1.0"))
api(platform("me.ahoo.simba:simba-bom:2.0.0"))
api(platform("me.ahoo.cosec:cosec-bom:2.0.0-M1"))
constraints {
api("com.google.guava:guava:32.0.1-jre")
api("commons-io:commons-io:2.13.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ if affected > 0 then
redis.call("hdel", serviceIdxStatKey, serviceId);
end

return affected;
return 1;
2 changes: 1 addition & 1 deletion cosky-discovery/src/main/resources/registry_renew.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ if shouldPub then
redis.call("publish", instanceKey, "renew");
end

return result;
return 1;

4 changes: 2 additions & 2 deletions cosky-discovery/src/main/resources/registry_set_metadata.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if #instanceKeys > 0 then
end
end

local result = redis.call("hmset", instanceKey, unpack(ARGV, 2, #ARGV));
redis.call("hmset", instanceKey, unpack(ARGV, 2, #ARGV));
redis.call("publish", instanceKey, "set_metadata");
return result;
return 1;

3 changes: 2 additions & 1 deletion cosky-discovery/src/main/resources/registry_set_service.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ local affected = redis.call("sadd", serviceIdxKey, serviceId);
if affected > 0 then
redis.call("publish", serviceIdxKey, "set");
redis.call("hset", serviceIdxStatKey, serviceId, 0);
return 1;
end

return affected;
return 0;
8 changes: 4 additions & 4 deletions cosky-rest-api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ plugins {

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
languageVersion.set(JavaLanguageVersion.of(17))
}
}
tasks.jar.configure {
Expand Down Expand Up @@ -52,7 +52,7 @@ application {
"-XX:MaxDirectMemorySize=256M",
"-Xss1m",
"-server",
"-XX:+UseG1GC",
"-XX:+UseZGC",
"-Xlog:gc*:file=logs/$applicationName-gc.log:time,tags:filecount=10,filesize=32M",
"-XX:+HeapDumpOnOutOfMemoryError",
"-XX:HeapDumpPath=data",
Expand All @@ -76,8 +76,8 @@ dependencies {
implementation("org.springdoc:springdoc-openapi-kotlin")
implementation("org.springdoc:springdoc-openapi-webflux-ui")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation(project(":spring-cloud-starter-cosky-config"))
implementation(project(":spring-cloud-starter-cosky-discovery"))
implementation(project(":cosky-spring-cloud-starter-config"))
implementation(project(":cosky-spring-cloud-starter-discovery"))
implementation("com.google.guava:guava")
implementation("me.ahoo.cosid:cosid-spring-redis")
implementation("me.ahoo.cosid:cosid-spring-boot-starter")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class GlobalRestExceptionHandler {
}

@ExceptionHandler
@ResponseStatus
@ResponseStatus(HttpStatus.BAD_REQUEST)
fun handleAll(ex: Exception): ErrorResponse {
if (log.isErrorEnabled) {
log.error(ex.message, ex)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,18 @@ package me.ahoo.cosky.rest.security
import me.ahoo.cosky.core.CoSky
import me.ahoo.cosky.rest.security.rbac.Action
import org.springframework.boot.context.properties.ConfigurationProperties
import org.springframework.boot.context.properties.ConstructorBinding

/**
* Security Properties.
*
* @author ahoo wang
*/
@ConstructorBinding
@ConfigurationProperties(SecurityProperties.PREFIX)
class SecurityProperties(
val enabled: Boolean = true,
val enforceInitSuperUser: Boolean = false,
val auditLog: AuditLog = AuditLog()
) {
@ConstructorBinding
data class AuditLog(
val action: Action = Action.WRITE
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class AuditLogHandlerInterceptor(
} else {
exchange.getSecurityContext()?.principal?.id.orEmpty()
}
val action = request.method!!.name
val action = request.method.name()
val ip = requireNotNull(request.remoteAddress).hostString
val status = requireNotNull(exchange.response.statusCode).value()
val msg = if (throwable?.message != null) throwable.message!! else ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import me.ahoo.cosec.token.TokenVerifier
import org.springframework.stereotype.Service
import reactor.core.publisher.Mono
import reactor.kotlin.core.publisher.toMono
import javax.validation.constraints.NotBlank
import jakarta.validation.constraints.NotBlank

@Service
class RefreshTokenAuthentication(
Expand Down
1 change: 0 additions & 1 deletion cosky-spring-cloud-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,5 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-data-redis")
kapt("org.springframework.boot:spring-boot-configuration-processor")
kapt("org.springframework.boot:spring-boot-autoconfigure-processor")

testImplementation("org.springframework.boot:spring-boot-starter-test")
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@ package me.ahoo.cosky.discovery.spring.cloud.discovery

import me.ahoo.cosky.spring.cloud.CoSkyProperties
import org.springframework.boot.context.properties.ConfigurationProperties
import org.springframework.boot.context.properties.ConstructorBinding
import java.time.Duration

/**
* CoSky Discovery Properties.
*
* @author ahoo wang
*/
@ConstructorBinding
@ConfigurationProperties(CoSkyDiscoveryProperties.PREFIX)
data class CoSkyDiscoveryProperties(
val enabled: Boolean = true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/
package me.ahoo.cosky.discovery.spring.cloud.registry

import jakarta.annotation.PreDestroy
import me.ahoo.cosky.core.util.ProcessId
import me.ahoo.cosky.discovery.ServiceInstanceContext
import org.slf4j.LoggerFactory
Expand All @@ -21,7 +22,6 @@ import org.springframework.boot.web.context.WebServerApplicationContext
import org.springframework.context.ApplicationContext
import org.springframework.context.ApplicationContextAware
import org.springframework.context.ApplicationListener
import javax.annotation.PreDestroy

/**
* CoSky Auto Service Registration Of None Web.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@ import me.ahoo.cosky.discovery.RenewProperties
import me.ahoo.cosky.discovery.spring.cloud.discovery.CoSkyDiscoveryProperties
import me.ahoo.cosky.discovery.spring.cloud.support.StatusConstants
import org.springframework.boot.context.properties.ConfigurationProperties
import org.springframework.boot.context.properties.ConstructorBinding
import java.time.Duration

/**
* CoSky Registry Properties.
*
* @author ahoo wang
*/
@ConstructorBinding
@ConfigurationProperties(CoSkyRegistryProperties.PREFIX)
data class CoSkyRegistryProperties(
var serviceId: String = "",
Expand Down
6 changes: 3 additions & 3 deletions examples/cosky-service-consumer/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ plugins {

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
languageVersion.set(JavaLanguageVersion.of(17))
}
}

Expand All @@ -30,8 +30,8 @@ dependencies {
implementation(platform(project(":cosky-dependencies")))
// implementation("io.springfox:springfox-boot-starter")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation(project(":spring-cloud-starter-cosky-config"))
implementation(project(":spring-cloud-starter-cosky-discovery"))
implementation(project(":cosky-spring-cloud-starter-config"))
implementation(project(":cosky-spring-cloud-starter-discovery"))
implementation("com.google.guava:guava")
implementation("org.springframework.cloud:spring-cloud-starter-loadbalancer")
implementation("org.springframework.cloud:spring-cloud-starter-openfeign")
Expand Down
2 changes: 1 addition & 1 deletion examples/cosky-service-provider-api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ plugins {

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
languageVersion.set(JavaLanguageVersion.of(17))
}
}

Expand Down
6 changes: 3 additions & 3 deletions examples/cosky-service-provider/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ plugins {

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
languageVersion.set(JavaLanguageVersion.of(17))
}
}

Expand All @@ -30,8 +30,8 @@ dependencies {
implementation(platform(project(":cosky-dependencies")))
// implementation("io.springfox:springfox-boot-starter")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation(project(":spring-cloud-starter-cosky-config"))
implementation(project(":spring-cloud-starter-cosky-discovery"))
implementation(project(":cosky-spring-cloud-starter-config"))
implementation(project(":cosky-spring-cloud-starter-discovery"))
implementation("com.google.guava:guava")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.cloud:spring-cloud-starter-openfeign")
Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
# limitations under the License.
#
group=me.ahoo.cosky
version=3.3.15
version=4.0.0-M1
description=High-performance, low-cost microservice governance platform. Service Discovery and Configuration Service.
website=https://github.com/Ahoo-Wang/cosky
issues=https://github.com/Ahoo-Wang/cosky/issues
vcs=https://github.com/Ahoo-Wang/cosky.git

license_name=The Apache Software License, Version 2.0
license_url=https://www.apache.org/licenses/LICENSE-2.0.txt

Loading

0 comments on commit 9a6f4fa

Please sign in to comment.