Sign inSign up

johnlindahl/edgeos-backup

By johnlindahl

•Updated over 3 years ago

Image
0

876

johnlindahl/edgeos-backup repository overview

⁠EdgeOS Remote Backup Script

⁠Configuration options (Env vars)

NameRequiredTypeDefaultDescription
SERVER_URLYesstring''The URL to the Rest API of EdgeOS instance, e.g. https://router.example.com:8443
USERNAMEYesstring''Username to log in as
PASSWORD_LOCATIONYesstring''Path to a file containing only the password
BACKUP_BASE_DIRYesstring''Location to store backups, will create sub directories and files, user must have write access.
COOKIE_JAR_LOCATIONYesstring''Filepath of where to store the temporary file containing session cookies related to the login. File will be emptied at start and end of script.
MAX_FILESNonumber0Number of files to save, when limit is met will remove oldest files first. If set to 0 no (valid) files will be removed.
INSECURE_HTTPSNobooleanfalseIf true the requests made will not validate certificate errors, useful for self-signed certificates.
MIN_FILE_SIZENonumber1024If the resulting backup file is smaller than this size (Bytes) the file will be marked as invalid. This is a naive check to make sure that the backup request was successful, since some invalid requests will still generate (a small) invalid file, that is not working.
INVALID_FILE_NAME_PREFIXNostringinvalid.If the backup is identified as invalid, it will rename the file with this prefix.
CLEAN_OLD_INVALID_FILESNobooleantrueIf true the script will remove previously invalid files. If current backup request is identified as invalid it will be kept until next run of the script to allow for some debugging/monitoring.
version: "3.9"
services:
  edgeos-backup:
    image: johnlindahl/edgeos-backup:latest
    environment:
      - SERVER_URL=https://<hostname-or-ip>
      - USERNAME=<your-user>
      - PASSWORD_LOCATION=/run/secrets/my_password
      - BACKUP_BASE_DIR=/backups # This must match right hand side of a volume.
      - COOKIE_JAR_LOCATION=/tmp/.cookie-jar
      - MAX_FILES=5
      - MIN_FILE_SIZE=1024
      - INSECURE_HTTPS=true # Convenient if using self-signed cert, NOT PRODUCTION GRADE setting
      - INVALID_FILE_NAME_PREFIX=invalid.
      - CLEAN_OLD_INVALID_FILES=true
    volumes:
      - ./backups:/backups # Right hand side of the volume must match BACKUP_BASE_DIR env var.
    secrets:
      - my_password

secrets:
  my_password:
    file: ./my_password.txt

⁠Example docker run

docker run -d \
  --name=edgeos-backup \
  -e SERVER_URL=https://<hostname-or-ip> \
  -e USERNAME=<your-user> \
  -e PASSWORD_LOCATION=/my_password \
  -e BACKUP_BASE_DIR=/backups \
  -e COOKIE_JAR_LOCATION=/tmp/.cookie-jar \
  -e MAX_FILES=5 \
  -e MIN_FILE_SIZE=1024 \
  -e INSECURE_HTTPS=true \
  -e INVALID_FILE_NAME_PREFIX=invalid. \
  -e CLEAN_OLD_INVALID_FILES=true \
  -v /path/to/backups:/backups \
  -v /path/to/passwordfile:/my_password \
  johnlindahl/edgeos-backup:latest

⁠See more

Tag summary

Content type

Image

Digest

sha256:bcc8e3e57…

Size

58.3 MB

Last updated

over 3 years ago

docker pull johnlindahl/edgeos-backup