diff --git a/v2.0/custom-network/00_bridge.conflist b/v2.0/custom-network/50_redis.conflist similarity index 91% rename from v2.0/custom-network/00_bridge.conflist rename to v2.0/custom-network/50_redis.conflist index e7f3cf2..4b83f54 100644 --- a/v2.0/custom-network/00_bridge.conflist +++ b/v2.0/custom-network/50_redis.conflist @@ -1,10 +1,10 @@ { "cniVersion": "0.4.0", - "name": "bridge", + "name": "redis", "plugins": [ { "type": "bridge", - "bridge": "sbr0", + "bridge": "srr0", "isGateway": true, "ipMasq": true, "ipam": { @@ -24,4 +24,4 @@ "snat": true } ] -} \ No newline at end of file +} diff --git a/v2.0/custom-network/50_static.conflist b/v2.0/custom-network/50_static.conflist deleted file mode 100644 index 54af934..0000000 --- a/v2.0/custom-network/50_static.conflist +++ /dev/null @@ -1,34 +0,0 @@ -{ - "cniVersion": "0.4.0", - "name": "static-redis", - "plugins": [ - { - "type": "bridge", - "bridge": "sbr0", - "isGateway": true, - "ipMasq": true, - "ipam": { - "type": "static", - "addresses": [ - { - "address": "192.168.20.10/24", - "gateway": "192.168.20.254" - } - ], - "routes": [ - { "dst": "0.0.0.0/0" } - ] - } - }, - { - "type": "firewall" - }, - { - "type": "portmap", - "capabilities": { - "portMappings": true - }, - "snat": true - } - ] -} diff --git a/v2.0/custom-network/rebuild.sh b/v2.0/custom-network/rebuild.sh index 6bd62aa..f533375 100755 --- a/v2.0/custom-network/rebuild.sh +++ b/v2.0/custom-network/rebuild.sh @@ -2,21 +2,32 @@ set -eo pipefail -echo "[1/6] stopping existing instance" -sudo singularity instance stop redis || true +echo "[1/8] stopping existing instance" +singularity-compose stop || true + +echo "[2/8] copy config to usr folder" +sudo cp 50_redis.conflist /usr/local/etc/singularity/network/50_redis.conflist # (docker-compose build --no-cache equivalent) #OPTIONAL -echo "[2/6] cleaning cache and old image" +echo "[3/8] cleaning cache and old image" singularity cache clean -f || true -echo "[3/6] removing old sif image" #OPTIONAL +echo "[4/8] removing old sif image" #OPTIONAL rm -f redis.sif -echo "[4/6] building sif image" -sudo singularity build redis.sif redis.def || true +echo "[5/8] removing etc.hosts and resolv.conf" +rm -f etc.hosts +rm -f resolv.conf + +echo "[7/8] building new instance" +singularity-compose build + +echo "[7/8] running singularity-compose" +singularity-compose --debug up -d -echo "[5/6] spinning up a new redis instance" -sudo singularity instance start --hostname redis --writable-tmpfs --net --network-args "portmap=6379:6379/tcp" $PWD/redis.sif redis +echo "[8/8] show instances" +singularity-compose ps -echo "[6/6] launching redis server in background" -sudo singularity exec instance://redis redis-server --bind 0.0.0.0 --requirepass ThisIsNotAStrongPassword! & +printf "\n" +echo "NOTE: to recover original configuration setup and delete new configuration run:" +echo "sudo rm -f /usr/local/etc/singularity/network/50_redis.conflist" diff --git a/v2.0/custom-network/singularity-compose.yml b/v2.0/custom-network/singularity-compose.yml index 7b980d0..4c2bb5e 100644 --- a/v2.0/custom-network/singularity-compose.yml +++ b/v2.0/custom-network/singularity-compose.yml @@ -14,9 +14,9 @@ instances: network: enable: true allocate_ip: true - + type: redis # If network args are provided, none is not used - args: - - '"portmap=6379:6379/tcp"' + #args: + # - '"portmap=6379:6379/tcp"' ports: - 6379:6379