Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions VCAC-A/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ You can setup the VCAC-A as a docker swarm worker node. Any subsequent deploymen

Run the [setup_swarm.sh](./script/setup_swarm.sh) script on the host to setup docker swarm. The script initializes the host as a swarm master and labels the VCAC-A with `vcac_zone=yes`.

> The Docker Swarm mode is limited to a single VCAC-A on a host system, (because `docker swarm init` must bind to a specific network interface,) unless you use the [WeaveNet](#setup-weavenet) workaround. In such a case, initialize docker swarm with `./setup_swarm.sh $(/usr/local/bin/weave expose)`.

#### Develop Docker-Compose Script:

Docker Compose File Format version 3 does not support device mount. We need to use the [docker-in-docker](https://hub.docker.com/_/docker) workaround (to be able to mount the media and analytics devices.) The workaround launches a privileged docker container that subsequently runs the application container. The [`vcac-container-launcher:latest`](https://github.com/OpenVisualCloud/Smart-City-Sample/blob/master/analytics/common/VCAC-A/Dockerfile.1.launcher) Dockerfile builds to an enhanced dock-in-docker image that additionally passes on environment variables, mounts network and volumes, and gracefully shutdown.
Expand Down
8 changes: 4 additions & 4 deletions VCAC-A/script/setup_swarm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# setup host docker swarm if not already
docker swarm leave --force 2> /dev/null || true
docker swarm init --advertise-addr=$(sudo vcactl config-show |awk '/gateway/{print$2;exit}') 2>/dev/null || true
docker swarm init --advertise-addr=${1:-$(sudo vcactl config-show |awk '/gateway/{print$2;exit}')} 2>/dev/null || true
JOINCMD=$(docker swarm join-token worker | grep token)

NODEUSER="root"
Expand All @@ -15,9 +15,9 @@ done

# setup node labels
for id in $(docker node ls -q 2>/dev/null); do
nodeip="$(docker node inspect -f {{.Status.Addr}} $id)"
if test -n "$(echo $NODES | grep --fixed-strings $nodeip)"; then
echo "label $id: vcac_zone=yes"
nodename="$(docker node inspect -f {{.Description.Hostname}} $id)"
if test -n "$(sudo vcactl config-show | awk -v name=$nodename '/node-name:/&&$2==name{print 1}')"; then
echo "label $nodename: vcac_zone=yes"
docker node update --label-add vcac_zone=yes $id
fi
done