Add git.uri option.
spring cloud --git-uri=http://mygit/myrepo.git configserver Above command option changes configserver to use the git profile with the configured git url. fixes gh-24
This commit is contained in:
@@ -42,9 +42,16 @@ spring:
|
||||
|
||||
The `name` attribute is required. If `waitUntilStarted` is true, Launcher will block until the application has reached the `deployed` state. Before commands are deployed, the list is sorted using Spring's `OrderComparator`. In the above case, `configserver` is deployed before any other app is deployed. Currently only `maven:` coordinates and standard Spring Resources (`file:`, etc...) are supported.
|
||||
|
||||
You can also use the `--deploy` option to select from the [predefined deployables](https://github.com/spring-cloud/spring-cloud-cli/blob/devtools/spring-cloud-launcher/spring-cloud-launcher-deployer/src/main/resources/cloud.yml). For example to run Spring Cloud Data Flow execute:
|
||||
You can also select from the [predefined deployables](https://github.com/spring-cloud/spring-cloud-cli/blob/devtools/spring-cloud-launcher/spring-cloud-launcher-deployer/src/main/resources/cloud.yml). For example to run Spring Cloud Data Flow execute:
|
||||
```
|
||||
spring cloud --launch=configserver,h2,kafka,dataflow
|
||||
spring cloud eureka,configserver
|
||||
```
|
||||
|
||||
### Config Server git uri
|
||||
|
||||
To run configserver with a git repo use the `--git-uri` option. For example:
|
||||
```
|
||||
spring cloud --git-uri=http://mygitserver/myrepo.git configserver
|
||||
```
|
||||
|
||||
### Stopping
|
||||
@@ -62,9 +69,9 @@ spring cloud --launch=configserver,h2,kafka,dataflow
|
||||
- [X] H2 Database
|
||||
- [X] Spring Cloud Dataflow server
|
||||
- [X] Launcher landing page (Eureka Dashboard works for now)
|
||||
- [X] Sleuth/Zipkin
|
||||
- [ ] Support external rabbit
|
||||
- [ ] Speedup startup (parallel start?, retry for config server, db and kafka?)
|
||||
- [ ] Sleuth/Zipkin
|
||||
- [ ] Cassandra Database
|
||||
- [ ] Client Side Library
|
||||
- [ ] Spring Boot Admin (Not compatible with Brixton)
|
||||
|
||||
@@ -42,6 +42,7 @@ import org.springframework.boot.cli.compiler.grape.RepositoryConfiguration;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import groovy.lang.GroovyClassLoader;
|
||||
import joptsimple.ArgumentAcceptingOptionSpec;
|
||||
import joptsimple.OptionSet;
|
||||
import joptsimple.OptionSpec;
|
||||
|
||||
@@ -60,6 +61,7 @@ public class LauncherCommand extends OptionParsingCommand {
|
||||
EXAMPLES.add(new HelpExample("Launch Eureka", "spring cloud eureka"));
|
||||
EXAMPLES.add(new HelpExample("Launch Config Server and Eureka", "spring cloud configserver eureka"));
|
||||
EXAMPLES.add(new HelpExample("List deployable apps", "spring cloud --list"));
|
||||
EXAMPLES.add(new HelpExample("Launch Config Server with git repo", "spring cloud --git-uri=http://example.com/proj.git configserver"));
|
||||
}
|
||||
|
||||
public LauncherCommand() {
|
||||
@@ -75,11 +77,13 @@ public class LauncherCommand extends OptionParsingCommand {
|
||||
|
||||
private OptionSpec<Void> debugOption;
|
||||
private OptionSpec<Void> listOption;
|
||||
private ArgumentAcceptingOptionSpec<String> gitUriOption;
|
||||
|
||||
@Override
|
||||
protected void options() {
|
||||
this.debugOption = option(Arrays.asList("debug", "d"), "Debug logging for the deployer");
|
||||
this.listOption = option(Arrays.asList("list", "l"), "List the deployables (don't launch anything)");
|
||||
this.gitUriOption = getParser().acceptsAll(Arrays.asList("git-uri", "g"), "URI for git repository for use with configserver").withRequiredArg();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -120,6 +124,9 @@ public class LauncherCommand extends OptionParsingCommand {
|
||||
if (options.has(this.debugOption)) {
|
||||
args.add("--debug=true");
|
||||
}
|
||||
if (options.has(this.gitUriOption)) {
|
||||
args.add("--git.uri=" + options.valueOf(this.gitUriOption));
|
||||
}
|
||||
if (options.has(this.listOption)) {
|
||||
args.add("--launcher.list=true");
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ import org.springframework.cloud.deployer.spi.core.AppDeploymentRequest;
|
||||
import org.springframework.cloud.launcher.deployer.DeployerProperties.Deployable;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.core.OrderComparator;
|
||||
import org.springframework.core.env.ConfigurableEnvironment;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
import org.springframework.core.env.StandardEnvironment;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
@@ -136,7 +137,7 @@ public class DeployerThread extends Thread {
|
||||
logger.debug("Deployables {}", properties.getDeployables());
|
||||
|
||||
for (Deployable deployable : deployables) {
|
||||
deploy(deployer, resourceLoader, deployable, properties);
|
||||
deploy(deployer, resourceLoader, deployable, properties, context.getEnvironment());
|
||||
}
|
||||
|
||||
Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||
@@ -180,7 +181,7 @@ public class DeployerThread extends Thread {
|
||||
}
|
||||
|
||||
private String deploy(AppDeployer deployer, ResourceLoader resourceLoader, Deployable deployable,
|
||||
DeployerProperties properties) {
|
||||
DeployerProperties properties, ConfigurableEnvironment environment) {
|
||||
if (!shouldDeploy(deployable, properties)) {
|
||||
return null;
|
||||
}
|
||||
@@ -198,6 +199,12 @@ public class DeployerThread extends Thread {
|
||||
if (!shouldDeploy("eureka", properties)) {
|
||||
appDefProps.put("eureka.client.enabled", Boolean.FALSE.toString());
|
||||
}
|
||||
if (deployable.getName().equals("configserver") && environment.containsProperty("git.uri")) {
|
||||
appDefProps.put("spring.profiles.active", "git");
|
||||
appDefProps.put("spring.cloud.config.server.git.uri",
|
||||
environment.getRequiredProperty("git.uri"));
|
||||
|
||||
}
|
||||
|
||||
AppDefinition definition = new AppDefinition(deployable.getName(), appDefProps);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user