diff --git a/salt/registry/bin/so-buildregistry.sh b/salt/registry/bin/so-buildregistry similarity index 95% rename from salt/registry/bin/so-buildregistry.sh rename to salt/registry/bin/so-buildregistry index 41e9a035d..9231de1df 100644 --- a/salt/registry/bin/so-buildregistry.sh +++ b/salt/registry/bin/so-buildregistry @@ -7,7 +7,6 @@ TARBALL=/nsm/docker-registry/docker/so-dockers-$VERSION.tar if [ -f "$TARBALL" ]; then cd /nsm/docker-registry/docker tar xvf so-dockers-$VERSION.tar - rm $TARBALL else exit fi diff --git a/salt/registry/init.sls b/salt/registry/init.sls index ac6cc1795..099219d41 100644 --- a/salt/registry/init.sls +++ b/salt/registry/init.sls @@ -26,6 +26,16 @@ dockerregistryconf: - name: /opt/so/conf/docker-registry/etc/config.yml - source: salt://registry/etc/config.yml +# Copy the registry script +dockerregistrybuild: + file.managed: + - name: /opt/so/conf/docker-registry/so-buildregistry + - source: salt://registry/bin/so-buildregistry + +dockerexpandregistry: + cmd.run: + - name: /opt/so/conf/docker-registry/so-buildregistry + # Install the registry container so-dockerregistry: docker_container.running: diff --git a/setup/functions.sh b/setup/functions.sh index 225bc64b9..bfe626fed 100644 --- a/setup/functions.sh +++ b/setup/functions.sh @@ -457,6 +457,7 @@ docker_registry() { docker_seed_registry() { VERSION="HH1.1.4" TRUSTED_CONTAINERS=( \ + "so-acng:$VERSION" \ "so-auth-api:$VERSION" \ "so-auth-ui:$VERSION" \ "so-core:$VERSION" \ @@ -489,22 +490,28 @@ docker_seed_registry() { "so-wazuh:$VERSION" \ "so-zeek:$VERSION" ) - for i in "${TRUSTED_CONTAINERS[@]}" - do - # Pull down the trusted docker image - echo "Downloading $i" - docker pull --disable-content-trust=false docker.io/soshybridhunter/$i - # Tag it with the new registry destination - docker tag soshybridhunter/$i $HOSTNAME:5000/soshybridhunter/$i - docker push $HOSTNAME:5000/soshybridhunter/$i - done + if [ ! -f /nsm/docker-registry/docker/so-dockers-1.1.4.tar ]; then + # Download the container from the interwebs + for i in "${TRUSTED_CONTAINERS[@]}" + do + # Pull down the trusted docker image + echo "Downloading $i" + docker pull --disable-content-trust=false docker.io/soshybridhunter/$i + # Tag it with the new registry destination + docker tag soshybridhunter/$i $HOSTNAME:5000/soshybridhunter/$i + docker push $HOSTNAME:5000/soshybridhunter/$i + done + + for i in "${TRUSTED_CONTAINERS[@]}" + do + echo "Removing $i locally" + docker rmi soshybridhunter/$i + done + else + # We already have the goods son + rm /nsm/docker-registry/docker/so-dockers-$VERSION.tar + fi - for i in "${TRUSTED_CONTAINERS[@]}" - do - echo "Removing $i locally" - docker rmi soshybridhunter/$i - done - } es_heapsize() {