Skip to content
Merged
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
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.git
kube/
api/bruno/
LICENSE
README.md
# Ignore the other Dockerfile when building one
docker/*.Dockerfile
skaffold.yaml
2 changes: 1 addition & 1 deletion api/bruno/environments/LOCAL.bru
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
vars {
BASE_URL: http://localhost:3000
BASE_URL: http://localhost:30000
}
vars:secret [
USERNAME,
Expand Down
File renamed without changes.
9 changes: 9 additions & 0 deletions docker/api.Dockerfile.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
kube
.vscode
.secrets
.github
migrations
docker
.env
kube
api
9 changes: 9 additions & 0 deletions docker/migrator.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM neo4j:community-trixie

WORKDIR /migrator

RUN mkdir migrations

COPY ./migrations ./migrations

CMD [ "cypher-shell", "--help" ]
8 changes: 8 additions & 0 deletions docker/migrator.Dockerfile.dockeringore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
kube
docker
internal
cmd
.backups
.github
.secrets
api
9 changes: 9 additions & 0 deletions kube/api/api.configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: dotpen-api.cfg
data:
NEO4J_URI: bolt://gopen-db
NEO4J_USERNAME: neo4j
NEO4J_PASSWORD: testpassword
JWT_SIGN: 74JkywUHV3tmT9Yj7r4gsH22Md5Df45n
50 changes: 50 additions & 0 deletions kube/api/api.deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "1"
labels:
app: gopen
name: gopen-api
spec:
progressDeadlineSeconds: 30
replicas: 3
revisionHistoryLimit: 6
selector:
matchLabels:
app: gopen-api
strategy:
rollingUpdate:
maxSurge: 2
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
labels:
app: gopen-api
spec:
containers:
- image: gopen-api:latest
imagePullPolicy: IfNotPresent
name: gopen-api
envFrom:
- configMapRef:
name: dotpen-api.cfg
ports:
- containerPort: 3000
protocol: TCP
livenessProbe:
httpGet:
path: health
port: 3000
initialDelaySeconds: 2
failureThreshold: 1
successThreshold: 1
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
restartPolicy: Always
15 changes: 15 additions & 0 deletions kube/api/api.service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
labels:
app: gopen
name: gopen-api
spec:
ports:
- nodePort: 30000
port: 3000
protocol: TCP
targetPort: 3000
selector:
app: gopen-api
type: NodePort
10 changes: 10 additions & 0 deletions kube/db/data.pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: gopen-data.pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 500Mi
6 changes: 6 additions & 0 deletions kube/db/db.configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: gopen-db.cfg
data:
NEO4J_AUTH: neo4j/testpassword
58 changes: 58 additions & 0 deletions kube/db/db.deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "1"
labels:
app: gopen
name: gopen-db
spec:
replicas: 1
revisionHistoryLimit: 1
selector:
matchLabels:
app: gopen-db
template:
metadata:
labels:
app: gopen-db
spec:
volumes:
- name: gopen-data-volume
persistentVolumeClaim:
claimName: gopen-data.pvc
containers:
- image: neo4j:community-trixie
name: gopen-db
envFrom:
- configMapRef:
name: gopen-db.cfg
ports:
- containerPort: 7687
protocol: TCP
volumeMounts:
- mountPath: /data
name: gopen-data-volume
readinessProbe:
exec:
command:
[
"cypher-shell",
"-u",
"neo4j",
"-p",
"testpassword",
"--access-mode=read",
"RETURN 0",
]
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 60
resources:
requests:
memory: "512Mi"
cpu: "250m"
limits:
memory: "1Gi"
cpu: "500m"
restartPolicy: Always
15 changes: 15 additions & 0 deletions kube/db/db.service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
labels:
app: gopen
name: gopen-db
spec:
selector:
app: gopen-db
ports:
- nodePort: 31000
port: 7687
protocol: TCP
targetPort: 7687
type: NodePort
82 changes: 82 additions & 0 deletions kube/jobs/jobs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
apiVersion: batch/v1
kind: Job
metadata:
name: gopen-db-setup
spec:
template:
spec:
containers:
- name: setup
image: gopen-db-migrator
imagePullPolicy: IfNotPresent
command:
[
"cypher-shell",
"-a",
"bolt://gopen-db",
"-u",
"neo4j",
"-p",
"testpassword",
"-f",
"/migrator/migrations/setup.cypher",
]
readinessProbe:
exec:
command:
[
"cypher-shell",
"-a",
"bolt://gopen-db",
"-u",
"neo4j",
"-p",
"testpassword",
"--access-mode=read",
"RETURN 0",
]
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 60
restartPolicy: Never
backoffLimit: 4
---
apiVersion: batch/v1
kind: Job
metadata:
name: gopen-db-hydrate
spec:
template:
spec:
containers:
- name: hydrate
image: gopen-db-migrator
imagePullPolicy: IfNotPresent
command:
[
"cypher-shell",
"-a",
"bolt://gopen-db",
"-u",
"neo4j",
"-p",
"testpassword",
"-f",
"/migrator/migrations/test_docs.cypher",
]
readinessProbe:
exec:
command:
[
"cypher-shell",
"-a",
"bolt://gopen-db",
"-u",
"neo4j",
"-p",
"testpassword",
"--access-mode=read",
"RETURN 0",
]
restartPolicy: Never
backoffLimit: 4
15 changes: 15 additions & 0 deletions skaffold.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: skaffold/v4beta13
kind: Config
metadata:
name: gopen-api
build:
artifacts:
- image: gopen-api
docker:
dockerfile: ./docker/api.Dockerfile
- image: gopen-db-migrator
docker:
dockerfile: ./docker/migrator.Dockerfile
manifests:
rawYaml:
- kube/**/*.yaml