Skip to content

Commit 135586a

Browse files
authored
Merge pull request #743 from cambridge-cares/467-example-visualization-mapbox-api-credentials-in-separate-file
Example visualization Mapbox API credentials from Docker secret files
2 parents 9fb7da3 + f656f4c commit 135586a

File tree

22 files changed

+187
-116
lines changed

22 files changed

+187
-116
lines changed

.github/scripts/dtvf/check-version.sh

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,6 @@ if grep -q "$TOKEN" <<< "$VERSION"; then
3030
fi
3131
echo "Version does not contain -SNAPSHOT qualifier."
3232

33-
# Check that the README has been updated
34-
README="./web/digital-twin-vis-framework/README.md"
35-
TOKEN="$VERSION"
36-
37-
echo "Looking in README for '$VERSION'"
38-
if ! grep -q "$TOKEN" "$README"; then
39-
echo "Main README does not list the correct version of DTVF!"
40-
exit -1
41-
fi
42-
echo "Main README has been updated."
43-
44-
4533
# Check that the change log contains an entry for that version
4634
CHANGELOG="./web/digital-twin-vis-framework/CHANGELOG.md"
4735
TOKEN="# $VERSION"

Deploy/stacks/dynamic/stack-clients/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: '3.8'
22
services:
33
stack-client:
4-
image: docker.cmclinnovations.com/stack-client${IMAGE_SUFFIX}:1.12.2
4+
image: docker.cmclinnovations.com/stack-client${IMAGE_SUFFIX}:1.13.0
55
secrets:
66
- blazegraph_password
77
- postgis_password

Deploy/stacks/dynamic/stack-clients/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<groupId>com.cmclinnovations</groupId>
99
<artifactId>stack-clients</artifactId>
10-
<version>1.12.2</version>
10+
<version>1.13.0</version>
1111

1212
<name>Stack Clients</name>
1313
<url>https://www.cmclinnovations.com</url>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.cmclinnovations.stack.services;
2+
3+
import com.cmclinnovations.stack.services.config.ServiceConfig;
4+
5+
public class VisualisationService extends ContainerService {
6+
7+
public static final String TYPE = "visualisation";
8+
9+
public VisualisationService(String stackName, ServiceConfig config) {
10+
super(stackName, config);
11+
}
12+
13+
@Override
14+
public void doPreStartUpConfiguration() {
15+
ensureOptionalSecret("mapbox_username");
16+
ensureOptionalSecret("mapbox_api_key");
17+
}
18+
}

Deploy/stacks/dynamic/stack-clients/src/main/resources/com/cmclinnovations/stack/services/built-ins/visualisation.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"type": "visualisation",
23
"ServiceSpec": {
34
"Name": "visualisation",
45
"TaskTemplate": {
@@ -10,6 +11,20 @@
1011
"Source": "vis-files",
1112
"Target": "/var/www/html"
1213
}
14+
],
15+
"Secrets": [
16+
{
17+
"SecretName": "mapbox_username",
18+
"File": {
19+
"Name": "/var/www/html/mapbox_username"
20+
}
21+
},
22+
{
23+
"SecretName": "mapbox_api_key",
24+
"File": {
25+
"Name": "/var/www/html/mapbox_api_key"
26+
}
27+
}
1328
]
1429
}
1530
}

Deploy/stacks/dynamic/stack-data-uploader/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: '3.8'
22
services:
33
stack-data-uploader:
4-
image: docker.cmclinnovations.com/stack-data-uploader${IMAGE_SUFFIX}:1.12.2
4+
image: docker.cmclinnovations.com/stack-data-uploader${IMAGE_SUFFIX}:1.13.0
55
secrets:
66
- blazegraph_password
77
- postgis_password

Deploy/stacks/dynamic/stack-data-uploader/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<groupId>com.cmclinnovations</groupId>
99
<artifactId>stack-data-uploader</artifactId>
10-
<version>1.12.2</version>
10+
<version>1.13.0</version>
1111

1212
<name>Stack Data Uploader</name>
1313
<url>https://www.cmclinnovations.com</url>
@@ -29,7 +29,7 @@
2929
<dependency>
3030
<groupId>com.cmclinnovations</groupId>
3131
<artifactId>stack-clients</artifactId>
32-
<version>1.12.2</version>
32+
<version>1.13.0</version>
3333
</dependency>
3434

3535
<dependency>

Deploy/stacks/dynamic/stack-manager/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,12 @@ The format of the stack configuration file is as follows:
268268

269269
## Example - including a visualisation
270270

271-
This example explains how to spin up a DTVF based visualisation container within a stack. The visualisation container requires a volume called `vis-files` to be populated.
271+
This example explains how to spin up a DTVF based visualisation container within a stack. The visualisation container requires a volume called `vis-files` to be populated and secrets `mapbox_username`, and `mapbox_api_key` to be created.
272272
The steps to configure the stack are as follows:
273273
* Enable the visualisation container by adding it to the `services` `includes` list in the stack config file.
274274
* Specify the sub-directory of the `stack-manager/inputs/data/` folder from which the custom files that configure the visualisation should be copied, in this example the sub-directory is called `webspace`.
275275
* Copy the custom files that configure the visualisation in to that directory, in this example `stack-manager/inputs/data/webspace`.
276+
* Create `mapbox_username` and `mapbox_api_key` files in the `stack-manager/inputs/secrets` and populate with the relevant credentials.
276277

277278
The final stack config file should contain the following content:
278279
```json

Deploy/stacks/dynamic/stack-manager/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: '3.8'
22
services:
33
stack-manager:
4-
image: docker.cmclinnovations.com/stack-manager${IMAGE_SUFFIX}:1.12.2
4+
image: docker.cmclinnovations.com/stack-manager${IMAGE_SUFFIX}:1.13.0
55
environment:
66
EXTERNAL_PORT: "${EXTERNAL_PORT-3838}"
77
STACK_BASE_DIR: "${STACK_BASE_DIR-}"

Deploy/stacks/dynamic/stack-manager/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<groupId>com.cmclinnovations</groupId>
99
<artifactId>stack-manager</artifactId>
10-
<version>1.12.2</version>
10+
<version>1.13.0</version>
1111

1212
<name>Stack Manager</name>
1313
<url>https://www.cmclinnovations.com</url>
@@ -29,7 +29,7 @@
2929
<dependency>
3030
<groupId>com.cmclinnovations</groupId>
3131
<artifactId>stack-clients</artifactId>
32-
<version>1.12.2</version>
32+
<version>1.13.0</version>
3333
</dependency>
3434

3535
<dependency>

0 commit comments

Comments
 (0)