Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ GITHUB_TOKEN=your_github_token_here
# Comma-separated list of GitHub users/organizations to backup
# Example: SCHEDULED_USERS=octocat,github,spring-projects
SCHEDULED_USERS=octocat

# Delay between scheduled backups, in milliseconds
# Leave empty to use the default of 86400000 (24 hours)
# Example: BACKUP_INTERVAL_MS=3600000 (1 hour)
BACKUP_INTERVAL_MS=
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased]

### Added

- `BACKUP_INTERVAL_MS` environment variable for the Docker daemon image, mapped by `docker-entrypoint.sh` to `-Dbackup.scheduled.interval.ms`, so the backup interval can be configured from `.env`/`docker-compose.yml` without overriding the entrypoint

## [2.0.0-SNAPSHOT-8-8-2026] – 2026-08-08

### Changed
Expand Down
6 changes: 3 additions & 3 deletions CONFIG.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,15 @@ When the image built from the included `Dockerfile` is used, the container alway
| Variable | Maps to | Default in the image | Description |
|----------|---------|----------------------|-------------|
| `SCHEDULED_USERS` | `backup.scheduled.users` | *(empty)* | Comma-separated list of GitHub users/organizations to back up automatically. Passed to the application only when non-empty. |
| `BACKUP_INTERVAL_MS` | `backup.scheduled.interval.ms` | *(empty)* | Delay between scheduled backups, in milliseconds. Passed to the application only when non-empty; when empty, the default of `86400000` (24 hours) from `application-daemon.properties` applies. |
| `BACKUP_DIRECTORY` | `backup.directory` | `/backups` | Backup directory inside the container. |
| `GITHUB_TOKEN` | *(read directly by the application)* | *(empty)* | GitHub personal access token, as described above. |

Of these, only `GITHUB_TOKEN` and `SCHEDULED_USERS` are wired through to a `.env` file by the included `docker-compose.yml` (see `.env.example`); that file pins `BACKUP_DIRECTORY` to `/backups` and mounts the host's `./backups` directory there so backups persist outside the container.

`backup.scheduled.interval.ms` has no corresponding environment variable, so a container built from this image backs up every 24 hours unless the entrypoint is overridden.
Of these, `GITHUB_TOKEN`, `SCHEDULED_USERS` and `BACKUP_INTERVAL_MS` are wired through to a `.env` file by the included `docker-compose.yml` (see `.env.example`); that file pins `BACKUP_DIRECTORY` to `/backups` and mounts the host's `./backups` directory there so backups persist outside the container.

**Example `.env`:**
```
GITHUB_TOKEN=ghp_yourTokenHere
SCHEDULED_USERS=octocat,github
BACKUP_INTERVAL_MS=3600000
```
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ RUN mkdir -p /backups
ENV BACKUP_DIRECTORY=/backups
ENV GITHUB_TOKEN=""
ENV SCHEDULED_USERS=""
ENV BACKUP_INTERVAL_MS=""

# Expose port 8080 for optional web mode.
# The default image entrypoint runs in daemon mode, so this port is only used if the
Expand Down
7 changes: 6 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ services:
# Comma-separated list of GitHub users/organizations to backup
# Example: SCHEDULED_USERS=octocat,github,spring-projects
- SCHEDULED_USERS=${SCHEDULED_USERS:-}


# Delay between scheduled backups, in milliseconds
# Leave empty for the default of 86400000 (24 hours)
# Example: BACKUP_INTERVAL_MS=3600000
- BACKUP_INTERVAL_MS=${BACKUP_INTERVAL_MS:-}

# Optional: Custom backup directory inside container
- BACKUP_DIRECTORY=/backups
volumes:
Expand Down
5 changes: 5 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ if [ -n "$SCHEDULED_USERS" ]; then
set -- "$@" "-Dbackup.scheduled.users=${SCHEDULED_USERS}"
fi

# Set backup interval if provided (defaults to 86400000 = 24 hours in application-daemon.properties)
if [ -n "$BACKUP_INTERVAL_MS" ]; then
set -- "$@" "-Dbackup.scheduled.interval.ms=${BACKUP_INTERVAL_MS}"
fi

# Execute the application
set -- "$@" -jar gh-backup.jar
exec "$@"
Loading