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

Develop #22

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
17 changes: 17 additions & 0 deletions argocd/helm-udaconnect-prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: techtrends-prod
namespace: argocd
spec:
destination:
namespace: default
server: https://kubernetes.default.svc
project: default
source:
helm:
valueFiles:
- values-prod.yaml
path: helm
repoURL: https://github.com/kydq2022/nd064-c2-message-passing-projects-starter
targetRevision: HEAD
3 changes: 1 addition & 2 deletions db/2020-08-15_init-db.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ CREATE TABLE location (
id SERIAL PRIMARY KEY,
person_id INT NOT NULL,
coordinate GEOMETRY NOT NULL,
creation_time TIMESTAMP NOT NULL DEFAULT NOW(),
FOREIGN KEY (person_id) REFERENCES person(id)
creation_time TIMESTAMP NOT NULL DEFAULT NOW()
);
CREATE INDEX coordinate_idx ON location (coordinate);
CREATE INDEX creation_time_idx ON location (creation_time);
8 changes: 8 additions & 0 deletions deployment/kafka-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: kafka-env
data:
KAFKA_BOOTSTRAP_SERVERS: "kafka-service:9092"
KAFKA_TOPIC_PERSON: "person-topic"
KAFKA_TOPIC_LOCATION: "location-topic"
35 changes: 35 additions & 0 deletions deployment/kafka.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: kafka-kraft
spec:
replicas: 1
selector:
matchLabels:
app: kafka-kraft
template:
metadata:
labels:
app: kafka-kraft
spec:
containers:
- name: kafka-kraft
image: confluentinc/confluent-local:7.4.0
ports:
- containerPort: 9092
env:
- name: KAFKA_ADVERTISED_LISTENERS
value: PLAINTEXT://kafka-kraft:29092,PLAINTEXT_HOST://kafka-service:9092

