Add generic deployment properties to deployer apps
Instead of JAVA_OPTS (didn't like the name anyway), user can define generic "properties" in each deployable that will be passed down to the app request. The current 1.0 snapshots of the local deployer look in there for JAVA_OPTS (but that hopefully will change to something more "property like") before 1.0.3 is released.
This commit is contained in:
@@ -138,8 +138,9 @@ public class DeployerProperties {
|
||||
*/
|
||||
private String message;
|
||||
/**
|
||||
* A map of "negative" properties that apply to all apps when this one is disabled.
|
||||
* E.g. when eureka is disabled you might want "eureka.client.enabled=false".
|
||||
* A map of "negative" properties that apply to all apps when this one is
|
||||
* disabled. E.g. when eureka is disabled you might want
|
||||
* "eureka.client.enabled=false".
|
||||
*/
|
||||
private Map<String, String> disabled = new LinkedHashMap<>();
|
||||
/**
|
||||
@@ -148,10 +149,11 @@ public class DeployerProperties {
|
||||
*/
|
||||
private Map<String, String> enabled = new LinkedHashMap<>();
|
||||
/**
|
||||
* A list of java options to pass to the jvm command (e.g. java).
|
||||
* E.g. -Dmy.prop=myval
|
||||
* A map of "deployment" properties passed to the deployer (not the app) when this
|
||||
* app is launched. You can use JAVA_OPTS here to pass JVM args to a local deployer.
|
||||
*/
|
||||
private List<String> javaOptions = new ArrayList<>();
|
||||
// TODO: update javadocs when JAVA_OPTS are passed as javaOpts or whatever it is)
|
||||
private Map<String, String> properties = new LinkedHashMap<>();
|
||||
|
||||
public String getCoordinates() {
|
||||
return this.coordinates;
|
||||
@@ -210,14 +212,6 @@ public class DeployerProperties {
|
||||
return disabled;
|
||||
}
|
||||
|
||||
public List<String> getJavaOptions() {
|
||||
return javaOptions;
|
||||
}
|
||||
|
||||
public void setJavaOptions(List<String> javaOptions) {
|
||||
this.javaOptions = javaOptions;
|
||||
}
|
||||
|
||||
public Map<String, String> getEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
@@ -226,6 +220,14 @@ public class DeployerProperties {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public Map<String, String> getProperties() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
public void setProperties(Map<String, String> properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuffer sb = new StringBuffer("Deployable{");
|
||||
@@ -236,7 +238,7 @@ public class DeployerProperties {
|
||||
sb.append(", order=").append(this.order);
|
||||
sb.append(", disabled=").append(this.disabled);
|
||||
sb.append(", enabled=").append(this.disabled);
|
||||
sb.append(", javaOptions=").append(this.javaOptions);
|
||||
sb.append(", properties=").append(this.properties);
|
||||
sb.append(", message=").append(this.message);
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
|
||||
@@ -16,17 +16,6 @@
|
||||
|
||||
package org.springframework.cloud.launcher.deployer;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.Banner.Mode;
|
||||
@@ -54,6 +43,17 @@ import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import static org.springframework.util.StringUtils.collectionToCommaDelimitedString;
|
||||
|
||||
/**
|
||||
@@ -318,10 +318,7 @@ public class DeployerThread extends Thread {
|
||||
|
||||
Map<String, String> deploymentProperties = new LinkedHashMap<>();
|
||||
deploymentProperties.put(AppDeployer.GROUP_PROPERTY_KEY, "launcher");
|
||||
|
||||
if (deployable.getJavaOptions() != null && !deployable.getJavaOptions().isEmpty()) {
|
||||
deploymentProperties.put("JAVA_OPTS", collectionToCommaDelimitedString(deployable.getJavaOptions()));
|
||||
}
|
||||
deploymentProperties.putAll(deployable.getProperties());
|
||||
|
||||
AppDeploymentRequest request = new AppDeploymentRequest(definition, resource,
|
||||
deploymentProperties);
|
||||
|
||||
@@ -7,3 +7,5 @@ spring:
|
||||
port: 8000
|
||||
waitUntilStarted: true
|
||||
order: -200
|
||||
properties:
|
||||
JAVA_OPTS: -Xmx64m
|
||||
|
||||
Reference in New Issue
Block a user