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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker-compose -> kompose #945

Closed
wants to merge 1 commit 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 11 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@ WORKDIR /app/
# RUN CGO_ENABLED=1 go build -race -o /go/bin/plex
RUN CGO_ENABLED=0 go build -o /go/bin/plex

ARG BACALHAU_VERSION=1.2.0
ARG NEXT_PUBLIC_PRIVY_APP_ID
ARG PRIVY_PUBLIC_KEY

# For bacalhau cli
FROM ghcr.io/bacalhau-project/bacalhau:v${BACALHAU_VERSION:-1.2.0} as bacalhau

FROM busybox:1.31.1-glibc

COPY --from=builder /go/bin/plex /plex
Expand All @@ -36,19 +29,22 @@ COPY --from=builder /lib/*-linux-gnu*/libdl.so.2 /lib/
COPY --from=builder /usr/lib/*-linux-gnu*/libssl.so* /usr/lib/
COPY --from=builder /usr/lib/*-linux-gnu*/libcrypto.so* /usr/lib/

# COPY bacalhau cli
COPY --from=bacalhau --chmod=755 /usr/local/bin/bacalhau /usr/local/bin/bacalhau

# This creates config file needed by bacalhau golang client
RUN /usr/local/bin/bacalhau version
RUN /usr/local/bin/bacalhau config default > /root/.bacalhau/config.yaml

ENV POSTGRES_PASSWORD=MAKE_UP_SOMETHING_RANDOM
ENV POSTGRES_USER=labdao
ENV POSTGRES_DB=labdao
ENV POSTGRES_HOST=localhost
ENV FRONTEND_URL=http://localhost:3080
ENV BACALHAU_API_HOST=127.0.0.1
ENV IPFS_API_HOST=ipfs
ENV MAX_QUEUE_TIME_SECONDS=259200 # default 72 hours
ENV MAX_COMPUTE_TIME_SECONDS=259200 # default 72 hours
ENV STRIPE_PRODUCT_SLUG=price_1OlwVPE7xzGf7nZbaccQCnHv
# ENV STRIPE_SECRET_KEY: ${STRIPE_SECRET_KEY}
# ENV STRIPE_WEBHOOK_SECRET_KEY: ${STRIPE_WEBHOOK_SECRET_KEY}
# ENV NEXT_PUBLIC_PRIVY_APP_ID: ${NEXT_PUBLIC_PRIVY_APP_ID}
# ENV PRIVY_PUBLIC_KEY: ${PRIVY_PUBLIC_KEY}
# ENV AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
# ENV AWS_SECRET_ACCESS_KEY : ${AWS_SECRET_ACCESS_KEY}


EXPOSE 8080

