Skip to content

Commit 60482b2

Browse files
Add label to optionally skip container restart after backup (#659)
* Add label to optionally skip container restart after backup * Add new mutually exclusive label instead * Simplified `hasLabel` * removed unnecessary else block * added new test-case `no-restart` based on test-case `local` * removed invalid README entry * added new section to how-tos * Added configuration reference
1 parent 5223459 commit 60482b2

File tree

7 files changed

+307
-114
lines changed

7 files changed

+307
-114
lines changed

cmd/backup/config.go

Lines changed: 78 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -18,83 +18,84 @@ import (
1818
// Config holds all configuration values that are expected to be set
1919
// by users.
2020
type Config struct {
21-
AwsS3BucketName string `split_words:"true"`
22-
AwsS3Path string `split_words:"true"`
23-
AwsEndpoint string `split_words:"true" default:"s3.amazonaws.com"`
24-
AwsEndpointProto string `split_words:"true" default:"https"`
25-
AwsEndpointInsecure bool `split_words:"true"`
26-
AwsEndpointCACert CertDecoder `envconfig:"AWS_ENDPOINT_CA_CERT"`
27-
AwsStorageClass string `split_words:"true"`
28-
AwsAccessKeyID string `envconfig:"AWS_ACCESS_KEY_ID"`
29-
AwsSecretAccessKey string `split_words:"true"`
30-
AwsIamRoleEndpoint string `split_words:"true"`
31-
AwsPartSize int64 `split_words:"true"`
32-
BackupCompression CompressionType `split_words:"true" default:"gz"`
33-
GzipParallelism WholeNumber `split_words:"true" default:"1"`
34-
BackupSources string `split_words:"true" default:"/backup"`
35-
BackupFilename string `split_words:"true" default:"backup-%Y-%m-%dT%H-%M-%S.{{ .Extension }}"`
36-
BackupFilenameExpand bool `split_words:"true"`
37-
BackupLatestSymlink string `split_words:"true"`
38-
BackupArchive string `split_words:"true" default:"/archive"`
39-
BackupCronExpression string `split_words:"true" default:"@daily"`
40-
BackupJitter time.Duration `split_words:"true" default:"0s"`
41-
BackupRetentionDays int32 `split_words:"true" default:"-1"`
42-
BackupPruningLeeway time.Duration `split_words:"true" default:"1m"`
43-
BackupPruningPrefix string `split_words:"true"`
44-
BackupStopContainerLabel string `split_words:"true"`
45-
BackupStopDuringBackupLabel string `split_words:"true" default:"true"`
46-
BackupStopServiceTimeout time.Duration `split_words:"true" default:"5m"`
47-
BackupFromSnapshot bool `split_words:"true"`
48-
BackupExcludeRegexp RegexpDecoder `split_words:"true"`
49-
BackupSkipBackendsFromPrune []string `split_words:"true"`
50-
GpgPassphrase string `split_words:"true"`
51-
GpgPublicKeyRing string `split_words:"true"`
52-
AgePassphrase string `split_words:"true"`
53-
AgePublicKeys []string `split_words:"true"`
54-
NotificationURLs []string `envconfig:"NOTIFICATION_URLS"`
55-
NotificationLevel string `split_words:"true" default:"error"`
56-
EmailNotificationRecipient string `split_words:"true"`
57-
EmailNotificationSender string `split_words:"true" default:"noreply@nohost"`
58-
EmailSMTPHost string `envconfig:"EMAIL_SMTP_HOST"`
59-
EmailSMTPPort int `envconfig:"EMAIL_SMTP_PORT" default:"587"`
60-
EmailSMTPUsername string `envconfig:"EMAIL_SMTP_USERNAME"`
61-
EmailSMTPPassword string `envconfig:"EMAIL_SMTP_PASSWORD"`
62-
WebdavUrl string `split_words:"true"`
63-
WebdavUrlInsecure bool `split_words:"true"`
64-
WebdavPath string `split_words:"true" default:"/"`
65-
WebdavUsername string `split_words:"true"`
66-
WebdavPassword string `split_words:"true"`
67-
SSHHostName string `split_words:"true"`
68-
SSHPort string `split_words:"true" default:"22"`
69-
SSHUser string `split_words:"true"`
70-
SSHPassword string `split_words:"true"`
71-
SSHIdentityFile string `split_words:"true" default:"/root/.ssh/id_rsa"`
72-
SSHIdentityPassphrase string `split_words:"true"`
73-
SSHRemotePath string `split_words:"true"`
74-
ExecLabel string `split_words:"true"`
75-
ExecForwardOutput bool `split_words:"true"`
76-
LockTimeout time.Duration `split_words:"true" default:"60m"`
77-
AzureStorageAccountName string `split_words:"true"`
78-
AzureStoragePrimaryAccountKey string `split_words:"true"`
79-
AzureStorageConnectionString string `split_words:"true"`
80-
AzureStorageContainerName string `split_words:"true"`
81-
AzureStoragePath string `split_words:"true"`
82-
AzureStorageEndpoint string `split_words:"true" default:"https://{{ .AccountName }}.blob.core.windows.net/"`
83-
AzureStorageAccessTier string `split_words:"true"`
84-
DropboxEndpoint string `split_words:"true" default:"https://api.dropbox.com/"`
85-
DropboxOAuth2Endpoint string `envconfig:"DROPBOX_OAUTH2_ENDPOINT" default:"https://api.dropbox.com/"`
86-
DropboxRefreshToken string `split_words:"true"`
87-
DropboxAppKey string `split_words:"true"`
88-
DropboxAppSecret string `split_words:"true"`
89-
DropboxRemotePath string `split_words:"true"`
90-
DropboxConcurrencyLevel NaturalNumber `split_words:"true" default:"6"`
91-
GoogleDriveCredentialsJSON string `split_words:"true"`
92-
GoogleDriveFolderID string `split_words:"true"`
93-
GoogleDriveImpersonateSubject string `split_words:"true"`
94-
GoogleDriveEndpoint string `split_words:"true"`
95-
GoogleDriveTokenURL string `split_words:"true"`
96-
source string
97-
additionalEnvVars map[string]string
21+
AwsS3BucketName string `split_words:"true"`
22+
AwsS3Path string `split_words:"true"`
23+
AwsEndpoint string `split_words:"true" default:"s3.amazonaws.com"`
24+
AwsEndpointProto string `split_words:"true" default:"https"`
25+
AwsEndpointInsecure bool `split_words:"true"`
26+
AwsEndpointCACert CertDecoder `envconfig:"AWS_ENDPOINT_CA_CERT"`
27+
AwsStorageClass string `split_words:"true"`
28+
AwsAccessKeyID string `envconfig:"AWS_ACCESS_KEY_ID"`
29+
AwsSecretAccessKey string `split_words:"true"`
30+
AwsIamRoleEndpoint string `split_words:"true"`
31+
AwsPartSize int64 `split_words:"true"`
32+
BackupCompression CompressionType `split_words:"true" default:"gz"`
33+
GzipParallelism WholeNumber `split_words:"true" default:"1"`
34+
BackupSources string `split_words:"true" default:"/backup"`
35+
BackupFilename string `split_words:"true" default:"backup-%Y-%m-%dT%H-%M-%S.{{ .Extension }}"`
36+
BackupFilenameExpand bool `split_words:"true"`
37+
BackupLatestSymlink string `split_words:"true"`
38+
BackupArchive string `split_words:"true" default:"/archive"`
39+
BackupCronExpression string `split_words:"true" default:"@daily"`
40+
BackupJitter time.Duration `split_words:"true" default:"0s"`
41+
BackupRetentionDays int32 `split_words:"true" default:"-1"`
42+
BackupPruningLeeway time.Duration `split_words:"true" default:"1m"`
43+
BackupPruningPrefix string `split_words:"true"`
44+
BackupStopContainerLabel string `split_words:"true"`
45+
BackupStopDuringBackupLabel string `split_words:"true" default:"true"`
46+
BackupStopDuringBackupNoRestartLabel string `split_words:"true" default:"true"`
47+
BackupStopServiceTimeout time.Duration `split_words:"true" default:"5m"`
48+
BackupFromSnapshot bool `split_words:"true"`
49+
BackupExcludeRegexp RegexpDecoder `split_words:"true"`
50+
BackupSkipBackendsFromPrune []string `split_words:"true"`
51+
GpgPassphrase string `split_words:"true"`
52+
GpgPublicKeyRing string `split_words:"true"`
53+
AgePassphrase string `split_words:"true"`
54+
AgePublicKeys []string `split_words:"true"`
55+
NotificationURLs []string `envconfig:"NOTIFICATION_URLS"`
56+
NotificationLevel string `split_words:"true" default:"error"`
57+
EmailNotificationRecipient string `split_words:"true"`
58+
EmailNotificationSender string `split_words:"true" default:"noreply@nohost"`
59+
EmailSMTPHost string `envconfig:"EMAIL_SMTP_HOST"`
60+
EmailSMTPPort int `envconfig:"EMAIL_SMTP_PORT" default:"587"`
61+
EmailSMTPUsername string `envconfig:"EMAIL_SMTP_USERNAME"`
62+
EmailSMTPPassword string `envconfig:"EMAIL_SMTP_PASSWORD"`
63+
WebdavUrl string `split_words:"true"`
64+
WebdavUrlInsecure bool `split_words:"true"`
65+
WebdavPath string `split_words:"true" default:"/"`
66+
WebdavUsername string `split_words:"true"`
67+
WebdavPassword string `split_words:"true"`
68+
SSHHostName string `split_words:"true"`
69+
SSHPort string `split_words:"true" default:"22"`
70+
SSHUser string `split_words:"true"`
71+
SSHPassword string `split_words:"true"`
72+
SSHIdentityFile string `split_words:"true" default:"/root/.ssh/id_rsa"`
73+
SSHIdentityPassphrase string `split_words:"true"`
74+
SSHRemotePath string `split_words:"true"`
75+
ExecLabel string `split_words:"true"`
76+
ExecForwardOutput bool `split_words:"true"`
77+
LockTimeout time.Duration `split_words:"true" default:"60m"`
78+
AzureStorageAccountName string `split_words:"true"`
79+
AzureStoragePrimaryAccountKey string `split_words:"true"`
80+
AzureStorageConnectionString string `split_words:"true"`
81+
AzureStorageContainerName string `split_words:"true"`
82+
AzureStoragePath string `split_words:"true"`
83+
AzureStorageEndpoint string `split_words:"true" default:"https://{{ .AccountName }}.blob.core.windows.net/"`
84+
AzureStorageAccessTier string `split_words:"true"`
85+
DropboxEndpoint string `split_words:"true" default:"https://api.dropbox.com/"`
86+
DropboxOAuth2Endpoint string `envconfig:"DROPBOX_OAUTH2_ENDPOINT" default:"https://api.dropbox.com/"`
87+
DropboxRefreshToken string `split_words:"true"`
88+
DropboxAppKey string `split_words:"true"`
89+
DropboxAppSecret string `split_words:"true"`
90+
DropboxRemotePath string `split_words:"true"`
91+
DropboxConcurrencyLevel NaturalNumber `split_words:"true" default:"6"`
92+
GoogleDriveCredentialsJSON string `split_words:"true"`
93+
GoogleDriveFolderID string `split_words:"true"`
94+
GoogleDriveImpersonateSubject string `split_words:"true"`
95+
GoogleDriveEndpoint string `split_words:"true"`
96+
GoogleDriveTokenURL string `split_words:"true"`
97+
source string
98+
additionalEnvVars map[string]string
9899
}
99100

100101
type CompressionType string

0 commit comments

Comments
 (0)