AWS

To configure daily backups, create an S3 bucket (or GCP/Azure's equivalent) and add the following job to your crontab configuration by running sudo crontab -e

0 0 * * * /home/ubuntu/onpremise/backup.sh

Modify the file .env to include your bucket name. If you use GCP/Azure you'll have to modify the script backup.sh to upload to their storage instead of AWS S3 storage.

KEYCLOAK_USER=admin
KEYCLOAK_PASSWORD=password
VERSION=latest
DOMAIN=http://secoda.company.com
DOPPLER_TOKEN=abc123
S3_BUCKET=s3://secoda-backup/ # Change value to your backup bucket

Install the AWS CLI and configure

sudo apt-get update && sudo apt-get install awscli -y

Configure the AWS CLI with your credentials using the command aws configure

# backup.sh file

#!/bin/bash
source .env

now=$(date +"%m-%d-%Y")

sudo tar -zcvf "neo4j_${now}".tar.gz /var/lib/docker/volumes/onpremise_neo4j_data
sudo tar -zcvf "postgres_${now}".tar.gz /var/lib/docker/volumes/onpremise_postgres_data
sudo tar -zcvf "es_${now}".tar.gz /var/lib/docker/volumes/onpremise_es_data

aws s3 cp "neo4j_${now}".tar.gz "$S3_BUCKET"
aws s3 cp "postgres_${now}".tar.gz "$S3_BUCKET"
aws s3 cp "es_${now}".tar.gz "$S3_BUCKET"

rm -rf "postgres_${now}.tar.gz" "neo4j_${now}.tar.gz" "es_${now}.tar.gz"

GCP

  1. Install the gsutil following this guide https://cloud.google.com/storage/docs/gsutil_install#deb
  2. Add the variable GS_BUCKET to you .env file, i.e.
    1. GS_BUCKET=gs://your-bucket
  3. Modify the backup script backup.sh
#!/bin/bash
source .env

now=$(date +"%m-%d-%Y")

sudo tar -zcvf "neo4j_${now}".tar.gz /var/lib/docker/volumes/onpremise_neo4j_data
sudo tar -zcvf "postgres_${now}".tar.gz /var/lib/docker/volumes/onpremise_postgres_data
sudo tar -zcvf "es_${now}".tar.gz /var/lib/docker/volumes/onpremise_es_data

gsutil cp "neo4j_${now}".tar.gz "$GS_BUCKET"
gsutil cp "postgres_${now}".tar.gz "$GS_BUCKET"
gsutil cp "es_${now}".tar.gz "$GS_BUCKET"

rm -rf "postgres_${now}.tar.gz" "neo4j_${now}.tar.gz" "es_${now}.tar.gz"