Skip to content

fix network configuration for custom network #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"cniVersion": "0.4.0",
"name": "bridge",
"name": "redis",
"plugins": [
{
"type": "bridge",
"bridge": "sbr0",
"bridge": "srr0",
"isGateway": true,
"ipMasq": true,
"ipam": {
Expand All @@ -24,4 +24,4 @@
"snat": true
}
]
}
}
34 changes: 0 additions & 34 deletions v2.0/custom-network/50_static.conflist

This file was deleted.

31 changes: 21 additions & 10 deletions v2.0/custom-network/rebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
6 changes: 3 additions & 3 deletions v2.0/custom-network/singularity-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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