-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathdeploy
executable file
·51 lines (46 loc) · 1.91 KB
/
deploy
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
#!/bin/bash
# Distinct ${CONDA_ENV} servers
# - $CONTROL_SERVER_HOST (here the etcd services need installing and running)
# - elsewhere (just install the control libraries)
# Distinct environments
# - ${CONDA_ENV} -- reliable, tested
# - development -- testing
# Install etcd services only on this host:
CONTROL_SERVER_HOST='lwacalimhead'
# Install in this conda environment:
CONDA_ENV=deployment
# setup
NAME="caltech-lwa"
SUBDIR="control_sw"
DATE=$(date --iso-8601=seconds)
LOG=~/deploy_${NAME}_${DATE}.log
set -ex >> $LOG 2>>$LOG
rm ~/deploy_$NAME_*.log >> $LOG 2>>$LOG # clean up old logs
echo $HOSTNAME >> $LOG 2>>$LOG # should be installing on calim
cd $SUBDIR # Base of software library
echo $PWD >> $LOG 2>>$LOG # should be base of code repo
whoami >> $LOG 2>>$LOG # should be user pipeline (or ubuntu?)
if [[ $PWD =~ ${NAME}/${SUBDIR} ]]; then
ROOTDIR=$PWD
echo "$DATE" >> $LOG 2>>$LOG
conda run -n ${CONDA_ENV} which python >> $LOG 2>>$LOG
conda run -n ${CONDA_ENV} git describe >> $LOG 2>>$LOG
conda run -n ${CONDA_ENV} pip install -r requirements.txt >> $LOG 2>>$LOG
conda run -n ${CONDA_ENV} python setup.py install >> $LOG 2>>$LOG
if [[ $HOSTNAME =~ $CONTROL_SERVER_HOST ]]; then
echo "Installing etcd service(s)" >> $LOG 2>>$LOG
# Copy special dependencies
cd ${ROOTDIR}/libs/casperfpga
conda run -n ${CONDA_ENV} pip install . >> $LOG 2>>$LOG
# Copy systemd services and start
sudo cp ${ROOTDIR}/systemd/lwa-feng-etcd@.service /etc/systemd/system/
sudo systemctl daemon-reload
for snap in snap0{1..9} snap{10..11}; do
sudo systemctl enable lwa-feng-etcd@${snap}.service >> $LOG 2>>$LOG;
sudo systemctl stop lwa-feng-etcd@${snap}.service >> $LOG 2>>$LOG;
sudo systemctl start lwa-feng-etcd@${snap}.service >> $LOG 2>>$LOG;
done
fi
else
echo "Not installing in this location" >> $LOG 2>>$LOG
fi