Skip to content

Commit

Permalink
Merge pull request #136 from overture-stack/rc/0.16.0
Browse files Browse the repository at this point in the history
release 0.16.0
remove facebook
remove stub commands
dms ui branding image and text
skip waiting ego ui container to stop
pass sso providers to dms ui
create assets directory in the wrapper script
upgrade ego ui, ego, dms-ui, arranger
  • Loading branch information
blabadi authored Mar 22, 2021
2 parents 9db6f16 + 0dd61c6 commit eaaa616
Show file tree
Hide file tree
Showing 48 changed files with 448 additions and 312 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>bio.overture</groupId>
<artifactId>dms</artifactId>
<version>0.15.1</version>
<version>0.16.0</version>
<name>dms</name>
<description>Overture Data Management System</description>

Expand Down
6 changes: 5 additions & 1 deletion src/main/bin/dms-docker
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ function provisionConfig {
mkdir -p $DMS_HOME
fi

if [ ! -d $DMS_HOME/assets ];then
mkdir -p $DMS_HOME/assets
fi

if [ ! -f $DMS_CONFIG_FILE ];then
genLatestConfig $DMS_CONFIG_FILE
fi
Expand Down Expand Up @@ -171,7 +175,7 @@ function main {
docker_opts="$docker_opts -p 5005:5005"
set -x
fi
docker_opts="$docker_opts -e DOCKER_RUNAS=true"
docker_opts="$docker_opts -e DOCKER_RUNAS=true -e DMS_HOME_HOST_PATH=$DMS_HOME"
# create dms-swarm-network if it doesn't exist, this is important for first run
# since the dms uses that in its run options
found_network=$(docker network ls --filter name=${NETWORK_NAME} --format="{{ .Name }}")
Expand Down
1 change: 0 additions & 1 deletion src/main/java/bio/overture/dms/cli/command/DmsCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
mixinStandardHelpOptions = true,
versionProvider = VersionProvider.class,
subcommands = {
SummaryCommand.class,
ConfigCommand.class,
ClusterCommand.class,
BashCompletionCommand.class
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,8 @@
mixinStandardHelpOptions = true,
versionProvider = VersionProvider.class,
subcommands = {
ClusterApplyCommand.class,
ClusterDestroyCommand.class,
ClusterGetCommand.class,
ClusterRestartCommand.class,
ClusterStartCommand.class,
ClusterStopCommand.class,
ClusterStatusCommand.class
ClusterDestroyCommand.class,
})
public class ClusterCommand {}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
name = "destroy",
mixinStandardHelpOptions = true,
versionProvider = VersionProvider.class,
description = "Destroy the cluster")
description = "Destroy the cluster and ALL the data")
public class ClusterDestroyCommand implements Callable<Integer> {

/** Dependencies */
Expand All @@ -34,14 +34,6 @@ public class ClusterDestroyCommand implements Callable<Integer> {
private final DmsComposeManager dmsComposeManager;
private final DmsConfigStore dmsConfigStore;

/** CLI Options */
@CommandLine.Option(
names = {"-v", "--volumes"},
required = false,
showDefaultValue = ALWAYS,
description = "Additionally destroy volumes")
private boolean destroyVolumes = false;

@CommandLine.Option(
names = {"-f", "--force"},
required = false,
Expand All @@ -67,9 +59,13 @@ public Integer call() throws Exception {
val result = dmsConfigStore.findStoredConfig();
if (result.isPresent()) {
t.printStatusLn(
"Starting cluster destruction: force=%s destroyVolumes=%s", force, destroyVolumes);
val resolvedDestroyVolumes = resolveDestroyVolumes();
dmsComposeManager.destroy(result.get(), resolvedDestroyVolumes);
"Starting cluster destruction: force=%s", force);
val isConfirmed = confirmVolumesDeletion();
if (!isConfirmed) {
t.printStatusLn("Cluster destruction canceled.");
return 2;
}
dmsComposeManager.destroy(result.get(), true);
t.printStatusLn("Finished cluster destruction");
return 0;
}
Expand All @@ -78,11 +74,11 @@ public Integer call() throws Exception {
return 1;
}

private boolean resolveDestroyVolumes() {
boolean askQuestion = !force && destroyVolumes;
boolean resolvedDestroyVolumes = force && destroyVolumes;
private boolean confirmVolumesDeletion() {
boolean askQuestion = !force;
boolean confirmedVolumeDestruction = force;
if (askQuestion) {
resolvedDestroyVolumes =
confirmedVolumeDestruction =
questionFactory
.newSingleQuestion(
WARNING,
Expand All @@ -91,13 +87,10 @@ private boolean resolveDestroyVolumes() {
true,
false)
.getAnswer();
if (!resolvedDestroyVolumes) {
t.printStatus("Volumes will NOT be destroyed!");
}
}
if (resolvedDestroyVolumes) {
if (confirmedVolumeDestruction) {
t.printStatus("Forcefully destroying all volumes!");
}
return resolvedDestroyVolumes;
return confirmedVolumeDestruction;
}
}
Original file line number Diff line number Diff line change
@@ -1,25 +1,49 @@
package bio.overture.dms.cli.command.cluster;

import bio.overture.dms.cli.DmsConfigStore;
import bio.overture.dms.cli.terminal.Terminal;
import bio.overture.dms.cli.util.VersionProvider;
import bio.overture.dms.compose.deployment.DmsComposeManager;
import java.util.concurrent.Callable;
import lombok.NonNull;
import lombok.val;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import picocli.CommandLine.Command;
import picocli.CommandLine.Option;

@Component
@Command(
name = "start",
mixinStandardHelpOptions = true,
versionProvider = VersionProvider.class,
description = "Start an existing cluster")
description = "Deploy a configuration to the cluster")
public class ClusterStartCommand implements Callable<Integer> {

@Option(
names = {"--skip-ego-init"},
required = false,
description = "Skip Ego initialization")
private boolean skipEgoInit = false;
private final Terminal t;
private final DmsComposeManager dmsComposeManager;
private final DmsConfigStore dmsConfigStore;

@Autowired
public ClusterStartCommand(
@NonNull Terminal terminal,
@NonNull DmsComposeManager dmsComposeManager,
@NonNull DmsConfigStore dmsConfigStore) {
this.dmsComposeManager = dmsComposeManager;
this.t = terminal;
this.dmsConfigStore = dmsConfigStore;
}

@Override
public Integer call() throws Exception {
return 0;
val result = dmsConfigStore.findStoredConfig();
if (result.isPresent()) {
t.printStatusLn("Starting deployment...");
dmsComposeManager.deploy(result.get());
t.printStatusLn("Deployment completed successfully");
return 0;
}

t.printErrorLn("Could not find DMS configuration: %s", dmsConfigStore.getDmsConfigFilePath());
return 1;
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,54 @@
package bio.overture.dms.cli.command.cluster;

import bio.overture.dms.cli.DmsConfigStore;
import bio.overture.dms.cli.terminal.Terminal;
import bio.overture.dms.cli.util.VersionProvider;
import java.util.concurrent.Callable;

import bio.overture.dms.compose.deployment.DmsComposeManager;
import lombok.Builder;
import lombok.NonNull;
import lombok.val;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import picocli.CommandLine.Command;

@Component
@Command(
name = "stop",
mixinStandardHelpOptions = true,
versionProvider = VersionProvider.class,
description = "Stop a running cluster")
description = "Stop a running cluster, without deleting data volumes")
public class ClusterStopCommand implements Callable<Integer> {

/** Dependencies */
private final Terminal t;

private final DmsComposeManager dmsComposeManager;
private final DmsConfigStore dmsConfigStore;

@Builder
@Autowired
public ClusterStopCommand(
@NonNull Terminal terminal,
@NonNull DmsComposeManager dmsComposeManager,
@NonNull DmsConfigStore dmsConfigStore) {
this.t = terminal;
this.dmsComposeManager = dmsComposeManager;
this.dmsConfigStore = dmsConfigStore;
}

@Override
public Integer call() throws Exception {
return 0;
val result = dmsConfigStore.findStoredConfig();
if (result.isPresent()) {
t.printStatusLn(
"Stopping cluster..");
dmsComposeManager.destroy(result.get(), false);
t.printStatusLn("Finished stopping cluster");
return 0;
}
t.printErrorLn("Could not find DMS configuration: %s", dmsConfigStore.getDmsConfigFilePath());
return 1;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public ConfigBuildCommand(
public Integer call() throws Exception {
t.printStatusLn("Starting interactive configuration");
// TODO: Fix this so that the storedDmsConfig is input into the buildDmsConfig method
dmsConfigStore.apply(storedDmsConfig -> dmsQuestionnaire.buildDmsConfig());
dmsConfigStore.apply(dmsQuestionnaire::buildDmsConfig);
t.printStatusLn("Wrote config file to %s", dmsConfigStore.getDmsConfigFilePath());
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,7 @@
mixinStandardHelpOptions = true,
versionProvider = VersionProvider.class,
subcommands = {
ConfigCheckCommand.class,
ConfigBuildCommand.class,
ConfigGetCommand.class,
ConfigSetCommand.class,
ConfigDeleteCommand.class,
ConfigStatusCommand.class,
ConfigUpgradeCommand.class,
ConfigVersionCommand.class
})
public class ConfigCommand {}
18 changes: 18 additions & 0 deletions src/main/java/bio/overture/dms/cli/question/QuestionFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import static java.util.Objects.isNull;

import bio.overture.dms.cli.model.enums.QuestionProfiles;
import bio.overture.dms.cli.question.validation.EmailValidator;
import bio.overture.dms.cli.question.validation.FileValidator;
import bio.overture.dms.cli.question.validation.QuestionValidator;
import bio.overture.dms.cli.question.validation.UrlQuestionValidator;
import bio.overture.dms.cli.terminal.UrlInputReader;
Expand Down Expand Up @@ -43,6 +45,10 @@ public class QuestionFactory {

private static final UrlQuestionValidator URL_QUESTION_VALIDATOR = new UrlQuestionValidator();

private static final EmailValidator EMAIL_VALIDATOR = new EmailValidator();

private static final FileValidator FILE_VALIDATOR = new FileValidator();

/** Dependencies */
private final TextIO textIO;

Expand Down Expand Up @@ -85,6 +91,18 @@ public SingleQuestion<URL> newUrlSingleQuestion(
URL.class, question, optional, defaultValue, URL_QUESTION_VALIDATOR);
}

public SingleQuestion<String> newEmailQuestion(
@NonNull String question, boolean optional, String defaultVal) {
return newDefaultSingleQuestion(
String.class, question, optional, defaultVal, EMAIL_VALIDATOR);
}

public SingleQuestion<String> newFileQuestion(
@NonNull String question, boolean optional) {
return newDefaultSingleQuestion(
String.class, question, optional, null, FILE_VALIDATOR);
}

public SingleQuestion<String> newPasswordQuestion(@NonNull String question) {
return new SingleQuestion<>(question, buildPasswordInputReader());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package bio.overture.dms.cli.question.validation;

import java.util.List;
import java.util.regex.Pattern;

public class EmailValidator implements QuestionValidator<String> {

public static final Pattern VALID_EMAIL_ADDRESS_REGEX =
Pattern.compile("^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$", Pattern.CASE_INSENSITIVE);

@Override
public List<String> getErrorMessages(String val) {
if (VALID_EMAIL_ADDRESS_REGEX.matcher(val).matches()) {
return null;
}
return List.of("The provided value is not a valid email");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package bio.overture.dms.cli.question.validation;

import lombok.val;

import java.io.File;
import java.util.List;

public class FileValidator implements QuestionValidator<String> {

@Override
public List<String> getErrorMessages(String path) {
try {
val fileExists = new File(path).exists();
if (fileExists) return null;
return List.of("File not found");
} catch (Exception e) {
return List.of("Couldn't check the provided file");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ public List<String> getErrorMessages(URL url) {
errors.add(
format("The url protocol '%s' is not one of ['http', 'https']", url.getProtocol()));
}
return null;
return errors.size() == 0 ? null : errors;
}
}
Loading

0 comments on commit eaaa616

Please sign in to comment.