Skip to content

Commit aa50d2c

Browse files
ukellergrealish
authored andcommitted
demo scripts
1 parent 7485351 commit aa50d2c

File tree

5 files changed

+56
-4
lines changed

5 files changed

+56
-4
lines changed

.dockerignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
build_demo.sh
2+
secrets.env
3+
target
4+
.gitignore
5+
.git
6+
.cache
7+
parsec_docker_cache

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ dependency-reduced-pom.xml
55
.idea
66
.run/gg_*
77
.run/parsec_docker_run.run.xml
8+
secrets.env
9+

build_demo.sh

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,53 @@
11
#!/bin/bash
22
pushd $(dirname $0)
3+
4+
function build_greengrass_patched() {
35
pushd examples/greengrass/parsec-greengrass-run-config/docker/
4-
pwd
5-
docker build . --tag parallaxsecond/greengrass_demo:latest
6+
docker build . --tag parallaxsecond/greengrass_patched:latest
67
popd
8+
}
79

10+
function build_parsec_containers() {
811
pushd ./parsec-testcontainers/
912
./build.sh
1013
popd
14+
}
15+
16+
function build_greengrass_with_provider() {
17+
docker build . -f greengrass_demo/Dockerfile --tag parallaxsecond/greengrass_demo:latest
18+
}
19+
20+
build_greengrass_patched
21+
build_parsec_containers
22+
build_greengrass_with_provider
23+
24+
25+
docker rm -f parsec_docker_run > /dev/null
26+
docker run -d --name parsec_docker_run \
27+
-ti \
28+
-v GG_PARSEC_STORE:/var/lib/parsec/mappings \
29+
-v GG_PARSEC_SOCK:/run/parsec \
30+
parallaxsecond/parsec:0.8.1
31+
32+
33+
GG_THING_NAME=$(id -un)-gg-test
34+
35+
source secrets.env
1136

37+
function gg_run() {
38+
docker rm -f "${1}" >/dev/null
39+
# shellcheck disable=SC2086
40+
docker run ${3} --name "${1}" \
41+
-e GG_THING_NAME="${GG_THING_NAME}" \
42+
-e GG_ADDITIONAL_CMD_ARGS="--trusted-plugin /provider.jar" \
43+
-e AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID}" \
44+
-e AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY}" \
45+
-e AWS_REGION="${AWS_REGION}" \
46+
-v GG_PARSEC_SOCK:/run/parsec \
47+
-v GG_HOME:/home/ggc_user \
48+
parallaxsecond/greengrass_demo:latest "${2}"
49+
}
1250

13-
docker build . -f greengrass_demo/Dockerfile
51+
gg_run greengrass_demo_provisioning provision
52+
gg_run greengrass_demo_run run -d
1453

parsec-testcontainers/parsec/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ COPY --from=builder --chown=${PARSEC_UID}:${PARSEC_GID} /home/parsec /home/parse
6565
COPY --from=builder --chown=${PARSEC_UID}:${PARSEC_GID} /run/parsec /run/parsec
6666
COPY --from=builder --chown=${PARSEC_UID}:${PARSEC_GID} /etc/parsec /etc/parsec
6767

68-
USER parsec:parsec
68+
# FIXME volume mount problem
69+
# Volumes are mounted as root first
70+
#USER parsec:parsec
6971
WORKDIR "/home/parsec"
7072
CMD ["parsec", "-c", "/etc/parsec/config.toml"]

parsec-testcontainers/pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2222
<maven.compiler.source>1.8</maven.compiler.source>
2323
<maven.compiler.target>1.8</maven.compiler.target>
24+
<containers.skip>false</containers.skip>
2425
</properties>
2526
<build>
2627
<plugins>
@@ -37,6 +38,7 @@
3738
</goals>
3839
<phase>package</phase>
3940
<configuration>
41+
<skip>${containers.skip}</skip>
4042
<executable>./build.sh</executable>
4143
<workingDirectory>${project.basedir}</workingDirectory>
4244
</configuration>

0 commit comments

Comments
 (0)