exchange-application/README.md
New file @@ -0,0 +1,29 @@ # Currency Exchange application This application serves as an example of multi-service application. It consists of the following services: - History - Currency - Exchange (Gateway) - Frontend ![Image of the application](imgs/app.png) ## Deployment Note that this application template is written for OpenShift Service Mesh. The project where you deploy this application should be managed by OSSM (i.e. be in the ServiceMeshMemberRoll resource). Also note there is no `http://` in the `INGRESS_GW` parameter. Protocol is added by the frontend application. To deploy this application, execute: ```sh oc process -o yaml -f kubefiles/template.yml \ -p INGRESS_GW=ingress-gateway.istio-system-app.apps.example.com \ -p NEWS_ENDPOINT=url \ | oc create -f ``` exchange-application/currencies/.gitignore
exchange-application/currencies/Dockerfile
exchange-application/currencies/requirements.txt
exchange-application/currencies/src/currencies.py
exchange-application/exchange/.gitignore
exchange-application/exchange/Dockerfile
exchange-application/exchange/README.md
exchange-application/exchange/pom.xml
exchange-application/exchange/src/main/docker/Dockerfile.jvm
exchange-application/exchange/src/main/docker/Dockerfile.native
exchange-application/exchange/src/main/java/com/redhat/restclient/CorsFilter.java
exchange-application/exchange/src/main/java/com/redhat/restclient/Currency.java
exchange-application/exchange/src/main/java/com/redhat/restclient/CurrencyResource.java
exchange-application/exchange/src/main/java/com/redhat/restclient/CurrencyService.java
exchange-application/exchange/src/main/java/com/redhat/restclient/ExchangeResource.java
exchange-application/exchange/src/main/java/com/redhat/restclient/ExchangeService.java
exchange-application/exchange/src/main/java/com/redhat/restclient/News.java
exchange-application/exchange/src/main/java/com/redhat/restclient/NewsResource.java
exchange-application/exchange/src/main/java/com/redhat/restclient/NewsService.java
exchange-application/exchange/src/main/resources/META-INF/resources/index.html
exchange-application/exchange/src/main/resources/application.properties
exchange-application/exchange/src/test/java/com/redhat/restclient/.gitkeep
exchange-application/frontend/.gitignore
exchange-application/frontend/Dockerfile
File was renamed from mczernek-exchange-application/frontend/Dockerfile @@ -2,11 +2,12 @@ # URL of the exchange app # All env vars exposed to the React app must start with REACT_APP ENV REACT_APP_GW_ENDPOINT=exchange-exchange-app.apps.ocp-d43.dev.nextcle.com ENV REACT_APP_GW_ENDPOINT=PLACEHOLDER # Cache dependencies COPY package.json . RUN npm install COPY package-lock.json . RUN npm ci --production # Cache public files COPY public ./public exchange-application/frontend/README.md
exchange-application/frontend/package-lock.json
New file Diff too large exchange-application/frontend/package.json
exchange-application/frontend/public/favicon.icoexchange-application/frontend/public/index.html
exchange-application/frontend/public/logo192.pngexchange-application/frontend/public/logo512.pngexchange-application/frontend/public/manifest.json
exchange-application/frontend/public/robots.txt
exchange-application/frontend/src/App.css
exchange-application/frontend/src/App.js
exchange-application/frontend/src/Graph.js
exchange-application/frontend/src/HistoricalDataForm.js
exchange-application/frontend/src/Loading.js
exchange-application/frontend/src/MainStructure.js
File was renamed from mczernek-exchange-application/frontend/src/MainStructure.js @@ -22,7 +22,7 @@ const { isNavOpen } = this.state; const logoProps = { href: '/' href: '/frontend/' }; const Header = ( <PageHeader exchange-application/frontend/src/NavList.js
exchange-application/frontend/src/NewsBoard.js
exchange-application/frontend/src/SingleCurrencyExchange.js
exchange-application/frontend/src/Welcome.js
File was renamed from mczernek-exchange-application/frontend/src/Welcome.js @@ -27,7 +27,7 @@ </Text> repository. </Text> <Text component="p"> You can ask questions or file issues at <Text component="a" src="https://github.com/RedHatTraining/DO328-apps/issues"> here</Text>. You can ask questions or file issues <Text component="a" href="https://github.com/RedHatTraining/DO328-apps/issues">here</Text>. </Text> </TextContent> exchange-application/frontend/src/index.js
exchange-application/frontend/src/serviceWorker.js
exchange-application/frontend/src/setupTests.js
exchange-application/frontend/src/training_black.pngexchange-application/frontend/src/training_white.pngexchange-application/frontend/yarn.lock
exchange-application/history/.gitignore
exchange-application/history/Dockerfile
exchange-application/history/index.js
exchange-application/history/lib/constants.js
exchange-application/history/package-lock.json
exchange-application/history/package.json
exchange-application/history/test.json
exchange-application/imgs/app.png
exchange-application/kubefiles/app-template.yml
New file @@ -0,0 +1,239 @@ apiVersion: v1 kind: Template metadata: name: financial-app annotations: description: "Financial sample application for Red Hat Training" objects: - apiVersion: networking.istio.io/v1alpha3 kind: VirtualService metadata: name: frontend-vservice spec: hosts: - "*" gateways: - exchange-gw http: - match: - uri: prefix: /frontend route: - destination: host: frontend port: number: 3000 - apiVersion: v1 kind: ConfigMap metadata: name: frontend-cm data: GW_ADDR: ${INGRESS_GW}/exchange - apiVersion: apps/v1 kind: Deployment metadata: name: frontend spec: selector: matchLabels: app: frontend replicas: 1 template: metadata: labels: app: frontend annotations: sidecar.istio.io/inject: "true" spec: containers: - name: frontend image: quay.io/redhattraining/ossm-frontend:${FRONTEND_TAG} imagePullPolicy: Always ports: - containerPort: 3000 env: - name: REACT_APP_GW_ENDPOINT valueFrom: configMapKeyRef: name: frontend-cm key: GW_ADDR - kind: Service apiVersion: v1 metadata: labels: app: frontend name: frontend spec: ports: - port: 3000 protocol: TCP targetPort: 3000 selector: app: frontend - kind: Deployment apiVersion: apps/v1 metadata: name: history spec: selector: matchLabels: app: history replicas: 1 template: metadata: labels: app: history annotations: sidecar.istio.io/inject: "true" spec: containers: - name: history image: quay.io/redhattraining/ossm-history:${HISTORY_TAG} imagePullPolicy: Always ports: - containerPort: 8080 - kind: Service apiVersion: v1 metadata: labels: app: history name: history spec: ports: - port: 8080 protocol: TCP targetPort: 8080 selector: app: history - kind: Deployment apiVersion: apps/v1 metadata: name: currency spec: selector: matchLabels: app: currency replicas: 1 template: metadata: labels: app: currency annotations: sidecar.istio.io/inject: "true" spec: containers: - name: currency image: quay.io/redhattraining/ossm-currencies:${CURRENCIES_TAG} imagePullPolicy: Always ports: - containerPort: 5000 - kind: Service apiVersion: v1 metadata: labels: app: currency name: currency spec: ports: - port: 5000 protocol: TCP targetPort: 5000 selector: app: currency - kind: Gateway apiVersion: networking.istio.io/v1alpha3 metadata: name: exchange-gw spec: selector: istio: ingressgateway # use istio default controller servers: - port: number: 80 name: http protocol: HTTP hosts: - "*" - kind: VirtualService apiVersion: networking.istio.io/v1alpha3 metadata: name: exchange-vservice spec: hosts: - "*" gateways: - exchange-gw http: - match: - uri: prefix: /exchange rewrite: uri: / route: - destination: host: exchange port: number: 8080 - kind: Deployment apiVersion: apps/v1 metadata: name: exchange spec: selector: matchLabels: app: exchange replicas: 1 template: metadata: labels: app: exchange annotations: sidecar.istio.io/inject: "true" spec: containers: - name: exchange image: quay.io/redhattraining/ossm-exchange:${EXCHANGE_TAG} imagePullPolicy: Always ports: - containerPort: 8080 env: - name: NEWS_ENDPOINT value: ${NEWS_ENDPOINT} - kind: Service apiVersion: v1 metadata: labels: app: exchange name: exchange spec: ports: - port: 8080 protocol: TCP targetPort: 8080 selector: app: exchange parameters: - name: INGRESS_GW description: "The address of the Istio Ingress Gateway, to be used for the external exchange service" required: true - name: FRONTEND_TAG description: "The tag of the image used to deploy the Frontend service" required: false value: "1.0" - name: HISTORY_TAG description: "The tag of the image used to deploy the History service" required: false value: "1.0" - name: CURRENCIES_TAG description: "The tag of the image used to deploy the Currencies service" required: false value: "1.0" - name: EXCHANGE_TAG description: "The tag of the image used to deploy the EXCHANGE service" required: false value: "1.0" - name: NEWS_ENDPOINT description: "URL of the news application backend" required: false value: "" exchange-application/kubefiles/currency.yml
exchange-application/kubefiles/exchange.yml
exchange-application/kubefiles/frontend.yml
exchange-application/kubefiles/history.yml
exchange-application/kubefiles/istio-exchange.yml
exchange-application/kubefiles/istio-frontend.yml