-
Notifications
You must be signed in to change notification settings - Fork 0
/
bvdemo.sh
executable file
·80 lines (70 loc) · 1.79 KB
/
bvdemo.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/sh
# Example of how to use bmaster.sh and bvslave-lxc.sh
# once you've created foo/{buildshim,master.cfg,slot.txt}
# You'll usually give these commands by hand.
# No commands need be given at system startup; the bots will start automatically.
set -e
set -x
projects="hellozlib.master"
guests="ubu1004 ubu1204"
install_and_start()
{
if ! test -d /data/lxc
then
echo "Please create directory /data/lxc on a volume with several gigabytes of free space"
exit 1
fi
if ! test -f ~/myconfig.json
then
abort "Can't initialize if you haven't put your secrets file at ~/myconfig.json"
fi
sh bmaster.sh install
for guest in $guests
do
sh bvslave-lxc.sh $guest install
done
for proj in $projects
do
for guest in $guests
do
sh bvslave-lxc.sh $guest init $proj
done
done
for proj in $projects
do
sh bmaster.sh init $proj
done
sh bservice.sh start
# It seems to take the slaves 30 seconds to wake up and get their DNS working
# FIXME
sleep 30
# Eyeball the bots' output to see if there are any obvious errors
for proj in $projects
do
echo =========== Last ten lines of logs for $proj ============
sleep 3
sh blogs.sh $proj tail
done
}
stop_and_uninstall()
{
sh bservice.sh stop || true
for proj in $projects
do
sh bmaster.sh uninit $proj || true
for guest in $guests
do
sh bvslave-lxc.sh $guest uninit $proj || true
done
done
sh bmaster.sh uninstall || true
for guest in $guests
do
sh bvslave-lxc.sh $guest uninstall || true
done
}
case $1 in
install) install_and_start ;;
uninstall) stop_and_uninstall ;;
*) echo Usage: $0 'install|uninstall';;
esac