Merge remote-tracking branch 'ssh/master'

This commit is contained in:
sap-p1-1 committed 2021-07-22 09:57:47 +00:00
commit 73f7b486c9
22 files changed
+236 -9463

No files matched your search

@@ -1,8 +0,0 @@
#!/bin/bash
# Discover replicas
IPs=""
for i in $( cat `dirname $0`/regions.txt ); do
echo Region: $i >&2
IPs="${IPs} $( aws --region $i ec2 describe-instances --filters Name=tag:sailing-analytics-server,Values=tokyo2020 | jq .Reservations[].Instances[].PublicIpAddress -r )"
done
echo "${IPs}"
@@ -3,6 +3,6 @@
IPs=""
for i in $( cat `dirname $0`/regions.txt ); do
echo Region: $i >&2
IPs="${IPs} $( aws --region $i ec2 describe-instances --filters Name=tag:sailing-analytics-server,Values=tokyo2020 | jq .Reservations[].Instances[].PublicIpAddress -r )"
IPs="${IPs} $( aws --region $i ec2 describe-instances --filters Name=instance-state-name,Values=running Name=tag:sailing-analytics-server,Values=tokyo2020 | jq .Reservations[].Instances[].PublicIpAddress -r )"
done
echo "${IPs}"
@@ -6,14 +6,14 @@ if [ $# -eq 0 ]; then
echo ""
echo "-b replication bearer token; mandatory"
echo "-i Amazon Machine Image (AMI) ID to use to launch the instance; defaults to latest image tagged with image-type:sailing-analytics-server"
echo "-k Key pair name, mapping to the --key-name parameter"
echo "-k Key pair name, mapping to the --key-name parameter; defaults to Axel"
echo "-R release name; must be provided to select the release, e.g., build-202106040947"
echo "-t Instance type; defaults to ${INSTANCE_TYPE}"
echo
echo "Example: $0 -b 098toyw098typ9e8/87t9shytp98894y5= -R build-202106041327 -k Jan"
echo
echo "Will launch as many new replicas in regions $( cat `dirname $0`/regions.txt ) with the release specified with -R"
echo "as there are currently healthy auto-replicas registered with teh S-ded-tokyo2020 target group in the region (at least one)."
echo "as there are currently healthy auto-replicas registered with the S-ded-tokyo2020 target group in the region (at least one)"
echo "which will register at the master proxy tokyo-ssh.internal.sapsailing.com:8888 and RabbitMQ at"
echo "rabbit-ap-northeast-1.sapsailing.com:5672, then when healthy get added to target group S-ded-tokyo2020"
echo "in that region, with all auto-replicas registered before removed from the target group."
@@ -14,9 +14,9 @@ if [ $# -eq 0 ]; then
echo "-c Count; defaults to ${COUNT}"
echo "-i Amazon Machine Image (AMI) ID to use to launch the instance; defaults to latest image tagged with image-type:sailing-analytics-server"
echo "-g AWS Region, e.g., eu-west-1"
echo "-k Key pair name, mapping to the --key-name parameter"
echo "-p Primary host:port; defaults to ${REPLICA_SET_PRIMARY}"
echo "-r Replica set name; defaults to ${REPLICA_SET_NAME}"
echo "-k SSH key pair name, mapping to the --key-name parameter; defaults to Axel"
echo "-p MongoDB primary host[:port]; defaults to ${REPLICA_SET_PRIMARY}"
echo "-r MongoDB replica set name; defaults to ${REPLICA_SET_NAME}"
echo "-R release name; must be provided to select the release, e.g., build-202106040947"
echo "-t Instance type; defaults to ${INSTANCE_TYPE}"
echo "-v VPC name; defaults to ${VPC}"
@@ -5,6 +5,11 @@ if [ $# -eq 0 ]; then
echo "-b replication bearer token; mandatory"
echo
echo "Example: $0 -b 7345983275087320/59870hfly945="
echo
echo "Will tell all replicas in the cloud to stop replicating. This works by invoking the"
echo "get-replica-ips script and for each of them to stop replicating, using the stopReplicating.sh"
echo "script in their /home/sailing/servers/tokyo2020 directory, passing through the bearer token."
echo "Note: this will NOT stop replication on the local replica on sap-p1-2!"
exit 2
fi
options='b:'
@@ -16,7 +16,7 @@ if [ $# -eq 0 ]; then
echo "Will upgrade the auto-scaling group tokyo2020-* in the regions from regions.txt with a new"
echo "launch configuration that will be derived from the existing launch configuration named tokyo2020-*"
echo "by copying it to tokyo2020-{RELEASE_NAME} while updating the INSTALL_FROM_RELEASE parameter in the"
echo "user data to the {RELEASE_NAME}, and optionally adjuting the AMI, key pair name and instance type if specified."
echo "user data to the {RELEASE_NAME}, and optionally adjusting the AMI, key pair name and instance type if specified."
echo "Note: this will NOT terminate any instances in the target group!"
exit 2
fi
@@ -28,12 +28,21 @@ if [ $# -eq 0 ]; then
echo "-s Skip release download"
echo
echo "Example: $0 -R build-202106041327 -k Jan"
echo
echo "Will upgrade the auto-scaling group tokyo2020-* in the regions from regions.txt with a new"
echo "launch configuration that will be derived from the existing launch configuration named tokyo2020-*"
echo "by copying it to tokyo2020-{RELEASE_NAME} while updating the INSTALL_FROM_RELEASE parameter in the"
echo "user data to the {RELEASE_NAME}, and optionally adjuting the AMI, key pair name and instance type if specified."
echo "Note: this will NOT terminate any instances in the target group!"
echo "The procedure works in the following steps:"
echo " - patch *.conf files in sap-p1-1:servers/[master|security_service] and sap-p1-2:servers/[replica|master|security_service] so"
echo " their INSTALL_FROM_RELEASE points to the new ${RELEASE}"
echo " - Install new releases to sap-p1-1:servers/[master|security_service] and sap-p1-2:servers/[replica|master|security_service]"
echo " - Update all launch configurations and auto-scaling groups in the cloud (update-launch-configuration.sh)"
echo " - Tell all replicas in the cloud to stop replicating (stop-all-cloud-replicas.sh)"
echo " - Tell sap-p1-2 to stop replicating"
echo " - on sap-p1-1:servers/master run ./stop; ./start to bring the master to the new release"
echo " - wait until master is healthy"
echo " - on sap-p1-2:servers/replica run ./stop; ./start to bring up on-site replica again"
echo " - launch upgraded cloud replicas and replace old replicas in target group (launch-replicas-in-all-regions.sh)"
echo " - terminate all instances named \"SL Tokyo2020 (auto-replica)\"; this should cause the auto-scaling group to launch new instances as required"
echo " - manually inspect the health of everything and terminate the \"SL Tokyo2020 (Upgrade Replica)\" instances when enough new instances"
echo " named \"SL Tokyo2020 (auto-replica)\" are available"
exit 2
fi
options='R:b:t:i:k:s'
@@ -57,9 +57,11 @@ public class FixFactory {
: Long.valueOf(fixTypeAndOptionalColonSeparatedSensorsSubId[1]));
final Type ft = Type.valueOf(fixType);
if (ft != null) {
Fix fix = createFix(sensor, ft, timePoint, valuesPerSubindex);
result.add(fix);
fixIndex++;
final Fix fix = createFix(sensor, ft, timePoint, valuesPerSubindex);
if (fix != null) {
result.add(fix);
fixIndex++;
}
}
}
}
@@ -67,14 +69,20 @@ public class FixFactory {
return result;
}
/**
* @return {@code null} in case the fix parser cannot make sense of the {@code valuesPerSubindex}, e.g., because
* it's empty.
*/
private Fix createFix(Sensor sensor, Type fixType, TimePoint timePoint, Map<Integer, Object> valuesPerSubindex) {
try {
Constructor<? extends Fix> constructor = fixType.getFixClass().getConstructor(TimePoint.class, Sensor.class, Map.class);
Fix fix = constructor.newInstance(timePoint, sensor, valuesPerSubindex);
return fix;
} catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
logger.log(Level.SEVERE, "Internal error trying to find fix constructor for fix type "+fixType+" with class "+fixType.getFixClass());
throw new RuntimeException(e);
logger.log(Level.SEVERE, "Internal error trying to find fix constructor for fix type "+
fixType+" with class "+fixType.getFixClass()+" or problem creating fix from data "+valuesPerSubindex+": "+
e.getMessage());
return null;
}
}
}
@@ -33,6 +33,18 @@ import com.sap.sse.common.Util;
import com.sap.sse.common.impl.MillisecondsTimePoint;
public class WebSocketConnectionManager implements LiveDataConnection {
/**
* The heartbeat receive timeout. Currently 45s because according to Brent Russel (2021-07-21) the server
* is expected to send every 15s, so we have a factor of two as tolerance.
*/
private static final long TIMEOUT_AFTER_NOT_RECEIVING_HEARTBEAT_IN_MILLIS = 45000l;
/**
* Send ping message every 15s. The server will timeout if not receiving a heartbeat after 30s, so we have a tolerance
* of a factor of two, in other words allowing the heartbeat to travel for another 15s.
*/
private static final long DURATION_BETWEEN_HEARTBEAT_SENDS_IN_MILLIS = 15000l;
private static final Logger logger = Logger.getLogger(WebSocketConnectionManager.class.getName());
private final IgtimiConnectionFactoryImpl connectionFactory;
private static enum TargetState { OPEN, CLOSED };
@@ -263,7 +275,7 @@ public class WebSocketConnectionManager implements LiveDataConnection {
logger.log(Level.WARNING, "Error with server heartbeat in "+this, e);
}
}
}, /* wait for 45s for first execution */ 45000l, /* and check again every 45s*/ 45000l);
}, TIMEOUT_AFTER_NOT_RECEIVING_HEARTBEAT_IN_MILLIS, TIMEOUT_AFTER_NOT_RECEIVING_HEARTBEAT_IN_MILLIS);
}
private void startClientHeartbeat() {
@@ -279,7 +291,7 @@ public class WebSocketConnectionManager implements LiveDataConnection {
logger.log(Level.WARNING, "Couldn't send heartbeat to Igtimi web socket session in "+WebSocketConnectionManager.this+". Will continue to try...", e);
}
}
}, /* delay */ 0, /* send ping message every other minute; has to be at least every five minutes, so this should be safe */ 120000l);
}, /* delay */ 0, DURATION_BETWEEN_HEARTBEAT_SENDS_IN_MILLIS);
}
private synchronized void reconnect() throws Exception {
@@ -24,7 +24,7 @@ import com.sap.sse.common.CountryCodeFactory;
import com.sap.sse.common.Util;
public class CountryCodeTest {
private static final int NUMBER_OF_COUNTRY_CODES = 259;
private static final int NUMBER_OF_COUNTRY_CODES = 260;
@Ignore
@Test
@@ -14,6 +14,8 @@
<li>Groups are now ordered by name in the drop-down for setting the default creation group
under "User Details."</li>
<li>A Slovenian translation of the user interface has been added.</li>
<li>The IOC code for "Russian Olympic Committee" has been added under the "ROC" abbreviation, together
with the IOC-provided flag.</li>
</ul>
<h5 class="articleSubheadline">June 2021</h5>
<ul class="bulletList">
@@ -16,22 +16,6 @@ public class FlagImageResolverImpl implements FlagImageResolver {
private final FlagImageResources flagImageResources = GWT.create(FlagImageResources.class);
public String[] flagImageNames = { "ad", "ae", "af", "ag", "ai", "al", "am", "an", "ao", "ar", "as", "at",
"au", "aw", "ax", "az", "ba", "bb", "bd", "be", "bf", "bg", "bh", "bi", "bj", "bm", "bn", "bo", "br", "bs",
"bt", "bv", "bw", "by", "bz", "ca", "catalonia", "cc", "cd", "cf", "cg", "ch", "ci", "ck", "cl", "cm",
"cn", "co", "cr", "cs", "cu", "cv", "cx", "cy", "cz", "de", "dj", "dk", "dm", "do", "dz", "ec", "ee", "eg",
"eh", "england", "er", "es", "et", "europeanunion", "fam", "fi", "fj", "fk", "fm", "fo", "fr", "ga", "gb",
"gd", "ge", "gf", "gh", "gi", "gl", "gm", "gn", "gp", "gq", "gr", "gs", "gt", "gu", "gw", "gy", "hk", "hm",
"hn", "hr", "ht", "hu", "id", "ie", "il", "in", "io", "iq", "ir", "is", "it", "jm", "jo", "jp", "ke", "kg",
"kh", "ki", "km", "kn", "kp", "kr", "kw", "ky", "kz", "la", "lb", "lc", "li", "lk", "lr", "ls", "lt", "lu",
"lv", "ly", "ma", "mc", "md", "me", "mg", "mh", "mk", "ml", "mm", "mn", "mo", "mp", "mq", "mr", "ms", "mt",
"mu", "mv", "mw", "mx", "my", "mz", "na", "nc", "ne", "nf", "ng", "ni", "nl", "no", NONE, "np", "nr", "nu",
"nz", "om", "pa", "pe", "pf", "pg", "ph", "pk", "pl", "pm", "pn", "pr", "ps", "pt", "pw", "py", "qa", "re",
"ro", "rs", "ru", "rw", "sa", "sb", "sc", "scotland", "sd", "se", "sg", "sh", "si", "sj", "sk", "sl", "sm",
"sn", "so", "sr", "st", "sv", "sy", "sz", "tc", "td", "tf", "tg", "th", "tj", "tk", "tl", "tm", "tn", "to",
"tr", "tt", "tv", "tw", "tz", "ua", "ug", "um", "us", "uy", "uz", "va", "vc", "ve", "vg", "vi", "vn", "vu",
"wales", "wf", "ws", "ye", "yt", "za", "zm", "zw" };
{
flagImagesMap = new HashMap<String, ImageResource>();
flagImagesMap.put("ad", flagImageResources.flagAD());
@@ -220,6 +204,7 @@ public class FlagImageResolverImpl implements FlagImageResolver {
flagImagesMap.put("pw", flagImageResources.flagPW());
flagImagesMap.put("py", flagImageResources.flagPY());
flagImagesMap.put("qa", flagImageResources.flagQA());
flagImagesMap.put("rc", flagImageResources.flagRC());
flagImagesMap.put("re", flagImageResources.flagRE());
flagImagesMap.put("ro", flagImageResources.flagRO());
flagImagesMap.put("rs", flagImageResources.flagRS());
@@ -562,8 +562,11 @@ public interface FlagImageResources extends ClientBundle {
@Source("com/sap/sailing/gwt/ui/client/images/flags/QA.png")
ImageResource flagQA();
@Source("com/sap/sailing/gwt/ui/client/images/flags/RE.png")
ImageResource flagRE();
@Source("com/sap/sailing/gwt/ui/client/images/flags/RC.png")
ImageResource flagRC();
@Source("com/sap/sailing/gwt/ui/client/images/flags/RE.png")
ImageResource flagRE();
@Source("com/sap/sailing/gwt/ui/client/images/flags/RO.png")
ImageResource flagRO();
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

@@ -0,0 +1,53 @@
package com.sap.sailing.server.replication.test;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.junit.Test;
import com.sap.sailing.domain.base.impl.SailingServerConfigurationImpl;
import com.sap.sailing.server.interfaces.RacingEventService;
import com.sap.sailing.server.operationaltransformation.UpdateServerConfiguration;
import com.sap.sailing.server.replication.test.ConnectionResetAndReconnectTest.MasterReplicationDescriptorMock;
import com.sap.sse.common.Util.Pair;
import com.sap.sse.replication.ReplicationMasterDescriptor;
public class StandaloneServerWithInitialLoadReplicationTest extends AbstractServerReplicationTest {
private static final Logger logger = Logger.getLogger(StandaloneServerWithInitialLoadReplicationTest.class.getName());
public StandaloneServerWithInitialLoadReplicationTest() {
super(new AbstractServerReplicationTest.ServerReplicationTestSetUp() {
/**
* Don't start replication immediately during set-up
*/
@Override
public void setUp() throws Exception {
try {
Pair<ReplicationServiceTestImpl<RacingEventService>, ReplicationMasterDescriptor> result = basicSetUp(
/* dropDB */true,
/* master=null means create a new one */null, /* replica=null means create a new one */null);
masterDescriptor = MasterReplicationDescriptorMock.from(result.getB());
} catch (Exception e) {
logger.log(Level.SEVERE, "Exception during set up", e);
tearDown();
}
}
});
}
/**
* See https://bugzilla.sapsailing.com/bugzilla/show_bug.cgi?id=5600
*/
@Test
public void testInitialLoadReplicationOfStandaloneServer() throws Exception {
master.apply(new UpdateServerConfiguration(new SailingServerConfigurationImpl(/* isStandalone */ true)));
Thread.sleep(1000); // wait 1s for JMS to deliver any recovered messages; there should be none
assertFalse(replica.getSailingServerConfiguration().isStandaloneServer());
testSetUp.getReplicaReplicator().startToReplicateFrom(testSetUp.getMasterDescriptor());
assertFalse(replica.isCurrentlyFillingFromInitialLoad());
assertTrue(replica.getSailingServerConfiguration().isStandaloneServer());
}
}
@@ -3351,6 +3351,8 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa
.getCachedEventsForRemoteSailingServers().keySet());
oos.writeObject(remoteServerReferences);
logoutput.append("Serialized " + remoteServerReferences.size() + " remote sailing server references\n");
logger.info("Serializing server configuration (e.g., \"local server\" state)...");
oos.writeObject(sailingServerConfiguration);
logger.info(logoutput.toString());
}
@@ -3475,6 +3477,8 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa
remoteSailingServerSet.add(remoteSailingServerReference);
logoutput.append("Received remote sailing server reference " + remoteSailingServerReference);
}
logger.info("Reading sailing server configuration (e.g., \"local server\" state)...");
this.sailingServerConfiguration = (SailingServerConfiguration) ois.readObject();
// make sure to initialize listeners correctly
for (Regatta regatta : regattasByName.values()) {
RegattaImpl regattaImpl = (RegattaImpl) regatta;
@@ -44,6 +44,12 @@
<li>A problem with uninitialized race timings may have led to endless loops trying to identify a valid
time range for wind sampling. This has been fixed now.</li>
<li>A Slovenian translation of the user interface has been added.</li>
<li>The IOC code for "Russian Olympic Committee" is now available under the "ROC" abbreviation.</li>
<li>Empty Igtimi WindBot messages, such as a COG message with no payload, no longer causes an uncaught
exception but is now handled properly and logged accordingly. Other fixes in the same message now
are processed as they should.</li>
<li>After Igtimi changed their WebSocket implementation, we had to lower the heartbeat sending interval
from 120s to 15s which now avoids connection interrupts.</li>
</ul>
<h2 class="articleSubheadline">June 2021</h2>
<ul class="bulletList">
@@ -213,6 +213,7 @@ public class CountryCodeFactoryImpl implements CountryCodeFactory {
add(new CountryCodeImpl("RÉUNION", "RE", "REU", "re", null, null, "638", "262"));
add(new CountryCodeImpl("ROMANIA", "RO", "ROU", "ro", "RO", "ROU", "642", "40"));
add(new CountryCodeImpl("RUSSIAN FEDERATION", "RU", "RUS", "ru", "RUS", "RUS", "643", "7"));
add(new CountryCodeImpl("RUSSIAN OLYMPIC COMMITTEE", "RC", "ROC", "rc", "ROC", "ROC", "643", "7"));
add(new CountryCodeImpl("RWANDA", "RW", "RWA", "rw", "RWA", "RWA", "646", "250"));
add(new CountryCodeImpl("SAINT BARTHÉLEMY", "BL", "BLM", "bl", null, null, "652", null));
add(new CountryCodeImpl("SAINT HELENA", "SH", "SHN", "sh", null, null, "654", "290"));
@@ -61,7 +61,7 @@ For questions and support please get in touch through <a href="mailto:support@sa
<td>Create a user</td>
</tr>
<tr>
<td><a href="user.html">/security/api/restsecurity/change_password</a></td>
<td><a href="change_password.html">/security/api/restsecurity/change_password</a></td>
<td>Change a user's password</td>
</tr>
<tr>
File diff suppressed because it is too large. Load diff
-54
View File
@@ -1,54 +0,0 @@
!SESSION 2020-11-06 12:38:21.621 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.8.0_261
java.vendor=Oracle Corporation
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=de_DE
Command-line arguments: -dev file:/Users/udowessels/git/java/target/dev.properties -os macosx -ws cocoa -arch x86_64 -consoleLog -console -clean
!ENTRY com.sap.sailing.polars 4 0 2020-11-06 18:30:12.071
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Exception in com.sap.sailing.polars.impl.Activator.stop() of bundle com.sap.sailing.polars.
at org.eclipse.osgi.internal.framework.BundleContextImpl.stop(BundleContextImpl.java:855)
at org.eclipse.osgi.internal.framework.EquinoxBundle.stopWorker0(EquinoxBundle.java:947)
at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.stopWorker(EquinoxBundle.java:314)
at org.eclipse.osgi.container.Module.doStop(Module.java:636)
at org.eclipse.osgi.container.Module.stop(Module.java:498)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.decStartLevel(ModuleContainer.java:1675)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1594)
at org.eclipse.osgi.container.SystemModule.stopWorker(SystemModule.java:270)
at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule.stopWorker(EquinoxBundle.java:147)
at org.eclipse.osgi.container.Module.doStop(Module.java:636)
at org.eclipse.osgi.container.Module.stop(Module.java:498)
at org.eclipse.osgi.container.SystemModule.stop(SystemModule.java:202)
at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule$1.run(EquinoxBundle.java:165)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: The service has been unregistered
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:206)
at com.sap.sailing.polars.impl.Activator.stop(Activator.java:92)
at org.eclipse.osgi.internal.framework.BundleContextImpl$4.run(BundleContextImpl.java:835)
at org.eclipse.osgi.internal.framework.BundleContextImpl$4.run(BundleContextImpl.java:1)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.osgi.internal.framework.BundleContextImpl.stop(BundleContextImpl.java:828)
... 13 more
Root exception:
java.lang.IllegalStateException: The service has been unregistered
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:206)
at com.sap.sailing.polars.impl.Activator.stop(Activator.java:92)
at org.eclipse.osgi.internal.framework.BundleContextImpl$4.run(BundleContextImpl.java:835)
at org.eclipse.osgi.internal.framework.BundleContextImpl$4.run(BundleContextImpl.java:1)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.osgi.internal.framework.BundleContextImpl.stop(BundleContextImpl.java:828)
at org.eclipse.osgi.internal.framework.EquinoxBundle.stopWorker0(EquinoxBundle.java:947)
at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.stopWorker(EquinoxBundle.java:314)
at org.eclipse.osgi.container.Module.doStop(Module.java:636)
at org.eclipse.osgi.container.Module.stop(Module.java:498)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.decStartLevel(ModuleContainer.java:1675)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1594)
at org.eclipse.osgi.container.SystemModule.stopWorker(SystemModule.java:270)
at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule.stopWorker(EquinoxBundle.java:147)
at org.eclipse.osgi.container.Module.doStop(Module.java:636)
at org.eclipse.osgi.container.Module.stop(Module.java:498)
at org.eclipse.osgi.container.SystemModule.stop(SystemModule.java:202)
at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule$1.run(EquinoxBundle.java:165)
at java.lang.Thread.run(Thread.java:748)
+108 -14
View File
@@ -1,5 +1,7 @@
# Setup for the Olympic Summer Games 2020/2021 Tokyo
[[_TOC_]]
## Local Installation
For the Olympic Summer Games 2020/2021 Tokyo we use a dedicated hardware set-up to accommodate the requirements on site. In particular, two Lenovo P1 laptops with equal hardware configuration (32GB RAM, Intel Core i9-9880H) will be established as server devices running various services in a way that we can tolerate, with minimal downtimes, failures of either of the two devices.
@@ -330,6 +332,21 @@ The ``monitor-mongo-replica-set-delay`` looks as the result of calling ``rs.prin
The ``monitor-disk-usage`` script checks the partition holding ``/var/lib/mongodb/``. Should it fill up to more than 90%, an alert will be sent using ``notify-operators``.
### Time Synchronizing
Setup chronyd service on desktop machine, in order to regurlary connect via VPN and relay the time towards the two P1s. Added
```
# Tokyo2020 configuration
server 10.1.3.221 iburst
```
to ``/etc/chrony/chrony.conf`` on the clients.
Added
```
# FOR TOKYO SERVER SETUP
allow all
local stratum 10
```
to the server file, started ```chronyd``` service.
## AWS Setup
Our primary AWS region for the event will be Tokyo (ap-northeast-1). There, we have reserved the elastic IP ``52.194.91.94`` to which we've mapped the Route53 hostname ``tokyo-ssh.sapsailing.com`` with a simple A-record. The host assigned to the IP/hostname is to be used as a "jump host" for SSH tunnels. It runs Amazon Linux with a login-user named ``ec2-user``. The ``ec2-user`` has ``sudo`` permission. In the root user's crontab we have the same set of scripts hooked up that in our eu-west-1 production landscape is responsible for obtaining and installing the landscape manager's SSH public keys to the login user's account, aligning the set of ``authorized_keys`` with those of the registered landscape managers (users with permission ``LANDSCAPE:MANAGE:AWS``). The ``authorized_keys.org`` file also contains the two public SSH keys of the ``sailing`` accounts on the two laptops, so each time the script produces a new ``authorized_keys`` file for the ``ec2-user``, the ``sailing`` keys for the laptop tunnels don't get lost.
@@ -419,7 +436,7 @@ One way to monitor the health and replication status of the replica set is runni
It shows the replication state and in particular the delay of the replicas. A cronjob exists for ``sailing@sap-p1-1`` which triggers ``/usr/local/bin/monitor-mongo-replica-set-delay`` every minute which will use ``/usr/local/bin/notify-operators`` in case the average replication delay for the last ten read-outs exceeds a threshold (currently 3s). We have a cron job monitoring this (see above) and sending out alerts if things start slowing down.
In order to have a local copy of the ``security_service`` database, a CRON job exists for user ``sailing`` on ``sap-p1-1`` which executes the ``/usr/local/bin/clone-security-service-db`` script once per hour. See ``/home/sailing/crontab``. The script dumps ``security_service`` from the ``live`` replica set in ``eu-west-1`` to the ``/tmp/dump`` directory on ``ec2-user@tokyo-ssh.sapsailing.com`` and then sends the directory content as a ``tar.gz`` stream through SSH and restores it on the local ``mongodb://sap-p1-1:27017,sap-p1-2/security_service?replicaSet=security_service`` replica set, after copying an existing local ``security_service`` database to ``security_service_bak``. This way, even if the Internet connection dies during this cloning process, a valid copy still exists in the local ``tokyo2020`` replica set which can be copied back to ``security_service`` using the MongoDB shell command
In order to have a local copy of the ``security_service`` database, a CRON job exists for user ``sailing`` on ``sap-p1-1`` which executes the ``/usr/local/bin/clone-security-service-db-safe-exit`` script (versioned in git under ``configuration/on-site-scripts/clone-security-service-db-safe-exit``) once per hour. See ``/home/sailing/crontab``. The script dumps ``security_service`` from the ``live`` replica set in ``eu-west-1`` to the ``/tmp/dump`` directory on ``ec2-user@tokyo-ssh.sapsailing.com`` and then sends the directory content as a ``tar.gz`` stream through SSH and restores it on the local ``mongodb://sap-p1-1:27017,sap-p1-2/security_service?replicaSet=security_service`` replica set, after copying an existing local ``security_service`` database to ``security_service_bak``. This way, even if the Internet connection dies during this cloning process, a valid copy still exists in the local ``tokyo2020`` replica set which can be copied back to ``security_service`` using the MongoDB shell command
```
db.copyDatabase("security_service_bak", "security_service")
@@ -543,28 +560,105 @@ The ``Event`` object is owned by ``tokyo2020-moderators``, and that group grants
## Landscape Upgrade Procedure
update git on all replicas
stop replication on all cloud replicas:
In the ``configuration/on-site-scripts`` we have prepared a number of scripts intended to be useful for local and cloud landscape management. TL;DR:
```
$ for i in `./get-replica-ips`; do ssh -o StrictHostKeyChecking=no sailing@$i "cd /home/sailing/servers/tokyo2020; /home/sailing/code/java/target/stopReplicating.sh 4qUrxMVQanLghETmM95XX3fshkHK0wNAQycuPAVNW0E="; done
configuration/on-site-scripts/upgrade-landscape.sh -R {release-name} -b {replication-bearer-token}
```
will upgrade the entire landscape to the release ``{release-name}`` (e.g., build-202107210711). The ``{replication-bearer-token}`` must be provided such that the user authenticated by that token will have the permission to stop replication and to replicate the ``tokyo2020`` master.
stop replication on-site
The script will proceed in the following steps:
- patch ``*.conf`` files in ``sap-p1-1:servers/[master|security_service]`` and ``sap-p1-2:servers/[replica|master|security_service]`` so
their ``INSTALL_FROM_RELEASE`` points to the new ``${RELEASE}``
- Install new releases to ``sap-p1-1:servers/[master|security_service]`` and ``sap-p1-2:servers/[replica|master|security_service]``
- Update all launch configurations and auto-scaling groups in the cloud (``update-launch-configuration.sh``)
- Tell all replicas in the cloud to stop replicating (``stop-all-cloud-replicas.sh``)
- Tell ``sap-p1-2`` to stop replicating
- on ``sap-p1-1:servers/master`` run ``./stop; ./start`` to bring the master to the new release
- wait until master is healthy
- on ``sap-p1-2:servers/replica`` run ``./stop; ./start`` to bring up on-site replica again
- launch upgraded cloud replicas and replace old replicas in target group (``launch-replicas-in-all-regions.sh``)
- terminate all instances named "SL Tokyo2020 (auto-replica)"; this should cause the auto-scaling group to launch new instances as required
- manually inspect the health of everything and terminate the "SL Tokyo2020 (Upgrade Replica)" instances when enough new instances
named "SL Tokyo2020 (auto-replica)" are available
put release in /home/trac/
The individual scripts will be described briefly in the following sub-sections. Many of them use as a common artifact the ``regions.txt`` file which contains the list of regions in which operations are executed. The ``eu-west-1`` region as our "legacy" or "primary" region requires special attention in some cases. In particular, it can use the ``live`` replica set for the replicas started in the region, also because the AMI used in this region is slightly different and in particular doesn't launch a MongoDB local replica set on each instance which the AMIs in all other regions supported do.
refresh instance stop start on sap-p1-1 / on-site master
### clone-security-service-db-safe-exit
after on-site master is healthy / available register cloud master forwarder to target groups, pay attention in eu-west-1 webserver instance works as cloud master forwarder
Creates a ``mongodump`` of "mongodb://mongo0.internal.sapsailing.com,mongo1.internal.sapsailing.com,dbserver.internal.sapsailing.com:10203/security_service?replicaSet=live&retryWrites=true&readPreference=nearest" on the ``tokyo-ssh.sapsailing.com`` host and packs it into a ``.tar.gz`` file. This archive is then transferred as the standard output of an SSH command to the host executing the script where it is unpacked into ``/tmp/dump``. The local "mongodb://localhost/security_service_bak?replicaSet=security_service&retryWrites=true&readPreference=nearest" backup copy is then dropped, the local ``security_service`` DB is moved to ``security_service_bak``, and the dump from ``/tmp/dump`` is then restored to ``security_service``. If this fails, the backup from ``security_service_bak`` is restored to ``security_service``, and there won't be a backup copy anymore in ``security_service_bak`` anymore.
./stop /start on on-site replica
The script is used as a CRON job for user ``sailing@sap-p1-1``.
launch more like this with new user data, append (manual) to name of instance, make sure master target group has a healthy target.
### get-replica-ips
check :8888/gwt/status , if initial load is not starting most probably registration to master has failed (check log for Exception), if so login and do stop & start
Lists the public IP addresses of all running replicas in the regions described in ``regions.txt`` on its standard output. Progress information will be sent to standard error. Example invocation:
<pre>
$ ./get-replica-ips
Region: eu-west-1
Region: ap-northeast-1
Region: ap-southeast-2
Region: us-west-1
Region: us-east-1
34.245.148.130 18.183.234.161 3.26.60.130 13.52.238.81 18.232.169.1
</pre>
edit target group, deregister and register in the same window, save changes
### launch-replicas-in-all-regions.sh
terminate old auto-replica
Will launch as many new replicas in the regions listed in ``regions.txt`` with the release specified with ``-R`` as there are currently healthy auto-replicas registered with the ``S-ded-tokyo2020`` target group in the region (at least one) which will register at the master proxy ``tokyo-ssh.internal.sapsailing.com:8888`` and RabbitMQ at ``rabbit-ap-northeast-1.sapsailing.com:5672``, then when healthy get added to target group ``S-ded-tokyo2020`` in that region, with all auto-replicas registered before removed from the target group.
wait for autoscaling group to create a new autoscaling instance, after healthy terminate manually launched instance/replica
The script uses the ``launch-replicas-in-region.sh`` script for each region where replicas are to be launched.
Example invocation:
<pre>
launch-replicas-in-all-regions.sh -R build-202107210711 -b 1234567890ABCDEFGH/+748397=
</pre>
Invoke without arguments to see a documentation of possible parameters.
### launch-replicas-in-region.sh
Will launch one or more (see ``-c``) new replicas in the AWS region specified with ``-g`` with the release specified with ``-R`` which will register at the master proxy ``tokyo-ssh.internal.sapsailing.com:8888`` and RabbitMQ at ``rabbit-ap-northeast-1.sapsailing.com:5672``, then when healthy get added to target group ``S-ded-tokyo2020`` in that region, with all auto-replicas registered before removed from the target group. Specify ``-r`` and ``-p`` if you are launching in ``eu-west-1`` because it has a special non-default MongoDB environment.
Example invocation:
<pre>
launch-replicas-in-region.sh -g us-east-1 -R build-202107210711 -b 1234567890ABCDEFGH/+748397=
</pre>
Invoke without arguments to see a documentation of possible parameters.
### stop-all-cloud-replicas.sh
Will tell all replicas in the cloud in those regions described by the ``regions.txt`` file to stop replicating. This works by invoking the ``get-replica-ips script`` and for each of them to stop replicating, using the ``stopReplicating.sh`` script in their ``/home/sailing/servers/tokyo2020`` directory, passing through the bearer token. Note: this will NOT stop replication on the local replica on ``sap-p1-2``!
The script must be invoked with the bearer token needed to authenticate a user with replication permission for the ``tokyo2020`` application replica set.
Example invocation:
<pre>
stop-all-cloud-replicas.sh -b 1234567890ABCDEFGH/+748397=
</pre>
Invoke without arguments to see a documentation of possible parameters.
### update-launch-configuration.sh
Will upgrade the auto-scaling group ``tokyo2020*`` (such as ``tokyo2020-auto-replicas``) in the regions from ``regions.txt`` with a new launch configuration that will be derived from the existing launch configuration named ``tokyo2020-*`` by copying it to ``tokyo2020-{RELEASE_NAME}`` while updating the ``INSTALL_FROM_RELEASE`` parameter in the user data to the ``{RELEASE_NAME}`` provided in the ``-R`` parameter, and optionally adjusting the AMI, key pair name and instance type if specified by the respective parameters. Note: this will NOT terminate any instances in the target group!
Example invocation:
<pre>
update-launch-configuration.sh -R build-202107210711
</pre>
Invoke without arguments to see a documentation of possible parameters.
### upgrade-landscape.sh
See the introduction of this main section. Synopsis:
<pre>
./upgrade-landscape.sh -R &lt;release-name&gt; -b &lt;replication-bearer-token&gt; \[-t &lt;instance-type&gt;\] \[-i &lt;ami-id&gt;\] \[-k &lt;key-pair-name&gt;\] \[-s\]<br>
-b replication bearer token; mandatory
-i Amazon Machine Image (AMI) ID to use to launch the instance; defaults to latest image tagged with image-type:sailing-analytics-server
-k Key pair name, mapping to the --key-name parameter
-R release name; must be provided to select the release, e.g., build-202106040947
-t Instance type; defaults to
-s Skip release download
</pre>