From 9d612beef01f08c3034547df4f851a3c01cee0ee Mon Sep 17 00:00:00 2001 From: blsaws Date: Wed, 18 May 2016 10:23:04 -0700 Subject: Further refactoring of test webapp setup. JIRA: COPPER-4 Change-Id: Ifabd2b1408a64862b0bef6e62275bfa3c8df86b5 Signed-off-by: blsaws --- .../setup/install_congress_testserver_1.sh | 28 ++++++++++++++++++---- .../setup/install_congress_testserver_2.sh | 25 ++----------------- components/congress/test-webapp/www/Dockerfile | 2 ++ components/congress/test-webapp/www/html/copper.js | 2 +- 4 files changed, 28 insertions(+), 29 deletions(-) create mode 100644 components/congress/test-webapp/www/Dockerfile (limited to 'components') diff --git a/components/congress/test-webapp/setup/install_congress_testserver_1.sh b/components/congress/test-webapp/setup/install_congress_testserver_1.sh index 7c84404..82e4686 100644 --- a/components/congress/test-webapp/setup/install_congress_testserver_1.sh +++ b/components/congress/test-webapp/setup/install_congress_testserver_1.sh @@ -95,15 +95,33 @@ gpgkey=https://yum.dockerproject.org/gpg EOF sudo yum install -y docker-engine sudo service docker start - sudo docker pull centos + + echo "Setup webapp files" + mkdir /tmp/copper/log mkdir /tmp/copper cp ~/congress/*.sh /tmp/copper cp -r ~/git/copper/components/congress/test-webapp/* /tmp/copper/ + echo "Point proxy.php to the Congress server" + source /tmp/copper/env.sh + sed -i -- "s/CONGRESS_HOST/$CONGRESS_HOST/g" /tmp/copper/html/proxy/index.php + chmod 755 /tmp/copper/setup/install_congress_testserver_2.sh - CID=$(sudo docker run -d -P --name copper -v /tmp/copper:/opt/copper centos /opt/copper/setup/install_congress_testserver_2.sh) -# sudo docker run -i -P --name copper -v /tmp/copper:/opt/copper centos /opt/copper/setup/install_congress_testserver_2.sh -# CIP=$(sudo docker inspect $CID | grep IPAddress | cut -d '"' -f 4 | tail -1) -# sudo docker attach $CID + + sudo docker build -t copper /tmp/copper/ + sudo docker run -d --name copper copper + + echo "Start Centos container" + sudo docker pull centos + export CID=$(sudo docker run -it -P --name copper -v /tmp/copper:/opt/copper centos) + echo "Attach to the Centos container" + echo "Once logged in, enter the command 'source /opt/copper/setup/install_congress_testserver_2.sh'" + sudo docker attach $CID +# sudo docker run -it -P --name copper -v /tmp/copper:/opt/copper centos /opt/copper/setup/install_congress_testserver_2.sh +# CIP=$(sudo docker inspect $CID | grep IPAddress | cut -d '"' -f 4 | tail -1) +# sudo docker ps -a +fi + +set +x fi diff --git a/components/congress/test-webapp/setup/install_congress_testserver_2.sh b/components/congress/test-webapp/setup/install_congress_testserver_2.sh index da608b8..1f50be3 100644 --- a/components/congress/test-webapp/setup/install_congress_testserver_2.sh +++ b/components/congress/test-webapp/setup/install_congress_testserver_2.sh @@ -70,6 +70,8 @@ if [ "$dist" == "Ubuntu" ]; then /etc/init.d/apache2 restart else + echo "Add epel repo" + yum install epel-release -y echo "install pip" yum install python-pip -y @@ -77,29 +79,6 @@ else 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" diff --git a/components/congress/test-webapp/www/Dockerfile b/components/congress/test-webapp/www/Dockerfile new file mode 100644 index 0000000..168d389 --- /dev/null +++ b/components/congress/test-webapp/www/Dockerfile @@ -0,0 +1,2 @@ +FROM php:5.6-apache +COPY html/ /var/www/html/ diff --git a/components/congress/test-webapp/www/html/copper.js b/components/congress/test-webapp/www/html/copper.js index cbdfaab..bd44f05 100644 --- a/components/congress/test-webapp/www/html/copper.js +++ b/components/congress/test-webapp/www/html/copper.js @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -var origin = "http://COPPER_HOST/proxy/?~url="; +var origin = "http://localhost/proxy/?~url="; var dataSources = []; var datasource_tables = []; var datasource_rows = []; -- cgit 1.2.3-korg