Skip to content

Commit b8305b1

Browse files
committed
MEDIUM: backups: Add configuration file backups
1 parent 5753cad commit b8305b1

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ HAProxy options:
6262
-s, --restart-cmd= Restart command
6363
--reload-retention= Reload retention in days, every older reload id will be deleted (default: 1)
6464
-t, --transaction-dir= Path to the transaction directory (default: /tmp/haproxy)
65+
-n, --backups-number= Number of backup configuration files you want to keep, stored in the config dir with version number suffix(default: 0)
6566
-m, --master-runtime= Path to the master Runtime API socket
6667
6768
Logging options:

configure_data_plane.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ var haproxyOptions struct {
7474
RestartCmd string `short:"s" long:"restart-cmd" description:"Restart command"`
7575
ReloadRetention int `long:"reload-retention" description:"Reload retention in days, every older reload id will be deleted" default:"1"`
7676
TransactionDir string `short:"t" long:"transaction-dir" description:"Path to the transaction directory" default:"/tmp/haproxy"`
77+
BackupsNumber int `short:"n" long:"backups-number" description:"Number of backup configuration files you want to keep, stored in the config dir with version number suffix" default:"0"`
7778
MasterRuntime string `short:"m" long:"master-runtime" description:"Path to the master Runtime API socket"`
7879
}
7980

@@ -518,6 +519,7 @@ func configureConfigurationClient() (*configuration.Client, error) {
518519
confParams := configuration.ClientParams{
519520
ConfigurationFile: haproxyOptions.ConfigFile,
520521
Haproxy: haproxyOptions.HAProxy,
522+
BackupsNumber: haproxyOptions.BackupsNumber,
521523
UseValidation: false,
522524
PersistentTransactions: true,
523525
TransactionDir: haproxyOptions.TransactionDir,

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ require (
1212
github.com/go-openapi/strfmt v0.19.0
1313
github.com/go-openapi/swag v0.19.0
1414
github.com/go-openapi/validate v0.19.0
15-
github.com/haproxytech/client-native v1.2.0
15+
github.com/haproxytech/client-native v1.2.1-0.20190813091531-c13eef260120
1616
github.com/haproxytech/config-parser v1.0.3
1717
github.com/haproxytech/models v1.2.0
1818
github.com/jessevdk/go-flags v1.4.0

go.sum

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:l
1010
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a h1:idn718Q4B6AGu/h5Sxe66HYVdqdGu2l9Iebqhi/AEoA=
1111
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
1212
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
13+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
1314
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
1415
github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
1516
github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw=
@@ -78,6 +79,8 @@ github.com/haproxytech/client-native v1.1.2-0.20190808132425-228cbc0ec380 h1:jbr
7879
github.com/haproxytech/client-native v1.1.2-0.20190808132425-228cbc0ec380/go.mod h1:0laC4mRKQgmkoeuie+LFkKBPM2UtBY7MXu66AxqKi1Q=
7980
github.com/haproxytech/client-native v1.2.0 h1:PRghCtq48SZikYwAmjvT4bySjKBiDYUCizvJPkyDqgc=
8081
github.com/haproxytech/client-native v1.2.0/go.mod h1:lj3L8k0WRbtSxsz71ojTmyA99h0K1Ef187JZEmRIe98=
82+
github.com/haproxytech/client-native v1.2.1-0.20190813091531-c13eef260120 h1:70LX5ipIqs0Xob45Cj6qBSty/DWcc2ts+VT6nVk4iEk=
83+
github.com/haproxytech/client-native v1.2.1-0.20190813091531-c13eef260120/go.mod h1:lj3L8k0WRbtSxsz71ojTmyA99h0K1Ef187JZEmRIe98=
8184
github.com/haproxytech/config-parser v1.0.0 h1:x6BQ5o5jzOq2QDApYwfFeidbKlS8d8F474tHbzT/GIY=
8285
github.com/haproxytech/config-parser v1.0.0/go.mod h1:se7v728KDunj+qz1kXFFFl+nDuoBdUaN5eYSi+gYjNM=
8386
github.com/haproxytech/config-parser v1.0.2 h1:IK0COYVxcVWp92j2Af8PA/z4yP3K69XqiT9iAI4e+48=
@@ -109,6 +112,7 @@ github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh
109112
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
110113
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
111114
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
115+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
112116
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
113117
github.com/rs/cors v1.6.0 h1:G9tHG9lebljV9mfp9SNPDL36nCDxmo3zTlAf1YgvzmI=
114118
github.com/rs/cors v1.6.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
@@ -117,6 +121,7 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd
117121
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
118122
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
119123
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
124+
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
120125
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
121126
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
122127
golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=

0 commit comments

Comments
 (0)