Expand Down
65 changes: 65 additions & 0 deletions backend-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
kompose.cmd: kompose convert -f docker-compose.yml
kompose.version: 1.32.0 (765fde254)
labels:
io.kompose.service: backend
name: backend
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: backend
template:
metadata:
annotations:
kompose.cmd: kompose convert -f docker-compose.yml
kompose.version: 1.32.0 (765fde254)
labels:
io.kompose.network/plex-default: "true"
io.kompose.service: backend
spec:
containers:
- env:
- name: BACALHAU_API_HOST
value: requester
- name: FRONTEND_URL
value: http://localhost:3000
- name: IPFS_API_HOST
value: ipfs
- name: MAX_COMPUTE_TIME_SECONDS
value: "259200"
- name: MAX_QUEUE_TIME_SECONDS
value: "259200"
- name: NEXT_PUBLIC_PRIVY_APP_ID
value: clnf5ptkk01h1jn0fzhh4xldt
- name: POSTGRES_DB
value: backend
- name: POSTGRES_HOST
value: dbbackend
- name: POSTGRES_PASSWORD
value: labdao
- name: POSTGRES_USER
value: labdao
- name: PRIVY_PUBLIC_KEY
- name: STRIPE_PRODUCT_SLUG
value: price_1OlwVPE7xzGf7nZbaccQCnHv
- name: STRIPE_SECRET_KEY
- name: STRIPE_WEBHOOK_SECRET_KEY
image: backend
livenessProbe:
exec:
command:
- wget --no-verbose --tries=1 --spider http://localhost:8080/healthcheck || exit 1
failureThreshold: 10
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 10
name: backend
ports:
- containerPort: 8080
hostPort: 8080
protocol: TCP
restartPolicy: Always
16 changes: 16 additions & 0 deletions backend-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
annotations:
kompose.cmd: kompose convert -f docker-compose.yml
kompose.version: 1.32.0 (765fde254)
labels:
io.kompose.service: backend
name: backend
spec:
ports:
- name: "8080"
port: 8080
targetPort: 8080
selector:
io.kompose.service: backend
12 changes: 12 additions & 0 deletions compute-claim0-persistentvolumeclaim.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
io.kompose.service: compute-claim0
name: compute-claim0
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi
12 changes: 12 additions & 0 deletions compute-claim1-persistentvolumeclaim.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
io.kompose.service: compute-claim1
name: compute-claim1
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi
69 changes: 69 additions & 0 deletions compute-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
kompose.cmd: kompose convert -f docker-compose.yml
kompose.version: 1.32.0 (765fde254)
labels:
io.kompose.service: compute
name: compute
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: compute
strategy:
type: Recreate
template:
metadata:
annotations:
kompose.cmd: kompose convert -f docker-compose.yml
kompose.version: 1.32.0 (765fde254)
labels:
io.kompose.network/plex-default: "true"
io.kompose.service: compute
spec:
containers:
- args:
- serve
- --ipfs-connect
- /dns4/ipfs/tcp/5001
- --node-type
- compute
- --labels
- owner=labdao
- --private-internal-ipfs=false
- --peer
- /dns4/requester/tcp/1234/http
- --job-selection-probe-http
- http://receptor:8080/judge
- --job-selection-accept-networked
- --job-selection-data-locality
- anywhere
env:
- name: BACALHAU_DIR
value: /tmp/bacalhau
- name: BACALHAU_ENVIRONMENT
value: local
- name: DOCKER_DEFAULT_PLATFORM
value: linux/amd64
- name: KEEP_STACK
value: "true"
- name: LOG_LEVEL
value: trace
image: ghcr.io/bacalhau-project/bacalhau:v1.2.0
name: compute
volumeMounts:
- mountPath: /var/run/docker.sock
name: compute-claim0
- mountPath: /tmp
name: compute-claim1
hostname: compute
restartPolicy: Always
volumes:
- name: compute-claim0
persistentVolumeClaim:
claimName: compute-claim0
- name: compute-claim1
persistentVolumeClaim:
claimName: compute-claim1
39 changes: 39 additions & 0 deletions compute-health-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
kompose.cmd: kompose convert -f docker-compose.yml
kompose.version: 1.32.0 (765fde254)
labels:
io.kompose.service: compute-health
name: compute-health
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: compute-health
template:
metadata:
annotations:
kompose.cmd: kompose convert -f docker-compose.yml
kompose.version: 1.32.0 (765fde254)
labels:
io.kompose.network/plex-default: "true"
io.kompose.service: compute-health
spec:
containers:
- args:
- sh
- -c
- apk add curl && sleep infinity
image: alpine
livenessProbe:
exec:
command:
- curl -f http://compute:1234/api/v1/healthz
failureThreshold: 10
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 10
name: compute-health
restartPolicy: Always
61 changes: 61 additions & 0 deletions dbbackend-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
kompose.cmd: kompose convert -f docker-compose.yml
kompose.version: 1.32.0 (765fde254)
labels:
io.kompose.service: dbbackend
name: dbbackend
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: dbbackend
strategy:
type: Recreate
template:
metadata:
annotations:
kompose.cmd: kompose convert -f docker-compose.yml
kompose.version: 1.32.0 (765fde254)
labels:
io.kompose.network/plex-default: "true"
io.kompose.service: dbbackend
spec:
containers:
- args:
- postgres
- -c
- log_statement=all
- -c
- log_destination=stderr
env:
- name: POSTGRES_DB
value: backend
- name: POSTGRES_PASSWORD
value: labdao
- name: POSTGRES_USER
value: labdao
image: postgres:15.4
livenessProbe:
exec:
command:
- pg_isready -U postgres || exit 1
failureThreshold: 10
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 10
name: dbbackend
ports:
- containerPort: 5432
hostPort: 5432
protocol: TCP
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: dbdata-backend
restartPolicy: Always
volumes:
- name: dbdata-backend
persistentVolumeClaim:
claimName: dbdata-backend
16 changes: 16 additions & 0 deletions dbbackend-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
annotations:
kompose.cmd: kompose convert -f docker-compose.yml
kompose.version: 1.32.0 (765fde254)
labels:
io.kompose.service: dbbackend
name: dbbackend
spec:
ports:
- name: "5432"
port: 5432
targetPort: 5432
selector:
io.kompose.service: dbbackend
12 changes: 12 additions & 0 deletions dbdata-backend-persistentvolumeclaim.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
io.kompose.service: dbdata-backend
name: dbdata-backend
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi
12 changes: 12 additions & 0 deletions dbdata-receptor-persistentvolumeclaim.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
io.kompose.service: dbdata-receptor
name: dbdata-receptor
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi