-
Notifications
You must be signed in to change notification settings - Fork 3
/
bootstrap-devopen.sh
101 lines (88 loc) · 2.82 KB
/
bootstrap-devopen.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/bash
# Install base
apt-get update
apt-get install -y build-essential g++ curl libssl-dev apache2-utils git libxml2-dev sshfs tmux
# Install Node.js
curl -sL https://deb.nodesource.com/setup_6.x | bash -
apt-get install -y nodejs
# run the remaining commands as the vagrant user
su vagrant <<EOF
pushd /home/vagrant/tutorial/
# Install Cloud9
git clone https://github.com/fno2010/core.git -b devopen ./cloud9
./cloud9/scripts/install-sdk.sh
# Tweak standlone.js conf
sed -i -e 's_127.0.0.1_0.0.0.0_g' ./cloud9/configs/standalone.js
# Install plugins
pushd /home/vagrant/tutorial/cloud9/plugins
if [ ! -d "snlab.devopen.newresource" ]; then
git clone https://github.com/snlab/snlab.devopen.newresource
else
pushd snlab.devopen.newresource
git pull
popd
fi
if [ ! -d "snlab.devopen.controller" ]; then
git clone https://github.com/snlab/snlab.devopen.controller
if [ ! -d "/home/vagrant/bin" ]; then
mkdir -p /home/vagrant/bin
export PATH=$PATH:/home/vagrant/bin
fi
else
pushd snlab.devopen.controller
git pull
popd
fi
pushd /home/vagrant/bin
npm install ssh2 && npm install scp2 && npm install optimist
popd
cp ./snlab.devopen.controller/deploy.js /home/vagrant/bin/deploy
if [ ! -d "snlab.devopen.server" ]; then
git clone https://github.com/snlab/snlab.devopen.server
else
pushd snlab.devopen.server
git pull
popd
fi
if [ ! -d "snlab.devopen.topoeditor" ]; then
git clone https://github.com/snlab/snlab.devopen.topoeditor
else
pushd snlab.devopen.topoeditor
git pull
popd
fi
if [ ! -d "cloud9-docker" ]; then
git clone https://github.com/fno2010/cloud9-docker.git -b devopen
else
pushd cloud9-docker
git pull
popd
fi
cp -fr /home/vagrant/tutorial/cloud9/plugins/cloud9-docker/conf/test-config.js /home/vagrant/tutorial/cloud9/configs/
cp -fr /home/vagrant/tutorial/cloud9/plugins/cloud9-docker/conf/client-workspace-test.js /home/vagrant/tutorial/cloud9/configs/
popd
# Add workspace
if [ ! -d "/home/vagrant/tutorial/workspace" ]; then
mkdir /home/vagrant/tutorial/workspace
fi
# Add topologies directory by default
if [ ! -d "/home/vagrant/tutorial/workspace/topologies" ]; then
mkdir -p /home/vagrant/tutorial/workspace/topologies
fi
cp -r /vagrant/utils/topologies/* /home/vagrant/tutorial/workspace/topologies/
# Add start cloud9
echo "nodejs /home/vagrant/tutorial/cloud9/server.js test-config -s standalone --workspacetype=test -l 0.0.0.0 -p 9000 -w /home/vagrant/tutorial/workspace" > /home/vagrant/tutorial/cloud9/start.sh
sudo chmod 755 /home/vagrant/tutorial/cloud9/start.sh
popd
# Install express, ssh2, body-parser
pushd /home/vagrant/tutorial/cloud9
npm install body-parser
npm install express
npm install ssh2
npm install sqlite3
npm install request
popd
EOF
# Clean up APT when done.
sudo apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
echo "devopen has been installed sucessfully."