Skip to content

Commit f1e4ea9

Browse files
authored
Merge pull request #487 from overture-stack/rc/2.2.0
Release Candidate 2.2.0
2 parents 90fb70c + 82d302d commit f1e4ea9

File tree

160 files changed

+993
-260
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+993
-260
lines changed

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,9 @@ dist_*/
8181
.vagrant/
8282
/dcc-portal-ui/src/main/js/app/.brackets.json
8383
dcc-portal-ui/src/main/js/app/bower_components
84+
85+
song-client/.factorypath
86+
87+
song-core/.factorypath
88+
89+
song-server/.factorypath

Dockerfile

+14-24
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,25 @@ RUN ./mvnw clean package -DskipTests
88
###############################################################################################################
99
FROM openjdk:11-jre-stretch as client
1010

11-
ENV DCC_HOME /opt/dcc
12-
ENV DCC_DATA $DCC_HOME/data
13-
ENV DCC_TOOLS $DCC_HOME/tools
11+
ENV SONG_CLIENT_HOME /song-client
12+
ENV CLIENT_DIST_DIR /song-client-dist
1413

15-
RUN apt update && \
16-
apt install -y python3 curl jq && \
17-
mkdir -p $DCC_HOME
18-
19-
ENV DCC_CONFIG $DCC_HOME/config
20-
ENV CLIENT_HOME $DCC_DATA
2114
ENV TARBALL $DCC_HOME/download.tar.gz
2215

