|
1 | 1 | #!/bin/bash |
2 | 2 | pushd $(dirname $0) |
| 3 | + |
| 4 | +function build_greengrass_patched() { |
3 | 5 | 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 |
6 | 7 | popd |
| 8 | +} |
7 | 9 |
|
| 10 | +function build_parsec_containers() { |
8 | 11 | pushd ./parsec-testcontainers/ |
9 | 12 | ./build.sh |
10 | 13 | 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 |
11 | 36 |
|
| 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 | +} |
12 | 50 |
|
13 | | -docker build . -f greengrass_demo/Dockerfile |
| 51 | +gg_run greengrass_demo_provisioning provision |
| 52 | +gg_run greengrass_demo_run run -d |
14 | 53 |
|
0 commit comments