mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-12 23:35:58 +00:00
Dedicate extra chapter to volumes
This commit is contained in:
parent
783d34f53a
commit
3edb590849
@ -26,6 +26,7 @@
|
||||
* [Kubernetes Dashboard](deployment/digital-ocean/dashboard/README.md)
|
||||
* [HTTPS](deployment/digital-ocean/https/README.md)
|
||||
* [Human Connection](deployment/human-connection/README.md)
|
||||
* [Volumes](deployment/volumes/README.md)
|
||||
* [Neo4J DB Backup](deployment/backup.md)
|
||||
* [Legacy Migration](deployment/legacy-migration/README.md)
|
||||
* [Feature Specification](cypress/features.md)
|
||||
|
||||
@ -37,6 +37,14 @@ If you have a [kubernets dashboard](../digital-ocean/dashboard/README.md)
|
||||
deployed you should switch to namespace `human-connection` in order to
|
||||
monitor the state of your deployments.
|
||||
|
||||
## Create persistent volumes
|
||||
|
||||
While the deployments and services can easily be restored, simply by deleting
|
||||
and applying the kubernetes configurations again, certain data is not that
|
||||
easily recovered. Therefore we separated persistent volumes from deployments
|
||||
and services. There is a [dedicated section](../volumes/README.md). Create those
|
||||
persistent volumes once before you apply the configuration.
|
||||
|
||||
## Apply the configuration
|
||||
|
||||
```text
|
||||
|
||||
@ -43,15 +43,3 @@
|
||||
restartPolicy: Always
|
||||
terminationGracePeriodSeconds: 30
|
||||
status: {}
|
||||
---
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: uploads-claim
|
||||
namespace: human-connection
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 2Gi
|
||||
|
||||
@ -57,15 +57,3 @@
|
||||
claimName: neo4j-data-claim
|
||||
restartPolicy: Always
|
||||
terminationGracePeriodSeconds: 30
|
||||
---
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: neo4j-data-claim
|
||||
namespace: human-connection
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
|
||||
42
deployment/volumes/README.md
Normal file
42
deployment/volumes/README.md
Normal file
@ -0,0 +1,42 @@
|
||||
# Persistent Volumes
|
||||
|
||||
At the moment, the application needs two persistent volumes:
|
||||
|
||||
* The `/data/` folder where `neo4j` stores its database and
|
||||
* the folder `/nitro-backend/public/uploads` where the backend stores uploads.
|
||||
|
||||
As a matter of precaution, the persistent volume claims that setup these volumes
|
||||
live in a separate folder. You don't want to accidently loose all your data in
|
||||
your database by running `kubectl delete -f human-connection/`, do you?
|
||||
|
||||
## Create Persistent Volume Claims
|
||||
|
||||
Run the following:
|
||||
```sh
|
||||
# in folder deployments/
|
||||
$ kubectl apply -f volumes
|
||||
persistentvolumeclaim/neo4j-data-claim created
|
||||
persistentvolumeclaim/uploads-claim created
|
||||
```
|
||||
|
||||
## Change Reclaim Policy
|
||||
|
||||
We recommend to change the `ReclaimPolicy`, so if you delete the persistent
|
||||
volume claims, the associated volumes will be released, not deleted:
|
||||
|
||||
```sh
|
||||
$ kubectl --namespace=human-connection get pv
|
||||
|
||||
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
|
||||
pvc-bd02a715-66d0-11e9-be52-ba9c337f4551 1Gi RWO Delete Bound human-connection/neo4j-data-claim do-block-storage 4m24s
|
||||
pvc-bd208086-66d0-11e9-be52-ba9c337f4551 2Gi RWO Delete Bound human-connection/uploads-claim do-block-storage 4m12s
|
||||
```
|
||||
|
||||
Get the volume id from above, then change `ReclaimPolicy` with:
|
||||
```sh
|
||||
kubectl patch pv <VOLUME-ID> -p '{"spec":{"persistentVolumeReclaimPolicy":"Retain"}}'
|
||||
|
||||
# in the above example
|
||||
kubectl patch pv pvc-bd02a715-66d0-11e9-be52-ba9c337f4551 -p '{"spec":{"persistentVolumeReclaimPolicy":"Retain"}}'
|
||||
kubectl patch pv pvc-bd208086-66d0-11e9-be52-ba9c337f4551 -p '{"spec":{"persistentVolumeReclaimPolicy":"Retain"}}'
|
||||
```
|
||||
12
deployment/volumes/neo4j-data.yaml
Normal file
12
deployment/volumes/neo4j-data.yaml
Normal file
@ -0,0 +1,12 @@
|
||||
---
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: neo4j-data-claim
|
||||
namespace: human-connection
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
12
deployment/volumes/uploads.yaml
Normal file
12
deployment/volumes/uploads.yaml
Normal file
@ -0,0 +1,12 @@
|
||||
---
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: uploads-claim
|
||||
namespace: human-connection
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 2Gi
|
||||
Loading…
x
Reference in New Issue
Block a user