forked from singularityhub/singularity-compose-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrebuild.sh
executable file
·36 lines (26 loc) · 1.09 KB
/
rebuild.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
set -eo pipefail
echo "[1/8] stopping existing instance"
singularity-compose stop || true
echo "[2/8] cleanup sbr0 network interface"
sudo ip link delete sbr0 || true
echo "[3/8] copy local bridge config to usr folder and backup original config"
if ! [ -f 00_bridge.conflist.original ]; then
sudo cp /usr/local/etc/singularity/network/00_bridge.conflist 00_bridge.conflist.original
sudo cp 00_bridge.conflist /usr/local/etc/singularity/network/00_bridge.conflist
fi
# (docker-compose build --no-cache equivalent) #OPTIONAL
echo "[4/8] cleaning cache and old image"
singularity cache clean -f || true
echo "[5/8] removing old sif image" #OPTIONAL
rm -f redis.sif
echo "[6/8] removing etc.hosts and resolv.conf"
rm -f etc.hosts
rm -f resolv.conf
echo "[7/8] running singularity-compose"
singularity-compose build && singularity-compose up -d
echo "[8/8] show instances"
singularity-compose ps
printf "\n"
echo "NOTE: to recover original /usr/local/etc/singularity/network/00_bridge.conflist run:"
echo "sudo cp 00_bridge.conflist.original /usr/local/etc/singularity/network/00_bridge.conflist"