java/com.sap.sailing.landscape.gateway/webservices/api/createapplicationreplicaset.html
... ...
@@ -12,7 +12,7 @@
12 12
<h2>URL: /sailinglandscape/api/landscape/createapplicationreplicaset</h2>
13 13
14 14
<b>Description:</b>
15
- <p>Creates an application replica set with an auto-scaling group and corresponding launch configuration, load
15
+ <p>Creates an application replica set with an auto-scaling group and corresponding launch template, load
16 16
balancer rules and corresponding target groups, hooking up to the region's default MongoDB replica set and
17 17
RabbitMQ and replicating the security service and shared sailing data from the security-service.sapsailing.com
18 18
server by default.</p>
java/com.sap.sailing.landscape.gateway/webservices/api/removeapplicationreplicaset.html
... ...
@@ -17,7 +17,7 @@
17 17
the node is terminated. The load balancing rules and the corresponding target groups are removed.
18 18
If this turns a load balancer empty (other than its default rule), the load balancer is removed too,
19 19
unless it was the dynamic load balancer. Any DNS record for the replica set (in case of a DNS-mapped
20
- load balancer being used) is removed, too, and so are the launch configuration and auto-scaling group
20
+ load balancer being used) is removed, too, and so are the launch template and auto-scaling group
21 21
in case they exist.</p>
22 22
<br />
23 23
<table>
java/com.sap.sailing.landscape.ui/src/com/sap/sailing/landscape/ui/client/LandscapeManagementPanel.java
... ...
@@ -85,7 +85,7 @@ import com.sap.sse.security.ui.client.component.SelectedElementsCountingButton;
85 85
* <li>SSH Key Pairs: generate, import, export, and deploy SSH key pairs used for spinning up and connect to compute
86 86
* instances</li>
87 87
* <li>Application server replica sets: single process per instance, or multiple processes per instance; with or without
88
- * auto scaling groups and launch configurations for auto-scaling the number of replicas; change the software version running on an application server
88
+ * auto scaling groups and launch templates for auto-scaling the number of replicas; change the software version running on an application server
89 89
* replica set while maintaining availability as good as possible by de-registering the master instance from the master target group, then
90 90
* spinning up a new master, then any desired number of replicas, then swap the old replicas for the new replicas in the public target group
91 91
* and register the master instance again.</li>
... ...
@@ -430,7 +430,9 @@ public class LandscapeManagementPanel extends SimplePanel {
430 430
applicationReplicaSetToUpdateAutoScalingReplicaAmiFor -> updateAutoScalingReplicaAmi(stringMessages,
431 431
regionsTable.getSelectionModel().getSelectedObject(),
432 432
Collections.singleton(applicationReplicaSetToUpdateAutoScalingReplicaAmiFor),
433
- machineImagesTable.getSelectionModel().getSelectedObject()));
433
+ // if a specific sailing-analytics-server machine image was selected, use it:
434
+ machineImagesTable.getSelectionModel().getSelectedObject()==null || machineImagesTable.getSelectionModel().getSelectedObject().getType().equals(SharedLandscapeConstants.IMAGE_TYPE_TAG_VALUE_SAILING) ?
435
+ null : machineImagesTable.getSelectionModel().getSelectedObject()));
434 436
applicationReplicaSetsActionColumn.addAction(ApplicationReplicaSetsImagesBarCell.ACTION_MOVE_MASTER_TO_OTHER_INSTANCE,
435 437
applicationReplicaSetToMoveMasterFor -> moveMasterToOtherInstance(stringMessages,
436 438
regionsTable.getSelectionModel().getSelectedObject(),
... ...
@@ -1359,10 +1361,9 @@ public class LandscapeManagementPanel extends SimplePanel {
1359 1361
* until the replica has reached its healthy state. The replica is then registered in the public target group.<p>
1360 1362
*
1361 1363
* Then, the {@code ./refreshInstance.sh install-release <release>} command is sent to the master which will
1362
- * download and unpack the new release but will not yet stop the master process. In parallel, an existing
1363
- * launch configuration will be copied and updated with user data reflecting the new release to be used.
1364
- * An existing auto-scaling group will then be updated to use the new launch configuration. The old launch
1365
- * configuration will then be removed.<p>
1364
+ * download and unpack the new release but will not yet stop the master process. In parallel, the existing
1365
+ * default launch template version will be copied and updated with user data reflecting the new release to be used.
1366
+ * The auto-scaling group will then use the new default launch template version.<p>
1366 1367
*
1367 1368
* Replication is then stopped for all existing replicas, then the master is de-registered from the master
1368 1369
* target group and the public target group, effectively making the replica set "read-only." Then, the {@code ./stop}
java/com.sap.sailing.landscape.ui/src/com/sap/sailing/landscape/ui/client/LandscapeManagementWriteServiceAsync.java
... ...
@@ -204,7 +204,7 @@ public interface LandscapeManagementWriteServiceAsync {
204 204
AsyncCallback<Boolean> callback);
205 205
206 206
/**
207
- * Updates the AMI to use in the launch configurations of those of the {@code replicaSets} that have an auto-scaling group.
207
+ * Updates the AMI to use in the launch template version of those of the {@code replicaSets} that have an auto-scaling group.
208 208
* Any running replica will not be affected by this. Only new replicas will be launched based on the AMI specified.
209 209
*
210 210
* @param replicaSets
... ...
@@ -213,7 +213,7 @@ public interface LandscapeManagementWriteServiceAsync {
213 213
* defaults to the latest image of type {@link SharedLandscapeConstants#IMAGE_TYPE_TAG_VALUE_SAILING}
214 214
* @return those replica sets that were updated according to this request; those from {@code replicaSets} not part
215 215
* of this result have not had their AMI upgraded, probably because we didn't find an auto-scaling group and
216
- * hence no launch configuration to update
216
+ * hence no launch template to update
217 217
*/
218 218
void updateImageForReplicaSets(String regionId,
219 219
ArrayList<SailingApplicationReplicaSetDTO<String>> applicationReplicaSetsToUpdate,
java/com.sap.sailing.landscape.ui/src/com/sap/sailing/landscape/ui/server/LandscapeManagementWriteServiceImpl.java
... ...
@@ -678,7 +678,7 @@ public class LandscapeManagementWriteServiceImpl extends ResultCachingProxiedRem
678 678
* Starts a first master process of a new replica set whose name is provided by the {@code replicaSetName}
679 679
* parameter. The process is started on the host identified by the {@code hostToDeployTo} parameter. A set of
680 680
* available ports is identified and chosen automatically. The target groups and load balancing set-up is created.
681
- * The {@code replicaInstanceType} is used to configure the launch configuration used by the auto-scaling group
681
+ * The {@code replicaInstanceType} is used to configure the launch template used by the auto-scaling group
682 682
* which is also created so that when dedicated replicas need to be provided during auto-scaling, their instance
683 683
* type is known.
684 684
* <p>
java/com.sap.sailing.landscape/src/com/sap/sailing/landscape/LandscapeService.java
... ...
@@ -151,7 +151,7 @@ public interface LandscapeService {
151 151
* Starts a first master process of a new replica set whose name is provided by the {@code replicaSetName}
152 152
* parameter. The process is started on the host identified by the {@code hostToDeployTo} parameter. A set of
153 153
* available ports is identified and chosen automatically. The target groups and load balancing set-up is created.
154
- * The {@code replicaInstanceType} is used to configure the launch configuration used by the auto-scaling group
154
+ * The {@code replicaInstanceType} is used to configure the launch template used by the auto-scaling group
155 155
* which is also created so that when dedicated replicas need to be provided during auto-scaling, their instance
156 156
* type is known. The choice of {@code dynamicLoadBalancerMapping} must only be set if the host to deploy to lives
157 157
* in the default region; otherwise, the DNS wildcard record for the overall domain would be made point to a wrong
... ...
@@ -218,10 +218,9 @@ public interface LandscapeService {
218 218
* until the replica has reached its healthy state. The replica is then registered in the public target group.<p>
219 219
*
220 220
* Then, the {@code ./refreshInstance.sh install-release <release>} command is sent to the master which will
221
- * download and unpack the new release but will not yet stop the master process. In parallel, an existing
222
- * launch configuration will be copied and updated with user data reflecting the new release to be used.
223
- * An existing auto-scaling group will then be updated to use the new launch configuration. The old launch
224
- * configuration will then be removed.<p>
221
+ * download and unpack the new release but will not yet stop the master process. In parallel, the existing
222
+ * default launch template version will be copied and updated with user data reflecting the new release to be used.
223
+ * The existing auto-scaling group will then use the new default launch template version.<p>
225 224
*
226 225
* Replication is then stopped for all existing replicas, then the master is de-registered from the master
227 226
* target group and the public target group, effectively making the replica set "read-only." Then, the {@code ./stop}
... ...
@@ -304,7 +303,7 @@ public interface LandscapeService {
304 303
byte[] privateKeyEncryptionPassphrase) throws Exception;
305 304
306 305
/**
307
- * Updates the AMI to use in the launch configurations of those of the {@code replicaSets} that have an auto-scaling group.
306
+ * Updates the AMI to use in the launch template version of those of the {@code replicaSets} that have an auto-scaling group.
308 307
* Any running replica will not be affected by this. Only new replicas will be launched based on the AMI specified.
309 308
*
310 309
* @param replicaSets
... ...
@@ -313,7 +312,7 @@ public interface LandscapeService {
313 312
* defaults to the latest image of type {@link SharedLandscapeConstants#IMAGE_TYPE_TAG_VALUE_SAILING}
314 313
* @return those replica sets that were updated according to this request; those from {@code replicaSets} not part
315 314
* of this result have not had their AMI upgraded, probably because we didn't find an auto-scaling group and
316
- * hence no launch configuration to update
315
+ * hence no launch template version to update
317 316
*/
318 317
Iterable<AwsApplicationReplicaSet<String, SailingAnalyticsMetrics, SailingAnalyticsProcess<String>>> updateImageForReplicaSets(AwsRegion region,
319 318
Iterable<AwsApplicationReplicaSet<String, SailingAnalyticsMetrics, SailingAnalyticsProcess<String>>> replicaSets,
... ...
@@ -399,14 +398,14 @@ public interface LandscapeService {
399 398
InterruptedException, ExecutionException, Exception;
400 399
401 400
/**
402
- * If the {@code replicaSet} provided has one or more auto-scaling groups, their launch configuration is adjusted such that it
403
- * matches the {@code optionalInstanceType}. The existing replicas managed currently by the auto-scaling group are
404
- * replaced one by one with new instances with the new configuration. This happens by setting the auto-scaling
405
- * group's new minimum size to the current number of instances managed by the auto-scaling group plus one, then
406
- * waiting for the new instance to become available, and then terminating one of the old auto-scaling group managed
407
- * replicas, again waiting for the one next new replica to become ready, and so on, until the last old auto-scaling
408
- * replica has been stopped/terminated. Then, the auto-scaling group's minimum size is reset to what it was when
409
- * this method was called.
401
+ * If the {@code replicaSet} provided has one or more auto-scaling groups, their default launch template version is
402
+ * adjusted such that it matches the {@code optionalInstanceType}. The existing replicas managed currently by the
403
+ * auto-scaling group are replaced one by one with new instances with the new configuration. This happens by setting
404
+ * the auto-scaling group's new minimum size to the current number of instances managed by the auto-scaling group
405
+ * plus one, then waiting for the new instance to become available, and then terminating one of the old auto-scaling
406
+ * group managed replicas, again waiting for the one next new replica to become ready, and so on, until the last old
407
+ * auto-scaling replica has been stopped/terminated. Then, the auto-scaling group's minimum size is reset to what it
408
+ * was when this method was called.
410 409
*/
411 410
AwsApplicationReplicaSet<String, SailingAnalyticsMetrics, SailingAnalyticsProcess<String>> changeAutoScalingReplicasInstanceType(
412 411
AwsApplicationReplicaSet<String, SailingAnalyticsMetrics, SailingAnalyticsProcess<String>> replicaSet,
java/com.sap.sailing.landscape/src/com/sap/sailing/landscape/impl/LandscapeServiceImpl.java
... ...
@@ -42,7 +42,7 @@ import com.sap.sailing.landscape.SailingAnalyticsProcess;
42 42
import com.sap.sailing.landscape.SailingReleaseRepository;
43 43
import com.sap.sailing.landscape.common.RemoteServiceMappingConstants;
44 44
import com.sap.sailing.landscape.common.SharedLandscapeConstants;
45
-import com.sap.sailing.landscape.procedures.CreateLaunchConfigurationAndAutoScalingGroup;
45
+import com.sap.sailing.landscape.procedures.CreateLaunchTemplateAndAutoScalingGroup;
46 46
import com.sap.sailing.landscape.procedures.DeployProcessOnMultiServer;
47 47
import com.sap.sailing.landscape.procedures.SailingAnalyticsHostSupplier;
48 48
import com.sap.sailing.landscape.procedures.SailingAnalyticsMasterConfiguration;
... ...
@@ -289,7 +289,7 @@ public class LandscapeServiceImpl implements LandscapeService {
289 289
* Starts a first master process of a new replica set whose name is provided by the {@code replicaSetName}
290 290
* parameter. The process is started on the host identified by the {@code hostToDeployTo} parameter. A set of
291 291
* available ports is identified and chosen automatically. The target groups and load balancing set-up is created.
292
- * The {@code replicaInstanceType} is used to configure the launch configuration used by the auto-scaling group
292
+ * The {@code replicaInstanceType} is used to configure the launch template used by the auto-scaling group
293 293
* which is also created so that when dedicated replicas need to be provided during auto-scaling, their instance
294 294
* type is known.
295 295
* <p>
... ...
@@ -939,35 +939,35 @@ public class LandscapeServiceImpl implements LandscapeService {
939 939
.setLandscape(landscape)
940 940
.build();
941 941
createLoadBalancerMapping.run();
942
- // construct a replica configuration which is used to produce the user data for the launch configuration used in an auto-scaling group
942
+ // construct a replica configuration which is used to produce the user data for the launch template used in an auto-scaling group
943 943
final Builder<?, String> replicaConfigurationBuilder = createReplicaConfigurationBuilder(region, replicaSetName, master.getPort(), release, bearerTokenUsedByReplicas, masterHostname);
944 944
// Now wait for master to become healthy before creating auto-scaling; otherwise it may happen that the replica tried to start
945 945
// replication before the master is ready (see also bug 5527).
946 946
master.waitUntilReady(Landscape.WAIT_FOR_HOST_TIMEOUT);
947
- final CreateLaunchConfigurationAndAutoScalingGroup.Builder<String, ?, SailingAnalyticsMetrics, SailingAnalyticsProcess<String>> createLaunchConfigurationAndAutoScalingGroupBuilder =
948
- CreateLaunchConfigurationAndAutoScalingGroup.builder(landscape, region, replicaSetName, createLoadBalancerMapping.getPublicTargetGroup());
949
- createLaunchConfigurationAndAutoScalingGroupBuilder
947
+ final CreateLaunchTemplateAndAutoScalingGroup.Builder<String, ?, SailingAnalyticsMetrics, SailingAnalyticsProcess<String>> createLaunchTemplateAndAutoScalingGroupBuilder =
948
+ CreateLaunchTemplateAndAutoScalingGroup.builder(landscape, region, replicaSetName, createLoadBalancerMapping.getPublicTargetGroup());
949
+ createLaunchTemplateAndAutoScalingGroupBuilder
950 950
.setInstanceType(InstanceType.valueOf(replicaInstanceType))
951 951
.setTags(Tags.with(StartAwsHost.NAME_TAG_NAME, StartSailingAnalyticsHost.INSTANCE_NAME_DEFAULT_PREFIX+replicaSetName+" (Auto-Replica)")
952 952
.and(SharedLandscapeConstants.SAILING_ANALYTICS_APPLICATION_HOST_TAG, replicaSetName))
953 953
.setOptionalTimeout(Landscape.WAIT_FOR_HOST_TIMEOUT)
954 954
.setReplicaConfiguration(replicaConfigurationBuilder.build()); // use the default scaling parameters (currently 1/30/30000)
955
- minimumNumberOfReplicas.ifPresent(minNumberOfReplicas->createLaunchConfigurationAndAutoScalingGroupBuilder.setMinReplicas(minNumberOfReplicas));
956
- maximumNumberOfReplicas.ifPresent(maxNumberOfReplicas->createLaunchConfigurationAndAutoScalingGroupBuilder.setMaxReplicas(maxNumberOfReplicas));
955
+ minimumNumberOfReplicas.ifPresent(minNumberOfReplicas->createLaunchTemplateAndAutoScalingGroupBuilder.setMinReplicas(minNumberOfReplicas));
956
+ maximumNumberOfReplicas.ifPresent(maxNumberOfReplicas->createLaunchTemplateAndAutoScalingGroupBuilder.setMaxReplicas(maxNumberOfReplicas));
957 957
if (replicaMachineImage.isPresent()) {
958
- createLaunchConfigurationAndAutoScalingGroupBuilder.setImage(replicaMachineImage.get());
958
+ createLaunchTemplateAndAutoScalingGroupBuilder.setImage(replicaMachineImage.get());
959 959
} else {
960 960
// obtain the latest AMI for launching a Sailing Analytics replica host:
961
- createLaunchConfigurationAndAutoScalingGroupBuilder.setImage(
961
+ createLaunchTemplateAndAutoScalingGroupBuilder.setImage(
962 962
StartSailingAnalyticsReplicaHost.replicaHostBuilder(replicaConfigurationBuilder)
963 963
.setLandscape(getLandscape())
964 964
.setRegion(region)
965 965
.getMachineImage());
966 966
}
967 967
if (optionalKeyName != null) {
968
- createLaunchConfigurationAndAutoScalingGroupBuilder.setKeyName(optionalKeyName);
968
+ createLaunchTemplateAndAutoScalingGroupBuilder.setKeyName(optionalKeyName);
969 969
}
970
- createLaunchConfigurationAndAutoScalingGroupBuilder.build().run();
970
+ createLaunchTemplateAndAutoScalingGroupBuilder.build().run();
971 971
final CompletableFuture<Iterable<ApplicationLoadBalancer<String>>> allLoadBalancersInRegion = landscape.getLoadBalancersAsync(region);
972 972
final CompletableFuture<Map<TargetGroup<String>, Iterable<TargetHealthDescription>>> allTargetGroupsInRegion = landscape.getTargetGroupsAsync(region);
973 973
final CompletableFuture<Map<Listener, Iterable<Rule>>> allLoadBalancerRulesInRegion = landscape.getLoadBalancerListenerRulesAsync(region, allLoadBalancersInRegion);
... ...
@@ -1690,7 +1690,7 @@ public class LandscapeServiceImpl implements LandscapeService {
1690 1690
Util.filter(newSetOfAllReplicas, r->!Util.contains(terminatedReplicas, r)));
1691 1691
} else {
1692 1692
logger.info("Replica set "+replicaSet.getName()+
1693
- " does not have an auto-scaling group configured, so no changes can be made to its launch configuration.");
1693
+ " does not have an auto-scaling group configured, so no changes can be made to its launch template.");
1694 1694
result = replicaSet;
1695 1695
}
1696 1696
return result;
java/com.sap.sailing.landscape/src/com/sap/sailing/landscape/procedures/CreateLaunchConfigurationAndAutoScalingGroup.java
... ...
@@ -1,242 +0,0 @@
1
-package com.sap.sailing.landscape.procedures;
2
-
3
-import java.util.Optional;
4
-
5
-import com.sap.sse.landscape.Region;
6
-import com.sap.sse.landscape.Release;
7
-import com.sap.sse.landscape.application.ApplicationProcessMetrics;
8
-import com.sap.sse.landscape.application.ApplicationReplicaSet;
9
-import com.sap.sse.landscape.aws.AmazonMachineImage;
10
-import com.sap.sse.landscape.aws.AwsApplicationProcess;
11
-import com.sap.sse.landscape.aws.AwsAutoScalingGroup;
12
-import com.sap.sse.landscape.aws.AwsLandscape;
13
-import com.sap.sse.landscape.aws.Tags;
14
-import com.sap.sse.landscape.aws.TargetGroup;
15
-import com.sap.sse.landscape.aws.orchestration.AwsApplicationConfiguration;
16
-import com.sap.sse.landscape.orchestration.AbstractProcedureImpl;
17
-import com.sap.sse.landscape.orchestration.Procedure;
18
-
19
-import software.amazon.awssdk.services.ec2.model.InstanceType;
20
-
21
-/**
22
- * For an {@link ApplicationReplicaSet} and a {@link TargetGroup} that represents the application replica set's public
23
- * target group creates an AWS EC2 Launch Configuration and a corresponding Auto-Scaling Group which by default produces
24
- * a minimum of one replica, a maximum of 30 replicas, scaling based on the number of requests per target which are
25
- * supposed to not exceed 15,000 per minute. An {@link AwsApplicationConfiguration} for the replica's config must be
26
- * provided and is expected to use the same {@link Release} as the master.
27
- * <p>
28
- *
29
- * The builder for the procedure requires the bearer token for replication permissions and the target group. Other
30
- * properties are optional.
31
- *
32
- * @author Axel Uhl (D043530)
33
- *
34
- * @param <ShardingKey>
35
- */
36
-public class CreateLaunchConfigurationAndAutoScalingGroup<ShardingKey, MetricsT extends ApplicationProcessMetrics, ProcessT extends AwsApplicationProcess<ShardingKey,MetricsT,ProcessT>>
37
-extends AbstractProcedureImpl<ShardingKey>
38
-implements Procedure<ShardingKey> {
39
- private static final int DEFAULT_MIN_REPLICAS = 1;
40
- private static final int DEFAULT_MAX_REPLICAS = 30;
41
-
42
- /**
43
- *
44
- * @author Axel Uhl (D043530)
45
- */
46
- public static interface Builder<ShardingKey, BuilderT extends Builder<ShardingKey, BuilderT, MetricsT, ProcessT>, MetricsT extends ApplicationProcessMetrics, ProcessT extends AwsApplicationProcess<ShardingKey,MetricsT,ProcessT>>
47
- extends com.sap.sse.landscape.orchestration.Procedure.Builder<BuilderT, CreateLaunchConfigurationAndAutoScalingGroup<ShardingKey, MetricsT, ProcessT>, ShardingKey> {
48
- BuilderT setKeyName(String keyName);
49
-
50
- BuilderT setReplicaConfiguration(AwsApplicationConfiguration<ShardingKey, MetricsT, ProcessT> applicationConfiguration);
51
-
52
- BuilderT setInstanceType(InstanceType instanceType);
53
-
54
- BuilderT setImage(AmazonMachineImage<ShardingKey> image);
55
-
56
- BuilderT setTags(Tags tags);
57
-
58
- /**
59
- * Set the minimum number of replicas. Defaults to 1 (see {@link CreateLaunchConfigurationAndAutoScalingGroup#DEFAULT_MIN_REPLICAS}).
60
- */
61
- BuilderT setMinReplicas(int minReplicas);
62
-
63
- /**
64
- * Set the maximum number of replicas. Defaults to 30 (see {@link CreateLaunchConfigurationAndAutoScalingGroup#DEFAULT_MAX_REPLICAS}).
65
- */
66
- BuilderT setMaxReplicas(int maxReplicas);
67
-
68
- /**
69
- * Defines the scaling threshold based on the number of requests per target per minute. Defaults to 15,000 (see
70
- * {@link AwsAutoScalingGroup#DEFAULT_MAX_REQUESTS_PER_TARGET}).
71
- */
72
- BuilderT setMaxRequestsPerTarget(int maxRequestsPerTarget);
73
- }
74
-
75
- protected static class BuilderImpl<ShardingKey, BuilderT extends Builder<ShardingKey, BuilderT, MetricsT, ProcessT>, MetricsT extends ApplicationProcessMetrics, ProcessT extends AwsApplicationProcess<ShardingKey,MetricsT,ProcessT>>
76
- extends AbstractProcedureImpl.BuilderImpl<BuilderT, CreateLaunchConfigurationAndAutoScalingGroup<ShardingKey, MetricsT, ProcessT>, ShardingKey>
77
- implements Builder<ShardingKey, BuilderT, MetricsT, ProcessT> {
78
- private final String replicaSetName;
79
- private final TargetGroup<ShardingKey> targetGroup;
80
- private final Region region;
81
- private String keyName;
82
- private AmazonMachineImage<ShardingKey> image;
83
- private InstanceType instanceType;
84
- private AwsApplicationConfiguration<ShardingKey, MetricsT, ProcessT> replicaConfiguration;
85
- private Optional<Tags> tags;
86
- private int minReplicas = DEFAULT_MIN_REPLICAS;
87
- private int maxReplicas = DEFAULT_MAX_REPLICAS;
88
- private int maxRequestsPerTarget = AwsAutoScalingGroup.DEFAULT_MAX_REQUESTS_PER_TARGET;
89
-
90
- public BuilderImpl(AwsLandscape<ShardingKey> landscape, Region region, String replicaSetName,
91
- TargetGroup<ShardingKey> targetGroup) {
92
- this.replicaSetName = replicaSetName;
93
- this.targetGroup = targetGroup;
94
- this.region = region;
95
- setLandscape(landscape);
96
- }
97
-
98
- @Override
99
- public BuilderT setKeyName(String keyName) {
100
- this.keyName = keyName;
101
- return self();
102
- }
103
-
104
- @Override
105
- public BuilderT setImage(AmazonMachineImage<ShardingKey> image) {
106
- this.image = image;
107
- return self();
108
- }
109
-
110
- @Override
111
- public BuilderT setInstanceType(InstanceType instanceType) {
112
- this.instanceType = instanceType;
113
- return self();
114
- }
115
-
116
- @Override
117
- public BuilderT setReplicaConfiguration(AwsApplicationConfiguration<ShardingKey, MetricsT, ProcessT> replicaConfiguration) {
118
- this.replicaConfiguration = replicaConfiguration;
119
- return self();
120
- }
121
-
122
- protected String getReplicaSetName() {
123
- return replicaSetName;
124
- }
125
-
126
- protected int getMinReplicas() {
127
- return minReplicas;
128
- }
129
-
130
- @Override
131
- public BuilderT setMinReplicas(int minReplicas) {
132
- this.minReplicas = minReplicas;
133
- return self();
134
- }
135
-
136
- protected int getMaxReplicas() {
137
- return maxReplicas;
138
- }
139
-
140
- @Override
141
- public BuilderT setMaxReplicas(int maxReplicas) {
142
- this.maxReplicas = maxReplicas;
143
- return self();
144
- }
145
-
146
- protected int getMaxRequestsPerTarget() {
147
- return maxRequestsPerTarget;
148
- }
149
-
150
- @Override
151
- public BuilderT setMaxRequestsPerTarget(int maxRequestsPerTarget) {
152
- this.maxRequestsPerTarget = maxRequestsPerTarget;
153
- return self();
154
- }
155
-
156
- protected TargetGroup<ShardingKey> getTargetGroup() {
157
- return targetGroup;
158
- }
159
-
160
- protected Region getRegion() {
161
- return region;
162
- }
163
-
164
- protected String getKeyName() {
165
- return keyName;
166
- }
167
-
168
- protected AmazonMachineImage<ShardingKey> getImage() {
169
- return image;
170
- }
171
-
172
- protected InstanceType getInstanceType() {
173
- return instanceType;
174
- }
175
-
176
- protected AwsApplicationConfiguration<ShardingKey, MetricsT, ProcessT> getReplicaConfiguration() {
177
- return replicaConfiguration;
178
- }
179
-
180
- protected Optional<Tags> getTags() {
181
- return tags;
182
- }
183
-
184
- @Override
185
- public BuilderT setTags(Tags tags) {
186
- this.tags = Optional.ofNullable(tags);
187
- return self();
188
- }
189
-
190
- @Override
191
- public CreateLaunchConfigurationAndAutoScalingGroup<ShardingKey, MetricsT, ProcessT> build() throws Exception {
192
- return new CreateLaunchConfigurationAndAutoScalingGroup<>(this);
193
- }
194
- }
195
-
196
- private final String replicaSetName;
197
- private final TargetGroup<ShardingKey> targetGroup;
198
- private final Region region;
199
- private final String keyName;
200
- private final InstanceType instanceType;
201
- private final String imageId;
202
- private final AwsApplicationConfiguration<ShardingKey, MetricsT, ProcessT> replicaConfiguration;
203
- private final Optional<Tags> tags;
204
- private final int minReplicas;
205
- private final int maxReplicas;
206
- private final int maxRequestsPerTarget;
207
-
208
- public static <ShardingKey, BuilderT extends Builder<ShardingKey, BuilderT, MetricsT, ProcessT>, MetricsT extends ApplicationProcessMetrics, ProcessT extends AwsApplicationProcess<ShardingKey,MetricsT,ProcessT>>
209
- Builder<ShardingKey, BuilderT, MetricsT, ProcessT> builder(
210
- AwsLandscape<ShardingKey> landscape, Region region,
211
- String replicaSetName,
212
- TargetGroup<ShardingKey> targetGroup) {
213
- return new BuilderImpl<>(landscape, region, replicaSetName, targetGroup);
214
- }
215
-
216
- protected <BuilderT extends Builder<ShardingKey, BuilderT, MetricsT, ProcessT>>
217
- CreateLaunchConfigurationAndAutoScalingGroup(BuilderImpl<ShardingKey, BuilderT, MetricsT, ProcessT> builder) {
218
- super(builder);
219
- this.region = builder.getRegion();
220
- this.replicaSetName = builder.getReplicaSetName();
221
- this.targetGroup = builder.getTargetGroup();
222
- this.keyName = builder.getKeyName();
223
- this.imageId = builder.getImage().getId();
224
- this.instanceType = builder.getInstanceType();
225
- this.replicaConfiguration = builder.getReplicaConfiguration();
226
- this.tags = builder.getTags();
227
- this.minReplicas = builder.getMinReplicas();
228
- this.maxReplicas = builder.getMaxReplicas();
229
- this.maxRequestsPerTarget = builder.getMaxRequestsPerTarget();
230
- }
231
-
232
- @Override
233
- public AwsLandscape<ShardingKey> getLandscape() {
234
- return (AwsLandscape<ShardingKey>) super.getLandscape();
235
- }
236
-
237
- @Override
238
- public void run() throws Exception {
239
- getLandscape().createLaunchTemplateAndAutoScalingGroup(region, replicaSetName, tags,
240
- targetGroup, keyName, instanceType, imageId, replicaConfiguration, minReplicas, maxReplicas, maxRequestsPerTarget);
241
- }
242
-}
java/com.sap.sailing.landscape/src/com/sap/sailing/landscape/procedures/CreateLaunchTemplateAndAutoScalingGroup.java
... ...
@@ -0,0 +1,242 @@
1
+package com.sap.sailing.landscape.procedures;
2
+
3
+import java.util.Optional;
4
+
5
+import com.sap.sse.landscape.Region;
6
+import com.sap.sse.landscape.Release;
7
+import com.sap.sse.landscape.application.ApplicationProcessMetrics;
8
+import com.sap.sse.landscape.application.ApplicationReplicaSet;
9
+import com.sap.sse.landscape.aws.AmazonMachineImage;
10
+import com.sap.sse.landscape.aws.AwsApplicationProcess;
11
+import com.sap.sse.landscape.aws.AwsAutoScalingGroup;
12
+import com.sap.sse.landscape.aws.AwsLandscape;
13
+import com.sap.sse.landscape.aws.Tags;
14
+import com.sap.sse.landscape.aws.TargetGroup;
15
+import com.sap.sse.landscape.aws.orchestration.AwsApplicationConfiguration;
16
+import com.sap.sse.landscape.orchestration.AbstractProcedureImpl;
17
+import com.sap.sse.landscape.orchestration.Procedure;
18
+
19
+import software.amazon.awssdk.services.ec2.model.InstanceType;
20
+
21
+/**
22
+ * For an {@link ApplicationReplicaSet} and a {@link TargetGroup} that represents the application replica set's public
23
+ * target group creates an AWS EC2 Launch Configuration and a corresponding Auto-Scaling Group which by default produces
24
+ * a minimum of one replica, a maximum of 30 replicas, scaling based on the number of requests per target which are
25
+ * supposed to not exceed 15,000 per minute. An {@link AwsApplicationConfiguration} for the replica's config must be
26
+ * provided and is expected to use the same {@link Release} as the master.
27
+ * <p>
28
+ *
29
+ * The builder for the procedure requires the bearer token for replication permissions and the target group. Other
30
+ * properties are optional.
31
+ *
32
+ * @author Axel Uhl (D043530)
33
+ *
34
+ * @param <ShardingKey>
35
+ */
36
+public class CreateLaunchTemplateAndAutoScalingGroup<ShardingKey, MetricsT extends ApplicationProcessMetrics, ProcessT extends AwsApplicationProcess<ShardingKey,MetricsT,ProcessT>>
37
+extends AbstractProcedureImpl<ShardingKey>
38
+implements Procedure<ShardingKey> {
39
+ private static final int DEFAULT_MIN_REPLICAS = 1;
40
+ private static final int DEFAULT_MAX_REPLICAS = 30;
41
+
42
+ /**
43
+ *
44
+ * @author Axel Uhl (D043530)
45
+ */
46
+ public static interface Builder<ShardingKey, BuilderT extends Builder<ShardingKey, BuilderT, MetricsT, ProcessT>, MetricsT extends ApplicationProcessMetrics, ProcessT extends AwsApplicationProcess<ShardingKey,MetricsT,ProcessT>>
47
+ extends com.sap.sse.landscape.orchestration.Procedure.Builder<BuilderT, CreateLaunchTemplateAndAutoScalingGroup<ShardingKey, MetricsT, ProcessT>, ShardingKey> {
48
+ BuilderT setKeyName(String keyName);
49
+
50
+ BuilderT setReplicaConfiguration(AwsApplicationConfiguration<ShardingKey, MetricsT, ProcessT> applicationConfiguration);
51
+
52
+ BuilderT setInstanceType(InstanceType instanceType);
53
+
54
+ BuilderT setImage(AmazonMachineImage<ShardingKey> image);
55
+
56
+ BuilderT setTags(Tags tags);
57
+
58
+ /**
59
+ * Set the minimum number of replicas. Defaults to 1 (see {@link CreateLaunchTemplateAndAutoScalingGroup#DEFAULT_MIN_REPLICAS}).
60
+ */
61
+ BuilderT setMinReplicas(int minReplicas);
62
+
63
+ /**
64
+ * Set the maximum number of replicas. Defaults to 30 (see {@link CreateLaunchTemplateAndAutoScalingGroup#DEFAULT_MAX_REPLICAS}).
65
+ */
66
+ BuilderT setMaxReplicas(int maxReplicas);
67
+
68
+ /**
69
+ * Defines the scaling threshold based on the number of requests per target per minute. Defaults to 15,000 (see
70
+ * {@link AwsAutoScalingGroup#DEFAULT_MAX_REQUESTS_PER_TARGET}).
71
+ */
72
+ BuilderT setMaxRequestsPerTarget(int maxRequestsPerTarget);
73
+ }
74
+
75
+ protected static class BuilderImpl<ShardingKey, BuilderT extends Builder<ShardingKey, BuilderT, MetricsT, ProcessT>, MetricsT extends ApplicationProcessMetrics, ProcessT extends AwsApplicationProcess<ShardingKey,MetricsT,ProcessT>>
76
+ extends AbstractProcedureImpl.BuilderImpl<BuilderT, CreateLaunchTemplateAndAutoScalingGroup<ShardingKey, MetricsT, ProcessT>, ShardingKey>
77
+ implements Builder<ShardingKey, BuilderT, MetricsT, ProcessT> {
78
+ private final String replicaSetName;
79
+ private final TargetGroup<ShardingKey> targetGroup;
80
+ private final Region region;
81
+ private String keyName;
82
+ private AmazonMachineImage<ShardingKey> image;
83
+ private InstanceType instanceType;
84
+ private AwsApplicationConfiguration<ShardingKey, MetricsT, ProcessT> replicaConfiguration;
85
+ private Optional<Tags> tags;
86
+ private int minReplicas = DEFAULT_MIN_REPLICAS;
87
+ private int maxReplicas = DEFAULT_MAX_REPLICAS;
88
+ private int maxRequestsPerTarget = AwsAutoScalingGroup.DEFAULT_MAX_REQUESTS_PER_TARGET;
89
+
90
+ public BuilderImpl(AwsLandscape<ShardingKey> landscape, Region region, String replicaSetName,
91
+ TargetGroup<ShardingKey> targetGroup) {
92
+ this.replicaSetName = replicaSetName;
93
+ this.targetGroup = targetGroup;
94
+ this.region = region;
95
+ setLandscape(landscape);
96
+ }
97
+
98
+ @Override
99
+ public BuilderT setKeyName(String keyName) {
100
+ this.keyName = keyName;
101
+ return self();
102
+ }
103
+
104
+ @Override
105
+ public BuilderT setImage(AmazonMachineImage<ShardingKey> image) {
106
+ this.image = image;
107
+ return self();
108
+ }
109
+
110
+ @Override
111
+ public BuilderT setInstanceType(InstanceType instanceType) {
112
+ this.instanceType = instanceType;
113
+ return self();
114
+ }
115
+
116
+ @Override
117
+ public BuilderT setReplicaConfiguration(AwsApplicationConfiguration<ShardingKey, MetricsT, ProcessT> replicaConfiguration) {
118
+ this.replicaConfiguration = replicaConfiguration;
119
+ return self();
120
+ }
121
+
122
+ protected String getReplicaSetName() {
123
+ return replicaSetName;
124
+ }
125
+
126
+ protected int getMinReplicas() {
127
+ return minReplicas;
128
+ }
129
+
130
+ @Override
131
+ public BuilderT setMinReplicas(int minReplicas) {
132
+ this.minReplicas = minReplicas;
133
+ return self();
134
+ }
135
+
136
+ protected int getMaxReplicas() {
137
+ return maxReplicas;
138
+ }
139
+
140
+ @Override
141
+ public BuilderT setMaxReplicas(int maxReplicas) {
142
+ this.maxReplicas = maxReplicas;
143
+ return self();
144
+ }
145
+
146
+ protected int getMaxRequestsPerTarget() {
147
+ return maxRequestsPerTarget;
148
+ }
149
+
150
+ @Override
151
+ public BuilderT setMaxRequestsPerTarget(int maxRequestsPerTarget) {
152
+ this.maxRequestsPerTarget = maxRequestsPerTarget;
153
+ return self();
154
+ }
155
+
156
+ protected TargetGroup<ShardingKey> getTargetGroup() {
157
+ return targetGroup;
158
+ }
159
+
160
+ protected Region getRegion() {
161
+ return region;
162
+ }
163
+
164
+ protected String getKeyName() {
165
+ return keyName;
166
+ }
167
+
168
+ protected AmazonMachineImage<ShardingKey> getImage() {
169
+ return image;
170
+ }
171
+
172
+ protected InstanceType getInstanceType() {
173
+ return instanceType;
174
+ }
175
+
176
+ protected AwsApplicationConfiguration<ShardingKey, MetricsT, ProcessT> getReplicaConfiguration() {
177
+ return replicaConfiguration;
178
+ }
179
+
180
+ protected Optional<Tags> getTags() {
181
+ return tags;
182
+ }
183
+
184
+ @Override
185
+ public BuilderT setTags(Tags tags) {
186
+ this.tags = Optional.ofNullable(tags);
187
+ return self();
188
+ }
189
+
190
+ @Override
191
+ public CreateLaunchTemplateAndAutoScalingGroup<ShardingKey, MetricsT, ProcessT> build() throws Exception {
192
+ return new CreateLaunchTemplateAndAutoScalingGroup<>(this);
193
+ }
194
+ }
195
+
196
+ private final String replicaSetName;
197
+ private final TargetGroup<ShardingKey> targetGroup;
198
+ private final Region region;
199
+ private final String keyName;
200
+ private final InstanceType instanceType;
201
+ private final String imageId;
202
+ private final AwsApplicationConfiguration<ShardingKey, MetricsT, ProcessT> replicaConfiguration;
203
+ private final Optional<Tags> tags;
204
+ private final int minReplicas;
205
+ private final int maxReplicas;
206
+ private final int maxRequestsPerTarget;
207
+
208
+ public static <ShardingKey, BuilderT extends Builder<ShardingKey, BuilderT, MetricsT, ProcessT>, MetricsT extends ApplicationProcessMetrics, ProcessT extends AwsApplicationProcess<ShardingKey,MetricsT,ProcessT>>
209
+ Builder<ShardingKey, BuilderT, MetricsT, ProcessT> builder(
210
+ AwsLandscape<ShardingKey> landscape, Region region,
211
+ String replicaSetName,
212
+ TargetGroup<ShardingKey> targetGroup) {
213
+ return new BuilderImpl<>(landscape, region, replicaSetName, targetGroup);
214
+ }
215
+
216
+ protected <BuilderT extends Builder<ShardingKey, BuilderT, MetricsT, ProcessT>>
217
+ CreateLaunchTemplateAndAutoScalingGroup(BuilderImpl<ShardingKey, BuilderT, MetricsT, ProcessT> builder) {
218
+ super(builder);
219
+ this.region = builder.getRegion();
220
+ this.replicaSetName = builder.getReplicaSetName();
221
+ this.targetGroup = builder.getTargetGroup();
222
+ this.keyName = builder.getKeyName();
223
+ this.imageId = builder.getImage().getId();
224
+ this.instanceType = builder.getInstanceType();
225
+ this.replicaConfiguration = builder.getReplicaConfiguration();
226
+ this.tags = builder.getTags();
227
+ this.minReplicas = builder.getMinReplicas();
228
+ this.maxReplicas = builder.getMaxReplicas();
229
+ this.maxRequestsPerTarget = builder.getMaxRequestsPerTarget();
230
+ }
231
+
232
+ @Override
233
+ public AwsLandscape<ShardingKey> getLandscape() {
234
+ return (AwsLandscape<ShardingKey>) super.getLandscape();
235
+ }
236
+
237
+ @Override
238
+ public void run() throws Exception {
239
+ getLandscape().createLaunchTemplateAndAutoScalingGroup(region, replicaSetName, tags,
240
+ targetGroup, keyName, instanceType, imageId, replicaConfiguration, minReplicas, maxReplicas, maxRequestsPerTarget);
241
+ }
242
+}
java/com.sap.sailing.www/release_notes_admin.html
... ...
@@ -346,7 +346,7 @@
346 346
up you can create and remove so-called "shards" to which you can assign zero or more leaderboards
347 347
offered by that replica set. Each shard gets its own auto-scaling group and target group in addition to the regular
348 348
auto-scaling group / target group pair used for the public target group. By default a minimum of two instances
349
- are required by each shard to ensure availability. They are created with the same launch configuration
349
+ are required by each shard to ensure availability. They are created with the same launch template
350 350
used by the replica set's regular public target group. When a shard's instances are healthy,
351 351
rules are managed in the replica set's load balancer to route traffic regarding the leaderboards
352 352
selected for the shard to the shard's target group. This reduces traffic on the default public
java/com.sap.sse.landscape.aws/src/com/sap/sse/landscape/aws/AwsAutoScalingGroup.java
... ...
@@ -9,7 +9,7 @@ import software.amazon.awssdk.services.ec2.model.LaunchTemplateVersion;
9 9
10 10
/**
11 11
* Wraps an {@link AutoScalingGroup} and offers convenience methods that are aware of the procedures
12
- * filling the launch configuration's user data, including aspects such as the release and the image
12
+ * filling the launch template's user data, including aspects such as the release and the image
13 13
* to use.
14 14
*
15 15
* @author Axel Uhl (D043530)
java/com.sap.sse.landscape.aws/src/com/sap/sse/landscape/aws/AwsLandscape.java
... ...
@@ -798,25 +798,22 @@ public interface AwsLandscape<ShardingKey> extends Landscape<ShardingKey> {
798 798
799 799
/**
800 800
* @param autoScalingGroups
801
- * {@link AwsApplicationReplicaSet#getAllAutoScalingGroups() All} auto-scaling groups of the replica set;
802
- * this is important because the method will eventually remove the old launch configuration used by those
803
- * auto-scaling groups, and this will fail if there is any other auto-scaling group still using it.
801
+ * The launch template version used by {@link AwsApplicationReplicaSet#getAllAutoScalingGroups() all}
802
+ * auto-scaling groups of the replica set is updated.
804 803
*/
805 804
void updateReleaseInAutoScalingGroups(Region region, LaunchTemplate oldLaunchTemplate, Iterable<AwsAutoScalingGroup> autoScalingGroups, String replicaSetName, Release release);
806 805
807 806
/**
808 807
* @param autoScalingGroups
809
- * {@link AwsApplicationReplicaSet#getAllAutoScalingGroups() All} auto-scaling groups of the replica set;
810
- * this is important because the method will eventually remove the old launch configuration used by those
811
- * auto-scaling groups, and this will fail if there is any other auto-scaling group still using it.
808
+ * The launch template version used by {@link AwsApplicationReplicaSet#getAllAutoScalingGroups() all}
809
+ * auto-scaling groups of the replica set is updated.
812 810
*/
813 811
void updateImageInAutoScalingGroups(Region region, Iterable<AwsAutoScalingGroup> autoScalingGroups, String replicaSetName, AmazonMachineImage<ShardingKey> ami);
814 812
815 813
/**
816 814
* @param autoScalingGroups
817
- * {@link AwsApplicationReplicaSet#getAllAutoScalingGroups() All} auto-scaling groups of the replica set;
818
- * this is important because the method will eventually remove the old launch configuration used by those
819
- * auto-scaling groups, and this will fail if there is any other auto-scaling group still using it.
815
+ * The launch template version used by {@link AwsApplicationReplicaSet#getAllAutoScalingGroups() all}
816
+ * auto-scaling groups of the replica set is updated.
820 817
*/
821 818
void updateInstanceTypeInAutoScalingGroup(Region region, Iterable<AwsAutoScalingGroup> autoScalingGroups, String replicaSetName, InstanceType instanceType);
822 819
java/com.sap.sse.landscape.aws/src/com/sap/sse/landscape/aws/LandscapeConstants.java
... ...
@@ -1,5 +1,6 @@
1 1
package com.sap.sse.landscape.aws;
2 2
3
+import software.amazon.awssdk.services.autoscaling.model.LaunchTemplateSpecification;
3 4
import software.amazon.awssdk.services.ec2.model.InstanceType;
4 5
5 6
public interface LandscapeConstants {
... ...
@@ -65,6 +66,12 @@ public interface LandscapeConstants {
65 66
* A tag key indicating that a subnet is not to be used for deploying instances, by autoscaling groups or by load balancers.
66 67
*/
67 68
String NO_INSTANCE_DEPLOYMENT = "noInstanceDeployment";
69
+
70
+ /**
71
+ * The version "number" to use for a launch template in an auto-scaling group to identify the
72
+ * "default" version. See, e.g., {@link LaunchTemplateSpecification#version()}.
73
+ */
74
+ String DEFAULT_LAUNCH_TEMPLATE_VERSION_NAME = "$Default";
68 75
69 76
InstanceType[] INSTANCE_TYPES_BANNED_FROM_INSTANCE_BASED_NLB_TARGET_GROUPS = new InstanceType[] { InstanceType.CC1_4_XLARGE, InstanceType.C1_MEDIUM, InstanceType.C1_XLARGE,
70 77
InstanceType.CC2_8_XLARGE, InstanceType.CG1_4_XLARGE, InstanceType.CR1_8_XLARGE, InstanceType.G2_2_XLARGE,
java/com.sap.sse.landscape.aws/src/com/sap/sse/landscape/aws/impl/AwsLandscapeImpl.java
... ...
@@ -1889,7 +1889,7 @@ public class AwsLandscapeImpl<ShardingKey> implements AwsLandscape<ShardingKey>
1889 1889
@Override
1890 1890
public CompletableFuture<Iterable<LaunchTemplateVersion>> getLaunchTemplateDefaultVersionsAsync(com.sap.sse.landscape.Region region) {
1891 1891
final Set<LaunchTemplateVersion> result = new HashSet<>();
1892
- return getEc2AsyncClient(getRegion(region)).describeLaunchTemplateVersionsPaginator(b->b.versions("$Default")).subscribe(response->
1892
+ return getEc2AsyncClient(getRegion(region)).describeLaunchTemplateVersionsPaginator(b->b.versions(LandscapeConstants.DEFAULT_LAUNCH_TEMPLATE_VERSION_NAME)).subscribe(response->
1893 1893
result.addAll(response.launchTemplateVersions())).handle((v, e)->Collections.unmodifiableCollection(result));
1894 1894
}
1895 1895
... ...
@@ -2021,7 +2021,7 @@ public class AwsLandscapeImpl<ShardingKey> implements AwsLandscape<ShardingKey>
2021 2021
final Ec2Client ec2Client = getEc2Client(getRegion(region));
2022 2022
final LaunchTemplateVersion oldLaunchTemplateVersion = ec2Client.describeLaunchTemplateVersions(b->b
2023 2023
.launchTemplateName(oldLaunchTemplate.launchTemplateName())
2024
- .versions("$Default")).launchTemplateVersions().iterator().next();
2024
+ .versions(LandscapeConstants.DEFAULT_LAUNCH_TEMPLATE_VERSION_NAME)).launchTemplateVersions().iterator().next();
2025 2025
final String oldUserData = new String(Base64.getDecoder().decode(oldLaunchTemplateVersion.launchTemplateData().userData().getBytes()));
2026 2026
final String newUserData = oldUserData.replaceFirst(
2027 2027
"(?m)^"+DefaultProcessConfigurationVariables.INSTALL_FROM_RELEASE.name()+"=(.*)$",
... ...
@@ -2031,7 +2031,7 @@ public class AwsLandscapeImpl<ShardingKey> implements AwsLandscape<ShardingKey>
2031 2031
}
2032 2032
2033 2033
private CreateLaunchTemplateVersionRequest.Builder copyLaunchTemplateVersionToCreateRequestBuilder(LaunchTemplate launchTemplateToCreateNewVersionFor, com.sap.sse.landscape.Region region) {
2034
- return CreateLaunchTemplateVersionRequest.builder().launchTemplateId(launchTemplateToCreateNewVersionFor.launchTemplateId()).sourceVersion("$Default");
2034
+ return CreateLaunchTemplateVersionRequest.builder().launchTemplateId(launchTemplateToCreateNewVersionFor.launchTemplateId()).sourceVersion(LandscapeConstants.DEFAULT_LAUNCH_TEMPLATE_VERSION_NAME);
2035 2035
}
2036 2036
2037 2037
@Override
... ...
@@ -2063,7 +2063,7 @@ public class AwsLandscapeImpl<ShardingKey> implements AwsLandscape<ShardingKey>
2063 2063
private void createUpdatedDefaultLaunchTemplateVersion(com.sap.sse.landscape.Region region, Iterable<AwsAutoScalingGroup> autoScalingGroups,
2064 2064
String newLaunchTemplateVersionDescription, Consumer<CreateLaunchTemplateVersionRequest.Builder> builderConsumer) {
2065 2065
if (Util.isEmpty(autoScalingGroups)) {
2066
- throw new IllegalArgumentException("At least one auto-scaling group must be provided for updating a launch configuration");
2066
+ throw new IllegalArgumentException("At least one auto-scaling group must be provided for updating a launch template");
2067 2067
}
2068 2068
logger.info("Creating a new, adjusted default launch template version for auto-scaling group(s) "+Util.join(", ", autoScalingGroups));
2069 2069
final LaunchTemplate launchTemplate = Util.first(autoScalingGroups).getLaunchTemplate();
... ...
@@ -2087,7 +2087,7 @@ public class AwsLandscapeImpl<ShardingKey> implements AwsLandscape<ShardingKey>
2087 2087
TargetGroup<ShardingKey> publicTargetGroup, String keyName, InstanceType instanceType,
2088 2088
String imageId, AwsApplicationConfiguration<ShardingKey, MetricsT, ProcessT> replicaConfiguration,
2089 2089
int minReplicas, int maxReplicas, int maxRequestsPerTarget) {
2090
- logger.info("Creating launch configuration for replica set "+replicaSetName);
2090
+ logger.info("Creating launch template for replica set "+replicaSetName);
2091 2091
final Region awsRegion = getRegion(region);
2092 2092
final Ec2Client ec2Client = getEc2Client(awsRegion);
2093 2093
final AutoScalingClient autoScalingClient = getAutoScalingClient(awsRegion);
... ...
@@ -2115,7 +2115,7 @@ public class AwsLandscapeImpl<ShardingKey> implements AwsLandscape<ShardingKey>
2115 2115
.targetGroupARNs(publicTargetGroup.getTargetGroupArn())
2116 2116
.launchTemplate(LaunchTemplateSpecification.builder()
2117 2117
.launchTemplateName(launchTemplateName)
2118
- .version("$Default").build());
2118
+ .version(LandscapeConstants.DEFAULT_LAUNCH_TEMPLATE_VERSION_NAME).build());
2119 2119
tags.ifPresent(t -> {
2120 2120
final List<software.amazon.awssdk.services.autoscaling.model.Tag> awsTags = new ArrayList<>();
2121 2121
for (final Entry<String, String> tag : t) {
... ...
@@ -2196,7 +2196,7 @@ public class AwsLandscapeImpl<ShardingKey> implements AwsLandscape<ShardingKey>
2196 2196
.autoScalingGroupName(autoScalingGroupName)
2197 2197
.availabilityZones(availabilityZones)
2198 2198
.targetGroupARNs(targetGroup.getTargetGroupArn())
2199
- .launchTemplate(ltb->ltb.launchTemplateId(launchTemplateId).version("$Default"));
2199
+ .launchTemplate(ltb->ltb.launchTemplateId(launchTemplateId).version(LandscapeConstants.DEFAULT_LAUNCH_TEMPLATE_VERSION_NAME));
2200 2200
final List<software.amazon.awssdk.services.autoscaling.model.Tag> awsTags = new ArrayList<>();
2201 2201
final List<software.amazon.awssdk.services.autoscaling.model.TagDescription> parentTags = autoScalingParent.getAutoScalingGroup().tags();
2202 2202
for (final software.amazon.awssdk.services.autoscaling.model.TagDescription parentTag : parentTags) {
wiki/info/landscape/amazon-ec2.md
... ...
@@ -172,7 +172,7 @@ With the exception of legacy, test and archive instances, regular application re
172 172
- five rules for the replica set are created in the load balancer's HTTPS listener, forwarding traffic as needed to the "master" and the "public" target groups
173 173
- for a DNS-mapped set-up (not using the default "dynamic" load balancer) a Route53 DNS CNAME record pointing to the ALB is created for the replica set's host name
174 174
- an auto-scaling group, named after the replica set with the suffix "-replicas" appended
175
-- a launch configuration used by the auto-scaling group, named after the replica set with the release name appended, separated by a dash (-), e.g., "abc-build-202202142355"
175
+- a launch template used by the auto-scaling group, named after the replica set with the release name appended, separated by a dash (-), e.g., "abc-build-202202142355"
176 176
- a master process, registered in both, the "master" and the "public" target groups
177 177
- a replica process, registered in the "public" target group
178 178
There are different standard deployment choices for the master and the replica process that will be described in the following sections.
... ...
@@ -390,7 +390,7 @@ This way, as an event starts to "cool down" and load decreases, the more expensi
390 390
391 391
### Scaling Replica Instances Up/Down
392 392
393
-When an application replica set's replica processes are provided by the auto-scaling group, the corresponding launch configuration specifies the instance type used for the dedicated instances used to host the replica processes. If this instance type turns out to be inadequate for the situation, e.g., because the event hosted in the application replica set produces more CPU load than expected or produces more tracking data than assumed, the instance type can be changed for the launch configuration, with a rolling update being performed for all replica instances managed by the auto-scaling group.
393
+When an application replica set's replica processes are provided by the auto-scaling group, the corresponding launch template specifies the instance type used for the dedicated instances used to host the replica processes. If this instance type turns out to be inadequate for the situation, e.g., because the event hosted in the application replica set produces more CPU load than expected or produces more tracking data than assumed, the instance type can be changed for the launch template, with a rolling update being performed for all replica instances managed by the auto-scaling group.
394 394
395 395
Click on the "Scale auto-scaling replicas up/down" action icon or the corresponding button in the button bar and select the new instance type.
396 396
... ...
@@ -406,7 +406,7 @@ Use the action icon entitled "Upgrade" or the corresponding multi-selection-enab
406 406
407 407
### Archiving Application Replica Set
408 408
409
-When the event or season or whatever you chose to assign an application replica set to has come to the end of its live workload with races and other updates no longer taking place, the application replica set is up for archiving. This will help save cost due to better resource utilization. The auto-scaling group, its launch configuration, its DNS record (unless the "dynamic" load balancing scenario in the default region eu-west-1 was used), its target groups and its load balancer listener rules can all be removed which frees up capacity for new or other live events. Furthermore, the processes can be stopped, freeing up memory and disk space on the instances they ran on, or even allowing for the termination of entire instances. Lastly, storage space in the ``live`` MongoDB replica set is more expensive than in the ``slow`` replica set that can be used for backup and archiving of DB content.
409
+When the event or season or whatever you chose to assign an application replica set to has come to the end of its live workload with races and other updates no longer taking place, the application replica set is up for archiving. This will help save cost due to better resource utilization. The auto-scaling group, its launch template, its DNS record (unless the "dynamic" load balancing scenario in the default region eu-west-1 was used), its target groups and its load balancer listener rules can all be removed which frees up capacity for new or other live events. Furthermore, the processes can be stopped, freeing up memory and disk space on the instances they ran on, or even allowing for the termination of entire instances. Lastly, storage space in the ``live`` MongoDB replica set is more expensive than in the ``slow`` replica set that can be used for backup and archiving of DB content.
410 410
411 411
To archive an application replica set, decide whether you want to move the MongoDB content away from the current (usually ``live``) replica set to free up space there. To do so, select any MongoDB endpoint from the "MongoDB Endpoints" table that you'd like to move the application replica set's database content to. If you want to keep it in the ``live`` environment, de-select all MongoDB endpoints in the table.
412 412
... ...
@@ -416,11 +416,11 @@ When confirmed, the archiving procedure will start by identifying the ``ARCHIVE`
416 416
417 417
After successful import and comparison, if you selected a MongoDB endpoint from the table then the MongoDB database used by the application replica set being archived will be copied to the MongoDB endpoint selected. After copying, the original and the copy will be compared by hashing their contents and comparing the hashes. Only if the two hashes are equal, the original database will be removed, freeing up the space in what usually would be the ``live`` MongoDB replica set.
418 418
419
-Finally, if you ticked the "Remove archive replica set after successful verification", the application replica set will be completely removed by stopping its master and replica processes, removing all its load balancer rules, removing its two target groups, removing the auto-scaling group and the corresponding launch configuration and, if a DNS-based load balancer was used, removing its DNS record.
419
+Finally, if you ticked the "Remove archive replica set after successful verification", the application replica set will be completely removed by stopping its master and replica processes, removing all its load balancer rules, removing its two target groups, removing the auto-scaling group and the corresponding launch template and, if a DNS-based load balancer was used, removing its DNS record.
420 420
421 421
### Removing Application Replica Set
422 422
423
-This action is really only useful for application replica sets that were created for development, testing or debugging purposes. While its MongoDB database is left untouched, all other resources pertinent to the application replica set will be removed, including its load balancing rules, target groups, auto-scaling group, launch configuration, application processes and potentially the instances they ran on in case the processes were the last on their instance, and the optional DNS record.
423
+This action is really only useful for application replica sets that were created for development, testing or debugging purposes. While its MongoDB database is left untouched, all other resources pertinent to the application replica set will be removed, including its load balancing rules, target groups, auto-scaling group, launch template, application processes and potentially the instances they ran on in case the processes were the last on their instance, and the optional DNS record.
424 424
425 425
Note that due to the database remaining in place, re-surrecting an application replica set removed this way is usually easy. If you use the "Add" button or the "+" action icon in case you'd like a shared master instance set-up, the application replica set launched will use the same database if it is launched with exactly the same name (case-sensitive).
426 426
... ...
@@ -434,9 +434,9 @@ You can then start testing or using the new image. It is recommended to keep the
434 434
435 435
#### Upgrading the Sailing Analytics Application AMI
436 436
437
-When upgrading the ``sailing-analytics-server`` AMI there is a good chance that the AMI you start with is used by one or more launch configurations that belong to auto-scaling groups and are used to launch new instances. Unfortunately, AWS doesn't keep you from removing old AMIs despite the fact that they are still referenced by one or more launch configurations that are in active use by their respective auto-scaling groups. So at some point you would want to upgrade those auto-scaling groups to use updated launch configurations which refer to the new AMI that results from the upgrade.
437
+When upgrading the ``sailing-analytics-server`` AMI there is a good chance that the AMI you start with is used by one or more launch templates that belong to auto-scaling groups and are used to launch new instances. Unfortunately, AWS doesn't keep you from removing old AMIs despite the fact that they are still referenced by one or more launch templates that are in active use by their respective auto-scaling groups. So at some point you would want to upgrade those auto-scaling groups to use updated launch templates which refer to the new AMI that results from the upgrade.
438 438
439
-After the AMI upgrade succeeds, you will see a pop-up dialog prompting you with a choice of whether you would like to update launch configurations for application replica sets that you selected in the table before upgrading the AMI, or in case you didn't pick any application replica sets suggesting all of them that currently use the AMI you just upgraded in their launch configuration. If you choose "OK" then all those auto-scaling groups will be updated so they point to new launch configurations copied from the previous ones, referencing the new AMI. The old launch configurations will be deleted. The names for the new launch configurations is constructed from the replica set name with the ID of the AMI appended to it. Note that running replicas are not affected by this.
439
+After the AMI upgrade succeeds, you will see a pop-up dialog prompting you with a choice of whether you would like to update launch templates for application replica sets that you selected in the table before upgrading the AMI, or in case you didn't pick any application replica sets suggesting all of them that currently use the AMI you just upgraded in their launch templates. If you choose "OK" then all those auto-scaling groups will be updated so they point to new launch templates copied from the previous ones, referencing the new AMI. The old launch templates will be deleted. The names for the new launch templates is constructed from the replica set name with the ID of the AMI appended to it. Note that running replicas are not affected by this.
440 440
441 441
You can also manually trigger the upgrade of the AMI used by an auto-scaling group by using the "Update machine image for auto-scaling replicas" button or the action icon entitled correspondingly. It will use the lastest ``sailing-analytics-server``-tagged image available.
442 442
... ...
@@ -816,7 +816,7 @@ This will automatically start replication from your master which is assumed to b
816 816
* log on to replica's `/gwt/AdminConsole.html` page, go to "Advanced" / "Replication" and stop replication; to this manually for all replicas in this application server replica set
817 817
* restart the master's application process (`./stop; sleep 5; ./start`)
818 818
* while your master spins up, follow its `/gwt/status` page
819
-* while your master spins up, prepare a new Launch Configuration for the replicas that uses the new release; for this, find out which release your new master is running (e.g., `build-202012211912`), copy your existing Launch Configuration to one with a new name that reflects the new release, and edit the new Launch Configuration's "User Data" section, adjusting the `INSTALL_FROM_RELEASE` variable to the new release name. You find the "User Data" in the section "Additional configuration - optional" after expanding the "Advanced details" drop-down. Acknowledge your key at the bottom and save the new launch configuration.
819
+* while your master spins up, prepare a new Launch Configuration for the replicas that uses the new release; for this, find out which release your new master is running (e.g., `build-202012211912`), copy your existing Launch Configuration to one with a new name that reflects the new release, and edit the new Launch Configuration's "User Data" section, adjusting the `INSTALL_FROM_RELEASE` variable to the new release name. You find the "User Data" in the section "Additional configuration - optional" after expanding the "Advanced details" drop-down. Acknowledge your key at the bottom and save the new launch template.
820 820
* as your new master's `/gwt/status` response tells you that the new master process is available again, add it to the master target group and the public target group again; in times of low load where you may afford going to zero replicas in your public target group, remove all replicas from the public target group; otherwise, before this step you would first need to spin up one or more replicas for your new release to replace all old replicas in the public target group in one transaction.
821 821
* update the Auto-Scaling Group so it uses your new Launch Configuration
822 822
* you may want to wait until your master's `/gwt/status` shows it has finished loading all races before starting new replicas on it; this way you can avoid huge numbers of replication operations that would be necessary to replicate the loading process fix by fix from the master to all replicas; it is a lot more efficient to transfer the result of loading all races in one sweep during the initial load process when a replica attaches after loading has completed