forked from docc-lab/openstack-build-ubuntu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup-pythia.sh
executable file
·257 lines (219 loc) · 8.64 KB
/
setup-pythia.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
#!/bin/bash
set -x
DIRNAME=`dirname $0`
# Gotta know the rules!
if [ $EUID -ne 0 ] ; then
echo "This script must be run as root" 1>&2
exit 1
fi
# Grab our libs
. "$DIRNAME/setup-lib.sh"
# Don't run setup-pythia.sh twice
if [ -f $OURDIR/setup-pythia-done ]; then
echo "setup-pythia already ran; not running again"
exit 0
fi
logtstart "pythia"
#
# openstack CLI commands seem flakey sometimes on Kilo and Liberty.
# Don't know if it's WSGI, mysql dropping connections, an NTP
# thing... but until it gets solved more permanently, have to retry :(.
#
__openstack() {
__err=1
__debug=
__times=0
while [ $__times -lt 16 -a ! $__err -eq 0 ]; do
openstack $__debug "$@"
__err=$?
if [ $__err -eq 0 ]; then
break
fi
__debug=" --debug "
__times=`expr $__times + 1`
if [ $__times -gt 1 ]; then
echo "ERROR: openstack command failed: sleeping and trying again!"
sleep 8
fi
done
}
if [ -f $SETTINGS ]; then
. $SETTINGS
fi
maybe_install_packages pssh chrony
PSSH='/usr/bin/parallel-ssh -t 0 -O StrictHostKeyChecking=no '
PSCP='/usr/bin/parallel-scp -t 0 -O StrictHostKeyChecking=no '
cd /local
# Update repositories
for repo in "dotfiles" "nova" "neutron" "osc_lib" "oslo.messaging" "osprofiler" "python-openstackclient" "oslo.log" "python-novaclient"
do
cd /local/$repo
# no key needed for public repos
# GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no -i /local/.ssh/$repo" git fetch --all
git fetch -all
git checkout $(git status | head -n 1 | awk '{print $3}') -f
# GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no -i /local/.ssh/$repo" git pull
git pull
cd /local
done
# Remove reconstruction repo & clone new pythia repo
echo "y" | rm -r /local/reconstruction/
sudo echo "y" | rm -i /users/geniuser/reconstruction
#git clone https://github.com/docc-lab/cacti-dev.git
git clone https://github.com/docc-lab/cacti-dev.git pythia
chmod -R 777 /local/pythia
#chmod -R 777 /local/cacti-dev
PHOSTS=""
mkdir -p $OURDIR/pssh.setup-pythia.stdout $OURDIR/pssh.setup-pythia.stderr
for node in $COMPUTENODES
do
PHOSTS="$PHOSTS -H $node"
done
echo "*** Setting up Pythia on compute nodes: $PHOSTS"
$PSSH -v $PHOSTS -o $OURDIR/pssh.setup-pythia.stdout \
-e $OURDIR/pssh.setup-pythia.stderr $DIRNAME/setup-pythia-compute.sh
maybe_install_packages python3-pip
# Bring back rustup for compilation error
su geniuser -c "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y"
source $HOME/.cargo/env
rustup update stable
echo "**** Mert updating rust for match compile error ***"
chown geniuser -R /local/pythia
#su geniuser -c "cargo update --manifest-path /local/pythia/Cargo.toml -p lexical-core"
#su geniuser -c "cargo update --manifest-path /local/pythia/pythia_server/Cargo.toml -p lexical-core"
#su geniuser -c "cargo install --locked --path /local/pythia"
#su geniuser -c "cargo install --locked --path /local/pythia/pythia_server"
echo "phase 0" >> cargo_phases.txt
su geniuser -c "cargo update --manifest-path /local/pythia/Cargo.toml -p lexical-core" > /local/lc0_out.txt 2> /local/lc0_err.txt
echo "phase 1" >> cargo_phases.txt
su geniuser -c "cargo update --manifest-path /local/pythia/pythia_server/Cargo.toml -p lexical-core" > /local/lc1_out.txt 2> /local/lc1_err.txt
echo "phase 2" >> cargo_phases.txt
su geniuser -c "cargo install --locked --path /local/pythia" > /local/pythia_out.txt 2> /local/pythia_err.txt
echo "phase 3" >> cargo_phases.txt
su geniuser -c "cargo install --locked --path /local/pythia/pythia_server" > /local/pythia_server_out.txt 2> /local/pythia_server_err.txt
echo "phase 4" >> cargo_phases.txt
sudo ln -s /users/geniuser/.cargo/bin/pythia_server /usr/local/bin/
sudo ln -s /users/geniuser/.cargo/bin/pythia /usr/bin/pythia
sudo ln -s /local/pythia /users/geniuser/
sudo ln -s /local/dotfiles /users/geniuser/
#chown geniuser -R /local/cacti-dev
#su geniuser -c "cargo update --manifest-path /local/cacti-dev/Cargo.toml -p lexical-core"
#su geniuser -c "cargo update --manifest-path /local/cacti-dev/pythia_server/Cargo.toml -p lexical-core"
#su geniuser -c "cargo install --locked --path /local/cacti-dev"
#su geniuser -c "cargo install --locked --path /local/cacti-dev/pythia_server"
#sudo ln -s /users/geniuser/.cargo/bin/pythia_server /usr/local/bin/
#sudo ln -s /users/geniuser/.cargo/bin/pythia /usr/bin/pythia
#sudo ln -s /local/cacti-dev /users/geniuser/
#sudo ln -s /local/dotfiles /users/geniuser/
mkdir -p /opt/stack/manifest
chmod -R g+rwX /opt/
chmod -R o+rwX /opt/
maybe_install_packages redis-server python-redis python3-redis python3-pip
service_start redis
profiler_conf=$(cat <<END
[profiler]
enabled = True
connection_string = redis://localhost:6379
hmac_keys = Devstack1
trace_wsgi_transport = True
trace_message_store = True
trace_management_store = True
trace_sqlalchemy = False
END
)
echo "$profiler_conf" >> /etc/nova/nova.conf
echo "$profiler_conf" >> /etc/keystone/keystone.conf
echo "$profiler_conf" >> /etc/cinder/cinder.conf
echo "$profiler_conf" >> /etc/neutron/neutron.conf
echo "$profiler_conf" >> /etc/glance/glance-api.conf
for project in "osprofiler" "osc_lib" "python-openstackclient" "nova" "oslo.messaging" "neutron" "oslo.log" "python-novaclient"
do
pip3 install --force-reinstall --no-deps -U /local/$project
done
chmod o+rX /etc/nova
chmod g+rX /etc/nova
chmod o+r /etc/nova/nova.conf
chmod g+r /etc/nova/nova.conf
# sudo sed -i 's/level = .*/level = DEBUG/g' /etc/nova/logging.conf
# sudo sed -i 's/level=.*/level=DEBUG/g' /etc/keystone/logging.conf
service_restart mysql.service
service_restart apache2.service
service_restart ceilometer-agent-central.service
service_restart ceilometer-agent-notification.service
service_restart chrony.service
sudo systemctl stop ntp.service
sudo systemctl disable ntp.service
service_restart cinder-scheduler.service
service_restart cinder-volume.service
service_restart designate-api.service
service_restart designate-central.service
service_restart designate-mdns.service
service_restart designate-producer.service
service_restart designate-worker.service
service_restart glance-api.service
service_restart gnocchi-metricd.service
service_restart heat-api-cfn.service
service_restart heat-api.service
service_restart heat-engine.service
service_restart magnum-api.service
service_restart magnum-conductor.service
service_restart manila-api.service
service_restart manila-scheduler.service
service_restart manila-share.service
service_restart memcached.service
service_restart neutron-dhcp-agent.service
service_restart neutron-l3-agent.service
service_restart neutron-lbaasv2-agent.service
service_restart neutron-metadata-agent.service
service_restart neutron-metering-agent.service
service_restart neutron-openvswitch-agent.service
service_restart neutron-ovs-cleanup.service
service_restart neutron-server.service
service_restart nginx.service
service_restart nova-api.service
service_restart nova-conductor.service
service_restart nova-consoleauth.service
service_restart nova-novncproxy.service
service_restart nova-scheduler.service
service_restart rabbitmq-server.service
service_restart redis-server.service
service_restart sahara-engine.service
service_restart swift-account-auditor.service
service_restart swift-account-reaper.service
service_restart swift-account-replicator.service
service_restart swift-account.service
service_restart swift-container-auditor.service
service_restart swift-container-replicator.service
service_restart swift-container-sync.service
service_restart swift-container-updater.service
service_restart swift-container.service
service_restart swift-object-auditor.service
service_restart swift-object-reconstructor.service
service_restart swift-object-replicator.service
service_restart swift-object-updater.service
service_restart swift-object.service
service_restart swift-proxy.service
service_restart trove-api.service
service_restart trove-conductor.service
service_restart trove-taskmanager.service
sudo chronyc -a 'burst 4/4'
wget https://download.cirros-cloud.net/0.5.1/cirros-0.5.1-${ARCH}-disk.img
openstack image create --file cirros-0.5.1-${ARCH}-disk.img cirros
sudo ln -s /local/pythia/etc/systemd/system/pythia.service /etc/systemd/system/
sudo ln -s /local/pythia/etc/pythia /etc/
chmod -R g+rwX /etc/pythia
chmod -R o+rwX /etc/pythia
chmod -R 777 /local/pythia/workloads
#sudo ln -s /local/cacti-dev/etc/systemd/system/pythia.service /etc/systemd/system/
#sudo ln -s /local/cacti-dev/etc/pythia /etc/
#chmod -R g+rwX /etc/pythia
#chmod -R o+rwX /etc/pythia
#
#chmod -R 777 /local/cacti-dev/workloads
sudo systemctl start pythia.service
touch $OURDIR/setup-pythia-done
logtend "pythia"
chown geniuser -R /local
su geniuser -c 'cd /local/dotfiles; ./setup_cloudlab.sh'
sudo chsh geniuser --shell /bin/bash
exit 0