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

cloud deployment #66

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
15 changes: 12 additions & 3 deletions .env
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
# URLs - change these to your local or cloud deployment IP address/URL if necessary
PUBLIC_URL=http://localhost
WS_PUBLIC_URL=ws://localhost
PUBLIC_URL=http://34.149.216.116
WS_PUBLIC_URL=ws://34.149.216.116

# Port numbers - change these if you are already using these ports for other (non-PeerPrep) services
FRONTEND_PORT=3000
QUESTION_API_PORT=2000
USER_API_PORT=3001
MATCHING_API_PORT=3002
COLLAB_API_PORT=3003
COLLAB_API_PORT=3003

# Use internal DNS names
# FRONTEND_API_URL=http://35.240.249.202
# USER_API_URL=http://35.197.128.24
# QUESTION_API_URL=http://35.247.159.214
# MATCHING_API_URL=http://35.197.129.244
# COLLAB_API_URL=http://34.126.181.193
# KAFKA_URL=http://34.142.245.12
# ZOOKEEPER_URL=http://35.247.142.189
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- name: Build and push Docker images
run: |
docker compose build
services=("frontend" "matching-service" "question" "signaling-service" "user")
services=("frontend" "matching-service" "question" "collab-service" "user")
for service in "${services[@]}"; do
image="asia-southeast1-docker.pkg.dev/tokyo-crossbar-440806-u9/peerprep/$service:latest"
docker tag "cs3219-ay2425s1-project-g44-$service" "$image"
Expand Down
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ services:
USER_API_PORT: ${USER_API_PORT}
MATCHING_API_PORT: ${MATCHING_API_PORT}
COLLAB_API_PORT: ${COLLAB_API_PORT}
FRONTEND_API_URL: ${FRONTEND_API_URL}
USER_API_URL: ${USER_API_URL}
QUESTION_API_URL: ${QUESTION_API_URL}
MATCHING_API_URL: ${MATCHING_API_URL}
COLLAB_API_URL: ${COLLAB_API_URL}
KAFKA_URL: ${KAFKA_URL}
ZOOKEEPER_URL: ${ZOOKEEPER_URL}
ports:
- "${FRONTEND_PORT}:${FRONTEND_PORT}"
develop:
Expand Down
26 changes: 21 additions & 5 deletions frontend/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,44 @@ ARG QUESTION_API_PORT
ARG USER_API_PORT
ARG MATCHING_API_PORT
ARG COLLAB_API_PORT
ARG FRONTEND_API_URL
ARG USER_API_URL
ARG QUESTION_API_URL
ARG MATCHING_API_URL
ARG COLLAB_API_URL

ENV PUBLIC_URL=${PUBLIC_URL}
ENV WS_PUBLIC_URL=${WS_PUBLIC_URL}
ENV FRONTEND_API_URL=${USER_API_URL}
ENV USER_API_URL=${USER_API_URL}
ENV QUESTION_API_URL=${QUESTION_API_URL}
ARG MATCHING_API_URL=${MATCHING_API_URL}
ARG COLLAB_API_URL=${COLLAB_API_URL}

ENV FRONTEND_PORT=${FRONTEND_PORT}
ENV NEXT_PUBLIC_FRONTEND_URL=${PUBLIC_URL}:${FRONTEND_PORT}
# ENV NEXT_PUBLIC_FRONTEND_URL=${FRONTEND_API_URL}:${FRONTEND_PORT}
ENV NEXT_PUBLIC_FRONTEND_URL=${PUBLIC_URL}

ENV QUESTION_API_PORT=${QUESTION_API_PORT}
ENV NEXT_PUBLIC_QUESTION_API_BASE_URL=${PUBLIC_URL}:${QUESTION_API_PORT}/questions
# ENV NEXT_PUBLIC_QUESTION_API_BASE_URL=${QUESTION_API_URL}:${QUESTION_API_PORT}/questions
ENV NEXT_PUBLIC_QUESTION_API_BASE_URL=${PUBLIC_URL}/questions


