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

Migrate to dgraph #26

Open
wants to merge 8 commits into
base: master
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
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ serde = { version = "1.0.106", features = ["derive"] }
serde_json = "1.0.52"
# TODO: Get from crates.io once 3.0 is published
clap = { git = "https://github.com/clap-rs/clap/" }
diesel = { version = "1.4", features = ["postgres"] }
flate2 = "1.0.14"
dotenv = "0.15.0"
itertools = "0.9.0"
Expand Down
11 changes: 7 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
FROM rust:1.43 as builder
WORKDIR /usr/src/papergraph
COPY . .
RUN cargo install diesel_cli --no-default-features --features "postgres"
RUN cargo install --path .

# Serving container
FROM debian:buster-slim
WORKDIR /usr/src/papergraph
RUN apt-get update && apt-get install -y libpq-dev wget

RUN apt-get update && apt-get install -y wget tar
RUN wget https://github.com/dgraph-io/dgraph/releases/download/v20.03.1/dgraph-linux-amd64.tar.gz && \
tar -C /usr/local/bin -xzf dgraph-linux-amd64.tar.gz && \
rm dgraph-linux-amd64.tar.gz

COPY . .
COPY --from=builder /usr/local/cargo/bin/papergraph /usr/local/bin/papergraph
COPY --from=builder /usr/local/cargo/bin/diesel /usr/local/bin/diesel
CMD ["papergraph"]
CMD ["papergraph"]
53 changes: 0 additions & 53 deletions deploy/k8s/cloudsql.yaml

This file was deleted.

145 changes: 145 additions & 0 deletions deploy/k8s/dgraph.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
---
# A small volume to store the dgraph xid mapping for data insertions
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: dgraph-xid
labels:
app: papergraph
tier: dgraph
spec:
accessModes:
- ReadWriteOnce
storageClassName: faster
resources:
requests:
storage: 16Gi
---
# This is the service that should be used by the clients of Dgraph to talk to the cluster.
apiVersion: v1
kind: Service
metadata:
name: papergraph-dgraph
labels:
app: papergraph
tier: dgraph
spec:
# type: LoadBalancer
ports:
- port: 5080
targetPort: 5080
name: zero-grpc
- port: 6080
targetPort: 6080
name: zero-http
- port: 8080
targetPort: 8080
name: alpha-http
- port: 9080
targetPort: 9080
name: alpha-grpc
- port: 8000
targetPort: 8000
name: ratel-http
selector:
app: papergraph
tier: dgraph
---
# This StatefulSet runs 1 pod with one Zero, one Alpha & one Ratel containers.
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: papergraph-dgraph
spec:
serviceName: "papergraph-dgraph"
replicas: 1
selector:
matchLabels:
app: papergraph
tier: dgraph
template:
metadata:
labels:
app: papergraph
tier: dgraph
spec:
tolerations:
- key: "preemptible"
operator: "Exists"
effect: "NoSchedule"
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: cloud.google.com/gke-nodepool
operator: In
values:
- preempt-1
containers:
- name: ratel
image: dgraph/dgraph:v20.03.1
imagePullPolicy: Always
ports:
- containerPort: 8000
name: ratel-http
command:
- dgraph-ratel
- name: zero
image: dgraph/dgraph:v20.03.1
imagePullPolicy: Always
ports:
- containerPort: 5080
name: zero-grpc
- containerPort: 6080
name: zero-http
volumeMounts:
- name: datadir
mountPath: /dgraph
command:
- bash
- "-c"
- |
set -ex
dgraph zero --my=localhost:5080 --ludicrous_mode
- name: alpha
image: dgraph/dgraph:v20.03.1
imagePullPolicy: Always
ports:
- containerPort: 8080
name: alpha-http
- containerPort: 9080
name: alpha-grpc
volumeMounts:
- name: datadir
mountPath: /dgraph
env:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
command:
- bash
- "-c"
- |
set -ex
dgraph alpha --my=localhost:7080 --lru_mb 8192 --zero localhost:5080 --ludicrous_mode
terminationGracePeriodSeconds: 60
volumes:
- name: datadir
persistentVolumeClaim:
claimName: datadir
updateStrategy:
type: RollingUpdate
volumeClaimTemplates:
- metadata:
name: datadir
annotations:
volume.alpha.kubernetes.io/storage-class: anything
spec:
storageClassName: faster
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 128Gi
36 changes: 0 additions & 36 deletions deploy/k8s/hasura-dev.yaml

This file was deleted.

70 changes: 0 additions & 70 deletions deploy/k8s/hasura.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion deploy/k8s/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ spec:
paths:
- path: /v1/graphql
backend:
serviceName: papergraph-hasura
serviceName: papergraph-dgraph
servicePort: 8080
Loading