-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
334 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Use the official Node.js 14 image as the base image | ||
FROM node:19 | ||
|
||
# Set the working directory inside the container | ||
WORKDIR /app | ||
|
||
# Copy package.json and package-lock.json to the working directory | ||
COPY package*.json ./ | ||
|
||
# Install dependencies | ||
RUN npm install | ||
|
||
# Copy the rest of the application code to the working directory | ||
COPY . . | ||
|
||
# Expose a port (e.g., 3000) if your application listens on a specific port | ||
EXPOSE 3000 | ||
|
||
# Define the command to run your application | ||
CMD [ "npm", "start" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/sh | ||
|
||
# this will only work if you are me, and have your aws login set up etc. | ||
|
||
set -e | ||
set -x | ||
|
||
me=$0 | ||
|
||
source .env | ||
VERSION_NUMBER=1 | ||
export IMAGE_NAME=hny-tricks | ||
export IMAGE_TAG=hny-tricks-$VERSION_NUMBER | ||
|
||
# because separately pushing ignores the other platform GOD I HATE HASHICORP SOMETIMES | ||
docker build -t $IMAGE_REPO/$IMAGE_NAME:$IMAGE_TAG . | ||
|
||
cat k8s/k8s.yaml \ | ||
| sed 's/IMAGE_TAG/'$IMAGE_TAG'/g' \ | ||
| kubectl apply -f - | ||
|
||
|
||
HONEYCOMB_API_KEY=$HONEYCOMB_API_KEY_PROD_MARKERS VERSION_NUMBER=$VERSION_NUMBER ./scripts/create-marker.sh $deploy_ONLY | ||
|
||
## Now change this script to increment the version number, so next time it will be different. | ||
function sed_in_place { | ||
expr=$1 | ||
file=$2 | ||
backup=$file.bak | ||
sed "$expr" $file > $file.bak | ||
if [ $? -eq 0 ]; then | ||
chmod `stat -f %A $file` $file.bak # this works on mac | ||
mv $file.bak $file | ||
else | ||
echo "replacement didn't work on $file" | ||
break | ||
fi | ||
} | ||
|
||
echo "Deployed from $me with VERSION_NUMBER $VERSION_NUMBER" | ||
|
||
sed_in_place "s/VERSION_NUMBER=$VERSION_NUMBER/VERSION_NUMBER=$(( VERSION_NUMBER + 1 ))/" $me |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# what is this directory | ||
|
||
Don't use this. | ||
|
||
## if you are me | ||
|
||
I'm deploying this app (the nodejs version) to my sandbox EKS cluster. | ||
|
||
First, push the images to dockerhub | ||
|
||
I might have to increment the version every time to get it to really update the pods, hmm. | ||
|
||
So change the version in k8s.yaml... | ||
|
||
Then, apply the k8s.yaml file | ||
|
||
`k apply -f k8s.yaml` | ||
|
||
see jessitron/infra/otel-demo-help/o11yday-ingress.yaml for the ingress. | ||
|
||
this is not a rigorous deployment (it's super flaky really) but I wanted it to be out there so I can show people. | ||
|
||
[https://o11yday.jessitron.honeydemo.io]() | ||
|
||
This one depends on a honeycomb API key secret that I threw into my cluster, and it reports to o11y-xp-workshop team, prod env. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,246 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: backend-for-frontend | ||
namespace: o11yday | ||
spec: | ||
selector: | ||
app: backend-for-frontend | ||
ports: | ||
- protocol: TCP | ||
port: 10114 | ||
targetPort: 10114 | ||
|
||
--- | ||
|
||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: backend-for-frontend | ||
namespace: o11yday | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: backend-for-frontend | ||
template: | ||
metadata: | ||
labels: | ||
app: backend-for-frontend | ||
spec: | ||
containers: | ||
- name: backend-for-frontend | ||
image: o11yday/backend-for-frontend-nodejs:IMAGE_TAG | ||
imagePullPolicy: Always | ||
ports: | ||
- containerPort: 10114 | ||
env: | ||
- name: OTEL_EXPORTER_OTLP_ENDPOINT | ||
value: "http://daemonset-otelcol.default.svc.cluster.local:4318" | ||
- name: OTEL_SERVICE_NAME | ||
value: "backend-for-frontend-nodejs" | ||
|
||
--- | ||
|
||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: meminator | ||
namespace: o11yday | ||
spec: | ||
selector: | ||
app: meminator | ||
ports: | ||
- protocol: TCP | ||
port: 10114 | ||
targetPort: 10114 | ||
|
||
--- | ||
|
||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: meminator | ||
namespace: o11yday | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: meminator | ||
template: | ||
metadata: | ||
labels: | ||
app: meminator | ||
spec: | ||
containers: | ||
- name: meminator | ||
image: o11yday/meminator-nodejs:IMAGE_TAG | ||
imagePullPolicy: Always | ||
ports: | ||
- containerPort: 10114 | ||
env: | ||
- name: OTEL_EXPORTER_OTLP_ENDPOINT | ||
value: "http://daemonset-otelcol.default.svc.cluster.local:4318" | ||
- name: OTEL_SERVICE_NAME | ||
value: "meminator-nodejs" | ||
- name: OTEL_EXPORTER_OTLP_LOG_PROTOCOL | ||
value: http | ||
- name: OTEL_EXPORTER_OTLP_PROTOCOL | ||
value: http | ||
|
||
--- | ||
|
||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: phrase-picker | ||
namespace: o11yday | ||
spec: | ||
selector: | ||
app: phrase-picker | ||
ports: | ||
- protocol: TCP | ||
port: 10114 | ||
targetPort: 10114 | ||
|
||
--- | ||
|
||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: phrase-picker | ||
namespace: o11yday | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: phrase-picker | ||
template: | ||
metadata: | ||
labels: | ||
app: phrase-picker | ||
spec: | ||
containers: | ||
- name: phrase-picker | ||
image: o11yday/phrase-picker-nodejs:IMAGE_TAG | ||
imagePullPolicy: Always | ||
ports: | ||
- containerPort: 10114 | ||
env: | ||
- name: OTEL_EXPORTER_OTLP_ENDPOINT | ||
value: "http://daemonset-otelcol.default.svc.cluster.local:4318" | ||
- name: OTEL_SERVICE_NAME | ||
value: "phrase-picker-nodejs" | ||
|
||
--- | ||
|
||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: image-picker | ||
namespace: o11yday | ||
spec: | ||
selector: | ||
app: image-picker | ||
ports: | ||
- protocol: TCP | ||
port: 10114 | ||
targetPort: 10114 | ||
|
||
--- | ||
|
||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: image-picker | ||
namespace: o11yday | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: image-picker | ||
template: | ||
metadata: | ||
labels: | ||
app: image-picker | ||
spec: | ||
containers: | ||
- name: image-picker | ||
image: o11yday/image-picker-nodejs:IMAGE_TAG | ||
imagePullPolicy: Always | ||
ports: | ||
- containerPort: 10114 | ||
env: | ||
- name: OTEL_EXPORTER_OTLP_ENDPOINT | ||
value: "http://daemonset-otelcol.default.svc.cluster.local:4318" | ||
- name: OTEL_SERVICE_NAME | ||
value: "image-picker-nodejs" | ||
|
||
--- | ||
|
||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: nginx | ||
namespace: o11yday | ||
spec: | ||
selector: | ||
app: nginx | ||
ports: | ||
- protocol: TCP | ||
port: 8080 | ||
targetPort: 80 | ||
|
||
--- | ||
|
||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: nginx | ||
namespace: o11yday | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: nginx | ||
template: | ||
metadata: | ||
labels: | ||
app: nginx | ||
spec: | ||
containers: | ||
- name: nginx | ||
image: o11yday/web:IMAGE_TAG | ||
imagePullPolicy: Always | ||
ports: | ||
- containerPort: 80 | ||
|
||
--- | ||
|
||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: loadgen | ||
namespace: o11yday | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: loadgen | ||
template: | ||
metadata: | ||
labels: | ||
app: loadgen | ||
spec: | ||
containers: | ||
- name: loadgen | ||
image: o11yday/loadgen:IMAGE_TAG | ||
imagePullPolicy: Always | ||
env: | ||
- name: LOAD_URL | ||
value: "http://nginx:8080/backend/createPicture" | ||
- name: HONEYCOMB_API_KEY | ||
valueFrom: | ||
secretKeyRef: | ||
name: o11yday-hny-api-key | ||
key: api-key |