Skip to content

Commit 07d7216

Browse files
authored
Merge pull request #173 from tiredofit/develop
2 parents 028966d + b31da0b commit 07d7216

File tree

5 files changed

+157
-146
lines changed

5 files changed

+157
-146
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## develop 2022-09-20 <dave at tiredofit dot ca>
2+
3+
### Added
4+
- MONGO_CUSTOM_URI support to ignore the seperate environment variables - Parses the URI and populates DB_HOST and DB_NAME for filenaming. Can be overridden
5+
16
## 3.4.2 2022-09-19 <dave at tiredofit dot ca>
27

38
### Changed

README.md

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,14 @@ Currently backs up CouchDB, InfluxDB, MySQL, MongoDB, Postgres, Redis servers.
3737
- [About](#about)
3838
- [Maintainer](#maintainer)
3939
- [Table of Contents](#table-of-contents)
40-
- [Persistent Storage](#persistent-storage)
4140
- [Prerequisites and Assumptions](#prerequisites-and-assumptions)
4241
- [Installation](#installation)
4342
- [Build from Source](#build-from-source)
4443
- [Prebuilt Images](#prebuilt-images)
4544
- [Multi Architecture](#multi-architecture)
4645
- [Configuration](#configuration)
4746
- [Quick Start](#quick-start)
48-
- [Persistent Storage](#persistent-storage-1)
47+
- [Persistent Storage](#persistent-storage)
4948
- [Environment Variables](#environment-variables)
5049
- [Base Images used](#base-images-used)
5150
- [Container Options](#container-options)
@@ -70,7 +69,6 @@ Currently backs up CouchDB, InfluxDB, MySQL, MongoDB, Postgres, Redis servers.
7069
- [License](#license)
7170

7271
> **NOTE**: If you are using this with a docker-compose file along with a seperate SQL container, take care not to set the variables to backup immediately, more so have it delay execution for a minute, otherwise you will get a failed first backup.
73-
### Persistent Storage
7472
7573
## Prerequisites and Assumptions
7674
* You must have a working connection to one of the supported DB Servers and appropriate credentials
@@ -140,32 +138,32 @@ Be sure to view the following repositories to understand all the customizable op
140138
| `SPLIT_DB` | For each backup, create a new archive. `TRUE` or `FALSE` (MySQL and Postgresql Only) | `TRUE` |
141139

142140
### Database Specific Options
143-
| Parameter | Description | Default |
144-
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | --------- |
145-
| `DB_AUTH` | (Mongo Only - Optional) Authentication Database | |
146-
| `DB_TYPE` | Type of DB Server to backup `couch` `influx` `mysql` `pgsql` `mongo` `redis` `sqlite3` | |
147-
| `DB_HOST` | Server Hostname e.g. `mariadb`. For `sqlite3`, full path to DB file e.g. `/backup/db.sqlite3` | |
148-
| `DB_NAME` | Schema Name e.g. `database` or `ALL` to backup all databases the user has access to. Backup multiple by seperating with commas eg `db1,db2` | |
149-
| `DB_NAME_EXCLUDE` | If using `ALL` - use this as to exclude databases seperated via commas from being backed up | |
150-
| `DB_USER` | username for the database(s) - Can use `root` for MySQL | |
151-
| `DB_PASS` | (optional if DB doesn't require it) password for the database | |
152-
| `DB_PORT` | (optional) Set port to connect to DB_HOST. Defaults are provided | varies |
153-
| `INFLUX_VERSION` | What Version of Influx are you backing up from `1`.x or `2` series - AMD64 and ARM64 only for `2` | |
154-
| `MONGO_HOST_TYPE` | Connect to regular `mongodb` or `atlas` | `mongodb` |
155-
| | You can also skip this and override the uri prefix with `MONGO_URI_PREFIX=mongodb+srv://` or whatever you would like | |
141+
| Parameter | Description | Default |
142+
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------- |
143+
| `DB_AUTH` | (Mongo Only - Optional) Authentication Database | |
144+
| `DB_TYPE` | Type of DB Server to backup `couch` `influx` `mysql` `pgsql` `mongo` `redis` `sqlite3` | |
145+
| `DB_HOST` | Server Hostname e.g. `mariadb`. For `sqlite3`, full path to DB file e.g. `/backup/db.sqlite3` | |
146+
| `DB_NAME` | Schema Name e.g. `database` or `ALL` to backup all databases the user has access to. Backup multiple by seperating with commas eg `db1,db2` | |
147+
| `DB_NAME_EXCLUDE` | If using `ALL` - use this as to exclude databases seperated via commas from being backed up | |
148+
| `DB_USER` | username for the database(s) - Can use `root` for MySQL | |
149+
| `DB_PASS` | (optional if DB doesn't require it) password for the database | |
150+
| `DB_PORT` | (optional) Set port to connect to DB_HOST. Defaults are provided | varies |
151+
| `INFLUX_VERSION` | What Version of Influx are you backing up from `1`.x or `2` series - AMD64 and ARM64 only for `2` | |
152+
| `MONGO_CUSTOM_URI` | If you wish to override the MongoDB Connection string enter it here e.g. `mongodb+srv://username:[email protected]` | |
153+
| | This environment variable will be parsed and populate the `DB_NAME` and `DB_HOST` variables to properly build your backup filenames. You can overrde them by making your own entries |
156154

157155
#### For Influx DB2:
158156
Your Organization will be mapped to `DB_USER` and your root token will need to be mapped to `DB_PASS`. You may use `DB_NAME=ALL` to backup the entire set of databases. For `DB_HOST` use syntax of `http(s)://db-name`
159157

160158
### Scheduling Options
161-
| Parameter | Description | Default |
162-
|--------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------|
163-
| `DB_DUMP_FREQ` | How often to do a dump, in minutes after the first backup. Defaults to 1440 minutes, or once per day. | `1440` |
164-
| `DB_DUMP_BEGIN` | What time to do the first dump. Defaults to immediate. Must be in one of two formats | |
165-
| | Absolute HHMM, e.g. `2330` or `0415` | |
166-
| | Relative +MM, i.e. how many minutes after starting the container, e.g. `+0` (immediate), `+10` (in 10 minutes), or `+90` in an hour and a half | |
167-
| `DB_DUMP_TARGET` | Directory where the database dumps are kept. | `/backup` |
168-
| `DB_CLEANUP_TIME` | Value in minutes to delete old backups (only fired when dump freqency fires). 1440 would delete anything above 1 day old. You don't need to set this variable if you want to hold onto everything. | `FALSE` |
159+
| Parameter | Description | Default |
160+
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- |
161+
| `DB_DUMP_FREQ` | How often to do a dump, in minutes after the first backup. Defaults to 1440 minutes, or once per day. | `1440` |
162+
| `DB_DUMP_BEGIN` | What time to do the first dump. Defaults to immediate. Must be in one of two formats | |
163+
| | Absolute HHMM, e.g. `2330` or `0415` | |
164+
| | Relative +MM, i.e. how many minutes after starting the container, e.g. `+0` (immediate), `+10` (in 10 minutes), or `+90` in an hour and a half | |
165+
| `DB_DUMP_TARGET` | Directory where the database dumps are kept. | `/backup` |
166+
| `DB_CLEANUP_TIME` | Value in minutes to delete old backups (only fired when dump freqency fires). 1440 would delete anything above 1 day old. You don't need to set this variable if you want to hold onto everything. | `FALSE` |
169167

170168

171169
- You may need to wrap your `DB_DUMP_BEGIN` value in quotes for it to properly parse. There have been reports of backups that start with a `0` get converted into a different format which will not allow the timer to start at the correct time.

install/assets/defaults/10-db-backup

100755100644
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/command/with-contenv bash
22

33
BACKUP_LOCATION=${BACKUP_LOCATION:-"FILESYSTEM"}
4+
BLOBXFER_REMOTE_PATH=${BLOBXFER_REMOTE_PATH:-"/docker-db-backup"}
45
CHECKSUM=${CHECKSUM:-"MD5"}
56
COMPRESSION=${COMPRESSION:-"ZSTD"}
67
COMPRESSION_LEVEL=${COMPRESSION_LEVEL:-"3"}
@@ -20,6 +21,6 @@ S3_PROTOCOL=${S3_PROTOCOL:-"https"}
2021
SCRIPT_LOCATION_PRE=${SCRIPT_LOCATION_PRE:-"/assets/scripts/pre/"}
2122
SCRIPT_LOCATION_POST=${SCRIPT_LOCATION_POST:-"/assets/scripts/post/"}
2223
SIZE_VALUE=${SIZE_VALUE:-"bytes"}
24+
SKIP_AVAILABILITY_CHECK=${SKIP_AVAILABILITY_CHECK:-"FALSE"}
2325
SPLIT_DB=${SPLIT_DB:-"TRUE"}
24-
TEMP_LOCATION=${TEMP_LOCATION:-"/tmp/backups"}
25-
BLOBXFER_REMOTE_PATH=${BLOBXFER_REMOTE_PATH:-"/docker-db-backup"}
26+
TEMP_LOCATION=${TEMP_LOCATION:-"/tmp/backups"}

0 commit comments

Comments
 (0)