-
-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated README.md #46
Open
TheDragon44
wants to merge
1
commit into
RealOrangeOne:master
Choose a base branch
from
TheDragon44:patch-1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,30 +13,60 @@ A script to automatically back up all databases running under docker on a host | |
|
||
## Installation | ||
|
||
This container requires access to the docker socket. This can be done either by mounting `/var/lib/docker.sock`, or using a HTTP proxy to provide it through `$DOCKER_HOST`. | ||
This container requires access to the docker socket. This should always be done, for security reasons, using a [HTTP proxy](https://github.com/Tecnativa/docker-socket-proxy) which this container can then access through the `DOCKER_HOST` environment variable. | ||
|
||
Mount your backup directory as `/var/backups` (or override `$BACKUP_DIR`). Backups will be saved here based on the name of the container. Backups are not dated or compressed. | ||
You can use this container by directly mounting `/var/lib/docker.sock` but this is not recommended. | ||
|
||
Backups run daily at midnight. To change this, add a cron-style schedule to `$SCHEDULE`. For more information on the format of the cron strings, please see the [croniter documentation on PyPI](https://pypi.org/project/croniter/). | ||
Mount your backup directory as `/var/backups` (or override `BACKUP_DIR`). Backups will be saved here based on the name of the container. Backups are not dated or compressed. | ||
|
||
Additionally, there is support for [healthchecks.io](https://healthchecks.io). `$HEALTHCHECKS_ID` can be used to specify the id to ping. If you're using a self-hosted instance, set `$HEALTHCHECKS_HOST`. | ||
Backups run daily at midnight. To change this, add a cron-style schedule to `SCHEDULE`. For more information on the format of the cron strings, please see the [croniter documentation on PyPI](https://pypi.org/project/croniter/). | ||
|
||
### Example `docker-compose.yml` | ||
Additionally, there is support for [healthchecks.io](https://healthchecks.io). `HEALTHCHECKS_ID` can be used to specify the id to ping. If you're using a self-hosted instance, set `HEALTHCHECKS_HOST`. | ||
|
||
```yml | ||
version: "2.3" | ||
### Example `docker-compose.yml` | ||
|
||
```yml | ||
--- | ||
version: "3.8" | ||
|
||
services: | ||
backup: | ||
|
||
db-auto-backup: | ||
image: ghcr.io/realorangeone/db-auto-backup:latest | ||
restart: unless-stopped | ||
container_name: db-auto-backup | ||
volumes: | ||
- /var/run/docker.sock:/var/run/docker.sock:ro | ||
- ./backups:/var/backups | ||
- /mnt/db-backups:/var/backups:rw | ||
environment: | ||
- DOCKER_HOST=tcp://docker-socket-proxy:2375 | ||
depends_on: | ||
- docker-socket-proxy | ||
networks: | ||
- docker-socket-proxy-net | ||
restart: unless-stopped | ||
|
||
docker-socket-proxy: | ||
image: tecnativa/docker-socket-proxy:latest | ||
container_name: docker-socket-proxy | ||
environment: | ||
- HEALTHCHECKS_ID=id | ||
- POST=1 | ||
- CONTAINERS=1 | ||
- IMAGES=1 | ||
- EXEC=1 | ||
networks: | ||
- docker-socket-proxy-net | ||
volumes: | ||
- /var/run/docker.sock:/var/run/docker.sock:ro | ||
restart: unless-stopped | ||
|
||
networks: | ||
docker-socket-proxy-net: | ||
internal: true | ||
``` | ||
|
||
### Oneshot | ||
|
||
You may want to use this container to run backups just once, rather than on a schedule. To achieve this, set `$SCHEDULE` to an empty string, and the backup will run just once. This may be useful in conjunction with an external scheduler. | ||
You may want to use this container to run backups just once, rather than on a schedule (or perhaps with an external scheduler). To achieve this, run these commands on the host running docker: | ||
|
||
`docker exec db-auto-backup SCHEDULE=` | ||
|
||
`docker exec ./db-auto-backup.py` | ||
Comment on lines
+70
to
+72
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Issue: I'm not sure these commands will actually work, the new
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a lot of wording change here, which doesn't seem to add much. I'm ok with talking about the socket before using a proxy (even if it is worse).
I personally always use
$
as a prefix for environment variables, although I agree that might not be clear. I'd be ok with a simpler patch which just rewords around that instead.