Skip to content

Restore mongodb in a production server

ear-dev edited this page Apr 15, 2021 · 2 revisions

Nightly Backups

Every night a cronjob grabs a mongodump and pushes it to an S3 bucket for backups. This is true in all of our vega and veranda environments.

MONGO_BACKUP_BUCKETS = {PROD_ACCOUNT: 'ver-prod-universe-verandamongodumpbackup',
                        DEV_ACCOUNT: 'ver-dev-universe-verandamongodumpbackup',
                        VEGA_DEV_ACCOUNT: 'vega-dev-messaging-mongobackups',
                        VEGA_PREPROD_ACCOUNT: 'vega-preprod-messaging-mongobackups',
                        VEGA_PROD_ACCOUNT: 'vega-prod-chatbot-messaging-mongobackups'}

Prerequisites

  • The vega\kluster tool will facilitate running restore jobs if needed. You will need to configure it by following the Setup section in the README.
  • Our project in the tool is called Veranda and it is fully configured and ready to use. kluster/projects/veranda

How to restore the mongodb to a previous dump.

tl;dr

  • Manually uninstall any installed Rocketchat apps on your server instance. For example, chatbot uses a Dialogflow and a Salesforce Integration app.
  • Use the kluster tool to find the backup file you want to use in S3.
  • Use the kluster tool to restore the db on your designated Rocketchat instance.
  • Manually ssh to the primary0 of your mongodb in the cluster using kubectl exec -it or through Rancher.
  • Use the mongo cli to login to the rocketchat db and manually clear all the contents in the mongodb collection named rocketchat_apps.
  • Reinstall the Rocketchat apps using the kluster tool.
  • Complete any manual configurations required when first setting up the apps used in our chatbot integration.
Clone this wiki locally