Skip to content

Commit 15fed69

Browse files
committed
Moved mgob documentation out of ssp chart
1 parent 6412536 commit 15fed69

File tree

2 files changed

+2
-137
lines changed

2 files changed

+2
-137
lines changed

README.md

Lines changed: 2 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -116,72 +116,10 @@ helm install ssp .
116116
Where `ssp` can be the name you want to give to this chart.
117117

118118
## Backup and Restore data using MGOB
119+
You can implement backup and restore feature on the Sugarizer School Portal MongoDB replicaset by using MGOB.
119120
[MGOB](https://github.com/stefanprodan/mgob/) is a MongoDB backup automation tool built with Go. It features like scheduled backups, local backups retention, upload to S3 Object Storage (Minio, AWS, Google Cloud, Azure) and upload to gcloud storage.
120121

121-
To setup MGOB to automate MongoDB backups on Google Kubernetes Engine, follow these step by step instructions:
122-
123-
Requirements:
124-
- GKE cluster minimum version v1.8
125-
- kubctl admin config
126-
127-
### Store Service Account key as a secret
128-
First, you need to create a GCP service account key from the API & Services page. In case you already have one, then download the JSON file and rename it to `key.json`.
129-
130-
Store the JSON file as a secret:
131-
```bash
132-
kubectl create secret generic service-acc-secret --from-file=key.json
133-
```
134-
135-
### MGOB Installation
136-
Clone the MGOB repository:
137-
```bash
138-
git clone https://github.com/stefanprodan/mgob.git
139-
cd mgob/chart
140-
```
141-
Edit the chart's `values.yaml` file.
142-
- Set the appropriate `storageClass` for your provider.
143-
- Update the `mgob-config` `configMap`. Add `sugarizer-database` backup plan.
144-
Here is an example backup plan:
145-
```bash
146-
sugarizer-database.yml: |
147-
target:
148-
host: "mymongodb-mongodb-replicaset-0.mymongodb-mongodb-replicaset.default,mymongodb-mongodb-replicaset-1.mymongodb-mongodb-replicaset.default,mymongodb-mongodb-replicaset-2.mymongodb-mongodb-replicaset.default"
149-
port: 27017
150-
database: ""
151-
scheduler:
152-
cron: "0 0,6,12,18 */1 * *"
153-
retention: 14
154-
timeout: 60
155-
```
156-
- Add a reference to the secret. You can either insert your secret values as part of helm values or refer externally created secrets. In our case, we created a secret with a name `service-acc-secret`.
157-
```bash
158-
secret:
159-
- name: service-acc-secret
160-
```
161-
An example YAML configuration is available as [mgob-gke.yaml](examples/mgob-gke.yaml).
162-
163-
### Backup to GCP Storage Bucket (Optional)
164-
For long term backup storage, you could use a GCP Bucket since is a cheaper option than keeping all backups on disk.
165-
You need to enable `storage.objects` acccess to the service account in order to allow objects creation in the bucket.
166-
From the GCP web UI, navigate to Storage and create a regional bucket named `ssp-backup` (Or any other name if it's taken). Set the bucket and secret name in the backup-plan in the `values.yaml` file.
167-
```bash
168-
gcloud:
169-
bucket: "ssp-backup"
170-
keyFilePath: /secret/service-acc-secret/key.json
171-
```
172-
173-
### Restoring data from backup
174-
In order to restore data to the Sugarizer School Portal database, you need to open a shell in MGOB pod. The backups are available in `/storage/sugarizer-database/` directory inside the pod (where `sugarizer-database` was the name of our backup plan).
175-
176-
- In case of a database error in which you need to completely restore all the databases, you can run:
177-
```bash
178-
mongorestore --gzip --archive=/storage/sugarizer-database/sugarizer-database-xxxxxxxxxx.gz --host mymongodb-mongodb-replicaset-0.mymongodb-mongodb-replicaset.default:27017 --drop
179-
```
180-
- In case a school's DB is messed up and you need to restore that, you can run:
181-
```bash
182-
mongorestore --gzip --archive=/storage/sugarizer-database/sugarizer-database-xxxxxxxxxx.gz --nsInclude="db_name.*" --host mymongodb-mongodb-replicaset-0.mymongodb-mongodb-replicaset.default:27017 --drop
183-
```
184-
Where db_name is the name of the database to restore.
122+
To setup MGOB to automate MongoDB backups on Google Kubernetes Engine, you can follow this [documentation](https://github.com/nikhilm98/sugarizer-school-portal#backup-and-restore-data-using-mgob).
185123

186124
## Contributing
187125
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

examples/mgob-gke.yaml

Lines changed: 0 additions & 73 deletions
This file was deleted.

0 commit comments

Comments
 (0)