From 32bd579321d413765998cda31c6d0bdc88e59f31 Mon Sep 17 00:00:00 2001 From: Axel Uhl Date: Thu, 21 Mar 2024 12:39:48 +0100 Subject: [PATCH 1/2] updated sap-p1-[12] configuration templates for paris2024 --- .../paris2024/sap-p1-1/master.conf | 9 ++++++-- .../paris2024/sap-p1-1/security_service.conf | 6 ++--- .../paris2024/sap-p1-2/master.conf | 16 +++++++++++-- .../paris2024/sap-p1-2/replica.conf | 19 --------------- .../paris2024/sap-p1-2/secondary_master.conf | 23 +++++++++++++++++++ .../paris2024/sap-p1-2/security_service.conf | 2 +- 6 files changed, 48 insertions(+), 27 deletions(-) delete mode 100644 configuration/on-site-scripts/paris2024/sap-p1-2/replica.conf create mode 100644 configuration/on-site-scripts/paris2024/sap-p1-2/secondary_master.conf diff --git a/configuration/on-site-scripts/paris2024/sap-p1-1/master.conf b/configuration/on-site-scripts/paris2024/sap-p1-1/master.conf index 1861b96a358..390e3e598f0 100644 --- a/configuration/on-site-scripts/paris2024/sap-p1-1/master.conf +++ b/configuration/on-site-scripts/paris2024/sap-p1-1/master.conf @@ -1,4 +1,4 @@ -INSTALL_FROM_RELEASE=build-202107291820 +INSTALL_FROM_RELEASE=build-202403210026 INSTALL_FROM_SCP_USER_AT_HOST_AND_PORT=sailing@localhost SERVER_NAME=paris2024 MONGODB_URI="mongodb://localhost:10201,localhost:10202,localhost:10203/${SERVER_NAME}?replicaSet=paris2024&retryWrites=true&readPreference=nearest" @@ -13,4 +13,9 @@ REPLICATE_MASTER_BEARER_TOKEN="..." REPLICATION_HOST=localhost REPLICATION_PORT=5673 USE_ENVIRONMENT=live-master-server -ADDITIONAL_JAVA_ARGS="${ADDITIONAL_JAVA_ARGS} -Dcom.sap.sse.debranding=true -Dpolardata.source.url=https://www.sapsailing.com:22443 -Dwindestimation.source.url=https://www.sapsailing.com:22443" +ADDITIONAL_JAVA_ARGS="${ADDITIONAL_JAVA_ARGS} -Dcom.sap.sse.debranding=true -Dpolardata.source.url=https://www.sapsailing.com:22443 -Dwindestimation.source.url=https://www.sapsailing.com:22443 -Daws.region=eu-west-1" +ADDITIONAL_JAVA_ARGS="$ADDITIONAL_JAVA_ARGS -Dsecurity.sharedAcrossSubdomainsOf=sailing.omegatiming.com -Dsecurity.baseUrlForCrossDomainStorage=https://security-service.sapsailing.com -Dgwt.acceptableCrossDomainStorageRequestOriginRegexp=https?://(.*\.)?sailing\.omegatiming\.com(:[0-9]*)?$" +MANAGE2SAIL_ACCESS_TOKEN=... +IGTIMI_CLIENT_ID=... +IGTIMI_CLIENT_SECRET=... +GOOGLE_MAPS_AUTHENTICATION_PARAMS="..." diff --git a/configuration/on-site-scripts/paris2024/sap-p1-1/security_service.conf b/configuration/on-site-scripts/paris2024/sap-p1-1/security_service.conf index c345963de5d..31b83d2a85b 100644 --- a/configuration/on-site-scripts/paris2024/sap-p1-1/security_service.conf +++ b/configuration/on-site-scripts/paris2024/sap-p1-1/security_service.conf @@ -1,13 +1,13 @@ # This is a configuration for an "emergency" local copy of the security-service.sapsailing.com server. # It assumes that a regular back-up of the eu-west-1 "security_service" DB from the "live" replica set -# has been copied to the local paris2024 replica set. Outbound replication is to the local RabbitMQ. -INSTALL_FROM_RELEASE=build-202107291820 +# has been copied to the local tokyo2020 replica set. Outbound replication is to the RabbitMQ on sap-p1-2. +INSTALL_FROM_RELEASE=build-202403210026 INSTALL_FROM_SCP_USER_AT_HOST_AND_PORT=sailing@localhost SERVER_NAME=security_service SERVER_PORT=8889 EXPEDITION_PORT=2011 TELNET_PORT=14889 -MONGODB_URI="mongodb://localhost:10201,localhost:10202,localhost:10203/${SERVER_NAME}?replicaSet=paris2024&retryWrites=true&readPreference=nearest" +MONGODB_URI="mongodb://localhost/${SERVER_NAME}?replicaSet=security_service&retryWrites=true&readPreference=nearest" # RabbitMQ in eu-west-1 (rabbit.internal.sapsailing.com) is expected to be found through SSH tunnel on localhost:5675 # Replication of shared services from central security-service.sapsailing.com through SSH tunnel 443:security-service.sapsailing.com:443 # with a local /etc/hosts entry mapping security-service.sapsailing.com to 127.0.0.1 diff --git a/configuration/on-site-scripts/paris2024/sap-p1-2/master.conf b/configuration/on-site-scripts/paris2024/sap-p1-2/master.conf index f57932159b4..ff2ac3e33b6 100644 --- a/configuration/on-site-scripts/paris2024/sap-p1-2/master.conf +++ b/configuration/on-site-scripts/paris2024/sap-p1-2/master.conf @@ -1,8 +1,15 @@ -INSTALL_FROM_RELEASE=build-202107291820 +# This instance to be "primary" master +# We're on sap-p1-2, so this is a fail-over case. +# Usually, sap-p1-2 should be running the secondary_master +# configuration with local security_service MongoDB +# replica set and outbound replication to local RabbitMQ +# +INSTALL_FROM_RELEASE=build-202403210026 INSTALL_FROM_SCP_USER_AT_HOST_AND_PORT="sailing@sap-p1-1" #INSTALL_FROM_SCP_USER_AT_HOST_AND_PORT="sailing@localhost" SERVER_NAME=paris2024 -MONGODB_URI="mongodb://localhost:10202,localhost:10203/${SERVER_NAME}?replicaSet=paris2024&retryWrites=true&readPreference=nearest" +# This is the fail-over master; Use the DB on the local machine that does not replicate into the cloud: +MONGODB_URI="mongodb://localhost:10201,localhost:10202,localhost:10203/${SERVER_NAME}?replicaSet=paris2024&retryWrites=true&readPreference=nearest" # RabbitMQ in eu-west-1 (rabbit.internal.sapsailing.com) is expected to be found through SSH tunnel on localhost:5675 # Replication of shared services from central security-service.sapsailing.com through SSH tunnel 443:security-service.sapsailing.com:443 # with a local /etc/hosts entry mapping security-service.sapsailing.com to 127.0.0.1 @@ -15,3 +22,8 @@ REPLICATION_HOST=localhost REPLICATION_PORT=5673 USE_ENVIRONMENT=live-master-server ADDITIONAL_JAVA_ARGS="${ADDITIONAL_JAVA_ARGS} -Dcom.sap.sse.debranding=true -Dpolardata.source.url=https://www.sapsailing.com:22443 -Dwindestimation.source.url=https://www.sapsailing.com:22443" +ADDITIONAL_JAVA_ARGS="$ADDITIONAL_JAVA_ARGS -Dsecurity.sharedAcrossSubdomainsOf=sailing.omegatiming.com -Dsecurity.baseUrlForCrossDomainStorage=https://security-service.sapsailing.com -Dgwt.acceptableCrossDomainStorageRequestOriginRegexp=https?://(.*\.)?sailing\.omegatiming\.com(:[0-9]*)?$" +MANAGE2SAIL_ACCESS_TOKEN=... +IGTIMI_CLIENT_ID=... +IGTIMI_CLIENT_SECRET=... +GOOGLE_MAPS_AUTHENTICATION_PARAMS="..." diff --git a/configuration/on-site-scripts/paris2024/sap-p1-2/replica.conf b/configuration/on-site-scripts/paris2024/sap-p1-2/replica.conf deleted file mode 100644 index 19f4697d7c4..00000000000 --- a/configuration/on-site-scripts/paris2024/sap-p1-2/replica.conf +++ /dev/null @@ -1,19 +0,0 @@ -# Regular operations; sap-p1-2 replicates sap-p1-1 using the rabbit-eu-west-3.sapsailing.com RabbitMQ in the cloud through SSH tunnel. -# Outbound replication, though not expected to become active, goes to a local RabbitMQ -INSTALL_FROM_RELEASE=build-202107291820 -INSTALL_FROM_SCP_USER_AT_HOST_AND_PORT="sailing@sap-p1-1" -#INSTALL_FROM_SCP_USER_AT_HOST_AND_PORT="sailing@localhost" -SERVER_NAME=paris2024 -MONGODB_URI="mongodb://localhost:10201,localhost:10202,localhost:10203/${SERVER_NAME}-replica?replicaSet=paris2024&retryWrites=true&readPreference=nearest" -# RabbitMQ in eu-west-3 is expected to be found locally on port 5673 -REPLICATE_MASTER_SERVLET_HOST=sap-p1-1 -REPLICATE_MASTER_SERVLET_PORT=8888 -REPLICATE_MASTER_QUEUE_HOST=localhost -REPLICATE_MASTER_QUEUE_PORT=5673 -REPLICATE_MASTER_BEARER_TOKEN="..." -# Outbound replication to RabbitMQ running locally on sap-p1-2 -REPLICATION_HOST=localhost -REPLICATION_PORT=5672 -REPLICATION_CHANNEL=${SERVER_NAME}-replica -USE_ENVIRONMENT=live-replica-server -ADDITIONAL_JAVA_ARGS="${ADDITIONAL_JAVA_ARGS} -Dcom.sap.sse.debranding=true" diff --git a/configuration/on-site-scripts/paris2024/sap-p1-2/secondary_master.conf b/configuration/on-site-scripts/paris2024/sap-p1-2/secondary_master.conf new file mode 100644 index 00000000000..0a8dc8628b1 --- /dev/null +++ b/configuration/on-site-scripts/paris2024/sap-p1-2/secondary_master.conf @@ -0,0 +1,23 @@ +INSTALL_FROM_RELEASE=build-202403210026 +INSTALL_FROM_SCP_USER_AT_HOST_AND_PORT="sailing@sap-p1-1" +#INSTALL_FROM_SCP_USER_AT_HOST_AND_PORT="sailing@localhost" +SERVER_NAME=paris2024 +# This is the fail-over master; Use the DB on the local machine that does not replicate into the cloud: +MONGODB_URI="mongodb://localhost/${SERVER_NAME}?replicaSet=security_service&retryWrites=true&readPreference=nearest" +# RabbitMQ in eu-west-1 (rabbit.internal.sapsailing.com) is expected to be found through SSH tunnel on localhost:5675 +# Replication of shared services from central security-service.sapsailing.com through SSH tunnel 443:security-service.sapsailing.com:443 +# with a local /etc/hosts entry mapping security-service.sapsailing.com to 127.0.0.1 +REPLICATE_MASTER_QUEUE_HOST=localhost +REPLICATE_MASTER_QUEUE_PORT=5675 +REPLICATE_MASTER_BEARER_TOKEN="..." +# Outbound replication to RabbitMQ through SSH tunnel with port forward on port 5673, regularly to RabbitMQ on localhost, +# can be re-mapped to RabbitMQ on rabbit-eu-west-3.sapsailing.com in case secondary master must become "primary" +REPLICATION_HOST=localhost +REPLICATION_PORT=5673 +USE_ENVIRONMENT=live-master-server +ADDITIONAL_JAVA_ARGS="${ADDITIONAL_JAVA_ARGS} -Dcom.sap.sse.debranding=false -Dpolardata.source.url=https://www.sapsailing.com:22443 -Dwindestimation.source.url=https://www.sapsailing.com:22443 -Daws.region=eu-west-1" +ADDITIONAL_JAVA_ARGS="$ADDITIONAL_JAVA_ARGS -Dsecurity.sharedAcrossSubdomainsOf=sailing.omegatiming.com -Dsecurity.baseUrlForCrossDomainStorage=https://security-service.sapsailing.com -Dgwt.acceptableCrossDomainStorageRequestOriginRegexp=https?://(.*\.)?sailing\.omegatiming\.com(:[0-9]*)?$" +MANAGE2SAIL_ACCESS_TOKEN=... +IGTIMI_CLIENT_ID=... +IGTIMI_CLIENT_SECRET=... +GOOGLE_MAPS_AUTHENTICATION_PARAMS="..." diff --git a/configuration/on-site-scripts/paris2024/sap-p1-2/security_service.conf b/configuration/on-site-scripts/paris2024/sap-p1-2/security_service.conf index f33c4360d3b..76dae318223 100644 --- a/configuration/on-site-scripts/paris2024/sap-p1-2/security_service.conf +++ b/configuration/on-site-scripts/paris2024/sap-p1-2/security_service.conf @@ -1,7 +1,7 @@ # This is a configuration for an "emergency" local copy of the security-service.sapsailing.com server. # It assumes that a regular back-up of the eu-west-1 "security_service" DB from the "live" replica set # has been copied to the local paris2024 replica set. Outbound replication is to the RabbitMQ on sap-p1-2. -INSTALL_FROM_RELEASE=build-202107291820 +INSTALL_FROM_RELEASE=build-202403210026 INSTALL_FROM_SCP_USER_AT_HOST_AND_PORT=sailing@sap-p1-1 SERVER_NAME=security_service SERVER_PORT=8889 From c748ed912cda57fde745195d7316c80bde849c6f Mon Sep 17 00:00:00 2001 From: Axel Uhl Date: Thu, 21 Mar 2024 13:29:18 +0100 Subject: [PATCH 2/2] deal with "resource leak" warnings that show since Eclipse 2024-03 --- .../.settings/com.gwtplugins.gwt.eclipse.core.prefs | 2 +- .../sap/sailing/server/impl/RacingEventServiceImpl.java | 7 +++---- .../com/sap/sse/mongodb/internal/MongoDBServiceImpl.java | 1 + .../sap/sse/replication/impl/ReplicationServiceImpl.java | 7 ++++--- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/java/com.sap.sailing.gwt.ui/.settings/com.gwtplugins.gwt.eclipse.core.prefs b/java/com.sap.sailing.gwt.ui/.settings/com.gwtplugins.gwt.eclipse.core.prefs index fec781dc440..60d5a342338 100644 --- a/java/com.sap.sailing.gwt.ui/.settings/com.gwtplugins.gwt.eclipse.core.prefs +++ b/java/com.sap.sailing.gwt.ui/.settings/com.gwtplugins.gwt.eclipse.core.prefs @@ -1,4 +1,4 @@ -//gwtVersion_/com.google.gwt.user/lib= +//gwtVersion_/com.google.gwt.user/lib=2.11.0 //gwtVersion_/opt/gwt-2.11.0=2.11.0 eclipse.preferences.version=1 entryPointModules= diff --git a/java/com.sap.sailing.server/src/com/sap/sailing/server/impl/RacingEventServiceImpl.java b/java/com.sap.sailing.server/src/com/sap/sailing/server/impl/RacingEventServiceImpl.java index 6752f7a0b07..aededa2f460 100644 --- a/java/com.sap.sailing.server/src/com/sap/sailing/server/impl/RacingEventServiceImpl.java +++ b/java/com.sap.sailing.server/src/com/sap/sailing/server/impl/RacingEventServiceImpl.java @@ -5248,11 +5248,10 @@ Replicator { String message = e.getMessage(); if (connection instanceof HttpURLConnection) { // try to obtain an error message from the connection's error stream: - try { - message = new BufferedReader( + try (final BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(((HttpURLConnection) connection).getErrorStream(), - HttpUrlConnectionHelper.getCharsetFromConnectionOrDefault(connection, "UTF-8"))) - .readLine(); + HttpUrlConnectionHelper.getCharsetFromConnectionOrDefault(connection, "UTF-8")))) { + message = bufferedReader.readLine(); } catch (Exception exceptionTryingToReadErrorStream) { // in this case we just stay with the exception's message } diff --git a/java/com.sap.sse.mongodb/src/com/sap/sse/mongodb/internal/MongoDBServiceImpl.java b/java/com.sap.sse.mongodb/src/com/sap/sse/mongodb/internal/MongoDBServiceImpl.java index 8e66cb0de1d..1cfbf6de444 100644 --- a/java/com.sap.sse.mongodb/src/com/sap/sse/mongodb/internal/MongoDBServiceImpl.java +++ b/java/com.sap.sse.mongodb/src/com/sap/sse/mongodb/internal/MongoDBServiceImpl.java @@ -142,6 +142,7 @@ public class MongoDBServiceImpl implements MongoDBService { @Override public MongoClient getMongo(ConnectionString mongoConnectionString) { + @SuppressWarnings("resource") MongoClient mongo = mongos.computeIfAbsent(mongoConnectionString, k-> MongoClients.create(mongoConnectionString)); return mongo; diff --git a/java/com.sap.sse.replication/src/com/sap/sse/replication/impl/ReplicationServiceImpl.java b/java/com.sap.sse.replication/src/com/sap/sse/replication/impl/ReplicationServiceImpl.java index c7cee246be3..b523b98f46e 100755 --- a/java/com.sap.sse.replication/src/com/sap/sse/replication/impl/ReplicationServiceImpl.java +++ b/java/com.sap.sse.replication/src/com/sap/sse/replication/impl/ReplicationServiceImpl.java @@ -711,9 +711,10 @@ public class ReplicationServiceImpl implements ReplicationService, OperationsToM final URLConnection initialLoadConnection = HttpUrlConnectionHelper .redirectConnectionWithBearerToken(initialLoadURL, /* HTTP request method */ "POST", master.getBearerToken()); final InputStream is = (InputStream) initialLoadConnection.getContent(); - final InputStreamReader queueNameReader = new InputStreamReader(is, HttpUrlConnectionHelper.getCharsetFromConnectionOrDefault(initialLoadConnection, "UTF-8")); - final String queueName = new BufferedReader(queueNameReader).readLine(); - queueNameReader.close(); + final String queueName; + try (final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(is, HttpUrlConnectionHelper.getCharsetFromConnectionOrDefault(initialLoadConnection, "UTF-8")))) { + queueName = bufferedReader.readLine(); + } final Channel channel = master.createChannel(); initialLoadChannels.put(master, new InitialLoadRequest(channel, replicables, queueName)); final RabbitInputStreamProvider rabbitInputStreamProvider = new RabbitInputStreamProvider(channel, queueName);