Skip to content

Commit

Permalink
Deployment scripts updates (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
pgrabusz authored May 17, 2021
1 parent 29e4880 commit f721afd
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 154 deletions.
42 changes: 28 additions & 14 deletions infra/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,42 @@

If you require a private repository access you must create a secret containing Github Deploy Key
```
oc create secret generic retail-git-ssh-key --from-file=ssh-privatekey=<path_to_private_key>--type=kubernetes.io/ssh-auth
oc create secret generic retail-git-ssh-key --from-file=ssh-privatekey=<path_to_private_key> --type=kubernetes.io/ssh-auth
```
Create BuildConfigs and ImageTags:
```
$ oc apply -f ocp-buildconfigs.yaml
oc apply -f ocp-buildconfigs.yaml
```
Verify build configs have been created:
```
$ oc get buildconfigs
oc get buildconfigs
```
```
NAME TYPE FROM LATEST
prediction-service-build Docker Git@develop-pl 0
recommendation-service-build Docker Git@develop-pl 0
```
Verify ImageTags have been created in your project:
```bash
oc get is
```
```
$ oc get is
NAME IMAGE REPOSITORY TAGS UPDATED
prediction-service default-route-openshift-image-registry.apps.red.ocp.public/retail/prediction-service
recommendation-service default-route-openshift-image-registry.apps.red.ocp.public/retail/recommendation-service
```
Manually trigger the images builds:
```
$ oc start-build prediction-service-build
$ oc start-build recommendation-service-build
```bash
oc start-build customer-simulation-service
oc start-build prediction-service
oc start-build recommendation-service
oc start-build visualization-service
```
Wait for the builds to complete:
```bash
oc get builds --watch
```
```
$ oc get builds --watch
NAME TYPE FROM STATUS STARTED DURATION
prediction-service-build-1 Docker Git@develop-pl Running 5 seconds ago
prediction-service-build-1 Docker Git@72d19cf Running 12 seconds ago
Expand All @@ -44,30 +52,36 @@ prediction-service-build-1 Docker Git@72d19cf Complete About a mi
```

See if the ImageTags have been updated:
```bash
oc get is
```
```
$ oc get is
NAME IMAGE REPOSITORY TAGS UPDATED
prediction-service default-route-openshift-image-registry.apps.red.ocp.public/retail/prediction-service latest 1 minutes ago
recommendation-service default-route-openshift-image-registry.apps.red.ocp.public/retail/recommendation-service latest 1 minutes ago
```

### Deploy the solution using Helm Charts
Edit the `values.yaml` file and configure your workload parameters:
```
$ vim retail-helm-charts/values.yaml
```bash
vim retail-helm-chart/values.yaml
```
Install the Chart with Helm:
```bash
helm install retail retail-helm-chart/
```
```
helm install retail retail-helm-charts/
NAME: retail
LAST DEPLOYED: 2021-04-07 14:52:49.839391 +0000 UTC m=+0.078141486
NAMESPACE: retail
STATUS: deployed
```

Verify all pods are Running and in a Ready:
```bash
oc get all
```
```
$ oc get all
NAME READY STATUS RESTARTS AGE
pod/postgres-5f549f5798-9qz72 1/1 Running 0 68s
pod/prediction-6d8d96776c-fpcjn 1/1 Running 0 67s
Expand Down Expand Up @@ -105,4 +119,4 @@ imagestream.image.openshift.io/recommendation-service default-route-openshift-
NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD
route.route.openshift.io/prediction-external prediction-external-retail.apps.red.ocp.public prediction-svc prediction-port None
route.route.openshift.io/recommendation-external recommendation-external-retail.apps.red.ocp.public recommendation-svc recommendation-port None
```
```
32 changes: 0 additions & 32 deletions infra/ocp-buildconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,36 +112,4 @@ spec:
local: false

---
apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
name: kafka2mqtt-bridge
spec:
source:
type: Git
sourceSecret:
name: retail-git-ssh-key
git:
uri: '[email protected]:pgrabusz/retailstoreofthefuture.git'
ref: kafka-mqtt-bridge # temporary
contextDir: kafka-mqtt-bridge/
strategy:
type: Docker
dockerStrategy:
dockerfilePath: src/main/docker/Dockerfile.multistage
env:
- name: "DOCKER_BUILDKIT"
value: "1"
output:
to:
kind: ImageStreamTag
name: 'kafka2mqtt-bridge:latest'
---
apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
name: kafka2mqtt-bridge
spec:
lookupPolicy:
local: false

This file was deleted.

This file was deleted.

12 changes: 0 additions & 12 deletions infra/retail-helm-chart/templates/kafka-mqtt-bridge/bridge-sa.yaml

This file was deleted.

24 changes: 7 additions & 17 deletions infra/retail-helm-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ globalInfra:
# sslBrokerCaCertPath: "files/broker.pem"

# set to true if MQTT requires username, password authentication, default: false
authenticationEnabled: true
authenticationEnabled: false

# MQTT client username
user: admin
# MQTT client password
password: password

# name or IP address of the MQTT broker
brokerServer: ex-aao-mqtt-1-svc.retail-infra.svc.cluster.local
brokerServer: ex-aao-mqtt-notls-0-svc.retail-infra.svc.cluster.local

# port that MQTT broker is listening on, default: 1883
brokerPort: 8883
brokerPort: 1883

# MQTT topic for entering events
enterTopic: "retail/mqttEntryTopic"
Expand Down Expand Up @@ -81,7 +81,7 @@ postgres:

recommendationService:
# recommendation service docker image
image: image-registry.openshift-image-registry.svc:5000/retail-helm/recommendation-service:latest
image: image-registry.openshift-image-registry.svc:5000/rsotf/recommendation-service:latest

# number of recommendation service replicas
replicas: 2
Expand Down Expand Up @@ -123,7 +123,7 @@ recommendationService:

predictionService:
# prediction service docker image
image: image-registry.openshift-image-registry.svc:5000/retail-helm/prediction-service:latest
image: image-registry.openshift-image-registry.svc:5000/rsotf/prediction-service:latest

# number of prediction service replicas
replicas: 2
Expand Down Expand Up @@ -153,7 +153,7 @@ predictionService:

customerSimulationService:
# customer simulation service docker image
image: image-registry.openshift-image-registry.svc:5000/retail-helm/customer-simulation-service:latest
image: image-registry.openshift-image-registry.svc:5000/rsotf/customer-simulation-service:latest

# number of customer simulations service replicas
replicas: 1
Expand All @@ -180,7 +180,7 @@ customerSimulationService:

visualization:
# visualization simulation service docker image
image: image-registry.openshift-image-registry.svc:5000/retail-helm/visualization-service:latest
image: image-registry.openshift-image-registry.svc:5000/rsotf/visualization-service:latest

# visualization service type, default: ClusterIP
# serviceType: ClusterIP
Expand All @@ -194,13 +194,3 @@ visualization:
# additional service account annotations
annotations: {}

kafka2mqttBridge:
# visualization simulation service docker image
image: image-registry.openshift-image-registry.svc:5000/retail-helm/kafka2mqtt-bridge:latest

serviceAccount:
# create separate service account for customer simulation service
create: true
# additional service account annotations
annotations: {}

0 comments on commit f721afd

Please sign in to comment.