23-
COPY song-docker-demo/client/config/* $DCC_CONFIG/
24-
25-
ENV SAVE_STUDY_SCRIPT $DCC_TOOLS/save_study.sh
26-
ENV EXPAND_SCRIPT $DCC_TOOLS/expand.py
27-
ENV INPUT_FILE $DCC_CONFIG/application.yml.template
28-
ENV OUTPUT_FILE $CLIENT_HOME/conf/application.yml
29-
30-
COPY --from=builder /srv/song-client/target/song-client-*-dist.tar.gz $TARBALL
16+
COPY --from=builder /srv/song-client/target/song-client-*-dist.tar.gz /song-client.tar.gz
3117

32-
RUN cd $DCC_HOME && \
33-
tar zxvf $TARBALL && \
34-
mv -f $DCC_HOME/song-client-* $DCC_HOME/song-client
18+
RUN tar zxvf song-client.tar.gz -C /tmp \
19+
&& rm -rf song-client.tar.gz \
20+
&& mv -f /tmp/song-client-* /tmp/song-client-dist \
21+
&& cp -r /tmp/song-client-dist $CLIENT_DIST_DIR \
22+
&& mkdir -p $CLIENT_DIST_DIR/logs \
23+
&& touch $CLIENT_DIST_DIR/logs/client.log \
24+
&& chmod 777 $CLIENT_DIST_DIR/logs/client.log \
25+
&& mkdir -p $SONG_CLIENT_HOME \
26+
&& mv $CLIENT_DIST_DIR/* $SONG_CLIENT_HOME
3527

36-
CMD rm -rf $CLIENT_HOME/* && \
37-
cp -rf $DCC_HOME/song-client/* $CLIENT_HOME && \
38-
python3 $EXPAND_SCRIPT $INPUT_FILE $OUTPUT_FILE && \
39-
$SAVE_STUDY_SCRIPT $SERVER_URL $CLIENT_STUDY_ID $AUTH_TOKEN
28+
# Set working directory for convenience with interactive usage
29+
WORKDIR $SONG_CLIENT_HOME
4030

4131
###############################################################################################################
4232

Dockerfile.dev

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM openjdk:11-jre-stretch as client
2+
3+
ENV SONG_CLIENT_HOME /song-client
4+
ENV CLIENT_DIST_DIR /song-client-dist
5+
6+
COPY song-client/target/song-client-*-dist.tar.gz /song-client.tar.gz
7+
RUN tar zxvf song-client.tar.gz -C /tmp \
8+
&& rm -rf song-client.tar.gz \
9+
&& mv -f /tmp/song-client-* /tmp/song-client-dist \
10+
&& cp -r /tmp/song-client-dist $CLIENT_DIST_DIR \
11+
&& mkdir -p $CLIENT_DIST_DIR/logs \
12+
&& touch $CLIENT_DIST_DIR/logs/client.log \
13+
&& chmod 777 $CLIENT_DIST_DIR/logs/client.log \
14+
&& mkdir -p $SONG_CLIENT_HOME \
15+
&& mv $CLIENT_DIST_DIR/* $SONG_CLIENT_HOME
16+
17+
# Set working directory for convenience with interactive usage
18+
WORKDIR $SONG_CLIENT_HOME

Jenkinsfile

+8-2
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,12 @@ spec:
7171
withCredentials([usernamePassword(credentialsId:'OvertureDockerHub', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
7272
sh 'docker login -u $USERNAME -p $PASSWORD'
7373
}
74-
sh "docker build --network=host -f Dockerfile . -t overture/song-server:edge -t overture/song-server:${commit}"
74+
sh "docker build --target=server --network=host -f Dockerfile . -t overture/song-server:edge -t overture/song-server:${commit}"
75+
sh "docker build --target=client --network=host -f Dockerfile . -t overture/song-client:edge -t overture/song-client:${commit}"
7576
sh "docker push overture/song-server:${commit}"
7677
sh "docker push overture/song-server:edge"
78+
sh "docker push overture/song-client:${commit}"
79+
sh "docker push overture/song-client:edge"
7780
}
7881
}
7982
}
@@ -90,9 +93,12 @@ spec:
9093
withCredentials([usernamePassword(credentialsId:'OvertureDockerHub', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
9194
sh 'docker login -u $USERNAME -p $PASSWORD'
9295
}
93-
sh "docker build --network=host -f Dockerfile . -t overture/song-server:latest -t overture/song-server:${version}"
96+
sh "docker build --target=server --network=host -f Dockerfile . -t overture/song-server:latest -t overture/song-server:${version}"
97+
sh "docker build --target=client --network=host -f Dockerfile . -t overture/song-client:latest -t overture/song-client:${version}"
9498
sh "docker push overture/song-server:${version}"
9599
sh "docker push overture/song-server:latest"
100+
sh "docker push overture/song-client:${version}"
101+
sh "docker push overture/song-client:latest"
96102
}
97103
}
98104
}

README.md

+47
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,56 @@ When running locally they can be accessed here: http://localhost:8080/swagger-ui
6060
Dockerfile Location: `Dockerfile`
6161
Build Context: `/`
6262
`Autobuild` is set to the ON position
63+
6364
`Build Caching` is set to the ON position
6465
4. Then save the configuration
6566

67+
### Docker Song Client
68+
The `song-client` is a CLI tool used for communicating with a `song-server`.
69+
70+
#### Building
71+
Simply running `mvn clean package` will package the client into a `-dist.tar.gz` file.
72+
73+
#### Configuration
74+
After unarchiving the distribution, it can be configured via the `./conf/application.yml` file. Alternatively, the client can be configured through environment variables, which take presedence over the `application.yml` config.
75+
For example, to run the `song-client config` command using environment variables with the same values as the `application.yml` configuration below:
76+
77+
```yaml
78+
client:
79+
serverUrl: http://localhost:8080
80+
studyId: ABC123-CA
81+
programName: sing
82+
debug: true
83+
accessToken: myAccessToken
84+
```
85+
86+
could be done via:
87+
88+
```bash
89+
CLIENT_SERVER_URL=http://localhost:8080 \
90+
CLIENT_STUDY_ID=ABC123-CA \
91+
CLIENT_PROGRAM_NAME=sing \
92+
CLIENT_DEBUG=true \
93+
CLIENT_ACCESS_TOKEN=myAccessToken \
94+
./bin/sing config
95+
```
96+
97+
#### Running the client locally
98+
The `song-client` can be run using the `./bin/sing` script.
99+
100+
#### Running the client using Docker
101+
Alternatively, the `song-client` can be run using docker. To run the dockerized client with the configurations above, the following command could be executed:
102+
```bash
103+
docker run --rm \
104+
-e 'CLIENT_SERVER_URL=http://localhost:8080' \
105+
-e 'CLIENT_STUDY_ID=ABC123-CA' \
106+
-e 'CLIENT_PROGRAM_NAME=sing' \
107+
-e 'CLIENT_DEBUG=true' \
108+
-e 'CLIENT_ACCESS_TOKEN=myAccessToken' \
109+
overture/song-client:latest
110+
bin/sing config
111+
```
112+
66113
### Notes
67114

68115
When running with the secure profile enabled, an oauth2 server is needed.

pom.xml

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2+
23
<!--
34
~ Copyright (c) 2018. Ontario Institute for Cancer Research
45
~
@@ -20,7 +21,7 @@
2021
<groupId>bio.overture</groupId>
2122
<artifactId>song</artifactId>
2223
<packaging>pom</packaging>
23-
<version>2.1.0</version>
24+
<version>2.2.0</version>
2425
<modules>
2526
<module>song-core</module>
2627
<module>song-java-sdk</module>
@@ -106,6 +107,15 @@
106107
<version>${spring-data-commons-core.version}</version>
107108
</dependency>
108109

110+
<!-- Spring Cloud -->
111+
<dependency>
112+
<groupId>org.springframework.cloud</groupId>
113+
<artifactId>spring-cloud-dependencies</artifactId>
114+
<version>${spring-cloud.version}</version>
115+
<type>pom</type>
116+
<scope>import</scope>
117+
</dependency>
118+
109119
<!--Swagger-->
110120
<dependency>
111121
<groupId>io.springfox</groupId>
@@ -462,6 +472,7 @@
462472
<spring-data-commons-core.version>1.4.1.RELEASE</spring-data-commons-core.version>
463473
<!--<spring-data-commons.version>1.12.11.RELEASE</spring-data-commons.version>-->
464474
<spring-framework.version>5.1.9.RELEASE</spring-framework.version>
475+
<spring-cloud.version>Greenwich.SR3</spring-cloud.version>
465476
<dcc-common.version>4.3.8</dcc-common.version>
466477
<postgresql.version>42.2.2</postgresql.version>
467478
<junit.version>4.12</junit.version>

song-client/pom.xml

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<!--
2-
<?xml version="1.0" encoding="UTF-8"?>
3-
~ Copyright (c) 2018. Ontario Institute for Cancer Research
2+
~ Copyright (c) 2019. Ontario Institute for Cancer Research
43
~
54
~ This program is free software: you can redistribute it and/or modify
65
~ it under the terms of the GNU Affero General Public License as
@@ -14,11 +13,12 @@
1413
~
1514
~ You should have received a copy of the GNU Affero General Public License
1615
~ along with this program. If not, see <https://www.gnu.org/licenses/>.
17-
--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
16+
-->
17+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
1818
<parent>
1919
<artifactId>song</artifactId>
2020
<groupId>bio.overture</groupId>
21-
<version>2.1.0</version>
21+
<version>2.2.0</version>
2222
</parent>
2323
<modelVersion>4.0.0</modelVersion>
2424

@@ -35,12 +35,12 @@
3535
<dependency>
3636
<groupId>bio.overture</groupId>
3737
<artifactId>song-java-sdk</artifactId>
38-
<version>2.1.0</version>
38+
<version>2.2.0</version>
3939
</dependency>
4040
<dependency>
4141
<groupId>bio.overture</groupId>
4242
<artifactId>song-core</artifactId>
43-
<version>2.1.0</version>
43+
<version>2.2.0</version>
4444
</dependency>
4545

4646
<!-- CLI -->

song-client/src/main/java/bio/overture/song/client/Main.java

+23-1
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
import static bio.overture.song.client.cli.ClientMain.createClientMain;
44
import static bio.overture.song.core.utils.JsonDocUtils.getInputStreamClasspath;
5+
import static java.lang.Boolean.parseBoolean;
56
import static java.nio.file.Files.exists;
67
import static java.nio.file.Files.newInputStream;
78
import static java.util.Objects.isNull;
89

910
import bio.overture.song.client.config.Config;
11+
import bio.overture.song.client.config.CustomRestClientConfig;
1012
import com.fasterxml.jackson.databind.ObjectMapper;
1113
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
1214
import java.io.InputStream;
@@ -40,6 +42,26 @@ public static Config buildConfig(String file) {
4042
}
4143
val mapper = new ObjectMapper(new YAMLFactory());
4244
val tree = mapper.readTree(is);
43-
return mapper.convertValue(tree, Config.class);
45+
val config = mapper.convertValue(tree, Config.class);
46+
updateWithEnv(config.getClient());
47+
return config;
48+
}
49+
50+
private static void updateWithEnv(CustomRestClientConfig c) {
51+
c.setServerUrl(getString(c.getServerUrl(), "CLIENT_SERVER_URL"));
52+
c.setAccessToken(getString(c.getAccessToken(), "CLIENT_ACCESS_TOKEN"));
53+
c.setDebug(getBoolean(c.isDebug(), "CLIENT_DEBUG"));
54+
c.setProgramName(getString(c.getProgramName(), "CLIENT_PROGRAM_NAME"));
55+
c.setStudyId(getString(c.getStudyId(), "CLIENT_STUDY_ID"));
56+
}
57+
58+
private static String getString(String value, String envVar) {
59+
val envValue = System.getenv(envVar);
60+
return isNull(envValue) ? value : envValue;
61+
}
62+
63+
private static boolean getBoolean(boolean value, String envVar) {
64+
val envValue = System.getenv(envVar);
65+
return isNull(envValue) ? value : parseBoolean(envValue);
4466
}
4567
}

song-client/src/main/java/bio/overture/song/client/cli/ClientMain.java

+8-9
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
*/
1717
package bio.overture.song.client.cli;
1818

