Skip to content

Commit

Permalink
Backport upgrade to GeoServer 2.25.3 and geonode OAuth2 support
Browse files Browse the repository at this point in the history
  • Loading branch information
groldan committed Aug 6, 2024
1 parent 1b2a994 commit 51f93ef
Show file tree
Hide file tree
Showing 46 changed files with 212 additions and 181 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-and-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
- "Makefile"
- "pom.xml"
- ".github/workflows/build-and-push.yaml"
- "config"
- "src/**"
tags:
- '*'
Expand Down
2 changes: 1 addition & 1 deletion compose/infra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
- acl_data:/var/lib/postgresql/data

rabbitmq:
image: rabbitmq:3.12.12
image: rabbitmq:3.13.3-alpine
user: ${GS_USER}
tmpfs:
- /var/lib/rabbitmq
Expand Down
4 changes: 4 additions & 0 deletions docs/cosign/cosign.pub
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEsUudw4Y6QJfiCMwBvu3KIssgfvEx
rCJ8pRHZL78ybbHiCPYyIwmy6RTOYaHePIFxDviZ0WZWH1fo3hrbw0b2ZQ==
-----END PUBLIC KEY-----
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.retry.annotation.EnableRetry;

@SpringBootApplication
@EnableRetry
public class GeoWebCacheApplication {

public static void main(String[] args) {
Expand Down
3 changes: 0 additions & 3 deletions src/apps/geoserver/gwc/src/main/resources/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ spring:
# override default of true, this service does not use the registry (when eureka client is enabled)
eureka.client.fetch-registry: false

logging.level:
'[org.springframework.retry]': debug

---
# local profile, used for development only. Other settings like config and eureka urls in gs_cloud_bootstrap_profiles.yml
spring.config.activate.on-profile: local
Expand Down
5 changes: 5 additions & 0 deletions src/apps/geoserver/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@
<groupId>org.geoserver.cloud</groupId>
<artifactId>gs-cloud-starter-observability</artifactId>
</dependency>
<dependency>
<groupId>org.geoserver.cloud</groupId>
<artifactId>gs-cloud-starter-geonode</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.geoserver.cloud</groupId>
<artifactId>spring-boot-simplejndi</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ spring:
# override default of true, this service does not use the registry (when eureka client is enabled)
eureka.client.fetch-registry: false

logging.level:
'[org.springframework.retry]': debug

---
# local profile, used for development only. Other settings like config and eureka urls in gs_cloud_bootstrap_profiles.yml
spring.config.activate.on-profile: local
Expand Down
3 changes: 0 additions & 3 deletions src/apps/geoserver/wcs/src/main/resources/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ spring:
# override default of true, this service does not use the registry (when eureka client is enabled)
eureka.client.fetch-registry: false

logging.level:
'[org.springframework.retry]': debug

---
# local profile, used for development only. Other settings like config and eureka urls in gs_cloud_bootstrap_profiles.yml
spring.config.activate.on-profile: local
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void onApplicationReady(ApplicationReadyEvent e) {
final String instanceId = env.getProperty("info.instance-id");
String nodeOpts = System.getProperty("GEOSERVER_NODE_OPTS");
if (null == nodeOpts) {
nodeOpts = String.format("id:%s;color:FF0000", instanceId);
nodeOpts = "id:%s;color:FF0000".formatted(instanceId);
System.setProperty("GEOSERVER_NODE_OPTS", nodeOpts);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private String getStatus(org.springframework.cloud.client.ServiceInstance i) {
private String buildUrl(org.springframework.cloud.client.ServiceInstance i) {
URI uri = i.getUri();
if (uri == null) {
uri = URI.create(String.format("%s://%s:%s", i.getScheme(), i.getHost(), i.getPort()));
uri = URI.create("%s://%s:%s".formatted(i.getScheme(), i.getHost(), i.getPort()));
}
return uri.toString();
}
Expand Down
3 changes: 0 additions & 3 deletions src/apps/geoserver/webui/src/main/resources/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,6 @@ geoserver:
resource-browser: true
catalog-bulk-load: true

logging.level:
'[org.springframework.retry]': debug

---
# local profile, used for development only. Other settings like config and eureka urls in gs_cloud_bootstrap_profiles.yml
spring.config.activate.on-profile: local
Expand Down
3 changes: 0 additions & 3 deletions src/apps/geoserver/wfs/src/main/resources/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ spring:
# override default of true, this service does not use the registry (when eureka client is enabled)
eureka.client.fetch-registry: false

logging.level:
'[org.springframework.retry]': debug

---
# local profile, used for development only. Other settings like config and eureka urls in gs_cloud_bootstrap_profiles.yml
spring.config.activate.on-profile: local
Expand Down
2 changes: 0 additions & 2 deletions src/apps/geoserver/wps/src/main/resources/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ spring:
# override default of true, this service does not use the registry (when eureka client is enabled)
eureka.client.fetch-registry: false

logging.level:
'[org.springframework.retry]': debug
---
# local profile, used for development only. Other settings like config and eureka urls in gs_cloud_bootstrap_profiles.yml
spring.config.activate.on-profile: local
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ management:
export:
atlas.enabled: false

logging.level:
'[org.springframework.retry]': debug

---
# local profile, used for development only. Other settings like config and eureka urls in gs_cloud_bootstrap_profiles.yml
spring.config.activate.on-profile: local
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,8 @@ public boolean test(ServerWebExchange exchange) {

@Override
public String toString() {
return String.format(
"Query: param regexp='%s' value regexp='%s'",
config.getParamRegexp(), config.getValueRegexp());
return "Query: param regexp='%s' value regexp='%s'"
.formatted(config.getParamRegexp(), config.getValueRegexp());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ spring:
application:
name: gateway-service
jmx.enabled: false
logging.level:
'[org.springframework.retry]': debug

# this service uses the registry (when eureka client is enabled)
eureka.client:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,10 @@ private HttpClientBuilder builder() {
HttpClientBuilder builder =
HttpClientBuilder.create()
.setUserAgent(
String.format(
"GeoTools/%s (%s)",
GeoTools.getVersion(), this.getClass().getSimpleName()))
"GeoTools/%s (%s)"
.formatted(
GeoTools.getVersion(),
this.getClass().getSimpleName()))
.useSystemProperties()
.setConnectionManager(connectionManager);
if (credsProvider != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,20 @@ void validateConfig() {
final boolean passwordSet = StringUtils.hasText(adminPassword);
if (userSet && !passwordSet) {
String msg =
String.format(
"""
"""
Found overriding admin username config property geoserver.admin.username=%s, \
but password not provided through config property geoserver.admin.password
""",
adminUserName);
"""
.formatted(adminUserName);
throw new BeanInstantiationException(getClass(), msg);
}
if (passwordSet && !userSet) {
String msg =
String.format(
"""
"""
Found overriding admin password config property geoserver.admin.password, \
but admin username not provided through config property geoserver.admin.username
""",
adminUserName);
"""
.formatted(adminUserName);
throw new BeanInstantiationException(getClass(), msg);
}
enabled = userSet && passwordSet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public File getCacheDirectory() {

private static String defaultCacheDirectory() {
String tmpdir = System.getProperty("java.io.tmpdir");
return String.format("%s%sgeoserver-jdbcconfig-cache", tmpdir, File.separator);
return "%s%sgeoserver-jdbcconfig-cache".formatted(tmpdir, File.separator);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
*/
package org.geoserver.cloud.config.catalog.backend.jdbcconfig;

import static java.lang.String.format;

import lombok.NonNull;
import lombok.RequiredArgsConstructor;

Expand Down Expand Up @@ -59,22 +57,21 @@ public void afterPropertiesSet() throws Exception {
String createSequenceStatement;
if (props.isPostgreSQL()) {
createSequenceStatement =
format("CREATE SEQUENCE IF NOT EXISTS %s AS BIGINT CYCLE", SEQUENCE_NAME);
"CREATE SEQUENCE IF NOT EXISTS %s AS BIGINT CYCLE".formatted(SEQUENCE_NAME);
// not using CURRVAL() to avoid the "currval of sequence "<name>" is not yet defined in
// this session" error
getQuery = format("SELECT last_value FROM %s", SEQUENCE_NAME);
incrementAndGetQuery = format("SELECT NEXTVAL('%s')", SEQUENCE_NAME);
getQuery = "SELECT last_value FROM %s".formatted(SEQUENCE_NAME);
incrementAndGetQuery = "SELECT NEXTVAL('%s')".formatted(SEQUENCE_NAME);
} else if (props.isH2()) {
createSequenceStatement = format("CREATE SEQUENCE IF NOT EXISTS %s", SEQUENCE_NAME);
createSequenceStatement = "CREATE SEQUENCE IF NOT EXISTS %s".formatted(SEQUENCE_NAME);
getQuery =
format(
"""
"""
SELECT CURRENT_VALUE \
FROM INFORMATION_SCHEMA.SEQUENCES \
WHERE SEQUENCE_NAME = '%s'
""",
SEQUENCE_NAME.toUpperCase());
incrementAndGetQuery = format("SELECT NEXTVAL('%s')", SEQUENCE_NAME);
"""
.formatted(SEQUENCE_NAME.toUpperCase());
incrementAndGetQuery = "SELECT NEXTVAL('%s')".formatted(SEQUENCE_NAME);
} else {
throw new IllegalStateException("Db is not PostgreSQL nor H2");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ public RemoteGeoServerEvent(

@Override
public String toString() {
return String.format(
"[%s id: '%s', originService: '%s', destinationService: '%s', payload: %s]",
getClass().getSimpleName(),
getId(),
getOriginService(),
getDestinationService(),
getEvent());
return "[%s id: '%s', originService: '%s', destinationService: '%s', payload: %s]"
.formatted(
getClass().getSimpleName(),
getId(),
getOriginService(),
getDestinationService(),
getEvent());
}

public String toShortString() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -792,9 +792,8 @@ private Patch roundtrip(Patch patch) throws JsonProcessingException {
Class<? extends Info> type = ProxyUtils.referenceTypeOf(patchValue).orElseThrow();
Supplier<String> desc =
() -> {
return String.format(
"Patch value of type %s shall be encoded as reference, got value %s",
type.getCanonicalName(), typeName);
return "Patch value of type %s shall be encoded as reference, got value %s"
.formatted(type.getCanonicalName(), typeName);
};
assertThat(typeName).as(desc).isEqualTo("ResolvingProxy");
} else {
Expand Down Expand Up @@ -835,16 +834,14 @@ protected void assertNotAProxy(Object value) {
assertThat(ProxyUtils.isResolvingProxy(info))
.as(
() ->
String.format(
"%s should not be a ResolvingProxy: %s",
info.getId(), typeName(info)))
"%s should not be a ResolvingProxy: %s"
.formatted(info.getId(), typeName(info)))
.isFalse();
assertThat(ProxyUtils.isModificationProxy(info))
.as(
() ->
String.format(
"%s should not be a ModificationProxy: %s",
info.getId(), typeName(info)))
"%s should not be a ModificationProxy: %s"
.formatted(info.getId(), typeName(info)))
.isFalse();
}
}
Expand All @@ -853,9 +850,8 @@ protected <I extends Info> I assertModificationProxy(I info) {
assertThat(ProxyUtils.isModificationProxy(info))
.as(
() ->
String.format(
"%s should be a ModificationProxy, got %s",
info.getId(), typeName(info)))
"%s should be a ModificationProxy, got %s"
.formatted(info.getId(), typeName(info)))
.isTrue();

I real = ModificationProxy.unwrap(info);
Expand All @@ -874,19 +870,17 @@ protected void assertResolvingProxy(Info info) {
assertThat(ProxyUtils.isResolvingProxy(info))
.as(
() ->
String.format(
"%s should be a ResolvingProxy, got %s",
info.getId(), typeName(info)))
"%s should be a ResolvingProxy, got %s"
.formatted(info.getId(), typeName(info)))
.isTrue();
}

private void assertValueObject(Object valueObject, Class<?> valueType) {
if (valueObject instanceof Info info) {
Supplier<String> msg =
() ->
String.format(
"expected pure value object of type %s, got %s",
valueType.getCanonicalName(), typeName(valueObject));
"expected pure value object of type %s, got %s"
.formatted(valueType.getCanonicalName(), typeName(valueObject));
assertThat(ProxyUtils.isResolvingProxy(info)).as(msg).isFalse();
assertThat(ProxyUtils.isModificationProxy(info)).as(msg).isFalse();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ private void assertActuallyEqualsExact(Geometry g1, Geometry g2) {
for (int i = 0; i < cs1.length; i++) {
Coordinate c1 = cs1[i];
Coordinate c2 = cs2[i];
assertTrue(c1.equals3D(c2), String.format("expected %s, got %s", c1, c2));
assertTrue(c1.equals3D(c2), "expected %s, got %s".formatted(c1, c2));
assertEquals(c1.getM(), c2.getM(), 1e-9d);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,11 @@ public void add(T value) {
synchronized (idMap) {
if (null != idMap.putIfAbsent(value.getId(), value)) {
String msg =
String.format(
"%s:%s(%s) already exists",
ClassMappings.fromImpl(value.getClass()),
value.getId(),
nameMapper.apply(value).getLocalPart());
"%s:%s(%s) already exists"
.formatted(
ClassMappings.fromImpl(value.getClass()),
value.getId(),
nameMapper.apply(value).getLocalPart());
LOGGER.warning(msg);
}
Name name = nameMapper.apply(value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ private static boolean isCollection(Method getter) {
public String toString() {
String props =
this.getPatches().stream()
.map(p -> String.format("(%s: %s)", p.getName(), p.getValue()))
.map(p -> "(%s: %s)".formatted(p.getName(), p.getValue()))
.collect(Collectors.joining(","));
return String.format("%s[%s]", getClass().getSimpleName(), props);
return "%s[%s]".formatted(getClass().getSimpleName(), props);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public static Change valueOf(String propertyName, Object oldValue, Object newVal

@Override
public String toString() {
return String.format("%s: {old: %s, new: %s}", propertyName, oldValue, newValue);
return "%s: {old: %s, new: %s}".formatted(propertyName, oldValue, newValue);
}
}

Expand Down
Loading

0 comments on commit 51f93ef

Please sign in to comment.