Skip to content

Database where the highscores are stored - MongoDB backed by OpenShift Container Storage

License

Notifications You must be signed in to change notification settings

CodeCafeOpenShiftGame/mongodb-openshift-container-storage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MongoDB with OpenShift Container Storage

This repo shows how to deploy a MongoDB container backed by OpenShift Container Storage. Red Hat's OpenShift Container Storage is software-defined storage for containers. It uses Ceph which is a battle-tested software defined storage (SDS) solution that has been available as a storage backend for OpenStack and Kubernetes for quite some time.

Creating your database from this template

Just run the following:

oc process -f ./mongodb-ocs-persistent.yaml -l name=mongodb\
-p MONGODB_USER=thisisauser \
-p MONGODB_PASSWORD=thisis4password \
-p MONGODB_DATABASE=highscores \
-p MONGODB_ADMIN_PASSWORD=thisis4password \
-p DATABASE_SERVICE_NAME=mongodb-ocs \
| oc create -f -

if you don't have OCS/ODF installed you can use default storage instead:

oc process -f ./mongodb-template-generic.yaml -l name=mongodb \
-p MONGODB_USER=thisisauser \
-p MONGODB_PASSWORD=thisis4password \
-p MONGODB_DATABASE=highscores \
-p MONGODB_ADMIN_PASSWORD=thisis4password \
-p DATABASE_SERVICE_NAME=mongodb-p \
| oc create -f -

How it works

If you look at the template you will notices that the PersistentVolume defined uses an annotation to select one of the storage classes for OCS -

<snip>

kind: PersistentVolumeClaim
  metadata:
    annotations:
      volume.beta.kubernetes.io/storage-class: ocs-storagecluster-ceph-rbd

<snip>

That's it.

You can read more about OpenShift Container Storage here:

https://www.redhat.com/en/resources/openshift-container-storage-4-datasheet

Installing this as a template

If you are a cluster admin you can install this template to reside in the cluster (vs. git cloned and run locally) with:

oc create -n openshift -f mongodb-ocs-persistent.yaml

(Doing the above will just remove the need to use this github repo. Future deployments can just come straight from the cluster console or with oc new-app --template=).

About

Database where the highscores are stored - MongoDB backed by OpenShift Container Storage

Resources

License

Stars

Watchers

Forks

Packages

No packages published