19+
import static bio.overture.song.client.util.ErrorMessage.fromException;
20+
import static bio.overture.song.core.exceptions.ServerErrors.UNAUTHORIZED_TOKEN;
21+
import static bio.overture.song.core.exceptions.ServerErrors.UNKNOWN_ERROR;
22+
import static bio.overture.song.core.exceptions.SongError.createSongError;
23+
1924
import bio.overture.song.client.command.ConfigCommand;
2025
import bio.overture.song.client.command.ExportCommand;
2126
import bio.overture.song.client.command.FileUpdateCommand;
@@ -37,20 +42,14 @@
3742
import bio.overture.song.sdk.ManifestClient;
3843
import bio.overture.song.sdk.SongApi;
3944
import bio.overture.song.sdk.Toolbox;
45+
import java.io.IOException;
46+
import java.net.HttpRetryException;
47+
import java.util.function.Consumer;
4048
import lombok.NonNull;
4149
import lombok.extern.slf4j.Slf4j;
4250
import lombok.val;
4351
import org.springframework.web.client.ResourceAccessException;
4452

45-
import java.io.IOException;
46-
import java.net.HttpRetryException;
47-
import java.util.function.Consumer;
48-
49-
import static bio.overture.song.client.util.ErrorMessage.fromException;
50-
import static bio.overture.song.core.exceptions.ServerErrors.UNAUTHORIZED_TOKEN;
51-
import static bio.overture.song.core.exceptions.ServerErrors.UNKNOWN_ERROR;
52-
import static bio.overture.song.core.exceptions.SongError.createSongError;
53-
5453
@Slf4j
5554
public class ClientMain {
5655

song-client/src/main/java/bio/overture/song/client/command/ConfigCommand.java

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public void run() throws IOException {
3333
output("Current configuration:\n");
3434
output("URL: %s\n", config.getServerUrl());
3535
output("Study ID: %s\n", config.getStudyId());
36+
output("Access Token: %s\n", config.getAccessToken());
3637
output("Debug Enabled: %s\n", config.isDebug());
3738
}
3839
}

