Fixing installation for Ubuntu 16.04

Condition for checking status of etcd service in
install_valence.sh is updated for ubuntu 16.04.
Also added valence.service and etcd.service to make
these services active.

Change-Id: I78bb2d3e65bf08712d87516372d40ad12802e66a
Closes-bug: #1686613
This commit is contained in:
akhiljain23 2017-05-01 18:27:20 +05:30
parent b19420fd04
commit 3f298567d5
3 changed files with 35 additions and 2 deletions

View File

@ -0,0 +1,11 @@
[Unit]
Description=etcd key value store
[Service]
Type=notify
ExecStart=/usr/local/bin/etcd
Restart=on-failure
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,11 @@
[Unit]
Description=Valence Server
[Service]
Environment=PYTHON_HOME=/usr/local/bin/valence
ExecStart=/usr/local/bin/valence
Restart=on-failure
[Install]
WantedBy=multi-user.target

View File

@ -29,6 +29,10 @@ sed "s/\${CHUID}/$CURR_USER/" "$DIR"/etc/services-startup-conf/valence.conf > /
# Use alternate sed delimiter because path will have /
sed -i "s#PYHOME#$PYHOME#" /tmp/valence.conf
mv /tmp/valence.conf /etc/init/valence.conf
# Valence service file required at this path for starting service using systemctl
if [ -d "/etc/systemd/system" ]; then
cp "$DIR"/etc/services-startup-conf/valence.service /etc/systemd/system/valence.service
fi
# Generate initial sample config file.
echo "Generating sample config file" >> $install_log
@ -41,7 +45,7 @@ if [ ! -d "/etc/valence" ]; then
fi
chown "$CURR_USER":"$CURR_USER" /etc/valence
VALENCE_CONF=/etc/valence/valence.conf
cp etc/valence.conf.sample /etc/valence/valence.conf
cp "$DIR"/etc/valence.conf.sample /etc/valence/valence.conf
sudo sed -i "s/#debug\s*=.*/debug=true/" $VALENCE_CONF
sudo sed -i "s/#log_level\s*=.*/log_level=debug/" $VALENCE_CONF
@ -69,16 +73,23 @@ curl -L ${DOWNLOAD_URL}/${ETCD_VER}/etcd-${ETCD_VER}-linux-amd64.tar.gz -o /tmp/
mkdir -p /var/etcd && tar xzvf /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz -C /var/etcd --strip-components=1
chown "$CURR_USER":"$CURR_USER" /var/etcd
mv /var/etcd/etcd /usr/local/bin/etcd && mv /var/etcd/etcdctl /usr/local/bin/etcdctl
# Etcd service file required at this path for starting service using systemctl
if [ -d "/etc/systemd/system" ]; then
cp "$DIR"/etc/services-startup-conf/etcd.service /etc/systemd/system/etcd.service
fi
sed "s/\${CHUID}/$CURR_USER/" "$DIR"/etc/services-startup-conf/etcd.conf > /etc/init/etcd.conf
echo "Starting etcd database" >> $install_log
service etcd start
ETCD_STATUS=$?
sleep 2
timeout=30
attempt=1
until [[ $(service etcd status) = "etcd start/running"* ]]
until [[ $ETCD_STATUS = 0 ]]
do
service etcd status
ETCD_STATUS=$?
sleep 1
attempt=$((attempt+1))
if [[ $attempt -eq timeout ]]