mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Use folders for groups of YAML files
This keeps our configuration DRY and helps us to save keystrokes.
This commit is contained in:
parent
5cd0485117
commit
bbfe39e076
23
README.md
23
README.md
@ -19,35 +19,33 @@ There are many Kubernetes distributions, but if you're just getting started, Min
|
|||||||
|
|
||||||
## Create a namespace locally
|
## Create a namespace locally
|
||||||
```shell
|
```shell
|
||||||
kubectl create -f namespace-staging.json
|
kubectl create -f namespace-staging.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
## Change config maps according to your needs
|
## Change config maps according to your needs
|
||||||
```shell
|
```shell
|
||||||
cd ./staging
|
cd config/
|
||||||
cp db-migration-worker-configmap.template.yaml db-migration-worker-configmap.yaml
|
cp db-migration-worker-configmap.template.yaml db-migration-worker-configmap.yaml
|
||||||
# edit all variables according to the setup of the remote legacy server
|
# edit all variables according to the setup of the remote legacy server
|
||||||
|
cd ..
|
||||||
```
|
```
|
||||||
|
|
||||||
## Apply the config map to staging namespace
|
## Apply the config map to staging namespace
|
||||||
```shell
|
```shell
|
||||||
cd ./staging
|
kubectl apply -f config/
|
||||||
kubectl apply -f neo4j-configmap.yaml -f backend-configmap.yaml -f web-configmap.yaml -f db-migration-worker-configmap.yaml
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Setup secrets and deploy themn
|
## Setup secrets and deploy themn
|
||||||
```shell
|
```shell
|
||||||
cd ./staging
|
|
||||||
cp secrets.yaml.template secrets.yaml
|
cp secrets.yaml.template secrets.yaml
|
||||||
# change all vars as needed and deploy it afterwards
|
# change all vars as needed and deploy it afterwards
|
||||||
kubectl apply -f secrets.yaml
|
kubectl apply -f secrets.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
## Deploy the app
|
## Create volumes and deployments
|
||||||
```shell
|
```shell
|
||||||
cd ./staging
|
kubectl apply -f volumes/
|
||||||
kubectl apply -f ./volumes
|
kubectl apply -f deployments/
|
||||||
kubectl apply -f neo4j-deployment.yaml -f backend-deployment.yaml -f web-deployment.yaml -f db-migration-worker-deployment.yaml
|
|
||||||
```
|
```
|
||||||
This can take a while.
|
This can take a while.
|
||||||
Sit back and relax and have a look into your minikube dashboard:
|
Sit back and relax and have a look into your minikube dashboard:
|
||||||
@ -59,7 +57,7 @@ Wait until all pods turn green and they don't show a warning `Waiting: Container
|
|||||||
## Expose the services
|
## Expose the services
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl create -f services/
|
kubectl apply -f services/
|
||||||
```
|
```
|
||||||
|
|
||||||
## Access the service
|
## Access the service
|
||||||
@ -77,11 +75,12 @@ Copy your private ssh key and the `.known-hosts` file of your remote legacy serv
|
|||||||
# check the corresponding db-migration-worker pod
|
# check the corresponding db-migration-worker pod
|
||||||
kubectl --namespace=staging get pods
|
kubectl --namespace=staging get pods
|
||||||
# change <POD_ID> below
|
# change <POD_ID> below
|
||||||
kubectl cp path/to/your/ssh/keys/folder staging/nitro-db-migration-worker-<POD_ID>:/root/
|
kubectl cp path/to/your/ssh/keys/.ssh staging/nitro-db-migration-worker-<POD_ID>:/root/
|
||||||
```
|
```
|
||||||
|
|
||||||
Run the migration:
|
Run the migration:
|
||||||
```shell
|
```shell
|
||||||
# change <POD_ID> below
|
# change <POD_IDs> below
|
||||||
kubectl --namespace=staging exec -it nitro-db-migration-worker-<POD_ID> ./import.sh
|
kubectl --namespace=staging exec -it nitro-db-migration-worker-<POD_ID> ./import.sh
|
||||||
|
kubectl --namespace=staging exec -it nitro-neo4j-<POD_ID> ./import/import.sh
|
||||||
```
|
```
|
||||||
|
|||||||
1
config/.gitignore
vendored
Normal file
1
config/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
db-migration-worker.yml
|
||||||
@ -1,13 +0,0 @@
|
|||||||
kind: Service
|
|
||||||
apiVersion: v1
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
k8s-app: nitro-backend
|
|
||||||
name: nitro-backend
|
|
||||||
namespace: staging
|
|
||||||
spec:
|
|
||||||
ports:
|
|
||||||
- port: 4000
|
|
||||||
targetPort: 4000
|
|
||||||
selector:
|
|
||||||
k8s-app: nitro-backend
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: sample-load-balancer
|
|
||||||
namespace: staging
|
|
||||||
spec:
|
|
||||||
type: LoadBalancer
|
|
||||||
ports:
|
|
||||||
- protocol: TCP
|
|
||||||
port: 80
|
|
||||||
targetPort: 80
|
|
||||||
name: http
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
apiVersion: extensions/v1beta1
|
|
||||||
kind: Ingress
|
|
||||||
metadata:
|
|
||||||
name: backend-ingress
|
|
||||||
namespace: staging
|
|
||||||
annotations:
|
|
||||||
nginx.ingress.kubernetes.io/rewrite-target: /
|
|
||||||
spec:
|
|
||||||
rules:
|
|
||||||
- http:
|
|
||||||
paths:
|
|
||||||
- path: /
|
|
||||||
backend:
|
|
||||||
serviceName: backend
|
|
||||||
servicePort: 4000
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: ingress-nginx
|
|
||||||
namespace: staging
|
|
||||||
labels:
|
|
||||||
app.kubernetes.io/name: ingress-nginx
|
|
||||||
app.kubernetes.io/part-of: ingress-nginx
|
|
||||||
spec:
|
|
||||||
type: NodePort
|
|
||||||
ports:
|
|
||||||
- name: http
|
|
||||||
port: 80
|
|
||||||
targetPort: 80
|
|
||||||
protocol: TCP
|
|
||||||
- name: https
|
|
||||||
port: 443
|
|
||||||
targetPort: 443
|
|
||||||
protocol: TCP
|
|
||||||
selector:
|
|
||||||
app.kubernetes.io/name: ingress-nginx
|
|
||||||
app.kubernetes.io/part-of: ingress-nginx
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
kind: Service
|
|
||||||
apiVersion: v1
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
k8s-app: nitro-web
|
|
||||||
name: nitro-web
|
|
||||||
namespace: staging
|
|
||||||
spec:
|
|
||||||
ports:
|
|
||||||
- port: 3000
|
|
||||||
targetPort: 3000
|
|
||||||
selector:
|
|
||||||
k8s-app: nitro-web
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"kind": "Namespace",
|
|
||||||
"apiVersion": "v1",
|
|
||||||
"metadata": {
|
|
||||||
"name": "staging",
|
|
||||||
"labels": {
|
|
||||||
"name": "staging"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
6
namespace-staging.yml
Normal file
6
namespace-staging.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
kind: Namespace
|
||||||
|
apiVersion: v1
|
||||||
|
metadata:
|
||||||
|
name: staging
|
||||||
|
labels:
|
||||||
|
name: staging
|
||||||
@ -8,10 +8,8 @@ metadata:
|
|||||||
spec:
|
spec:
|
||||||
ports:
|
ports:
|
||||||
- name: web
|
- name: web
|
||||||
protocol: TCP
|
|
||||||
port: 4000
|
port: 4000
|
||||||
targetPort: 4000
|
targetPort: 4000
|
||||||
nodePort: 32612
|
|
||||||
selector:
|
selector:
|
||||||
workload.user.cattle.io/workloadselector: deployment-staging-backend
|
workload.user.cattle.io/workloadselector: deployment-staging-backend
|
||||||
type: LoadBalancer
|
type: LoadBalancer
|
||||||
|
|||||||
@ -10,11 +10,9 @@ spec:
|
|||||||
workload.user.cattle.io/workloadselector: deployment-staging-neo4j
|
workload.user.cattle.io/workloadselector: deployment-staging-neo4j
|
||||||
ports:
|
ports:
|
||||||
- name: bolt
|
- name: bolt
|
||||||
protocol: TCP
|
|
||||||
port: 7687
|
port: 7687
|
||||||
targetPort: 7687
|
targetPort: 7687
|
||||||
- name: web
|
- name: web
|
||||||
protocol: TCP
|
|
||||||
port: 7474
|
port: 7474
|
||||||
targetPort: 7474
|
targetPort: 7474
|
||||||
type: LoadBalancer
|
type: LoadBalancer
|
||||||
|
|||||||
@ -8,7 +8,6 @@ metadata:
|
|||||||
spec:
|
spec:
|
||||||
ports:
|
ports:
|
||||||
- name: web
|
- name: web
|
||||||
protocol: "TCP"
|
|
||||||
port: 3000
|
port: 3000
|
||||||
targetPort: 3000
|
targetPort: 3000
|
||||||
selector:
|
selector:
|
||||||
|
|||||||
@ -1,21 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: nitro-web
|
|
||||||
namespace: staging
|
|
||||||
labels:
|
|
||||||
workload.user.cattle.io/workloadselector: deployment-staging-web
|
|
||||||
spec:
|
|
||||||
ports:
|
|
||||||
- name: web
|
|
||||||
protocol: "TCP"
|
|
||||||
port: 3000
|
|
||||||
targetPort: 3000
|
|
||||||
selector:
|
|
||||||
workload.user.cattle.io/workloadselector: deployment-staging-web
|
|
||||||
type: LoadBalancer
|
|
||||||
sessionAffinity: None
|
|
||||||
externalTrafficPolicy: Cluster
|
|
||||||
status:
|
|
||||||
loadBalancer: {}
|
|
||||||
|
|
||||||
1
staging/.gitignore
vendored
1
staging/.gitignore
vendored
@ -1 +0,0 @@
|
|||||||
db-migration-worker-configmap.yaml
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
kind: PersistentVolumeClaim
|
|
||||||
apiVersion: v1
|
|
||||||
metadata:
|
|
||||||
name: mongo-export-claim
|
|
||||||
namespace: staging
|
|
||||||
spec:
|
|
||||||
accessModes:
|
|
||||||
- ReadWriteMany
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
storage: 1Gi
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: PersistentVolume
|
|
||||||
metadata:
|
|
||||||
name: mongo-export-volume
|
|
||||||
namespace: staging
|
|
||||||
spec:
|
|
||||||
accessModes:
|
|
||||||
- ReadWriteMany
|
|
||||||
capacity:
|
|
||||||
storage: 1Gi
|
|
||||||
hostPath:
|
|
||||||
path: /data/shared/mongo-exports/
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
kind: PersistentVolumeClaim
|
|
||||||
apiVersion: v1
|
|
||||||
metadata:
|
|
||||||
name: ssh-keys-claim
|
|
||||||
namespace: staging
|
|
||||||
spec:
|
|
||||||
accessModes:
|
|
||||||
- ReadWriteOnce
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
storage: 1Mi
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: PersistentVolume
|
|
||||||
metadata:
|
|
||||||
name: ssh-keys-volume
|
|
||||||
namespace: staging
|
|
||||||
spec:
|
|
||||||
accessModes:
|
|
||||||
- ReadWriteOnce
|
|
||||||
capacity:
|
|
||||||
storage: 1Mi
|
|
||||||
hostPath:
|
|
||||||
path: /data/pv0001/
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
kind: PersistentVolumeClaim
|
|
||||||
apiVersion: v1
|
|
||||||
metadata:
|
|
||||||
name: uploads-claim
|
|
||||||
namespace: staging
|
|
||||||
spec:
|
|
||||||
accessModes:
|
|
||||||
- ReadWriteMany
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
storage: 8Gi
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: PersistentVolume
|
|
||||||
metadata:
|
|
||||||
name: uploads-volume
|
|
||||||
namespace: staging
|
|
||||||
spec:
|
|
||||||
accessModes:
|
|
||||||
- ReadWriteMany
|
|
||||||
capacity:
|
|
||||||
storage: 8Gi
|
|
||||||
hostPath:
|
|
||||||
path: /data/shared/uploads/
|
|
||||||
25
volumes/mongo-export.yml
Normal file
25
volumes/mongo-export.yml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
kind: PersistentVolume
|
||||||
|
apiVersion: v1
|
||||||
|
metadata:
|
||||||
|
name: mongo-export-volume
|
||||||
|
namespace: staging
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteMany
|
||||||
|
capacity:
|
||||||
|
storage: 1Gi
|
||||||
|
hostPath:
|
||||||
|
path: /data/shared/mongo-exports/
|
||||||
|
---
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
apiVersion: v1
|
||||||
|
metadata:
|
||||||
|
name: mongo-export-claim
|
||||||
|
namespace: staging
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteMany
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 1Gi
|
||||||
25
volumes/ssh-keys.yml
Normal file
25
volumes/ssh-keys.yml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolume
|
||||||
|
metadata:
|
||||||
|
name: ssh-keys-volume
|
||||||
|
namespace: staging
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
capacity:
|
||||||
|
storage: 1Mi
|
||||||
|
hostPath:
|
||||||
|
path: /data/pv0001/
|
||||||
|
---
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
apiVersion: v1
|
||||||
|
metadata:
|
||||||
|
name: ssh-keys-claim
|
||||||
|
namespace: staging
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 1Mi
|
||||||
25
volumes/uploads.yml
Normal file
25
volumes/uploads.yml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolume
|
||||||
|
metadata:
|
||||||
|
name: uploads-volume
|
||||||
|
namespace: staging
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteMany
|
||||||
|
capacity:
|
||||||
|
storage: 8Gi
|
||||||
|
hostPath:
|
||||||
|
path: /data/shared/uploads/
|
||||||
|
---
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
apiVersion: v1
|
||||||
|
metadata:
|
||||||
|
name: uploads-claim
|
||||||
|
namespace: staging
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteMany
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 8Gi
|
||||||
Loading…
x
Reference in New Issue
Block a user