summaryrefslogtreecommitdiffstats
path: root/components/congress/test-webapp/setup/install_congress_testserver_2.sh
blob: 009ff5ecb21d241aae2723ec0953d1db1d8e391b (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
#!/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 install per https://wiki.opnfv.org/copper/academy/joid
# On jumphost:
# - Congress installed through install_congress_1.sh
# How to use:
#   $ source ~/git/copper/tests/setup/install_congress_testserver_1.sh

# Setup OpenStack environment variables per your OPNFV install
source ~/env.sh
source ~/admin-openrc.sh <<EOF
openstack
EOF

# Update the base server
set -x
sudo apt-get update
sudo apt-get -y upgrade

# Install pip
sudo apt-get install -y python-pip

# Install java
sudo apt-get install -y default-jre

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

# Install and test OpenStack client
mkdir ~/coppertest
mkdir ~/coppertest/git
cd ~/coppertest/git
git clone https://github.com/openstack/python-openstackclient.git
cd python-openstackclient
git checkout stable/liberty
sudo pip install -r requirements.txt
sudo pip install .
openstack service list

# Install and test Congress client
cd ~/coppertest/git
git clone https://github.com/openstack/python-congressclient.git
cd python-congressclient
git checkout stable/liberty
sudo pip install -r requirements.txt
sudo pip install .
openstack congress driver list

# Install and test Glance client
cd ~/coppertest/git
git clone https://github.com/openstack/python-glanceclient.git
cd python-glanceclient
git checkout stable/liberty
sudo pip install -r requirements.txt
sudo pip install .
glance image-list

# Install and test Neutron client
cd ~/coppertest/git
git clone https://github.com/openstack/python-neutronclient.git
cd python-neutronclient
git checkout stable/liberty
sudo pip install -r requirements.txt
sudo pip install .
neutron net-list

# Install and test Nova client
cd ~/coppertest/git
git clone https://github.com/openstack/python-novaclient.git
cd python-novaclient
git checkout stable/liberty
sudo pip install -r requirements.txt
sudo pip install .
nova hypervisor-list

# Install and test Keystone client
cd ~/coppertest/git
git clone https://github.com/openstack/python-keystoneclient.git
cd python-keystoneclient
git checkout stable/liberty
sudo pip install -r requirements.txt
sudo pip install .

# </code>

# === Setup the Congress Test Webapp ===

# <code>
# Clone Copper (if not already cloned in user home)
cd ~/coppertest/git
git clone https://gerrit.opnfv.org/gerrit/copper

# Install Apache, PHP
sudo apt-get install -y apache2 php5 libapache2-mod-php5
sudo /etc/init.d/apache2 restart

# Copy the Apache config
sudo cp ~/coppertest/git/copper/components/congress/test-webapp/www/ubuntu-apache2.conf /etc/apache2/apache2.conf

# Copy the webapp to the Apache root directory and fix permissions
sudo cp -R ~/coppertest/git/copper/components/congress/test-webapp/www/html /var/www
sudo chmod 755 /var/www/html -R

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

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

# Make webapp log directory and set permissions
mkdir ~/coppertest/logs
chmod 777 ~/coppertest/logs

# Restart Apache
sudo service apache2 restart

set +x