summaryrefslogtreecommitdiffstats
path: root/components/congress/test-webapp/setup/install_congress_testserver_2.sh
blob: da608b8c0b27d36e908d20c9518ed94c242d61ce (plain)
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
#!/bin/bash
# Copyright 2015-2016 AT&T Intellectual Property, Inc
#  
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#  
# http://www.apache.org/licenses/LICENSE-2.0
#  
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# What this is: script 2 of 2 for installation of a test server for Congress.
# Status: this is a work in progress, under test.
#
# Prequisite: OPFNV installed per JOID or Apex installer
# On jumphost:
# - Congress installed through install_congress_1.sh
# How to use:
#   $ source install_congress_testserver_1.sh

set -x

echo "Setup OpenStack environment variables per your OPNFV install"
source /opt/copper/env.sh
source /opt/copper/admin-openrc.sh

echo "Install prerequisites"
dist=`grep DISTRIB_ID /etc/*-release | awk -F '=' '{print $2}'`

if [ "$dist" == "Ubuntu" ]; then
  echo "Update the base server"
  set -x
  apt-get update
  #apt-get -y upgrade

  echo "Install pip"
  apt-get install -y python-pip

  echo "Install java"
  apt-get install -y default-jre

  echo "Install other dependencies"
  apt-get install -y git gcc python-dev libxml2 libxslt1-dev libzip-dev php5-curl

  echo "Install Apache, PHP"
  apt-get install -y apache2 php5 libapache2-mod-php5

  echo "Setup the Congress Test Webappp"

  echo "Copy the Apache config"
  cp /opt/copper/www/ubuntu-apache2.conf /etc/apache2/apache2.conf

  echo "Copy the webapp to the Apache root directory and fix permissions"
  cp -R /opt/copper/www/html /var/www
  chmod 755 /var/www/html -R

  echo "Point copper.js to the trusty-copper server per your install"
  sed -i -- "s/COPPER_HOST/$COPPER_HOST/g" /var/www/html/copper.js

  echo "Point proxy.php to the Congress server per your install"
  sed -i -- "s/CONGRESS_HOST/$CONGRESS_HOST/g" /var/www/html/proxy/index.php

  echo "Make webapp log directory"
  mkdir /tmp/copper/log

  /etc/init.d/apache2 restart

else

  echo "install pip"
  yum install python-pip -y

  echo "install other dependencies"
  yum install apg git gcc libxml2 python-devel libzip-devel libxslt-devel -y

  echo "Install Apache, PHP"
  yum install -y httpd php

  echo "Setup the Congress Test Webappp"

  echo "Copy the Apache config"
  cp /opt/copper/www/centos-httpd.conf /etc/httpd/conf/httpd.conf

  echo "Copy the webapp to the Apache root directory and fix permissions"
  cp -R /opt/copper/www/html/* /var/www/html
  chmod 755 /var/www/html -R

  echo "Point copper.js to the trusty-copper server per your install"
  sed -i -- "s/COPPER_HOST/$COPPER_HOST/g" /var/www/html/copper.js

  echo "Point proxy.php to the Congress server per your install"
  sed -i -- "s/CONGRESS_HOST/$CONGRESS_HOST/g" /var/www/html/proxy/index.php

  echo "Make webapp log directory"
  mkdir /tmp/copper/log

  systemctl restart httpd.service

fi

echo "Install python dependencies"
pip install --upgrade pip setuptools pbr tox

echo "Install OpenStack client"
mkdir /opt/copper/git
cd /opt/copper/git
git clone https://github.com/openstack/python-openstackclient.git
cd python-openstackclient
git checkout stable/liberty
pip install -r requirements.txt
pip install .

echo "Install Congress client"
cd /opt/copper/git
git clone https://github.com/openstack/python-congressclient.git
cd python-congressclient
git checkout stable/liberty
pip install -r requirements.txt
pip install .

echo "Install Glance client"
cd /opt/copper/git
git clone https://github.com/openstack/python-glanceclient.git
cd python-glanceclient
git checkout stable/liberty
pip install -r requirements.txt
pip install .

echo "Install Neutron client"
cd /opt/copper/git
git clone https://github.com/openstack/python-neutronclient.git
cd python-neutronclient
git checkout stable/liberty
pip install -r requirements.txt
pip install .

echo "Install Nova client"
cd /opt/copper/git
git clone https://github.com/openstack/python-novaclient.git
cd python-novaclient
git checkout stable/liberty
pip install -r requirements.txt
pip install .

echo "Install Keystone client"
cd /opt/copper/git
git clone https://github.com/openstack/python-keystoneclient.git
cd python-keystoneclient
git checkout stable/liberty
pip install -r requirements.txt
pip install .

set +x