This repository has been archived by the owner on Aug 27, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdeploy.sh
72 lines (54 loc) · 2.2 KB
/
deploy.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
# Installing system libs, tools and gems
echo "Attention: make, automake, gcc, gcc-c++, kernel-devel, ruby-devel, zeromq, zeromq-devel libs and zmqjsonrpc gem will be installed."
#echo -n "You have 5 sec before some dangerous stuff will started..."
#echo -n '5..' && sleep 1 && echo -n '4..' && sleep 1 && echo -n '3..' && sleep 1 && echo -n '2..' && sleep 1 && echo -n '1..' && sleep 1 && echo 'Go'
sed -i 's/enabled\=1/enabled\=0/g' /etc/yum.repos.d/opennebula.repo
sed -i 's/enabled\=1/enabled\=0/g' /etc/yum.repos.d/vonecloud.repo
yum install -y git make automake gcc gcc-c++ kernel-devel ruby-devel zeromq zeromq-devel
gem install zmqjsonrpc
sed -i 's/enabled\=0/enabled\=1/g' /etc/yum.repos.d/opennebula.repo
sed -i 's/enabled\=0/enabled\=1/g' /etc/yum.repos.d/vonecloud.repo
# Creating gem-test file
echo "require 'zmqjsonrpc'
class TestHand
def test_func(msg)
return 'pong' if msg == 'ping'
end
end
server = ZmqJsonRpc::Server.new(TestHand.new, 'tcp://*:666666')
Thread.new do
server.server_loop
end
client = ZmqJsonRpc::Client.new('tcp://localhost:666666')
if client.test_func('ping') == 'pong' then
puts 'OK'
else
puts 'FAIL'
end" > gemtest.rb
# Testing how the lib was installed
UNIT=`/usr/bin/ruby gemtest.rb`
if [ "$UNIT" == 'OK' ]; then
echo '++++++++++++++++++++++++++++++++++++++++++++++'
echo '+ Deploy process finished successfuly! +'
echo '++++++++++++++++++++++++++++++++++++++++++++++'
else
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo "+ Something went wrong, it's maybe caused by 'zmqjsonrpc' gem installing... +"
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
fi
git clone --branch stable https://github.com/ione-cloud/ione-cloud-core.git
mv ione-cloud-core ione-cloud
cd ione-cloud
cp -f utils/ione /usr/bin
chmod +x /usr/bin/ione
DIR=`pwd`
echo >> ~/.bashrc
echo "export IONEROOT=\"$DIR/server\"" >> ~/.bashrc
echo 'export IONELOGROOT="/var/log/ione"' >> ~/.bashrc
systemctl set-environment IONEROOT=$IONEROOT
cp -f utils/ione.service /lib/systemd/system/ione.service
systemctl daemon-reload
mkdir /var/log/ione
rm -f ./gemtest.rb
rm -f ./deploy.sh
rm -f .gitignore