song-core/pom.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2+
23
<!--
34
~ Copyright (c) 2018. Ontario Institute for Cancer Research
45
~
@@ -18,7 +19,7 @@
1819
<parent>
1920
<artifactId>song</artifactId>
2021
<groupId>bio.overture</groupId>
21-
<version>2.1.0</version>
22+
<version>2.2.0</version>
2223
</parent>
2324
<modelVersion>4.0.0</modelVersion>
2425

song-docker-demo/storage-client/config/application-aws.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2018. Ontario Institute for Cancer Research
2+
# Copyright (c) 2019. Ontario Institute for Cancer Research
33
#
44
# This program is free software: you can redistribute it and/or modify
55
# it under the terms of the GNU Affero General Public License as

song-go-client/go.mod

+17
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,21 @@ require (
1414
github.com/stretchr/testify v1.2.2
1515
golang.org/x/arch v0.0.0-20180920145803-b19384d3c130 // indirect
1616
golang.org/x/crypto v0.0.0-20181009213950-7c1a557ab941 // indirect
17+
<!--
18+
~ Copyright (c) 2019. Ontario Institute for Cancer Research
19+
~
20+
~ This program is free software: you can redistribute it and/or modify
21+
~ it under the terms of the GNU Affero General Public License as
22+
~ published by the Free Software Foundation, either version 3 of the
23+
~ License, or (at your option) any later version.
24+
~
25+
~ This program is distributed in the hope that it will be useful,
26+
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
27+
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28+
~ GNU Affero General Public License for more details.
29+
~
30+
~ You should have received a copy of the GNU Affero General Public License
31+
~ along with this program. If not, see <https://www.gnu.org/licenses/>.
32+
-->
33+
1734
)

song-java-sdk/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
3-
~ Copyright (c) 2018. Ontario Institute for Cancer Research
3+
~ Copyright (c) 2019. Ontario Institute for Cancer Research
44
~
55
~ This program is free software: you can redistribute it and/or modify
66
~ it under the terms of the GNU Affero General Public License as
@@ -18,7 +18,7 @@
1818
<parent>
1919
<artifactId>song</artifactId>
2020
<groupId>bio.overture</groupId>
21-
<version>2.1.0</version>
21+
<version>2.2.0</version>
2222
</parent>
2323
<modelVersion>4.0.0</modelVersion>
2424

0 commit comments

Comments
 (0)