ENV USER_API_PORT=${USER_API_PORT}
ENV USER_API_BASE_URL=${PUBLIC_URL}:${USER_API_PORT}
# ENV USER_API_BASE_URL=${PUBLIC_URL}:${USER_API_PORT}
ENV USER_API_BASE_URL=${PUBLIC_URL}
ENV NEXT_PUBLIC_USER_API_AUTH_URL=${USER_API_BASE_URL}/auth
ENV NEXT_PUBLIC_USER_API_USERS_URL=${USER_API_BASE_URL}/users
ENV NEXT_PUBLIC_USER_API_EMAIL_URL=${USER_API_BASE_URL}/email
ENV NEXT_PUBLIC_USER_API_HISTORY_URL=${USER_API_BASE_URL}/users/history

ENV MATCHING_API_PORT=${MATCHING_API_PORT}
ENV NEXT_PUBLIC_MATCHING_API_URL=${PUBLIC_URL}:${MATCHING_API_PORT}/matching
# ENV NEXT_PUBLIC_MATCHING_API_URL=${MATCHING_API_URL}:${MATCHING_API_PORT}/matching
ENV NEXT_PUBLIC_MATCHING_API_URL=${PUBLIC_URL}/matching

ENV COLLAB_API_PORT=${COLLAB_API_PORT}
ENV NEXT_PUBLIC_COLLAB_API_URL=${PUBLIC_URL}:${COLLAB_API_PORT}
# ENV NEXT_PUBLIC_COLLAB_API_URL=${COLLAB_API_URL}:${COLLAB_API_PORT}
ENV NEXT_PUBLIC_COLLAB_API_URL=${PUBLIC_URL}

COPY package.json package-lock.json ./
RUN npm ci
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: signaling-service
name: collab-service
spec:
replicas: 1
selector:
matchLabels:
app: signaling-service
app: collab-service
template:
metadata:
labels:
app: signaling-service
app: collab-service
spec:
containers:
- image: asia-southeast1-docker.pkg.dev/tokyo-crossbar-440806-u9/peerprep/signaling-service:latest
name: signaling-service
- image: asia-southeast1-docker.pkg.dev/tokyo-crossbar-440806-u9/peerprep/collab-service:latest
name: collab-service
ports:
- containerPort: 3003
protocol: TCP
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: signaling-service
name: collab-service
spec:
type: ClusterIP
ports:
- name: "3003"
port: 3003
targetPort: 3003
selector:
app: signaling-service
app: collab-service
67 changes: 67 additions & 0 deletions kubernetes/frontend-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: frontend-ingress
annotations:
kubernetes.io/ingress.global-static-ip-name: "peerprep"
spec:
ingressClassName: "gce"
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: frontend
port:
number: 3000
- path: /users
pathType: Prefix
backend:
service:
name: user
port:
number: 3001
- path: /auth
pathType: Prefix
backend:
service:
name: user
port:
number: 3001
- path: /email
pathType: Prefix
backend:
service:
name: user
port:
number: 3001
- path: /users/history
pathType: Prefix
backend:
service:
name: user
port:
number: 3001
- path: /questions
pathType: Prefix
backend:
service:
name: question
port:
number: 2000
- path: /matching
pathType: Prefix
backend:
service:
name: matching-service
port:
number: 3002
- path: /
pathType: Prefix
backend:
service:
name: collab-service
port:
number: 3003
2 changes: 1 addition & 1 deletion kubernetes/frontend-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: Service
metadata:
name: frontend
spec:
type: LoadBalancer
type: ClusterIP
ports:
- name: "3000"
port: 3000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ spec:
failureThreshold: 10
periodSeconds: 10
timeoutSeconds: 5
name: kafka-containter
name: kafka-container
ports:
- containerPort: 9092
protocol: TCP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ kind: Service
metadata:
name: kafka-container
spec:
type: ClusterIP
ports:
- name: "9092"
port: 9092
Expand Down
1 change: 1 addition & 0 deletions kubernetes/matching-service-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ kind: Service
metadata:
name: matching-service
spec:
type: ClusterIP
ports:
- name: "3002"
port: 3002
Expand Down
1 change: 1 addition & 0 deletions kubernetes/question-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ kind: Service
metadata:
name: question
spec:
type: ClusterIP
ports:
- name: "2000"
port: 2000
Expand Down
1 change: 1 addition & 0 deletions kubernetes/zookeeper-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ kind: Service
metadata:
name: zookeeper
spec:
type: ClusterIP
ports:
- name: "2181"
port: 2181
Expand Down