|
| 1 | +# mydnshost-maintenance |
| 2 | +Maintenance Container |
| 3 | + |
| 4 | +This container runs various scripts under cron to perform maintenance tasks: |
| 5 | + |
| 6 | + - Every 6 Hours: |
| 7 | + - Database Backups |
| 8 | + - Bind Zone Backups |
| 9 | + - Every Hour |
| 10 | + - Update StatusCake checks |
| 11 | + - Every Minute |
| 12 | + - Gather Statistics from bind servers |
| 13 | + |
| 14 | +## Backup DB |
| 15 | + |
| 16 | +This will look for any container with a label of `uk.co.mydnshost.maintenance.db.backup` set to `"true"` and then will attempt to backup named databases from it. |
| 17 | + |
| 18 | +Credentials for mysqldump can be passed with labels `uk.co.mydnshost.maintenance.db.user` and `uk.co.mydnshost.maintenance.db.pass` and the list of databases to dump can be passed as a comma separated string `uk.co.mydnshost.maintenance.db.dbs` |
| 19 | + |
| 20 | +Backups are stored in `/output/mysqlbackup/<containername>/<date>/<database>/backup-<time>.sql` |
| 21 | + |
| 22 | +The last 30 days of backups are kept. |
| 23 | + |
| 24 | +## Backup Zone Files |
| 25 | + |
| 26 | +This will create a backup of all files under `/bind/` into `/output/bindbackup/<date>/backup-<time>.tgz` |
| 27 | + |
| 28 | +The last 30 days of backups are kept. |
| 29 | + |
| 30 | +## Update StatusCake |
| 31 | + |
| 32 | +This will make changes to a test domain and update StatusCake tests to look for the updated data. |
| 33 | + |
| 34 | +Example ENV VARS Required: |
| 35 | + |
| 36 | + - API_URL=https://api.mydnshost.co.uk/ |
| 37 | + - The API Endpoint to use to make changes |
| 38 | + - API_DOMAIN=test.example.org |
| 39 | + - The domain we are using for putting tests under |
| 40 | + - API_RRNAMES=foobar,bazqux |
| 41 | + - List of RRNAMES to update. These will be updated in turn and cycled though to reduce the change of a test firing and failing between us updating the record and then updating the check. |
| 42 | + - A Records are created for each `<RRNAME>.<API_DOMAIN>` with an IP Address related to the date/time the change was made, statuscake will then be updated to point at the new `RRNAME` and the expected value. |
| 43 | + - A TXT record named `active` will also be created to remember between runs which `RRNAME` was last named. |
| 44 | + - API_DOMAINKEY=SomeKey |
| 45 | + - DomainKey to access the domain via the API. |
| 46 | + - STATUSCAKE_USER=SomeUser |
| 47 | + - StatusCake Username (If blank, this cron script will not run) |
| 48 | + - STATUSCAKE_APIKEY=SomeKey |
| 49 | + - StatusCake API |
| 50 | + - STATUSCAKE_TESTIDS=12345,67890 |
| 51 | + - The TestIDs for status cake to update. There should be 1 test for each nameserver we monitor. |
| 52 | + |
| 53 | + |
| 54 | +## Gather Statistics |
| 55 | + |
| 56 | +This will gather statistics from bind servers and put them into influx. |
| 57 | + |
| 58 | +Example ENV VARS Required: |
| 59 | + |
| 60 | + - INFLUX_HOST=influxdb |
| 61 | + - Server that hosts influx |
| 62 | + - INFLUX_PORT=8086 |
| 63 | + - Influx Port |
| 64 | + - INFLUX_USER= |
| 65 | + - Influx Username |
| 66 | + - INFLUX_PASS= |
| 67 | + - Influx Password |
| 68 | + - INFLUX_DB=MyDNSHost |
| 69 | + - Influx Database |
| 70 | + - INFLUX_BIND_SLAVES=ns1=1.1.1.1, ns2=2.2.2.2, ns3=3.3.3.3 |
| 71 | + - List of bind servers to get statistics from. This should be a comma-separated list of `<name>=<ip>` to reach the server. |
| 72 | + - We need the XML statistics API enabled on the server, and this container host needs to be allowed access it. |
| 73 | + - If this is empty, this cron script will not run. |
| 74 | + |
| 75 | + |
0 commit comments