remove bookinfo | docker files
diff --git a/demo/apps/bookinfo/BUILD b/demo/apps/bookinfo/BUILD deleted file mode 100644 index 5ce7a3b..0000000 --- a/demo/apps/bookinfo/BUILD +++ /dev/null
@@ -1,16 +0,0 @@ -filegroup( - name = "bookinfo", - srcs = [ - "bookinfo.yaml", - "mixer-rule-additional-telemetry.yaml", - "mixer-rule-empty-rule.yaml", - "mixer-rule-ratings-denial.yaml", - "mixer-rule-ratings-ratelimit.yaml", - "route-rule-all-v1.yaml", - "route-rule-delay.yaml", - "route-rule-reviews-50-v3.yaml", - "route-rule-reviews-test-v2.yaml", - "route-rule-reviews-v2-v3.yaml", - ], - visibility = ["//visibility:public"], -)
diff --git a/demo/apps/bookinfo/README.md b/demo/apps/bookinfo/README.md deleted file mode 100644 index 3c72e26..0000000 --- a/demo/apps/bookinfo/README.md +++ /dev/null
@@ -1,2 +0,0 @@ -See the [Bookinfo demo](https://istio.io/docs/samples/bookinfo.html) in Istio -docs for instructions on how to run this demo application.
diff --git a/demo/apps/bookinfo/bookinfo.yaml b/demo/apps/bookinfo/bookinfo.yaml deleted file mode 100644 index dec1645..0000000 --- a/demo/apps/bookinfo/bookinfo.yaml +++ /dev/null
@@ -1,222 +0,0 @@ -# Copyright 2017 Istio Authors -# -# 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. - -################################################################################################## -# Details service -################################################################################################## -apiVersion: v1 -kind: Service -metadata: - name: details - labels: - app: details -spec: - ports: - - port: 9080 - name: http - selector: - app: details ---- -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: details-v1 -spec: - replicas: 1 - template: - metadata: - labels: - app: details - version: v1 - spec: - containers: - - name: details - image: istio/examples-bookinfo-details-v1 - imagePullPolicy: IfNotPresent - ports: - - containerPort: 9080 ---- -################################################################################################## -# Ratings service -################################################################################################## -apiVersion: v1 -kind: Service -metadata: - name: ratings - labels: - app: ratings -spec: - ports: - - port: 9080 - name: http - selector: - app: ratings ---- -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: ratings-v1 -spec: - replicas: 1 - template: - metadata: - labels: - app: ratings - version: v1 - spec: - containers: - - name: ratings - image: istio/examples-bookinfo-ratings-v1 - imagePullPolicy: IfNotPresent - ports: - - containerPort: 9080 ---- -################################################################################################## -# Reviews service -################################################################################################## -apiVersion: v1 -kind: Service -metadata: - name: reviews - labels: - app: reviews -spec: - ports: - - port: 9080 - name: http - selector: - app: reviews ---- -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: reviews-v1 -spec: - replicas: 1 - template: - metadata: - labels: - app: reviews - version: v1 - spec: - containers: - - name: reviews - image: istio/examples-bookinfo-reviews-v1 - imagePullPolicy: IfNotPresent - ports: - - containerPort: 9080 ---- -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: reviews-v2 -spec: - replicas: 1 - template: - metadata: - labels: - app: reviews - version: v2 - spec: - containers: - - name: reviews - image: istio/examples-bookinfo-reviews-v2 - imagePullPolicy: IfNotPresent - ports: - - containerPort: 9080 ---- -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: reviews-v3 -spec: - replicas: 1 - template: - metadata: - labels: - app: reviews - version: v3 - spec: - containers: - - name: reviews - image: istio/examples-bookinfo-reviews-v3 - imagePullPolicy: IfNotPresent - ports: - - containerPort: 9080 ---- -################################################################################################## -# Productpage service -################################################################################################## -apiVersion: v1 -kind: Service -metadata: - name: productpage - labels: - app: productpage -spec: - ports: - - port: 9080 - name: http - selector: - app: productpage ---- -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: productpage-v1 -spec: - replicas: 1 - template: - metadata: - labels: - app: productpage - version: v1 - spec: - containers: - - name: productpage - image: istio/examples-bookinfo-productpage-v1 - imagePullPolicy: IfNotPresent - ports: - - containerPort: 9080 ---- -########################################################################### -# Ingress resource (gateway) -########################################################################## -apiVersion: extensions/v1beta1 -kind: Ingress -metadata: - name: gateway - annotations: - kubernetes.io/ingress.class: "istio" -spec: - rules: - - http: - paths: - - path: /productpage - backend: - serviceName: productpage - servicePort: 9080 - - path: /login - backend: - serviceName: productpage - servicePort: 9080 - - path: /logout - backend: - serviceName: productpage - servicePort: 9080 - - path: /ratings - backend: - serviceName: ratings - servicePort: 9080 ----
diff --git a/demo/apps/bookinfo/cleanup.sh b/demo/apps/bookinfo/cleanup.sh deleted file mode 100755 index 533db2d..0000000 --- a/demo/apps/bookinfo/cleanup.sh +++ /dev/null
@@ -1,27 +0,0 @@ -#!/bin/bash -# -# Copyright 2017 Istio Authors -# -# 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. - -SCRIPTDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) - -istioctl delete route-rule productpage-default -istioctl delete route-rule reviews-default -istioctl delete route-rule ratings-default -istioctl delete route-rule details-default -istioctl delete route-rule reviews-test-v2 -istioctl delete route-rule ratings-test-delay -#istioctl delete mixer-rule ratings-ratelimit - -kubectl delete -f $SCRIPTDIR/bookinfo.yaml
diff --git a/demo/apps/bookinfo/destination-ratings-test-delay.yaml b/demo/apps/bookinfo/destination-ratings-test-delay.yaml deleted file mode 100644 index 2d39120..0000000 --- a/demo/apps/bookinfo/destination-ratings-test-delay.yaml +++ /dev/null
@@ -1,16 +0,0 @@ -type: route-rule -name: ratings-test-delay -spec: - destination: ratings.default.svc.cluster.local - precedence: 2 - match: - httpHeaders: - cookie: - regex: "^(.*?;)?(user=jason)(;.*)?$" - route: - - tags: - version: v1 - httpFault: - delay: - percent: 100 - fixedDelay: 7s
diff --git a/demo/apps/bookinfo/mixer-rule-additional-telemetry.yaml b/demo/apps/bookinfo/mixer-rule-additional-telemetry.yaml deleted file mode 100644 index 17be581..0000000 --- a/demo/apps/bookinfo/mixer-rule-additional-telemetry.yaml +++ /dev/null
@@ -1,42 +0,0 @@ -revision: "1" -rules: -- aspects: - - adapter: prometheus - kind: metrics - params: - metrics: - - descriptor_name: response_size - value: response.size | 0 - labels: - source: source.service | "unknown" - target: target.service | "unknown" - service: target.labels["app"] | "unknown" - method: request.path | "unknown" - response_code: response.code | 200 - - kind: access-logs - params: - logName: combined_log - log: - descriptor_name: accesslog.combined - template_expressions: - originIp: origin.ip - sourceUser: origin.user - timestamp: request.time - method: request.method - url: request.path - protocol: request.scheme - responseCode: response.code - responseSize: response.size - referer: request.referer - userAgent: request.headers["user-agent"] - labels: - originIp: origin.ip - sourceUser: origin.user - timestamp: request.time - method: request.method - url: request.path - protocol: request.scheme - responseCode: response.code - responseSize: response.size - referer: request.referer - userAgent: request.headers["user-agent"]
diff --git a/demo/apps/bookinfo/mixer-rule-empty-rule.yaml b/demo/apps/bookinfo/mixer-rule-empty-rule.yaml deleted file mode 100644 index 59b07e9..0000000 --- a/demo/apps/bookinfo/mixer-rule-empty-rule.yaml +++ /dev/null
@@ -1,2 +0,0 @@ -revision: "2" -rules:
diff --git a/demo/apps/bookinfo/mixer-rule-ratings-denial.yaml b/demo/apps/bookinfo/mixer-rule-ratings-denial.yaml deleted file mode 100644 index d6e5ba7..0000000 --- a/demo/apps/bookinfo/mixer-rule-ratings-denial.yaml +++ /dev/null
@@ -1,4 +0,0 @@ -rules: - - selector: source.labels["app"]=="reviews" && source.labels["version"] == "v3" - aspects: - - kind: denials
diff --git a/demo/apps/bookinfo/mixer-rule-ratings-ratelimit.yaml b/demo/apps/bookinfo/mixer-rule-ratings-ratelimit.yaml deleted file mode 100644 index 4284de0..0000000 --- a/demo/apps/bookinfo/mixer-rule-ratings-ratelimit.yaml +++ /dev/null
@@ -1,8 +0,0 @@ -rules: -- aspects: - - kind: quotas - params: - quotas: - - descriptorName: RequestCount - maxAmount: 5 - expiration: 1s
diff --git a/demo/apps/bookinfo/route-rule-all-v1.yaml b/demo/apps/bookinfo/route-rule-all-v1.yaml deleted file mode 100644 index b136ee9..0000000 --- a/demo/apps/bookinfo/route-rule-all-v1.yaml +++ /dev/null
@@ -1,35 +0,0 @@ -type: route-rule -name: productpage-default -spec: - destination: productpage.default.svc.cluster.local - precedence: 1 - route: - - tags: - version: v1 ---- -type: route-rule -name: reviews-default -spec: - destination: reviews.default.svc.cluster.local - precedence: 1 - route: - - tags: - version: v1 ---- -type: route-rule -name: ratings-default -spec: - destination: ratings.default.svc.cluster.local - precedence: 1 - route: - - tags: - version: v1 ---- -type: route-rule -name: details-default -spec: - destination: details.default.svc.cluster.local - precedence: 1 - route: - - tags: - version: v1
diff --git a/demo/apps/bookinfo/route-rule-delay.yaml b/demo/apps/bookinfo/route-rule-delay.yaml deleted file mode 100644 index 2bfecb2..0000000 --- a/demo/apps/bookinfo/route-rule-delay.yaml +++ /dev/null
@@ -1,16 +0,0 @@ -type: route-rule -name: ratings-test-delay -spec: - destination: ratings.default.svc.cluster.local - precedence: 2 - match: - httpHeaders: - cookie: - regex: "^(.*?;)?(user=test-user)(;.*)?$" - route: - - tags: - version: v1 - httpFault: - delay: - percent: 100 - fixedDelay: 7s
diff --git a/demo/apps/bookinfo/route-rule-reviews-50-v3.yaml b/demo/apps/bookinfo/route-rule-reviews-50-v3.yaml deleted file mode 100644 index a517ec2..0000000 --- a/demo/apps/bookinfo/route-rule-reviews-50-v3.yaml +++ /dev/null
@@ -1,12 +0,0 @@ -type: route-rule -name: reviews-default -spec: - destination: reviews.default.svc.cluster.local - precedence: 1 - route: - - tags: - version: v1 - weight: 50 - - tags: - version: v3 - weight: 50
diff --git a/demo/apps/bookinfo/route-rule-reviews-test-v2.yaml b/demo/apps/bookinfo/route-rule-reviews-test-v2.yaml deleted file mode 100644 index 775cc83..0000000 --- a/demo/apps/bookinfo/route-rule-reviews-test-v2.yaml +++ /dev/null
@@ -1,12 +0,0 @@ -type: route-rule -name: reviews-test-v2 -spec: - destination: reviews.default.svc.cluster.local - precedence: 2 - match: - httpHeaders: - cookie: - regex: "^(.*?;)?(user=jason)(;.*)?$" - route: - - tags: - version: v2
diff --git a/demo/apps/bookinfo/route-rule-reviews-v2-v3.yaml b/demo/apps/bookinfo/route-rule-reviews-v2-v3.yaml deleted file mode 100644 index 4be24e0..0000000 --- a/demo/apps/bookinfo/route-rule-reviews-v2-v3.yaml +++ /dev/null
@@ -1,12 +0,0 @@ -type: route-rule -name: reviews-default -spec: - destination: reviews.default.svc.cluster.local - precedence: 1 - route: - - tags: - version: v2 - weight: 50 - - tags: - version: v3 - weight: 50
diff --git a/demo/apps/bookinfo/route-rule-reviews-v3.yaml b/demo/apps/bookinfo/route-rule-reviews-v3.yaml deleted file mode 100644 index d238270..0000000 --- a/demo/apps/bookinfo/route-rule-reviews-v3.yaml +++ /dev/null
@@ -1,9 +0,0 @@ -type: route-rule -name: reviews-default -spec: - destination: reviews.default.svc.cluster.local - precedence: 1 - route: - - tags: - version: v3 - weight: 100
diff --git a/demo/apps/bookinfo/src/build-services.sh b/demo/apps/bookinfo/src/build-services.sh deleted file mode 100755 index 9dcb95f..0000000 --- a/demo/apps/bookinfo/src/build-services.sh +++ /dev/null
@@ -1,44 +0,0 @@ -#!/bin/bash -# -# Copyright 2017 Istio Authors -# -# 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. - -set -o errexit - -SCRIPTDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) - -pushd $SCRIPTDIR/productpage - docker build -t istio/examples-bookinfo-productpage-v1 . -popd - -pushd $SCRIPTDIR/details - docker build -t istio/examples-bookinfo-details-v1 . -popd - -pushd $SCRIPTDIR/reviews - #java build the app. - docker run --rm -v `pwd`:/usr/bin/app:rw niaquinto/gradle clean build - pushd reviews-wlpcfg - #plain build -- no ratings - docker build -t istio/examples-bookinfo-reviews-v1 --build-arg service_version=v1 . - #with ratings black stars - docker build -t istio/examples-bookinfo-reviews-v2 --build-arg service_version=v2 --build-arg enable_ratings=true . - #with ratings red stars - docker build -t istio/examples-bookinfo-reviews-v3 --build-arg service_version=v3 --build-arg enable_ratings=true --build-arg star_color=red . - popd -popd - -pushd $SCRIPTDIR/ratings - docker build -t istio/examples-bookinfo-ratings-v1 . -popd
diff --git a/demo/apps/bookinfo/src/details/Dockerfile b/demo/apps/bookinfo/src/details/Dockerfile deleted file mode 100644 index b721e3e..0000000 --- a/demo/apps/bookinfo/src/details/Dockerfile +++ /dev/null
@@ -1,22 +0,0 @@ -# Copyright 2017 Istio Authors -# -# 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. - -FROM ruby:2.3 - -RUN mkdir -p /opt/microservices -COPY . /opt/microservices/ -EXPOSE 9080 -WORKDIR /opt/microservices - -CMD ruby details.rb 9080
diff --git a/demo/apps/bookinfo/src/details/details.rb b/demo/apps/bookinfo/src/details/details.rb deleted file mode 100755 index a7ba941..0000000 --- a/demo/apps/bookinfo/src/details/details.rb +++ /dev/null
@@ -1,83 +0,0 @@ -#!/usr/bin/ruby -# -# Copyright 2017 Istio Authors -# -# 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. - -require 'webrick' - -if ARGV.length < 1 then - puts "usage: #{$PROGRAM_NAME} port" - exit(-1) -end - -port = Integer(ARGV[0]) - -server = WEBrick::HTTPServer.new :BindAddress => '0.0.0.0', :Port => port - -trap 'INT' do server.shutdown end - -details_resp = ' -<h4 class="text-center text-primary">Book Details</h4> -<dl> -<dt>Paperback:</dt>200 pages -<dt>Publisher:</dt> PublisherA -<dt>Language:</dt>English -<dt>ISBN-10:</dt>1234567890 -<dt>ISBN-13:</dt>123-1234567980 -</dl> -' - -server.mount_proc '/health' do |req, res| - res.status = 200 - res.body = 'Details is healthy' - res['Content-Type'] = 'text/html' -end - -server.mount_proc '/details' do |req, res| - res.body = details_resp - res['Content-Type'] = 'text/html' -end - -server.mount_proc '/' do |req, res| - res.body = ' - <html> - <head> - <meta charset="utf-8"> - <meta http-equiv="X-UA-Compatible" content="IE=edge"> - <meta name="viewport" content="width=device-width, initial-scale=1"> - - <!-- Latest compiled and minified CSS --> - <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> - - <!-- Optional theme --> - <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css"> - - <!-- Latest compiled and minified JavaScript --> - <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> - - <!-- Latest compiled and minified JavaScript --> - <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> - - </head> - <title>Book details service</title> - <body> - <p><h2>Hello! This is the book details service. My content is</h2></p> - <div>%s</div> - </body> - </html> - ' % [details_resp] - res['Content-Type'] = 'text/html' -end - -server.start
diff --git a/demo/apps/bookinfo/src/productpage/Dockerfile b/demo/apps/bookinfo/src/productpage/Dockerfile deleted file mode 100644 index bf52623..0000000 --- a/demo/apps/bookinfo/src/productpage/Dockerfile +++ /dev/null
@@ -1,21 +0,0 @@ -# Copyright 2017 Istio Authors -# -# 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. - -FROM python:2-onbuild - -RUN mkdir -p /opt/microservices -COPY . /opt/microservices/ -EXPOSE 9080 -WORKDIR /opt/microservices -CMD python productpage.py 9080
diff --git a/demo/apps/bookinfo/src/productpage/productpage.py b/demo/apps/bookinfo/src/productpage/productpage.py deleted file mode 100644 index 52cde6b..0000000 --- a/demo/apps/bookinfo/src/productpage/productpage.py +++ /dev/null
@@ -1,181 +0,0 @@ -#!/usr/bin/python -# -# Copyright 2017 Istio Authors -# -# 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. - - -from flask import Flask, request, render_template, redirect, url_for -import simplejson as json -import requests -import sys -from json2html import * -import logging -import requests - -# These two lines enable debugging at httplib level (requests->urllib3->http.client) -# You will see the REQUEST, including HEADERS and DATA, and RESPONSE with HEADERS but without DATA. -# The only thing missing will be the response.body which is not logged. -try: - import http.client as http_client -except ImportError: - # Python 2 - import httplib as http_client -http_client.HTTPConnection.debuglevel = 1 - -app = Flask(__name__) -logging.basicConfig(filename='microservice.log',filemode='w',level=logging.DEBUG) -requests_log = logging.getLogger("requests.packages.urllib3") -requests_log.setLevel(logging.DEBUG) -requests_log.propagate = True -app.logger.addHandler(logging.StreamHandler(sys.stdout)) -app.logger.setLevel(logging.DEBUG) - -from flask_bootstrap import Bootstrap -Bootstrap(app) - -details = { - "name" : "http://details:9080", - "endpoint" : "details", - "children" : [] -} - -ratings = { - "name" : "http://ratings:9080", - "endpoint" : "ratings", - "children" : [] -} - -reviews = { - "name" : "http://reviews:9080", - "endpoint" : "reviews", - "children" : [ratings] -} - -productpage = { - "name" : "http://productpage:9080", - "endpoint" : "details", - "children" : [details, reviews] -} - -service_dict = { - "productpage" : productpage, - "details" : details, - "reviews" : reviews, -} - -def getForwardHeaders(request): - headers = {} - - user_cookie = request.cookies.get("user") - if user_cookie: - headers['Cookie'] = 'user=' + user_cookie - - incoming_headers = [ 'x-request-id', - 'x-b3-traceid', - 'x-b3-spanid', - 'x-b3-parentspanid', - 'x-b3-sampled', - 'x-b3-flags', - 'x-ot-span-context' - ] - - for ihdr in incoming_headers: - val = request.headers.get(ihdr) - if val is not None: - headers[ihdr] = val - #print "incoming: "+ihdr+":"+val - - return headers - -@app.route('/') -@app.route('/index.html') -def index(): - """ Display productpage with normal user and test user buttons""" - global productpage - - table = json2html.convert(json = json.dumps(productpage), - table_attributes="class=\"table table-condensed table-bordered table-hover\"") - - return render_template('index.html', serviceTable=table) - -@app.route('/health') -def health(): - return 'Product page is healthy' - -@app.route('/login', methods=['POST']) -def login(): - user = request.values.get('username') - response = app.make_response(redirect(request.referrer)) - response.set_cookie('user', user) - return response - -@app.route('/logout', methods=['GET']) -def logout(): - response = app.make_response(redirect(request.referrer)) - response.set_cookie('user', '', expires=0) - return response - -@app.route('/productpage') -def front(): - headers = getForwardHeaders(request) - user = request.cookies.get("user", "") - bookdetails = getDetails(headers) - bookreviews = getReviews(headers) - return render_template('productpage.html', details=bookdetails, reviews=bookreviews, user=user) - -def getReviews(headers): - for i in range(2): - try: - res = requests.get(reviews['name']+"/"+reviews['endpoint'], headers=headers, timeout=3.0) - except: - res = None - - if res and res.status_code == 200: - return res.text - - return """<h3>Sorry, product reviews are currently unavailable for this book.</h3>""" - - -def getDetails(headers): - try: - res = requests.get(details['name']+"/"+details['endpoint'], headers=headers, timeout=1.0) - except: - res = None - - if res and res.status_code == 200: - return res.text - else: - return """<h3>Sorry, product details are currently unavailable for this book.</h3>""" - - -class Writer(object): - - def __init__(self, filename): - self.file = open(filename,'w') - - def write(self, data): - self.file.write(data) - self.file.flush() - - -if __name__ == '__main__': - if len(sys.argv) < 2: - print "usage: %s port" % (sys.argv[0]) - sys.exit(-1) - - p = int(sys.argv[1]) - sys.stderr = Writer('stderr.log') - sys.stdout = Writer('stdout.log') - app.run(host='0.0.0.0', port=p, debug = True, threaded=True) -
diff --git a/demo/apps/bookinfo/src/productpage/requirements.txt b/demo/apps/bookinfo/src/productpage/requirements.txt deleted file mode 100644 index 619c343..0000000 --- a/demo/apps/bookinfo/src/productpage/requirements.txt +++ /dev/null
@@ -1,8 +0,0 @@ -requests -flask -flask_json -flask_bootstrap -json2html -simplejson -gevent -
diff --git a/demo/apps/bookinfo/src/productpage/templates/index.html b/demo/apps/bookinfo/src/productpage/templates/index.html deleted file mode 100644 index 6f7d6d2..0000000 --- a/demo/apps/bookinfo/src/productpage/templates/index.html +++ /dev/null
@@ -1,32 +0,0 @@ -{% extends "bootstrap/base.html" %} -{% block metas %} -<meta charset="utf-8"> -<meta http-equiv="X-UA-Compatible" content="IE=edge"> -<meta name="viewport" content="width=device-width, initial-scale=1"> -{% endblock %} - -{% block styles %} -<!-- Latest compiled and minified CSS --> -<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> - -<!-- Optional theme --> -<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css"> -{% endblock %} -{% block scripts %} -<!-- Latest compiled and minified JavaScript --> -<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> - -<!-- Latest compiled and minified JavaScript --> -<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> -{% endblock %} -{% block title %}Simple Bookstore App{% endblock %} -{% block content %} - <p><h3>Hello! This is a simple bookstore application consisting of three services as shown below</h3></p> - {% autoescape false %} - {{ serviceTable }} - {% endautoescape %} - <p><h4>Click on one of the links below to auto generate a request to the backend as a real user or a tester - </h4></p> - <p><a href="/productpage?u=normal">Normal user</a></p> - <p><a href="/productpage?u=test">Test user</a></p> -{% endblock %}
diff --git a/demo/apps/bookinfo/src/productpage/templates/productpage.html b/demo/apps/bookinfo/src/productpage/templates/productpage.html deleted file mode 100644 index 382726a..0000000 --- a/demo/apps/bookinfo/src/productpage/templates/productpage.html +++ /dev/null
@@ -1,120 +0,0 @@ -{% extends "bootstrap/base.html" %} -{% block metas %} -<meta charset="utf-8"> -<meta http-equiv="X-UA-Compatible" content="IE=edge"> -<meta name="viewport" content="width=device-width, initial-scale=1.0"> -{% endblock %} - -{% block styles %} -<!-- Latest compiled and minified CSS --> -<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> - -<!-- Optional theme --> -<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css"> -{% endblock %} -{% block scripts %} -<!-- Latest compiled and minified JavaScript --> -<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> - -<!-- Latest compiled and minified JavaScript --> -<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> - -<script type="text/javascript"> -$('#login-modal').on('shown.bs.modal', function () { - $('#username').focus(); -}); -</script> -{% endblock %} -{% block title %}Simple Bookstore App{% endblock %} -{% block content %} - -<nav class="navbar navbar-inverse navbar-static-top"> - <div class="container"> - <div class="navbar-header"> - <a class="navbar-brand" href="#">BookInfo Sample</a> - </div> - {% if user: %} - <p class="navbar-text navbar-right"> - <i class="glyphicon glyphicon-user" aria-hidden="true"></i> - <span style="padding-left: 5px;">{{ user }} ( <a href="logout">sign out</a> )</span> - </p> - {% else %} - <button type="button" class="btn btn-default navbar-btn navbar-right" data-toggle="modal" href="#login-modal">Sign in</button> - {% endif %} - </div> -</nav> - -<!--- -<div class="navbar navbar-inverse navbar-fixed-top"> - <div class="container"> - <div class="navbar-header pull-left"> - <a class="navbar-brand" href="#">Microservices Fabric BookInfo Demo</a> - </div> - <div class="navbar-header pull-right"> - <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> - <span class="icon-bar"></span> - <span class="icon-bar"></span> - <span class="icon-bar"></span> - </button> - </div> - <div class="navbar-collapse collapse"> -{% if user %} - <a href="logout"><button type="button" class="btn btn-default navbar-btn pull-right">Sign out</button></a> - <p class="navbar-text pull-right">Signed in as {{ user }}</p> -{% else %} - <button type="button" class="btn btn-default navbar-btn pull-right" data-toggle="modal" data-target="#login-modal">Sign in</button> -{% endif %} - </div> - </div> -</div> ---> - -<div id="login-modal" class="modal fade" role="dialog"> - <div class="modal-dialog"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal">×</button> - <h4 class="modal-title">Please sign in</h4> - </div> - <div class="modal-body"> - <form method="post" action='login' name="login_form"> - <p><input type="text" class="form-control" name="username" id="username" placeholder="User Name"></p> - <p><input type="password" class="form-control" name="passwd" placeholder="Password"></p> - <p> - <button type="submit" class="btn btn-primary">Sign in</button> - <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> - </p> - </form> - </div> - </div> - - </div> -</div> - -<div class="container-fluid"> -<div class="row"> -<div class="col-md-12"> - <h3 class="text-center text-primary">The Comedy of Errors</h3> - <p> <a href="https://en.wikipedia.org/wiki/The_Comedy_of_Errors">Wikipedia - Summary</a>: The Comedy of Errors is one of <b>William - Shakespeare's</b> early plays. It is his shortest and one of his - most farcical comedies, with a major part of the humour coming - from slapstick and mistaken identity, in addition to puns and word - play.</p> -</div> -</div> - -<div class="row"> -<div class="col-md-6"> -{% autoescape false %} -{{ details }} -{% endautoescape %} -</div> -<div class="col-md-6"> -{% autoescape false %} -{{ reviews }} -{% endautoescape %} -</div> -</div> -</div> -{% endblock %}
diff --git a/demo/apps/bookinfo/src/ratings/Dockerfile b/demo/apps/bookinfo/src/ratings/Dockerfile deleted file mode 100644 index 45030d7..0000000 --- a/demo/apps/bookinfo/src/ratings/Dockerfile +++ /dev/null
@@ -1,18 +0,0 @@ -# Copyright 2017 Istio Authors -# -# 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. - -FROM node:4-onbuild - -EXPOSE 9080 -CMD node ratings.js 9080
diff --git a/demo/apps/bookinfo/src/ratings/package.json b/demo/apps/bookinfo/src/ratings/package.json deleted file mode 100644 index 40c0984..0000000 --- a/demo/apps/bookinfo/src/ratings/package.json +++ /dev/null
@@ -1,8 +0,0 @@ -{ - "scripts": { - "start": "node ratings.js" - }, - "dependencies": { - "httpdispatcher": "1.0.0" - } -} \ No newline at end of file
diff --git a/demo/apps/bookinfo/src/ratings/ratings.js b/demo/apps/bookinfo/src/ratings/ratings.js deleted file mode 100644 index 2d0cb98..0000000 --- a/demo/apps/bookinfo/src/ratings/ratings.js +++ /dev/null
@@ -1,72 +0,0 @@ -// Copyright 2017 Istio Authors -// -// 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. - -var http = require('http'); -var dispatcher = require('httpdispatcher'); - -port = parseInt(process.argv[2]); - -var ratingsResponse = {"Reviewer1": 5, "Reviewer2": 4} - -dispatcher.onGet("/", function(req, res) { - res.writeHead(200) - res.end( - '<html>' + - '<head>' + - '<meta charset="utf-8">' + - '<meta http-equiv="X-UA-Compatible" content="IE=edge">' + - '<meta name="viewport" content="width=device-width, initial-scale=1">' + - '<!-- Latest compiled and minified CSS -->' + - '<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">' + - '<!-- Optional theme -->' + - '<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">' + - '<!-- Latest compiled and minified JavaScript -->' + - '<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>' + - '<!-- Latest compiled and minified JavaScript -->' + - '<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>' + - '</head>' + - '<title>Book ratings service</title>' + - '<body>' + - '<p><h2>Hello! This is the book ratings service. My content is</h2></p>' + - '<div>' + JSON.stringify(ratingsResponse) + '</div>' + - '</body>' + - '</html>', - {"Content-type": "text/html"}) -}) - -dispatcher.onGet("/ratings", function(req, res) { - var json = JSON.stringify(ratingsResponse) - res.writeHead(200, {"Content-type": "application/json"}) - res.end(json) -}) - -dispatcher.onGet("/health", function(req, res) { - res.writeHead(200, {"Content-type": "text/plain"}) - res.end("Ratings is healthy") -}) - -function handleRequest(request, response){ - try { - console.log(request.method + " " + request.url); - dispatcher.dispatch(request, response); - } catch(err) { - console.log(err); - } -} - -var server = http.createServer(handleRequest); - -server.listen(port, function(){ - console.log("Server listening on: http://0.0.0.0:%s", port); -});
diff --git a/demo/apps/bookinfo/src/reviews/build.gradle b/demo/apps/bookinfo/src/reviews/build.gradle deleted file mode 100644 index 75bf360..0000000 --- a/demo/apps/bookinfo/src/reviews/build.gradle +++ /dev/null
@@ -1,7 +0,0 @@ -allprojects { - group = 'org.istio' - version = '1.0' - repositories { - mavenCentral() - } -}
diff --git a/demo/apps/bookinfo/src/reviews/reviews-application/build.gradle b/demo/apps/bookinfo/src/reviews/reviews-application/build.gradle deleted file mode 100644 index bf0f375..0000000 --- a/demo/apps/bookinfo/src/reviews/reviews-application/build.gradle +++ /dev/null
@@ -1,19 +0,0 @@ -apply plugin: 'war' - -sourceCompatibility = 1.8 - -repositories { - mavenCentral() -} - -dependencies { - providedCompile group:'javax.websocket', name:'javax.websocket-api', version:'1.1' - providedCompile group:'javax.ws.rs', name:'javax.ws.rs-api', version:'2.0' - providedCompile group:'javax.json', name:'javax.json-api', version:'1.0' - providedCompile 'javax.servlet:javax.servlet-api:3.1.0' - providedCompile 'javax.annotation:javax.annotation-api:1.2' - providedCompile 'javax.inject:javax.inject:1' - providedCompile 'javax.enterprise.concurrent:javax.enterprise.concurrent-api:1.0' - providedCompile 'javax.enterprise:cdi-api:1.2' - providedCompile 'io.swagger:swagger-annotations:1.5.0' -}
diff --git a/demo/apps/bookinfo/src/reviews/reviews-application/src/main/java/application/ReviewsApplication.java b/demo/apps/bookinfo/src/reviews/reviews-application/src/main/java/application/ReviewsApplication.java deleted file mode 100644 index 9f62285..0000000 --- a/demo/apps/bookinfo/src/reviews/reviews-application/src/main/java/application/ReviewsApplication.java +++ /dev/null
@@ -1,7 +0,0 @@ -package application; -import javax.ws.rs.ApplicationPath; -import javax.ws.rs.core.Application; - -@ApplicationPath("/") -public class ReviewsApplication extends Application { -}
diff --git a/demo/apps/bookinfo/src/reviews/reviews-application/src/main/java/application/rest/LibertyRestEndpoint.java b/demo/apps/bookinfo/src/reviews/reviews-application/src/main/java/application/rest/LibertyRestEndpoint.java deleted file mode 100644 index 7379c4b..0000000 --- a/demo/apps/bookinfo/src/reviews/reviews-application/src/main/java/application/rest/LibertyRestEndpoint.java +++ /dev/null
@@ -1,192 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2017 Istio Authors - * - * 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. - *******************************************************************************/ -package application.rest; - -import java.io.StringReader; -import javax.json.Json; -import javax.json.JsonObject; -import javax.json.JsonObjectBuilder; -import javax.json.JsonReader; -import javax.ws.rs.ApplicationPath; -import javax.ws.rs.CookieParam; -import javax.ws.rs.GET; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.Path; -import javax.ws.rs.client.Client; -import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.client.Invocation; -import javax.ws.rs.client.Invocation.Builder; -import javax.ws.rs.client.ResponseProcessingException; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.Application; -import javax.ws.rs.core.Cookie; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -@Path("/") -public class LibertyRestEndpoint extends Application { - - private final static Boolean ratings_enabled = Boolean.valueOf(System.getenv("ENABLE_RATINGS")); - private final static String star_color = System.getenv("STAR_COLOR") == null ? "black" : System.getenv("STAR_COLOR"); - private final static String ratings_service = "http://ratings:9080/ratings"; - - private final static String review_resp = ""+ - "<blockquote>"+ - "<p>"+ - "An extremely entertaining play by Shakespeare. The slapstick humour is refreshing!"+ - "</p> <small>Reviewer1 <cite>Affiliation1</cite></small>"+ - "%s"+ - "</blockquote>"+ - "<blockquote>"+ - "<p>"+ - "Absolutely fun and entertaining. The play lacks thematic depth when compared "+ - "to other plays by Shakespeare."+ - "</p> <small>Reviewer2 <cite>Affiliation2</cite></small>"+ - "%s"+ - "</blockquote>"; - - private JsonObject getRatings(Cookie user, String xreq, String xtraceid, String xspanid, - String xparentspanid, String xsampled, String xflags, String xotspan){ - ClientBuilder cb = ClientBuilder.newBuilder(); - String timeout = star_color.equals("black") ? "10000" : "2500"; - cb.property("com.ibm.ws.jaxrs.client.connection.timeout", timeout); - cb.property("com.ibm.ws.jaxrs.client.receive.timeout", timeout); - Client client = cb.build(); - WebTarget ratingsTarget = client.target(ratings_service); - Invocation.Builder builder = ratingsTarget.request(MediaType.APPLICATION_JSON); - if(xreq!=null) { - builder.header("x-request-id",xreq); - } - if(xtraceid!=null) { - builder.header("x-b3-traceid",xtraceid); - } - if(xspanid!=null) { - builder.header("x-b3-spanid",xspanid); - } - if(xparentspanid!=null) { - builder.header("x-b3-parentspanid",xparentspanid); - } - if(xsampled!=null) { - builder.header("x-b3-sampled",xsampled); - } - if(xflags!=null) { - builder.header("x-b3-flags",xflags); - } - if(xotspan!=null) { - builder.header("x-ot-span-context",xotspan); - } - if(user!=null) { - builder.cookie(user); - } - Response r = builder.get(); - int statusCode = r.getStatusInfo().getStatusCode(); - if (statusCode == Response.Status.OK.getStatusCode() ) { - StringReader stringReader = new StringReader(r.readEntity(String.class)); - try (JsonReader jsonReader = Json.createReader(stringReader)) { - JsonObject j = jsonReader.readObject(); - JsonObjectBuilder jb = Json.createObjectBuilder(); - for(String key : j.keySet()){ - int count = j.getInt(key); - String stars = "<font color=\""+ star_color +"\">"; - for(int i=0; i<count; i++){ - stars += "<span class=\"glyphicon glyphicon-star\"></span>"; - } - stars += "</font>"; - if(count<5){ - for(int i=0; i<(5-count); i++){ - stars += "<span class=\"glyphicon glyphicon-star-empty\"></span>"; - } - } - jb.add(key,stars); - } - JsonObject result = jb.build(); - return result; - } - }else{ - System.out.println("Error: unable to contact "+ratings_service+" got status of "+statusCode); - return null; - } - } - - @GET - @Path("/health") - public Response health() { - return Response.ok().type(MediaType.TEXT_HTML_TYPE).entity("Reviews is healthy").build(); - } - - @GET - @Path("/reviews") - public Response bookReviews(@CookieParam("user") Cookie user, - @HeaderParam("x-request-id") String xreq, - @HeaderParam("x-b3-traceid") String xtraceid, - @HeaderParam("x-b3-spanid") String xspanid, - @HeaderParam("x-b3-parentspanid") String xparentspanid, - @HeaderParam("x-b3-sampled") String xsampled, - @HeaderParam("x-b3-flags") String xflags, - @HeaderParam("x-ot-span-context") String xotspan) { - String r1 = ""; - String r2 = ""; - - if(ratings_enabled){ - JsonObject ratings = getRatings(user, xreq, xtraceid, xspanid, xparentspanid, xsampled, xflags, xotspan); - - if(ratings!=null){ - if(ratings.containsKey("Reviewer1")){ - r1 = ratings.getString("Reviewer1"); - } - if(ratings.containsKey("Reviewer2")){ - r2 = ratings.getString("Reviewer2"); - } - }else{ - // return Response.serverError().build(); - r1 = r2 = "<span class=\"bg-warning\">product ratings not available</span>"; - } - } - String replyBody = String.format(review_resp,r1,r2); - return Response.ok().type(MediaType.TEXT_HTML_TYPE).entity(replyBody).build(); - } - - private final static String index = ""+ - "<html>"+ - "<head>"+ - "<meta charset=\"utf-8\">"+ - "<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">"+ - "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">"+ - "<!-- Latest compiled and minified CSS -->"+ - "<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css\">"+ - "<!-- Optional theme -->"+ - "<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css\">"+ - "<!-- Latest compiled and minified JavaScript -->"+ - "<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js\"></script>"+ - "<!-- Latest compiled and minified JavaScript -->"+ - "<script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js\"></script>"+ - "</head>"+ - "<title>Book reviews service</title>"+ - "<body>"+ - "<p><h2>Hello! This is the book reviews service. My content is</h2></p>"+ - "<div>%s</div>"+ - "<p>Ratings service enabled? %s</p>"+ - "<p>Star color: %s </p>"+ - "</body>"+ - "</html>"; - - @GET - @Path("/") - public String getDefault(){ - return String.format(index,review_resp,ratings_enabled,star_color); - } - -}
diff --git a/demo/apps/bookinfo/src/reviews/reviews-application/src/main/webapp/WEB-INF/ibm-web-ext.xml b/demo/apps/bookinfo/src/reviews/reviews-application/src/main/webapp/WEB-INF/ibm-web-ext.xml deleted file mode 100644 index 68c5217..0000000 --- a/demo/apps/bookinfo/src/reviews/reviews-application/src/main/webapp/WEB-INF/ibm-web-ext.xml +++ /dev/null
@@ -1,23 +0,0 @@ -<!-- - Copyright (c) 2017 Istio Authors - - 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. ---> -<!DOCTYPE xml> -<web-ext - xmlns="http://websphere.ibm.com/xml/ns/javaee" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-web-ext_1_0.xsd" - version="1.0"> - <context-root uri="/"/> -</web-ext>
diff --git a/demo/apps/bookinfo/src/reviews/reviews-application/src/main/webapp/WEB-INF/web.xml b/demo/apps/bookinfo/src/reviews/reviews-application/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index a3823f1..0000000 --- a/demo/apps/bookinfo/src/reviews/reviews-application/src/main/webapp/WEB-INF/web.xml +++ /dev/null
@@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" - version="3.1"> - <display-name>Liberty Project</display-name> - - <welcome-file-list> - <welcome-file>index.html</welcome-file> - </welcome-file-list> -</web-app> \ No newline at end of file
diff --git a/demo/apps/bookinfo/src/reviews/reviews-application/src/main/webapp/index.html b/demo/apps/bookinfo/src/reviews/reviews-application/src/main/webapp/index.html deleted file mode 100644 index d77e51b..0000000 --- a/demo/apps/bookinfo/src/reviews/reviews-application/src/main/webapp/index.html +++ /dev/null Binary files differ
diff --git a/demo/apps/bookinfo/src/reviews/reviews-application/src/test/java/test/TestApplication.java b/demo/apps/bookinfo/src/reviews/reviews-application/src/test/java/test/TestApplication.java deleted file mode 100644 index 16469c7..0000000 --- a/demo/apps/bookinfo/src/reviews/reviews-application/src/test/java/test/TestApplication.java +++ /dev/null
@@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2017 Istio Authors - * - * 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. - *******************************************************************************/ -package test; - -public class TestApplication { - -}
diff --git a/demo/apps/bookinfo/src/reviews/reviews-wlpcfg/Dockerfile b/demo/apps/bookinfo/src/reviews/reviews-wlpcfg/Dockerfile deleted file mode 100644 index 39abc01..0000000 --- a/demo/apps/bookinfo/src/reviews/reviews-wlpcfg/Dockerfile +++ /dev/null
@@ -1,16 +0,0 @@ -FROM websphere-liberty:latest - -ENV SERVERDIRNAME reviews - -ADD ./servers/LibertyProjectServer /opt/ibm/wlp/usr/servers/defaultServer/ - -RUN /opt/ibm/wlp/bin/installUtility install --acceptLicense /opt/ibm/wlp/usr/servers/defaultServer/server.xml - -ARG service_version -ARG enable_ratings -ARG star_color -ENV SERVICE_VERSION ${service_version:-v1} -ENV ENABLE_RATINGS ${enable_ratings:-false} -ENV STAR_COLOR ${star_color:-black} - -CMD /opt/ibm/wlp/bin/server run defaultServer
diff --git a/demo/apps/bookinfo/src/reviews/reviews-wlpcfg/build.gradle b/demo/apps/bookinfo/src/reviews/reviews-wlpcfg/build.gradle deleted file mode 100644 index 5cc57f2..0000000 --- a/demo/apps/bookinfo/src/reviews/reviews-wlpcfg/build.gradle +++ /dev/null
@@ -1,23 +0,0 @@ -apply plugin: 'eclipse' - -buildscript { - repositories { - mavenCentral() - } -} - -task copyApplication(type: Copy) { - from '../reviews-application/build/libs/reviews-application-1.0.war' - into 'servers/LibertyProjectServer/apps/' -} - -task build(dependsOn: ['copyApplication']){ -} - -task clean { - delete "servers/LibertyProjectServer/apps" - delete "servers/LibertyProjectServer/lib" - delete "servers/LibertyProjectServer/logs" - delete "servers/LibertyProjectServer/workarea" - delete "servers/LibertyProjectServer/resources" -}
diff --git a/demo/apps/bookinfo/src/reviews/reviews-wlpcfg/servers/LibertyProjectServer/server.xml b/demo/apps/bookinfo/src/reviews/reviews-wlpcfg/servers/LibertyProjectServer/server.xml deleted file mode 100644 index aac20bd..0000000 --- a/demo/apps/bookinfo/src/reviews/reviews-wlpcfg/servers/LibertyProjectServer/server.xml +++ /dev/null
@@ -1,33 +0,0 @@ -<!-- Copyright (c) 2017 Istio Authors - - 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.--> -<server description="Sample Liberty server"> - - <featureManager> - <feature>jaxrs-2.0</feature> - <feature>jsonp-1.0</feature> - </featureManager> - - <httpEndpoint host="*" httpPort="9080" httpsPort="-1" - id="defaultHttpEndpoint"/> - - <webContainer deferServletLoad="false"/> - <applicationMonitor dropinsEnabled="false" updateTrigger="mbean"/> - <config updateTrigger="mbean"/> - - - <executor coreThreads="5"/> - - <webApplication contextRoot="/" id="reviews-app" location="reviews-application-1.0.war" name="reviews-app"/> - -</server>
diff --git a/demo/apps/bookinfo/src/reviews/reviews-wlpcfg/shared/.gitkeep b/demo/apps/bookinfo/src/reviews/reviews-wlpcfg/shared/.gitkeep deleted file mode 100644 index e69de29..0000000 --- a/demo/apps/bookinfo/src/reviews/reviews-wlpcfg/shared/.gitkeep +++ /dev/null
diff --git a/demo/apps/bookinfo/src/reviews/reviews-wlpcfg/src/test/java/it/EndpointTest.java b/demo/apps/bookinfo/src/reviews/reviews-wlpcfg/src/test/java/it/EndpointTest.java deleted file mode 100644 index d594d53..0000000 --- a/demo/apps/bookinfo/src/reviews/reviews-wlpcfg/src/test/java/it/EndpointTest.java +++ /dev/null
@@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2017 Istio Authors - * - * 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. - *******************************************************************************/ -package it; - -import static org.junit.Assert.assertTrue; - -import javax.ws.rs.client.Client; -import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.client.Invocation; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.Response; - -public class EndpointTest { - - public void testEndpoint(String endpoint, String expectedOutput) { - String port = System.getProperty("liberty.test.port"); - String war = System.getProperty("war.name"); - String url = "http://localhost:" + port + "/" + war + endpoint; - System.out.println("Testing " + url); - Response response = sendRequest(url, "GET"); - int responseCode = response.getStatus(); - assertTrue("Incorrect response code: " + responseCode, - responseCode == 200); - - String responseString = response.readEntity(String.class); - response.close(); - assertTrue("Incorrect response, response is " + responseString, responseString.contains(expectedOutput)); - } - - public Response sendRequest(String url, String requestType) { - Client client = ClientBuilder.newClient(); - System.out.println("Testing " + url); - WebTarget target = client.target(url); - Invocation.Builder invoBuild = target.request(); - Response response = invoBuild.build(requestType).invoke(); - return response; - } -}
diff --git a/demo/apps/bookinfo/src/reviews/reviews-wlpcfg/src/test/java/it/TestApplication.java b/demo/apps/bookinfo/src/reviews/reviews-wlpcfg/src/test/java/it/TestApplication.java deleted file mode 100644 index de7fa29..0000000 --- a/demo/apps/bookinfo/src/reviews/reviews-wlpcfg/src/test/java/it/TestApplication.java +++ /dev/null
@@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2017 Istio Authors - * - * 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. - *******************************************************************************/ -package it; - -import org.junit.Test; - -public class TestApplication extends EndpointTest { - - @Test - public void testDeployment() { - testEndpoint("/index.html", "<h1>Welcome to your Liberty Application</h1>"); - } - -}
diff --git a/demo/apps/bookinfo/src/reviews/reviews-wlpcfg/src/test/java/it/rest/LibertyRestEndpointTest.java b/demo/apps/bookinfo/src/reviews/reviews-wlpcfg/src/test/java/it/rest/LibertyRestEndpointTest.java deleted file mode 100644 index 916841f..0000000 --- a/demo/apps/bookinfo/src/reviews/reviews-wlpcfg/src/test/java/it/rest/LibertyRestEndpointTest.java +++ /dev/null
@@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2017 Istio Authors - * - * 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. - *******************************************************************************/ -package it.rest; - -import it.EndpointTest; - -import org.junit.Test; - -public class LibertyRestEndpointTest extends EndpointTest { - - @Test - public void testDeployment() { - testEndpoint("/rest", "Hello from the REST endpoint!"); - } -}
diff --git a/demo/apps/bookinfo/src/reviews/settings.gradle b/demo/apps/bookinfo/src/reviews/settings.gradle deleted file mode 100644 index 019d1e8..0000000 --- a/demo/apps/bookinfo/src/reviews/settings.gradle +++ /dev/null
@@ -1,4 +0,0 @@ -rootProject.name = 'reviews' - -include 'reviews-application' -include 'reviews-wlpcfg'
diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..5cd3fe7 --- /dev/null +++ b/docker/Dockerfile
@@ -0,0 +1,16 @@ +FROM istio/mixer:0.1.2-6bfa390 + +RUN apt-get update + +# Install tools we might need +RUN apt-get install -y curl build-essential ca-certificates + +RUN mkdir -p /etc/opt/mixer + +ADD mixs /usr/local/bin/mixs +ADD mixc /usr/local/bin/mixc + +ADD testdata/apigee /etc/opt/mixer/apigee +ADD testdata/configroot /etc/opt/mixer/configroot + +RUN ln -s /etc/opt/mixer/apigee/adapters.yml /etc/opt/mixer/configroot/scopes/global/adapters.yml
diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000..105a530 --- /dev/null +++ b/docker/README.md
@@ -0,0 +1,3 @@ +copy this Dockerfile file to the mixer repo root +cp the mixs and mixc binary to mixer repo root (since bazel builds binary in tmp directory outside the mixer root, this step is needed) +docker build