83ea675a285e8261a8a6967840939dcf508a4f64
java/com.sap.sailing.landscape.ui/src/com/sap/sailing/landscape/ui/server/LandscapeManagementWriteServiceImpl.java
| ... | ... | @@ -73,6 +73,7 @@ import com.sap.sse.common.Util; |
| 73 | 73 | import com.sap.sse.common.Util.Pair; |
| 74 | 74 | import com.sap.sse.common.Util.Triple; |
| 75 | 75 | import com.sap.sse.gwt.server.ResultCachingProxiedRemoteServiceServlet; |
| 76 | +import com.sap.sse.landscape.DefaultProcessConfigurationVariables; |
|
| 76 | 77 | import com.sap.sse.landscape.Host; |
| 77 | 78 | import com.sap.sse.landscape.Landscape; |
| 78 | 79 | import com.sap.sse.landscape.Release; |
| ... | ... | @@ -680,20 +681,27 @@ public class LandscapeManagementWriteServiceImpl extends ResultCachingProxiedRem |
| 680 | 681 | @Override |
| 681 | 682 | public SailingApplicationReplicaSetDTO<String> createArchiveReplicaSet(String regionId, SailingApplicationReplicaSetDTO<String> archiveReplicaSetToUpgrade, |
| 682 | 683 | String instanceType, String releaseNameOrNullForLatestMaster, String optionalKeyName, |
| 683 | - byte[] privateKeyEncryptionPassphrase, String replicationBearerToken) throws Exception { |
|
| 684 | + byte[] privateKeyEncryptionPassphrase, String optionalReplicationBearerToken) throws Exception { |
|
| 684 | 685 | checkLandscapeManageAwsPermission(); |
| 686 | + final String bearerToken; |
|
| 685 | 687 | final AwsRegion region = new AwsRegion(regionId, getLandscape()); |
| 686 | 688 | final AwsApplicationReplicaSet<String, SailingAnalyticsMetrics, SailingAnalyticsProcess<String>> awsReplicaSet = |
| 687 | 689 | convertFromApplicationReplicaSetDTO(region, archiveReplicaSetToUpgrade, optionalKeyName, privateKeyEncryptionPassphrase); |
| 690 | + final SailingAnalyticsProcess<String> master = awsReplicaSet.getMaster(); |
|
| 691 | + if(Util.hasLength(optionalReplicationBearerToken)) { |
|
| 692 | + bearerToken = optionalReplicationBearerToken; |
|
| 693 | + } else { |
|
| 694 | + bearerToken = master.getEnvShValueFor(DefaultProcessConfigurationVariables.REPLICATE_MASTER_BEARER_TOKEN, Landscape.WAIT_FOR_PROCESS_TIMEOUT, Optional.of(optionalKeyName), privateKeyEncryptionPassphrase); |
|
| 695 | + } |
|
| 688 | 696 | final String replicaSetName = SharedLandscapeConstants.ARCHIVE_SERVER_APPLICATION_REPLICA_SET_NAME; |
| 689 | 697 | final String archiveCandidateSubDomain = SharedLandscapeConstants.ARCHIVE_CANDIDATE_SUBDOMAIN; |
| 690 | 698 | final String domainName = AwsLandscape.getHostedZoneName(archiveReplicaSetToUpgrade.getHostname()); |
| 691 | 699 | final Release release = getLandscapeService().getRelease(releaseNameOrNullForLatestMaster); |
| 692 | - final Database databaseConfiguration = awsReplicaSet.getMaster().getDatabaseConfiguration(region, |
|
| 700 | + final Database databaseConfiguration = master.getDatabaseConfiguration(region, |
|
| 693 | 701 | Landscape.WAIT_FOR_PROCESS_TIMEOUT, Optional.ofNullable(optionalKeyName), |
| 694 | 702 | privateKeyEncryptionPassphrase); |
| 695 | 703 | final AwsApplicationReplicaSet<String, SailingAnalyticsMetrics, SailingAnalyticsProcess<String>> result = getLandscapeService().createArchiveReplicaSet(regionId, replicaSetName, |
| 696 | - instanceType, releaseNameOrNullForLatestMaster, databaseConfiguration, optionalKeyName, privateKeyEncryptionPassphrase, replicationBearerToken, domainName, |
|
| 704 | + instanceType, releaseNameOrNullForLatestMaster, databaseConfiguration, optionalKeyName, privateKeyEncryptionPassphrase, bearerToken, domainName, |
|
| 697 | 705 | /* optionalMemoryInMegabytesOrNull */ null, /* optionalMemoryTotalSizeFactorOrNull */ null, /* optionalIgtimiRiotPort */ null); |
| 698 | 706 | return new SailingApplicationReplicaSetDTO<String>(result.getName(), convertToSailingAnalyticsProcessDTO(result |
| 699 | 707 | .getMaster(), Optional.ofNullable(optionalKeyName), privateKeyEncryptionPassphrase), /* replicas */ Collections.emptySet(), |
java/com.sap.sailing.landscape/src/com/sap/sailing/landscape/impl/LandscapeServiceImpl.java
| ... | ... | @@ -272,6 +272,12 @@ public class LandscapeServiceImpl implements LandscapeService { |
| 272 | 272 | final AwsApplicationReplicaSet<String, SailingAnalyticsMetrics, SailingAnalyticsProcess<String>> replicaSet = |
| 273 | 273 | landscape.getApplicationReplicaSet(region, replicaSetName, master, Collections.emptySet(), |
| 274 | 274 | Landscape.WAIT_FOR_PROCESS_TIMEOUT, Optional.ofNullable(optionalKeyName), privateKeyEncryptionPassphrase); |
| 275 | + final ReverseProxy<String, SailingAnalyticsMetrics, SailingAnalyticsProcess<String>, RotatingFileBasedLog> reverseProxyCluster = |
|
| 276 | + getLandscape().getCentralReverseProxy(region); |
|
| 277 | + // TODO bug5311: when refactoring this for general scope migration, moving to a dedicated replica set will not require this |
|
| 278 | + // TODO bug5311: when refactoring this for general scope migration, moving into a cold storage server other than ARCHIVE will require ALBToReverseProxyRedirectMapper instead |
|
| 279 | + logger.info("Adding reverse proxy rule for archive candidate with hostname "+ hostname + " and private ip address"); |
|
| 280 | + reverseProxyCluster.setPlainRedirect(hostname, master, Optional.of(optionalKeyName), privateKeyEncryptionPassphrase); |
|
| 275 | 281 | return replicaSet; |
| 276 | 282 | } |
| 277 | 283 |