---
apiVersion: v1
kind: Service
metadata:
name: kafka-service
spec:
selector:
app: kafka-kraft
ports:
- protocol: TCP
port: 9092 # Port to expose on the service
targetPort: 9092 # Port your application is listening on
62 changes: 62 additions & 0 deletions deployment/person-rpc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
apiVersion: v1
kind: Service
metadata:
labels:
service: person-rpc
name: person-rpc
spec:
ports:
- name: "50051"
port: 50051
targetPort: 50051
selector:
service: person-rpc
type: NodePort
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
service: person-rpc
name: person-rpc
spec:
replicas: 1
selector:
matchLabels:
service: person-rpc
template:
metadata:
labels:
service: person-rpc
spec:
containers:
- image: kydq2022/nd064-c2-person-rpc:latest
name: person-rpc
imagePullPolicy: Always
env:
- name: DB_USERNAME
valueFrom:
configMapKeyRef:
name: db-env
key: DB_USERNAME
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: db-secret
key: DB_PASSWORD
- name: DB_NAME
valueFrom:
configMapKeyRef:
name: db-env
key: DB_NAME
- name: DB_HOST
valueFrom:
configMapKeyRef:
name: db-env
key: DB_HOST
- name: DB_PORT
valueFrom:
configMapKeyRef:
name: db-env
key: DB_PORT
restartPolicy: Always
3 changes: 2 additions & 1 deletion deployment/postgres.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ spec:
containers:
- name: postgres
image: postgis/postgis:12-2.5-alpine
imagePullPolicy: "IfNotPresent"
imagePullPolicy: Always
restartPolicy: Always
ports:
- containerPort: 5432
env:
Expand Down
1 change: 0 additions & 1 deletion deployment/udaconnect-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ spec:
- name: "5000"
port: 5000
targetPort: 5000
nodePort: 30001
selector:
service: udaconnect-api
type: NodePort
Expand Down
8 changes: 6 additions & 2 deletions deployment/udaconnect-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ spec:
- name: "3000"
port: 3000
targetPort: 3000
nodePort: 30000
selector:
service: udaconnect-app
type: NodePort
Expand All @@ -31,7 +30,7 @@ spec:
service: udaconnect-app
spec:
containers:
- image: udacity/nd064-udaconnect-app:latest
- image: kydq2022/nd064-c2-udaconnect-app:latest
name: udaconnect-app
imagePullPolicy: Always
resources:
Expand All @@ -41,4 +40,9 @@ spec:
limits:
memory: "256Mi"
cpu: "256m"
env:
- name: PERSON_API
value: "person-api:5000"
- name: CONNECTION_API
value: "person-api:5000"
restartPolicy: Always
65 changes: 65 additions & 0 deletions deployment/udaconnect-connection.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
apiVersion: v1
kind: Service
metadata:
labels:
service: connection-api
name: connection-api
spec:
ports:
- name: "5000"
port: 5000
targetPort: 5000
selector:
service: connection-api
type: NodePort
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
service: connection-api
name: connection-api
spec:
replicas: 1
selector:
matchLabels:
service: connection-api
template:
metadata:
labels:
service: connection-api
spec:
containers:
- image: kydq2022/nd064-c2-connection-api:latest
name: connection-api
imagePullPolicy: Always
env:
- name: DB_USERNAME
valueFrom:
configMapKeyRef:
name: db-env
key: DB_USERNAME
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: db-secret
key: DB_PASSWORD
- name: DB_NAME
valueFrom:
configMapKeyRef:
name: db-env
key: DB_NAME
- name: DB_HOST
valueFrom:
configMapKeyRef:
name: db-env
key: DB_HOST
- name: DB_PORT
valueFrom:
configMapKeyRef:
name: db-env
key: DB_PORT
# gRPC
- name: GRPC_SERVER_ADDRESS
value: "person-rpc:50051"
restartPolicy: Always
58 changes: 58 additions & 0 deletions deployment/udaconnect-location-consumer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
service: location-consumer
name: location-consumer
spec:
replicas: 1
selector:
matchLabels:
service: location-consumer
template:
metadata:
labels:
service: location-consumer
spec:
containers:
- image: kydq2022/nd064-c2-location-consumer:latest
name: location-consumer
imagePullPolicy: Always
env:
- name: DB_USERNAME
valueFrom:
configMapKeyRef:
name: db-env
key: DB_USERNAME
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: db-secret
key: DB_PASSWORD
- name: DB_NAME
valueFrom:
configMapKeyRef:
name: db-env
key: DB_NAME
- name: DB_HOST
valueFrom:
configMapKeyRef:
name: db-env
key: DB_HOST
- name: DB_PORT
valueFrom:
configMapKeyRef:
name: db-env
key: DB_PORT
# Kafka
- name: KAFKA_BOOTSTRAP_SERVERS
valueFrom:
configMapKeyRef:
name: kafka-env
key: KAFKA_BOOTSTRAP_SERVERS
- name: KAFKA_TOPIC
valueFrom:
configMapKeyRef:
name: kafka-env
key: KAFKA_TOPIC_LOCATION
restartPolicy: Always
73 changes: 73 additions & 0 deletions deployment/udaconnect-location.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
apiVersion: v1
kind: Service
metadata:
labels:
service: location-api
name: location-api
spec:
ports:
- name: "5000"
port: 5000
targetPort: 5000
selector:
service: location-api
type: NodePort
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
service: location-api
name: location-api
spec:
replicas: 1
selector:
matchLabels:
service: location-api
template:
metadata:
labels:
service: location-api
spec:
containers:
- image: kydq2022/nd064-c2-location-api:latest
name: location-api
imagePullPolicy: Always
env:
- name: DB_USERNAME
valueFrom:
configMapKeyRef:
name: db-env
key: DB_USERNAME
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: db-secret
key: DB_PASSWORD
- name: DB_NAME
valueFrom:
configMapKeyRef:
name: db-env
key: DB_NAME
- name: DB_HOST
valueFrom:
configMapKeyRef:
name: db-env
key: DB_HOST
- name: DB_PORT
valueFrom:
configMapKeyRef:
name: db-env
key: DB_PORT
# Kafka
- name: KAFKA_BOOTSTRAP_SERVERS
valueFrom:
configMapKeyRef:
name: kafka-env
key: KAFKA_BOOTSTRAP_SERVERS
- name: KAFKA_TOPIC
valueFrom:
configMapKeyRef:
name: kafka-env
key: KAFKA_TOPIC_LOCATION
restartPolicy: Always
Loading