Backup scripts for YouPin
- Make sure you have Google Cloud SDK (gcloud, gsutil commands) and mongodump on your server.
- Generate service account to grant your server permission to access your storage bucket. Also make sure you grant this service account as a storage admin. So this account can read/write to this storage bucket. By generating the service account, you should get a .json key file which we will use to authenticate our script to access the storage.
./start-gcs-backup.sh <keyfile.json> <db-name-in-mongo> <bucket-name-in-gcs>
- Move the secret key file to your server.
- Clone this repo onto your server.
- Run
crontab -e
to set cronjob. Add the script with the correct parameters. For example,
0 0 * * * /bin/bash /opt/youpin-backupper/start-gcs-backup.sh key_file.json youpin youpin_backup_bucket