Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the px-mongo demo to the CLI #1802

Merged
merged 4 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions demos/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,20 @@ pkg_tar(
strip_prefix = "k8ssandra",
)

pkg_tar(
name = "px-mongo",
srcs = glob(["mongodb/*"]),
extension = "tar.gz",
strip_prefix = "mongodb",
)

ARCHIVES = [
":px-finagle",
":px-kafka",
":px-sock-shop",
":px-online-boutique",
":px-k8ssandra",
":px-mongo",
]

demo_upload(
Expand Down
14 changes: 14 additions & 0 deletions demos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,20 @@ file describes the demo scenarios.

6. Replace all occurrences of the k8ssandra-operator namespace. At the time of this writing, the areas to search and replace include the namespace field for a given resource in addition to the cert-manager annotations (cert-manager.io/inject-ca-from). Note: there may be kustomize variables used for the cert-manager.io/inject-ca-from annotation, so ensure all usages reference the px-k8ssandra namespace.

## Updating the `px-mongo` demo

1. Clone `https://github.com/kpattaswamy/mern-k8s`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably don't want to link to a personal Github repo. We should probably pull this into one of Pixie's repos.
What sorts of changes are on this fork?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The upstream demo app was done by the MongoDB team and relied on the demo's backend interacting with their hosted MongoDB atlas instance.

My fork made changes to that demo to create a local MongoDB instance and let the backend service interact with that instead of MongoDB's hosted one. It also contains the necessary docker compose/kubernetes manifests to run the demo locally and utilizes locust for constant load on the various backend endpoints.

Copy link
Member

@JamesMBartlett JamesMBartlett Jan 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with @aimichelle. We shouldn't linked to personal forks. If we need a fork, it should be under the pixie-io org. Happy to create the fork for you, just send me the info about where its forked from.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the fork has been created and upstream added a license. Is there anything else to do here?


2. (optional) Build the container images & update the individual yaml files.

3. Build a single yaml file for the demo:

```shell
kustomize . > mongodb.yaml
kpattaswamy marked this conversation as resolved.
Show resolved Hide resolved
```

4. Copy the yaml file to `pixie/demos/mongodb`.

## Updating the `px-finagle` demo

1. Clone `https://github.com/pixie-io/finagle-helloworld`
Expand Down
9 changes: 9 additions & 0 deletions demos/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,14 @@
"dependencies": {
"cert-manager": true
}
},
"px-mongo": {
"description": "Microservice demo that generates traffic between the Mern-K8s demo app and MongoDB.",
"instructions": [
"Load testing has been automatically launched for px-mongo",
"",
" Use the px/mongodb_data and px/http_data scripts to view the backend API and MongoDB traffic",
" flowing through the demo app."
kpattaswamy marked this conversation as resolved.
Show resolved Hide resolved
]
}
}
230 changes: 230 additions & 0 deletions demos/mongodb/mongodb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
apiVersion: v1
kind: Namespace
metadata:
name: px-mongo
---
apiVersion: v1
kind: Service
metadata:
annotations:
kompose.cmd: /snap/kompose/19/kompose-linux-amd64 convert -f ../docker-compose.yml
kompose.version: 1.21.0 (992df58d8)
creationTimestamp: null
labels:
io.kompose.service: back
name: back
namespace: px-mongo
spec:
ports:
- name: "8085"
port: 8085
targetPort: 8085
selector:
io.kompose.service: back
status:
loadBalancer: {}
---
apiVersion: v1
kind: Service
metadata:
annotations:
kompose.cmd: /snap/kompose/19/kompose-linux-amd64 convert -f ../docker-compose.yml
kompose.version: 1.21.0 (992df58d8)
creationTimestamp: null
labels:
io.kompose.service: front
name: front
namespace: px-mongo
spec:
ports:
- name: "8080"
port: 8080
targetPort: 8080
selector:
io.kompose.service: front
status:
loadBalancer: {}
---
apiVersion: v1
kind: Service
metadata:
annotations:
kompose.cmd: /snap/kompose/19/kompose-linux-amd64 convert -f ../docker-compose.yml
kompose.version: 1.21.0 (992df58d8)
creationTimestamp: null
labels:
io.kompose.service: mongodb
name: mongodb
namespace: px-mongo
spec:
ports:
- name: "27017"
port: 27017
targetPort: 27017
selector:
io.kompose.service: mongodb
status:
loadBalancer: {}
---
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
kompose.cmd: /snap/kompose/19/kompose-linux-amd64 convert -f ../docker-compose.yml
kompose.version: 1.21.0 (992df58d8)
creationTimestamp: null
labels:
io.kompose.service: back
name: back
namespace: px-mongo
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: back
strategy: {}
template:
metadata:
annotations:
kompose.cmd: /snap/kompose/19/kompose-linux-amd64 convert -f ../docker-compose.yml
kompose.version: 1.21.0 (992df58d8)
creationTimestamp: null
labels:
io.kompose.service: back
spec:
containers:
- env:
- name: CONN_STR
value: mongodb://mongodb:27017
- name: PORT
value: "8085"
image: gcr.io/pixie-prod/demos/px-mongo/backend:1.0.0
imagePullPolicy: ""
name: back
ports:
- containerPort: 8085
resources: {}
initContainers:
- command:
- sh
- -c
- set -xe; while ! mongosh mongodb://mongodb:27017 --eval "db.serverStatus()"
; do echo "waiting until mongodb is available"; sleep 2; done;
image: mongo:7.0
name: mongodb-wait
restartPolicy: Always
serviceAccountName: ""
volumes: null
status: {}
---
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
kompose.cmd: /snap/kompose/19/kompose-linux-amd64 convert -f ../docker-compose.yml
kompose.version: 1.21.0 (992df58d8)
creationTimestamp: null
labels:
io.kompose.service: front
name: front
namespace: px-mongo
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: front
strategy: {}
template:
metadata:
annotations:
kompose.cmd: /snap/kompose/19/kompose-linux-amd64 convert -f ../docker-compose.yml
kompose.version: 1.21.0 (992df58d8)
creationTimestamp: null
labels:
io.kompose.service: front
spec:
containers:
- image: gcr.io/pixie-prod/demos/px-mongo/frontend:1.0.0
imagePullPolicy: ""
name: front
ports:
- containerPort: 8080
resources: {}
restartPolicy: Always
serviceAccountName: ""
volumes: null
status: {}
---
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
kompose.cmd: /snap/kompose/19/kompose-linux-amd64 convert -f ../docker-compose.yml
kompose.version: 1.21.0 (992df58d8)
creationTimestamp: null
labels:
io.kompose.service: load
name: load
namespace: px-mongo
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: load
strategy: {}
template:
metadata:
annotations:
kompose.cmd: /snap/kompose/19/kompose-linux-amd64 convert -f ../docker-compose.yml
kompose.version: 1.21.0 (992df58d8)
creationTimestamp: null
labels:
io.kompose.service: load
spec:
containers:
- image: gcr.io/pixie-prod/demos/px-mongo/load:1.0.0
imagePullPolicy: ""
name: load
resources: {}
restartPolicy: Always
serviceAccountName: ""
volumes: null
status: {}
---
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
kompose.cmd: /snap/kompose/19/kompose-linux-amd64 convert -f ../docker-compose.yml
kompose.version: 1.21.0 (992df58d8)
creationTimestamp: null
labels:
io.kompose.service: mongodb
name: mongodb
namespace: px-mongo
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: mongodb
strategy: {}
template:
metadata:
annotations:
kompose.cmd: /snap/kompose/19/kompose-linux-amd64 convert -f ../docker-compose.yml
kompose.version: 1.21.0 (992df58d8)
creationTimestamp: null
labels:
io.kompose.service: mongodb
spec:
containers:
- image: mongo:7.0
imagePullPolicy: ""
name: mongodb
ports:
- containerPort: 27017
resources: {}
restartPolicy: Always
serviceAccountName: ""
volumes: null
status: {}
Loading