Add 'rabbit' thin launcher profile to all apps and --deployer=thin

This commit is contained in:
Dave Syer
2016-12-16 08:41:07 +00:00
parent c1c2f9d940
commit ca120e6302
11 changed files with 103 additions and 4 deletions

View File

@@ -77,6 +77,8 @@ public class LauncherCommand extends OptionParsingCommand {
private OptionSpec<Void> debugOption;
private OptionSpec<Void> listOption;
private OptionSpec<String> deployerOption;
private OptionSpec<String> profileOption;
private OptionSpec<Void> versionOption;
@Override
@@ -88,6 +90,12 @@ public class LauncherCommand extends OptionParsingCommand {
"Debug logging for the deployer");
this.listOption = option(Arrays.asList("list", "l"),
"List the deployables (don't launch anything)");
this.deployerOption = option(Arrays.asList("deployer"),
"Use a different deployer instead of the default local one (either 'local' or 'thin')")
.withRequiredArg().defaultsTo("local");
this.profileOption = option(Arrays.asList("profile", "p"),
"Use a different Spring profile (or profiles) for the deployer app, e.g. 'rabbit' for a Spring Cloud Bus with RabbitMQ")
.withOptionalArg();
this.versionOption = option(Arrays.asList("version", "v"),
"Show the version (don't launch anything)");
}
@@ -135,6 +143,12 @@ public class LauncherCommand extends OptionParsingCommand {
if (options.has(this.debugOption)) {
args.add("--debug=true");
}
if (options.has(this.profileOption)) {
args.add("--spring.profiles.active=" + profileOption.value(options));
}
if (options.has(this.deployerOption)) {
args.add("--thin.profile=" + deployerOption.value(options));
}
if (options.has(this.listOption)) {
args.add("--launcher.list=true");
}

View File

@@ -0,0 +1,2 @@
exclusions.spring-cloud-starter-bus-kafka: org.springframework.cloud:spring-cloud-starter-bus-kafka
dependencies.spring-cloud-starter-bus-amqp: org.springframework.cloud:spring-cloud-starter-bus-amqp

View File

@@ -0,0 +1,2 @@
exclusions.spring-cloud-starter-bus-kafka: org.springframework.cloud:spring-cloud-starter-bus-kafka
dependencies.spring-cloud-starter-bus-amqp: org.springframework.cloud:spring-cloud-starter-bus-amqp

View File

@@ -178,6 +178,7 @@ public class Deployer {
appDefProps.putAll(other.getEnabled());
}
}
appDefProps.putAll(deployable.getApplicationProperties());
Map<String, String> map = extractProperties("/" + deployable.getName() + ".yml");
for (String key : map.keySet()) {
appDefProps.put(key, map.get(key));
@@ -198,7 +199,8 @@ public class Deployer {
logger.debug("Deployment Properties: {}", deploymentProperties);
String id = deployer.deploy(request);
AppStatus appStatus = getAppStatus(deployer, id);
// TODO: stream stdout/stderr like docker-compose (with colors and prefix)
// TODO: stream stdout/stderr like docker-compose (with colors and prefix) - the
// colors work with the "thin" deployer, but there is no prefix in the logs yet
if (deployable.isWaitUntilStarted()) {
try {

View File

@@ -25,6 +25,7 @@ import javax.annotation.PostConstruct;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.core.Ordered;
@@ -149,12 +150,19 @@ public class DeployerProperties {
*/
private Map<String, String> enabled = new LinkedHashMap<>();
/**
* A map of "deployment" properties passed to the deployer (not the app) when this
* app is launched. You can use <code>spring.cloud.deployer.local.javaOpts</code>
* here to pass JVM args to a local deployer.
* A map of "deployment" properties passed to the deployer (not the app) when an
* app is launched. E.g. you can use
* <code>spring.cloud.deployer.local.javaOpts</code> here to pass JVM args to a
* local deployer.
*/
private Map<String, String> properties = new LinkedHashMap<>();
/**
* A map of properties passed to the app (not the deployer) when an app is
* launched.
*/
private Map<String, String> applicationProperties;
public String getCoordinates() {
return this.coordinates;
}
@@ -228,6 +236,14 @@ public class DeployerProperties {
this.properties = properties;
}
public Map<String, String> getApplicationProperties() {
return applicationProperties;
}
public void setApplicationProperties(Map<String, String> applicationProperties) {
this.applicationProperties = applicationProperties;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("Deployable{");

View File

@@ -24,12 +24,16 @@ spring:
properties:
spring.cloud.deployer.memory: ${dt.mem}
spring.cloud.deployer.local.javaOpts: ${dt.opts}
application-properties:
management.security.enabled: false
dataflow:
coordinates: ${dt.pre}dataflow:${dt.ver}
port: 9393
properties:
spring.cloud.deployer.memory: ${dt.mem}
spring.cloud.deployer.local.javaOpts: ${dt.opts}
application-properties:
management.security.enabled: false
eureka:
coordinates: ${dt.pre}eureka:${dt.ver}
port: 8761
@@ -39,6 +43,8 @@ spring:
properties:
spring.cloud.deployer.memory: ${dt.mem}
spring.cloud.deployer.local.javaOpts: ${dt.opts}
application-properties:
management.security.enabled: false
h2:
coordinates: ${dt.pre}h2:${dt.ver}
port: 9095
@@ -50,12 +56,16 @@ spring:
properties:
spring.cloud.deployer.memory: ${dt.mem}
spring.cloud.deployer.local.javaOpts: ${dt.opts}
application-properties:
management.security.enabled: false
hystrixdashboard:
coordinates: ${dt.pre}hystrixdashboard:${dt.ver}
port: 7979
properties:
spring.cloud.deployer.memory: ${dt.mem}
spring.cloud.deployer.local.javaOpts: ${dt.opts}
application-properties:
management.security.enabled: false
kafka:
coordinates: ${dt.pre}kafka:${dt.ver}
port: 9091
@@ -66,6 +76,8 @@ spring:
properties:
spring.cloud.deployer.memory: ${dt.mem}
spring.cloud.deployer.local.javaOpts: ${dt.opts}
application-properties:
management.security.enabled: false
zipkin:
coordinates: ${dt.pre}zipkin:${dt.ver}
port: 9411
@@ -73,4 +85,43 @@ spring:
properties:
spring.cloud.deployer.memory: ${dt.mem}
spring.cloud.deployer.local.javaOpts: ${dt.opts}
application-properties:
management.security.enabled: false
deploy: ${launcher.deploy:configserver,eureka}
---
spring:
profiles: rabbit
cloud:
launcher:
deployables:
configserver:
properties:
spring.cloud.deployer.thin.profile: rabbit
application-properties:
spring.cloud.bus.enabled: true
eureka:
properties:
spring.cloud.deployer.thin.profile: rabbit
application-properties:
spring.cloud.bus.enabled: true
h2:
properties:
spring.cloud.deployer.thin.profile: rabbit
application-properties:
spring.cloud.bus.enabled: true
dataflow:
properties:
spring.cloud.deployer.thin.profile: rabbit
application-properties:
spring.cloud.bus.enabled: true
hystrixdashboard:
properties:
spring.cloud.deployer.thin.profile: rabbit
application-properties:
spring.cloud.bus.enabled: true
zipkin:
properties:
spring.cloud.deployer.thin.profile: rabbit
application-properties:
spring.cloud.bus.enabled: true

View File

@@ -0,0 +1,2 @@
exclusions.spring-cloud-starter-bus-kafka: org.springframework.cloud:spring-cloud-starter-bus-kafka
dependencies.spring-cloud-starter-bus-amqp: org.springframework.cloud:spring-cloud-starter-bus-amqp

View File

@@ -33,6 +33,10 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-kafka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>

View File

@@ -0,0 +1,2 @@
exclusions.spring-cloud-starter-bus-kafka: org.springframework.cloud:spring-cloud-starter-bus-kafka
dependencies.spring-cloud-starter-bus-amqp: org.springframework.cloud:spring-cloud-starter-bus-amqp

View File

@@ -0,0 +1,2 @@
exclusions.spring-cloud-starter-bus-kafka: org.springframework.cloud:spring-cloud-starter-bus-kafka
dependencies.spring-cloud-starter-bus-amqp: org.springframework.cloud:spring-cloud-starter-bus-amqp

View File

@@ -0,0 +1,2 @@
exclusions.spring-cloud-starter-bus-kafka: org.springframework.cloud:spring-cloud-starter-bus-kafka
dependencies.spring-cloud-starter-bus-amqp: org.springframework.cloud:spring-cloud-starter-bus-amqp