Skip to content

Commit

Permalink
add compiler deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalmishraa committed Aug 28, 2024
1 parent 2cc15d3 commit 63af261
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 3 deletions.
5 changes: 3 additions & 2 deletions docker/worker-compiler/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ FROM node:20-alpine
ARG DATABASE_URL
ARG REDIS_URL

# Install g++ compiler
RUN apk add --no-cache g++

# Set the working directory in the container
WORKDIR /usr/src/app

Expand All @@ -12,8 +15,6 @@ COPY ../../apps/worker-compiler /usr/src/app/apps/worker-compiler
COPY ../../package.json /usr/src/app/package.json
COPY ../../turbo.json /usr/src/app/turbo.json



# Install dependencies
RUN npm install

Expand Down
39 changes: 39 additions & 0 deletions k8s/33-compiler/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: compiler
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: compiler
template:
metadata:
labels:
app: compiler
spec:
containers:
- name: main-container
image: vishal022/algoearth-compiler:latest
ports:
- containerPort: 3005
volumeMounts:
- name: problems
mountPath: /dev/problems
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: algoearth-compiler-secret
key: DATABASE_URL
- name: REDIS_URL
valueFrom:
secretKeyRef:
name: algoearth-compiler-secret
key: REDIS_URL
volumes:
- name: problems
persistentVolumeClaim:
claimName: problems-pvc
---
12 changes: 12 additions & 0 deletions k8s/33-compiler/secret.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Secret
metadata:
name: algoearth-compiler-secret
type: Opaque
data:
DATABASE_URL:
REDIS_URL:
NEXTAUTH_SECRET:
JUDGE0_URI:
CLOUD_FLARE_TURNSTILE_SITE_KEY:
CLOUD_FLARE_TURNSTILE_SECRET_KEY:
13 changes: 13 additions & 0 deletions k8s/33-compiler/services.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: algoearth-compiler-service
namespace: default
spec:
selector:
app: compiler
ports:
- protocol: TCP
port: 3005
targetPort: 3005
type: ClusterIP
9 changes: 8 additions & 1 deletion k8s/44-worker-compiler/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ spec:
containers:
- name: worker-compiler
image: vishal022/algoearth-worker-compiler:latest
volumeMounts:
- name: problems
mountPath: /dev/problems
env:
- name: DATABASE_URL
valueFrom:
Expand All @@ -25,4 +28,8 @@ spec:
valueFrom:
secretKeyRef:
name: algoearth-wc
key: REDIS_URL
key: REDIS_URL
volumes:
- name: problems
persistentVolumeClaim:
claimName: problems-pvc

0 comments on commit 63af261

Please sign in to comment.