|
| 1 | +# TGBS |
| 2 | + |
| 3 | +Tweede golf backup service |
| 4 | + |
| 5 | +This image allows you to backup data in a docker/kubernetes environment to a |
| 6 | +restic repository. This image is best suited to be run at scheduled times (e.g. |
| 7 | +as a cron job). |
| 8 | + |
| 9 | +The most basic operation of this image would be to mount some image/disk into |
| 10 | +the container and create a backup from that mount. You can also mount S3 or |
| 11 | +GCS object storage buckets to backup their files. Note that this is not |
| 12 | +recommended for very large buckets. |
| 13 | + |
| 14 | +This image also has an option to connect to a PostgreSQL database and create a |
| 15 | +backup file/directory, and upload that result to a restic repository. |
| 16 | + |
| 17 | +Most of these modes of operation are controlled by environment variables. |
| 18 | + |
| 19 | +## Backup settings |
| 20 | +The listing below contains a short overview of the environment variables |
| 21 | +supported by restic and which ones are required when backing up to a repository |
| 22 | +on Backblaze B2 storage. For details on the environment variables restic |
| 23 | +supports, see [their documentation](https://restic.readthedocs.io/en/stable/040_backup.html#environment-variables). |
| 24 | + |
| 25 | +### RESTIC_REPOSITORY |
| 26 | +The repository url for the backup. |
| 27 | + |
| 28 | +### RESTIC_PASSWORD |
| 29 | +The password to access the repository. In a kubernetes environment this should |
| 30 | +be made available via a secret and not directly in the kubernetes config. |
| 31 | + |
| 32 | +### B2_ACCOUNT_ID |
| 33 | +The account id of the account that has write access to the backblaze repository. |
| 34 | + |
| 35 | +### B2_ACCOUNT_KEY |
| 36 | +The secret account key of the account that has write access to the backblaze |
| 37 | +repository. |
| 38 | + |
| 39 | +### TGBS_BACKUP_LOCK |
| 40 | +If this is set to `1`, the `--no-lock` flag will not be set. |
| 41 | + |
| 42 | +### TGBS_BACKUP_TAGS |
| 43 | +If this is set, then the backup is tagged with the value of this environment |
| 44 | +variable. Different tags can be comma-separated. If the variable is not set, |
| 45 | +then the backup is not tagged. |
| 46 | + |
| 47 | +### TGBS_BACKUP_PATH |
| 48 | +If this is specified, create a backup of the given path (either a directory or |
| 49 | +file). |
| 50 | + |
| 51 | +## PostgreSQL database backup |
| 52 | +To create a PostgreSQL database backup, set the `TGBS_PSQL_BACKUP` to `1`. |
| 53 | +To configure the database connection, use the environment variables available |
| 54 | +to postgresql clients: https://www.postgresql.org/docs/current/libpq-envars.html |
| 55 | + |
| 56 | +Generally you will want to set these environment variables for a simple database |
| 57 | +backup: |
| 58 | + |
| 59 | + TGBS_PSQL_BACKUP=1 |
| 60 | + PGHOST=somehost |
| 61 | + PGDATABASE=mydatabase |
| 62 | + PGUSER=myuser |
| 63 | + PGPASSWORD=password |
| 64 | + |
| 65 | +Here is a full list of environment variable this image listens for: |
| 66 | + |
| 67 | +### TGBS_PSQL_BACKUP |
| 68 | +Set this variable to `1` to enable backups of PostgreSQL. |
| 69 | + |
| 70 | +### TGBS_PSQL_BACKUP_TAGS |
| 71 | +If this is set, this overrides the tags for the PostgreSQL specific part of the |
| 72 | +backup. This variable works the same as the `TGBS_BACKUP_TAGS` variable. |
| 73 | + |
| 74 | +### TGBS_PSQL_BACKUP_JOBS |
| 75 | +Set the number of jobs to backup. By default this will be the number of cores |
| 76 | +available to the backup container. |
| 77 | + |
| 78 | +### TGBS_PSQL_BACKUP_OWNER |
| 79 | +Set this variable to `1` to backup owner information. This is not done by |
| 80 | +default. |
| 81 | + |
| 82 | +### TGBS_PSQL_BACKUP_PRIVILEGES |
| 83 | +Set this variable to `1` to backup privilege information (grants). This is not |
| 84 | +done by default. |
| 85 | + |
| 86 | +### TGBS_PSQL_BACKUP_FORMAT |
| 87 | +Set this variable to `c` to change the backup format to the custom format, which |
| 88 | +will result in a single file instead of a directory. In most cases the |
| 89 | +directory format is more suited for backup using restic. |
| 90 | + |
| 91 | +### TGBS_PSQL_BACKUP_COMPRESS |
| 92 | +Set the compression level to a number between `0` (no compression) and |
| 93 | +`9` (maximum compression). |
| 94 | + |
| 95 | +### PGURL |
| 96 | +Instead of specifying the `PGHOST`, `PGPORT`, `PGDATABASE`, `PGUSER` and |
| 97 | +`PGPASSWORD` environment variables individually, you can also specify the |
| 98 | +`PGURL` variable as an (non-standard) alternative. |
0 commit comments