Initial commit of docker compose project generator
Creates project directory structure in /docker Creates docker-compose.yml with sensible defaults Creates borgmatic config in /etc/borgmatic.d Adds proxy info to caddyfile and reloads caddy Config file generation done via jsonnet and yq Borgmatic configured to backup to borgbase repo
This commit is contained in:
77
borgmatic/borg-config.jsonnet
Normal file
77
borgmatic/borg-config.jsonnet
Normal file
@@ -0,0 +1,77 @@
|
||||
function(
|
||||
project,
|
||||
encryption_passphrase,
|
||||
parent_dir='/docker',
|
||||
repo_path='ssh://s1dw3340@s1dw3340.repo.borgbase.com/./repo',
|
||||
repo_label='winterfell-docker on BorgBase',
|
||||
exclude_patterns=[
|
||||
// Generic caches & temp
|
||||
'**/tmp/',
|
||||
'**/temp/',
|
||||
'**/.cache/',
|
||||
'**/cache/',
|
||||
|
||||
// Potential ephemeral DB areas (adjust if you do raw file backups)
|
||||
'**/pg_stat_tmp/',
|
||||
'**/pg_replslot/',
|
||||
|
||||
// Node-based ephemeral
|
||||
'**/node_modules/',
|
||||
|
||||
// System or FS-specific
|
||||
'**/lost+found/',
|
||||
'**/*.lock',
|
||||
],
|
||||
one_file_system=true,
|
||||
compression='auto,zstd',
|
||||
archive_name_format='docker-{now:%Y-%m-%d-%H%M%S}',
|
||||
prefix_project_name_archive=true,
|
||||
retries=0,
|
||||
retry_wait=2,
|
||||
keep_daily=3,
|
||||
keep_weekly=4,
|
||||
keep_monthly=12,
|
||||
checks=[
|
||||
{
|
||||
"name": "repository",
|
||||
"frequency": "4 weeks"
|
||||
},
|
||||
{
|
||||
"name": "archives",
|
||||
"frequency": "8 weeks"
|
||||
}
|
||||
],
|
||||
check_last=3,
|
||||
before_backup='/code/scripts/docker-gen/borgmatic/pre-backup-docker-compose-down.sh {{project}}',
|
||||
after_backup='/code/scripts/docker-gen/borgmatic/post-backup-docker-compose-up.sh {{project}}'
|
||||
)
|
||||
|
||||
{
|
||||
'source_directories': [
|
||||
std.rstripChars(parent_dir, '/') + '/' + std.stripChars(project, ' ')
|
||||
],
|
||||
'repositories': [
|
||||
{
|
||||
'path': repo_path,
|
||||
'label': repo_label
|
||||
}
|
||||
],
|
||||
'exclude_patterns': exclude_patterns,
|
||||
'one_file_system': one_file_system,
|
||||
'compression': compression,
|
||||
'encryption_passphrase': encryption_passphrase,
|
||||
'archive_name_format': if prefix_project_name_archive then project + '-' + archive_name_format else archive_name_format,
|
||||
'retries': retries,
|
||||
'retry_wait': retry_wait,
|
||||
'keep_daily': keep_daily,
|
||||
'keep_weekly': keep_weekly,
|
||||
'keep_monthly': keep_monthly,
|
||||
'checks': checks,
|
||||
'check_last': check_last,
|
||||
'before_backup': [
|
||||
std.strReplace(before_backup, '{{project}}', project)
|
||||
],
|
||||
'after_backup': [
|
||||
std.strReplace(after_backup, '{{project}}', project)
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user