Skip to content

Commit 7ede5fd

Browse files
hossainemruztamalsaha
authored andcommitted
Finalize doc template (#3)
1 parent bb3b7fd commit 7ede5fd

File tree

5 files changed

+106
-470
lines changed

5 files changed

+106
-470
lines changed

docs/_index.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: MongoDB {{ .subproject_version }} Backup Guides | Stash
3+
menu:
4+
product_stash_{{ .version }}:
5+
identifier: stash-mongodb-guides-{{ .subproject_version }}
6+
name: {{ .subproject_version }}
7+
parent: stash-mongodb-guides
8+
weight: 50
9+
menu_name: product_stash_{{ .version }}
10+
---

docs/mongodb-replicaset.md

Lines changed: 33 additions & 157 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
---
2-
title: Backup MongoDB ReplicaSet Cluster | Stash
3-
description: Backup MongoDB ReplicaSet Cluster using Stash
2+
title: Backup & Restore MongoDB ReplicaSet Cluster | Stash
3+
description: Backup and restore MongoDB ReplicaSet cluster using Stash
44
menu:
5-
product_stash_0.8.3:
6-
identifier: replicaset-mongodb
7-
name: MongoDB
8-
parent: database
9-
weight: 30
5+
product_stash_{{ .version }}:
6+
identifier: mongodb-replicaset-{{ .subproject_version }}
7+
name: MongoDB ReplicaSet Cluster
8+
parent: stash-mongodb-guides-{{ .subproject_version }}
9+
weight: 20
1010
product_name: stash
11-
menu_name: product_stash_0.8.3
12-
section_menu_id: guides
11+
menu_name: product_stash_{{ .version }}
12+
section_menu_id: stash-addons
1313
---
1414

1515
# Backup and Restore MongoDB ReplicaSet Clusters using Stash
@@ -19,21 +19,18 @@ Stash supports taking [backup and restores MongoDB ReplicaSet clusters in "idiom
1919
## Before You Begin
2020

2121
- At first, you need to have a Kubernetes cluster, and the `kubectl` command-line tool must be configured to communicate with your cluster. If you do not already have a cluster, you can create one by using Minikube.
22-
23-
- Install Stash in your cluster following the steps [here](https://appscode.com/products/stash/0.8.3/setup/install/).
24-
25-
- Install [KubeDB](https://kubedb.com) in your cluster following the steps [here](https://kubedb.com/docs/0.12.0/setup/install/). This step is optional. You can deploy your database using any method you want. We are using KubeDB because it automates some tasks that you have to do manually otherwise.
26-
27-
- If you are not familiar with how Stash backup and restore databases, please check the following guide:
28-
- [How Stash backup and restore databases](https://appscode.com/products/stash/0.8.3/guides/databases/overview/).
22+
- Install Stash in your cluster following the steps [here](/docs/setup/install.md).
23+
- Install MongoDB addon for Stash following the steps [here](/docs/addons/mongodb/setup/install.md)
24+
- Install [KubeDB](https://kubedb.com) in your cluster following the steps [here](https://kubedb.com/docs/setup/install/). This step is optional. You can deploy your database using any method you want. We are using KubeDB because KubeDB simplifies many of the difficult or tedious management tasks of running a production grade databases on private and public clouds.
25+
- If you are not familiar with how Stash backup and restore MongoDB databases, please check the following guide [here](/docs/addons/mongodb/overview.md).
2926

3027
You have to be familiar with following custom resources:
3128

32-
- [AppBinding](https://appscode.com/products/stash/0.8.3/concepts/crds/appbinding/)
33-
- [Function](https://appscode.com/products/stash/0.8.3/concepts/crds/function/)
34-
- [Task](https://appscode.com/products/stash/0.8.3/concepts/crds/task/)
35-
- [BackupConfiguration](https://appscode.com/products/stash/0.8.3/concepts/crds/backupconfiguration/)
36-
- [RestoreSession](https://appscode.com/products/stash/0.8.3/concepts/crds/restoresession/)
29+
- [AppBinding](/docs/concepts/crds/appbinding.md)
30+
- [Function](/docs/concepts/crds/function.md)
31+
- [Task](/docs/concepts/crds/task.md)
32+
- [BackupConfiguration](/docs/concepts/crds/backupconfiguration.md)
33+
- [RestoreSession](/docs/concepts/crds/restoresession.md)
3734

3835
To keep things isolated, we are going to use a separate namespace called `demo` throughout this tutorial. Create `demo` namespace if you haven't created yet.
3936

@@ -42,88 +39,7 @@ $ kubectl create ns demo
4239
namespace/demo created
4340
```
4441

45-
> Note: YAML files used in this tutorial are stored [here](https://github.com/stashed/mongodb/tree/master/docs/examples).
46-
47-
## Install MongoDB Catalog for Stash
48-
49-
Stash uses a `Function-Task` model to backup databases. We have to install MongoDB catalogs (`stash-mongodb`) for Stash. This catalog creates necessary `Function` and `Task` definitions to backup/restore MongoDB databases.
50-
51-
You can install the catalog either as a helm chart or you can create only the YAMLs of the respective resources.
52-
53-
<ul class="nav nav-tabs" id="installerTab" role="tablist">
54-
<li class="nav-item">
55-
<a class="nav-link" id="helm-tab" data-toggle="tab" href="#helm" role="tab" aria-controls="helm" aria-selected="false">Helm</a>
56-
</li>
57-
<li class="nav-item">
58-
<a class="nav-link active" id="script-tab" data-toggle="tab" href="#script" role="tab" aria-controls="script" aria-selected="true">Script</a>
59-
</li>
60-
</ul>
61-
<div class="tab-content" id="installerTabContent">
62-
<!-- ------------ Helm Tab Begins----------- -->
63-
<div class="tab-pane fade" id="helm" role="tabpanel" aria-labelledby="helm-tab">
64-
65-
### Install as chart release
66-
67-
Run the following script to install `stash-mongodb` catalog as a Helm chart.
68-
69-
```console
70-
curl -fsSL https://github.com/stashed/catalog/raw/master/deploy/chart.sh | bash -s -- --catalog=stash-mongodb
71-
```
72-
73-
</div>
74-
<!-- ------------ Helm Tab Ends----------- -->
75-
76-
<!-- ------------ Script Tab Begins----------- -->
77-
<div class="tab-pane fade show active" id="script" role="tabpanel" aria-labelledby="script-tab">
78-
79-
### Install only YAMLs
80-
81-
Run the following script to install `stash-mongodb` catalog as Kubernetes YAMLs.
82-
83-
```console
84-
curl -fsSL https://github.com/stashed/catalog/raw/master/deploy/script.sh | bash -s -- --catalog=stash-mongodb
85-
```
86-
87-
</div>
88-
<!-- ------------ Script Tab Ends----------- -->
89-
</div>
90-
91-
Once installed, this will create `mongodb-backup-*` and `mongodb-restore-*` Functions for all supported MongoDB versions. To verify, run the following command:
92-
93-
```console
94-
$ kubectl get functions.stash.appscode.com
95-
NAME AGE
96-
mongodb-backup-4.1 20s
97-
mongodb-backup-4.0 20s
98-
mongodb-backup-3.6 19s
99-
mongodb-backup-3.4 20s
100-
mongodb-restore-4.1 20s
101-
mongodb-restore-4.0 20s
102-
mongodb-restore-3.6 19s
103-
mongodb-restore-3.4 20s
104-
pvc-backup 7h6m
105-
pvc-restore 7h6m
106-
update-status 7h6m
107-
```
108-
109-
Also, verify that the necessary `Task` have been created.
110-
111-
```console
112-
$ kubectl get tasks.stash.appscode.com
113-
NAME AGE
114-
mongodb-backup-4.1 2m7s
115-
mongodb-backup-4.0 2m7s
116-
mongodb-backup-3.6 2m6s
117-
mongodb-backup-3.4 2m7s
118-
mongodb-restore-4.1 2m7s
119-
mongodb-restore-4.0 2m7s
120-
mongodb-restore-3.6 2m6s
121-
mongodb-restore-3.4 2m7s
122-
pvc-backup 7h7m
123-
pvc-restore 7h7m
124-
```
125-
126-
Now, Stash is ready to backup MongoDB database.
42+
> Note: YAML files used in this tutorial are stored [here](https://github.com/stashed/mongodb/tree/{{< param "info.subproject_version" >}}/docs/examples).
12743
12844
## Backup MongoDB ReplicaSet using Stash
12945

@@ -160,7 +76,7 @@ spec:
16076
Create the above `MongoDB` crd,
16177

16278
```console
163-
$ kubectl apply -f ./docs/examples/backup/replicaset/mongodb-replicaset.yaml
79+
$ kubectl apply -f https://github.com/stashed/mongodb/raw/{{< param "info.subproject_version" >}}/docs/examples/backup/replicaset/mongodb-replicaset.yaml
16480
mongodb.kubedb.com/sample-mgo-rs created
16581
```
16682

@@ -188,7 +104,7 @@ sample-mgo-rs ClusterIP 10.107.13.16 <none> 27017/TCP 2m14s
188104
sample-mgo-rs-gvr ClusterIP None <none> 27017/TCP 2m14s
189105
```
190106

191-
KubeDB creates an [AppBinding](https://appscode.com/products/stash/0.8.3/concepts/crds/appbinding/) crd that holds the necessary information to connect with the database.
107+
KubeDB creates an [AppBinding](/docs/concepts/crds/appbinding.md) crd that holds the necessary information to connect with the database.
192108

193109
**Verify AppBinding:**
194110

@@ -254,7 +170,7 @@ Stash uses the `AppBinding` crd to connect with the target database. It requires
254170

255171
### AppBinding for SSL
256172

257-
If `SSLMode` of the MongoDB server is either of `requireSSL` or `preferSSL`, you can provide ssl connection informatin through AppBinding Spces.
173+
If `SSLMode` of the MongoDB server is either of `requireSSL` or `preferSSL`, you can provide ssl connection information through AppBinding Specs.
258174

259175
User need to provide the following fields in case of SSL is enabled,
260176

@@ -263,7 +179,7 @@ User need to provide the following fields in case of SSL is enabled,
263179

264180
**KubeDB does these automatically**. It has added the subject of `client.pem` in the mongodb server with `root` role. So, user can just use the appbinding that is created by KubeDB without doing any hurdle! See the [MongoDB with TLS/SSL (Transport Encryption)](https://github.com/kubedb/docs/blob/master/docs/guides/mongodb/tls-ssl-encryption/tls-ssl-encryption.md) guide to learn about the ssl options in mongodb in details.
265181

266-
So, in KubeDB, the following `CRD` deployes a mongodb replicaset where ssl is enabled (`requireSSL` sslmode),
182+
So, in KubeDB, the following `CRD` deploys a mongodb replicaset where ssl is enabled (`requireSSL` sslmode),
267183

268184
```yaml
269185
apiVersion: kubedb.com/v1alpha1
@@ -400,7 +316,7 @@ Now, we are ready to backup this sample database.
400316

401317
### Prepare Backend
402318

403-
We are going to store our backed up data into a GCS bucket. At first, we need to create a secret with GCS credentials then we need to create a `Repository` crd. If you want to use a different backend, please read the respective backend configuration doc from [here](https://appscode.com/products/stash/0.8.3/guides/backends/overview/).
319+
We are going to store our backed up data into a GCS bucket. At first, we need to create a secret with GCS credentials then we need to create a `Repository` crd. If you want to use a different backend, please read the respective backend configuration doc from [here](/docs/guides/latest/backends/overview.md).
404320

405321
**Create Storage Secret:**
406322

@@ -438,7 +354,7 @@ spec:
438354
Let's create the `Repository` we have shown above,
439355

440356
```console
441-
$ kubectl apply -f ./docs/examples/backup/replicaset/repository-replicaset.yaml
357+
$ kubectl apply -f https://github.com/stashed/mongodb/raw/{{< param "info.subproject_version" >}}/docs/examples/backup/replicaset/repository-replicaset.yaml
442358
repository.stash.appscode.com/gcs-repo-replicaset created
443359
```
444360

@@ -483,7 +399,7 @@ Here,
483399
Let's create the `BackupConfiguration` crd we have shown above,
484400

485401
```console
486-
$ kubectl apply -f ./docs/examples/backup/replicaset/backupconfiguration-replicaset.yaml
402+
$ kubectl apply -f https://github.com/stashed/mongodb/raw/{{< param "info.subproject_version" >}}/docs/examples/backup/replicaset/backupconfiguration-replicaset.yaml
487403
backupconfiguration.stash.appscode.com/sample-mgo-rs-backup created
488404
```
489405

@@ -501,7 +417,7 @@ sample-mgo-rs-backup */5 * * * * False 0 <none> 62s
501417

502418
**Wait for BackupSession:**
503419

504-
The `sample-mgo-rs-backup` CronJob will trigger a backup on each schedule by creating a `BackpSession` crd.
420+
The `sample-mgo-rs-backup` CronJob will trigger a backup on each schedule by creating a `BackupSession` crd.
505421

506422
Wait for the next schedule. Run the following command to watch `BackupSession` crd,
507423

@@ -595,7 +511,7 @@ Here,
595511
Let's create the above database,
596512

597513
```console
598-
$ kubectl apply -f ./docs/examples/restore/replicaset/restored-mongodb-replicaset.yaml
514+
$ kubectl apply -f https://github.com/stashed/mongodb/raw/{{< param "info.subproject_version" >}}/docs/examples/restore/replicaset/restored-mongodb-replicaset.yaml
599515
mongodb.kubedb.com/restored-mgo-rs created
600516
```
601517

@@ -655,12 +571,12 @@ Here,
655571
- `spec.target.ref` refers to the AppBinding crd for the `restored-mgo-rs` database.
656572
- `spec.rules` specifies that we are restoring from the latest backup snapshot of the database.
657573

658-
> **Warning:** Label `kubedb.com/kind: MongoDB` is mandatory if you are uisng KubeDB to deploy the database. Otherwise, the database will be stuck in `Initializing` state.
574+
> **Warning:** Label `kubedb.com/kind: MongoDB` is mandatory if you are using KubeDB to deploy the database. Otherwise, the database will be stuck in `Initializing` state.
659575

660576
Let's create the `RestoreSession` crd we have shown above,
661577

662578
```console
663-
$ kubectl apply -f ./docs/examples/restore/replicaset/restoresession-replicaset.yaml
579+
$ kubectl apply -f https://github.com/stashed/mongodb/raw/{{< param "info.subproject_version" >}}/docs/examples/restore/replicaset/restoresession-replicaset.yaml
664580
restoresession.stash.appscode.com/sample-mgo-rs-restore created
665581
```
666582

@@ -797,7 +713,7 @@ spec:
797713
```
798714

799715
```console
800-
$ kubectl create -f ./docs/examples/backup/replicaset/standalone-backup.yaml
716+
$ kubectl create -f https://github.com/stashed/mongodb/raw/{{< param "info.subproject_version" >}}/docs/examples/backup/replicaset/standalone-backup.yaml
801717
appbinding.appcatalog.appscode.com/sample-mgo-rs-custom created
802718
repository.stash.appscode.com/gcs-repo-custom created
803719
backupconfiguration.stash.appscode.com/sample-mgo-rs-backup2 created
@@ -868,14 +784,14 @@ spec:
868784
```
869785

870786
```console
871-
$ kubectl create -f ./docs/examples/restore/replicaset/restored-standalone.yaml
787+
$ kubectl create -f https://github.com/stashed/mongodb/raw/{{< param "info.subproject_version" >}}/docs/examples/restore/replicaset/restored-standalone.yaml
872788
mongodb.kubedb.com/restored-mongodb created
873789
874790
$ kubectl get mg -n demo restored-mongodb
875791
NAME VERSION STATUS AGE
876792
restored-mongodb 3.6-v4 Initializing 56s
877793
878-
$ kubectl create -f ./docs/examples/restore/replicaset/restoresession-standalone.yaml
794+
$ kubectl create -f https://github.com/stashed/mongodb/raw/{{< param "info.subproject_version" >}}/docs/examples/restore/replicaset/restoresession-standalone.yaml
879795
restoresession.stash.appscode.com/sample-mongodb-restore created
880796
881797
$ kubectl get mg -n demo restored-mongodb
@@ -938,43 +854,3 @@ kubectl delete backupconfiguration -n demo sample-mgo-rs-backup sample-mgo-rs-ba
938854
kubectl delete mg -n demo restored-mgo-rs restored-mgo-rs restored-mongodb
939855
kubectl delete repository -n demo gcs-repo-replicaset gcs-repo-custom
940856
```
941-
942-
To cleanup the MongoDB catalogs that we had created earlier, run the following:
943-
944-
<ul class="nav nav-tabs" id="uninstallerTab" role="tablist">
945-
<li class="nav-item">
946-
<a class="nav-link" id="helm-uninstaller-tab" data-toggle="tab" href="#helm-uninstaller" role="tab" aria-controls="helm-uninstaller" aria-selected="false">Helm</a>
947-
</li>
948-
<li class="nav-item">
949-
<a class="nav-link active" id="script-uninstaller-tab" data-toggle="tab" href="#script-uninstaller" role="tab" aria-controls="script-uninstaller" aria-selected="true">Script</a>
950-
</li>
951-
</ul>
952-
<div class="tab-content" id="uninstallerTabContent">
953-
<!-- ------------ Helm Tab Begins----------- -->
954-
<div class="tab-pane fade" id="helm-uninstaller" role="tabpanel" aria-labelledby="helm-uninstaller-tab">
955-
956-
### Uninstall `stash-mongdb-*` charts
957-
958-
Run the following script to uninstall `stash-mongodb` catalogs that was installed as a Helm chart.
959-
960-
```console
961-
curl -fsSL https://github.com/stashed/catalog/raw/master/deploy/chart.sh | bash -s -- --uninstall --catalog=stash-mongodb
962-
```
963-
964-
</div>
965-
<!-- ------------ Helm Tab Ends----------- -->
966-
967-
<!-- ------------ Script Tab Begins----------- -->
968-
<div class="tab-pane fade show active" id="script-uninstaller" role="tabpanel" aria-labelledby="script-uninstaller-tab">
969-
970-
### Uninstall `stash-mongodb` catalog YAMLs
971-
972-
Run the following script to uninstall `stash-mongodb` catalog that was installed as Kubernetes YAMLs.
973-
974-
```console
975-
curl -fsSL https://github.com/stashed/catalog/raw/master/deploy/script.sh | bash -s -- --uninstall --catalog=stash-mongodb
976-
```
977-
978-
</div>
979-
<!-- ------------ Script Tab Ends----------- -->
980-
</div>

0 commit comments

Comments
 (0)