Skip to content

Commit

Permalink
[Docs][Add] Added docs for v0.1.0 (#29)
Browse files Browse the repository at this point in the history
* Added documentation for v0.1.0

Signed-off-by: iamabhishek-dubey <[email protected]>
  • Loading branch information
iamabhishek-dubey authored Feb 5, 2022
1 parent 6753290 commit facc90e
Show file tree
Hide file tree
Showing 10 changed files with 206 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
# Ignore build and test binaries.
bin/
testbin/
docs/
examples/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ testbin/*
*.swp
*.swo
*~
.hugo_build.lock
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
### v0.1.0
##### Feburary 5, 2022

#### :tada: Features

- Added standalone MongoDB functionality
- Added cluster MongoDB functionality
- Helm chart installation support
- Monitoring support for MongoDB
- Documentation for setup and management

7 changes: 7 additions & 0 deletions docs/content/en/docs/Development/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: "Development"
linkTitle: "Development"
weight: 5
description: >
Development related information for MongoDB Operator
---
69 changes: 69 additions & 0 deletions docs/content/en/docs/Development/dev-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
title: "Development Guide"
weight: 2
linkTitle: "Development Guide"
description: >
Development guide for MongoDB Operator
---

## Pre-requisites

**Access to Kubernetes cluster**

First, you will need access to a Kubernetes cluster. The easiest way to start is minikube.

- [Virtualbox](https://www.virtualbox.org/wiki/Downloads)
- [Minikube](https://kubernetes.io/docs/setup/minikube/)
- [Kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/)

**Tools to build an Operator**

Apart from kubernetes cluster, there are some tools which are needed to build and test the MongoDB Operator.

- [Git](https://git-scm.com/downloads)
- [Go](https://golang.org/dl/)
- [Docker](https://docs.docker.com/install/)
- [Operator SDK](https://github.com/operator-framework/operator-sdk/blob/v0.8.1/doc/user/install-operator-sdk.md)
- [Make](https://www.gnu.org/software/make/manual/make.html)

## Building Operator

To build the operator on local system, we can use `make` command.

```shell
$ make manager
...
go build -o bin/manager main.go
```

MongoDB operator gets packaged as a container image for running on the Kubernetes cluster.

```shell
$ make docker-build
```

If you want to play it on Kubernetes. You can use a minikube.

```shell
$ minikube start --vm-driver virtualbox
...
😄 minikube v1.0.1 on linux (amd64)
🤹 Downloading Kubernetes v1.14.1 images in the background ...
🔥 Creating kvm2 VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
📶 "minikube" IP address is 192.168.39.240
🐳 Configuring Docker as the container runtime ...
🐳 Version of container runtime is 18.06.3-ce
⌛ Waiting for image downloads to complete ...
✨ Preparing Kubernetes environment ...
🚜 Pulling images required by Kubernetes v1.14.1 ...
🚀 Launching Kubernetes v1.14.1 using kubeadm ...
⌛ Waiting for pods: apiserver proxy etcd scheduler controller dns
🔑 Configuring cluster permissions ...
🤔 Verifying component health .....
💗 kubectl is now configured to use "minikube"
🏄 Done! Thank you for using minikube!
```

```shell
$ make test
```
7 changes: 7 additions & 0 deletions docs/content/en/docs/Monitoring/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: "Monitoring"
linkTitle: "Monitoring"
weight: 4
description: >
Monitoring of MongoDB standalone and cluster
---
9 changes: 9 additions & 0 deletions docs/content/en/docs/Monitoring/grafana-dashboard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: "Grafana Dashboard"
weight: 3
linkTitle: "Grafana Dashboard"
description: >
Monitoring dashboard of MongoDB database for Grafana
---

### Coming Soon
74 changes: 74 additions & 0 deletions docs/content/en/docs/Monitoring/prometheus-monitoring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
title: "Prometheus Monitoring"
weight: 2
linkTitle: "Prometheus Monitoring"
description: >
Monitoring of MongoDB standalone and replicaset cluster using Prometheus
---

In MongoDB Operator, we are using [mongodb-exporter](https://github.com/percona/mongodb_exporter) to collect the stats, metrics for MongoDB database. This exporter is capable to capture the stats for standalone and cluster mode of MongoDB.

If we are using the `helm` chart for installation purpose, we can simply enable this configuration inside the [values.yaml](https://github.com/OT-CONTAINER-KIT/helm-charts/blob/main/charts/mongodb-cluster/values.yaml).

```yaml
mongoDBMonitoring:
enabled: true
image:
name: bitnami/mongodb-exporter
tag: 0.11.2-debian-10-r382
imagePullPolicy: IfNotPresent
resources: {}
```
In case of `kubectl` installation, we can add a code snippet in yaml manifest like this:-

```yaml
mongoDBMonitoring:
enableExporter: true
image: bitnami/mongodb-exporter:0.11.2-debian-10-r382
imagePullPolicy: IfNotPresent
resources: {}
```

## ServiceMonitor for Prometheus Operator

Once the exporter is configured, the next aligned task would be to ask [Prometheus](https://prometheus.io) to monitor it. For [Prometheus Operator](https://github.com/prometheus-operator/prometheus-operator), we have to create CRD object in Kubernetes called "ServiceMonitor". We can update this using the `helm` as well.

```yaml
serviceMonitor:
enabled: false
interval: 30s
scrapeTimeout: 10s
namespace: monitoring
```

For kubectl related configuration, we may have to create `ServiceMonitor` definition in a yaml file and apply it using kubectl command. A `ServiceMonitor` definition looks like this:-

```yaml
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: mongodb-prometheus-monitoring
labels:
app.kubernetes.io/name: mongodb
app.kubernetes.io/managed-by: mongodb
app.kubernetes.io/instance: mongodb
app.kubernetes.io/version: v0.1.0
app.kubernetes.io/component: middleware
spec:
selector:
matchLabels:
app: mongodb
mongodb_setup: standalone
role: standalone
endpoints:
- port: metrics
interval: 30s
scrapeTimeout: 30s
namespaceSelector:
matchNames:
- middleware-production
```


7 changes: 7 additions & 0 deletions docs/content/en/docs/Release History/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: "Release History"
linkTitle: "Release History"
weight: 6
description: >
Release information for MongoDB Operator
---
19 changes: 19 additions & 0 deletions docs/content/en/docs/Release History/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: "CHANGELOG"
weight: 2
linkTitle: "CHANGELOG"
description: >
Changelog version history for MongoDB
---

### v0.1.0

**Feburary 5, 2022**

**🏄 Features**

- Added standalone MongoDB functionality
- Added cluster MongoDB functionality
- Helm chart installation support
- Monitoring support for MongoDB
- Documentation for setup and management

0 comments on commit facc90e

Please sign in to comment.