From a349df7b059e30ea10c4bef3cc410418a404bc0c Mon Sep 17 00:00:00 2001 From: likhachevam Date: Thu, 20 Nov 2025 11:01:43 +0300 Subject: [PATCH 01/13] MSP-6703 up dependencies --- cmd/migrate/go.mod | 24 ++++++------ cmd/migrate/go.sum | 11 ++++++ go.mod | 50 ++++++++++++++++-------- go.sum | 94 ++++++++++++++++++++++++++++++++-------------- 4 files changed, 124 insertions(+), 55 deletions(-) diff --git a/cmd/migrate/go.mod b/cmd/migrate/go.mod index 6937745..01feded 100644 --- a/cmd/migrate/go.mod +++ b/cmd/migrate/go.mod @@ -1,12 +1,12 @@ module isp-config-service/migrate -go 1.25 +go 1.25.0 replace isp-config-service => ../.. require ( github.com/jmoiron/sqlx v1.4.0 - github.com/mattn/go-sqlite3 v1.14.28 + github.com/mattn/go-sqlite3 v1.14.32 github.com/pkg/errors v0.9.1 github.com/pressly/goose/v3 v3.25.0 github.com/txix-open/isp-kit v1.58.0 @@ -25,7 +25,7 @@ require ( github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3 // indirect github.com/iancoleman/strcase v0.3.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect @@ -63,15 +63,15 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect go.yaml.in/yaml/v2 v2.4.3 // indirect - golang.org/x/crypto v0.42.0 // indirect - golang.org/x/net v0.44.0 // indirect - golang.org/x/sync v0.17.0 // indirect - golang.org/x/sys v0.36.0 // indirect - golang.org/x/text v0.29.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20250908214217-97024824d090 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20250908214217-97024824d090 // indirect - google.golang.org/grpc v1.75.1 // indirect - google.golang.org/protobuf v1.36.9 // indirect + golang.org/x/crypto v0.44.0 // indirect + golang.org/x/net v0.47.0 // indirect + golang.org/x/sync v0.18.0 // indirect + golang.org/x/sys v0.38.0 // indirect + golang.org/x/text v0.31.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20251020155222-88f65dc88635 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20251020155222-88f65dc88635 // indirect + google.golang.org/grpc v1.76.0 // indirect + google.golang.org/protobuf v1.36.10 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/cmd/migrate/go.sum b/cmd/migrate/go.sum index 4c0200b..bf02762 100644 --- a/cmd/migrate/go.sum +++ b/cmd/migrate/go.sum @@ -50,6 +50,7 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 h1:8Tjv8EJ+pM1xP8mK6egEbD1OgnVTyacbefKhmbLhIhU= github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2/go.mod h1:pkJQ2tZHJ0aFOVEEot6oZmaVEZcRme73eIFmhiVuRWs= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3/go.mod h1:zQrxl1YP88HQlA6i9c63DSVPFklWpGX4OWAc9bFuaH4= github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= @@ -87,6 +88,7 @@ github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/mattn/go-sqlite3 v1.14.28 h1:ThEiQrnbtumT+QMknw63Befp/ce/nUPgBPMlRFEum7A= github.com/mattn/go-sqlite3 v1.14.28/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= +github.com/mattn/go-sqlite3 v1.14.32/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/mfridman/interpolate v0.0.2 h1:pnuTK7MQIxxFz1Gr+rjSIx9u7qVjf5VOoM/u6BbAxPY= github.com/mfridman/interpolate v0.0.2/go.mod h1:p+7uk6oE07mpE/Ik1b8EckO0O4ZXiGAfshKBWLUM9Xg= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= @@ -180,26 +182,35 @@ go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= golang.org/x/crypto v0.42.0 h1:chiH31gIWm57EkTXpwnqf8qeuMUi0yekh6mT2AvFlqI= golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8= +golang.org/x/crypto v0.44.0/go.mod h1:013i+Nw79BMiQiMsOPcVCB5ZIJbYkerPrGnOa00tvmc= golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b h1:M2rDM6z3Fhozi9O7NWsxAkg/yqS/lQJ6PmkyIV3YP+o= golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b/go.mod h1:3//PLf8L/X+8b4vuAfHzxeRUl04Adcb341+IGKfnqS8= golang.org/x/net v0.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I= golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY= +golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug= golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= +golang.org/x/sync v0.18.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k= golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk= golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4= +golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM= gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= google.golang.org/genproto/googleapis/api v0.0.0-20250908214217-97024824d090 h1:d8Nakh1G+ur7+P3GcMjpRDEkoLUcLW2iU92XVqR+XMQ= google.golang.org/genproto/googleapis/api v0.0.0-20250908214217-97024824d090/go.mod h1:U8EXRNSd8sUYyDfs/It7KVWodQr+Hf9xtxyxWudSwEw= +google.golang.org/genproto/googleapis/api v0.0.0-20251020155222-88f65dc88635/go.mod h1:fDMmzKV90WSg1NbozdqrE64fkuTv6mlq2zxo9ad+3yo= google.golang.org/genproto/googleapis/rpc v0.0.0-20250908214217-97024824d090 h1:/OQuEa4YWtDt7uQWHd3q3sUMb+QOLQUg1xa8CEsRv5w= google.golang.org/genproto/googleapis/rpc v0.0.0-20250908214217-97024824d090/go.mod h1:GmFNa4BdJZ2a8G+wCe9Bg3wwThLrJun751XstdJt5Og= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251020155222-88f65dc88635/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= google.golang.org/grpc v1.75.1 h1:/ODCNEuf9VghjgO3rqLcfg8fiOP0nSluljWFlDxELLI= google.golang.org/grpc v1.75.1/go.mod h1:JtPAzKiq4v1xcAB2hydNlWI2RnF85XXcV0mhKXr2ecQ= +google.golang.org/grpc v1.76.0/go.mod h1:Ju12QI8M6iQJtbcsV+awF5a4hfJMLi4X0JLo94ULZ6c= google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw= google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= +google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/go.mod b/go.mod index b8ac048..e19a65e 100644 --- a/go.mod +++ b/go.mod @@ -1,9 +1,10 @@ module isp-config-service -go 1.25 +go 1.25.0 replace ( github.com/armon/go-metrics => github.com/hashicorp/go-metrics v0.5.1 + github.com/mattn/go-sqlite3 => github.com/rqlite/go-sqlite3 v1.42.0 golang.org/x/text => golang.org/x/text v0.3.8 ) @@ -15,19 +16,38 @@ require ( github.com/prometheus/client_golang v1.23.2 github.com/rqlite/gorqlite v0.0.0-20250609141355-ac86a4a1c9a8 github.com/rqlite/rqlite-disco-clients v0.0.0-20250205044118-8ada2b350099 - github.com/rqlite/rqlite/v8 v8.39.1 + github.com/rqlite/rqlite/v9 v9.3.0 github.com/stretchr/testify v1.11.1 github.com/tidwall/gjson v1.18.0 github.com/txix-open/etp/v4 v4.0.1 github.com/txix-open/go-cmp v0.0.0-20240401171944-16b203530f60 - github.com/txix-open/isp-kit v1.58.0 + github.com/txix-open/isp-kit v1.63.2 github.com/xeipuuv/gojsonschema v1.2.0 golang.org/x/sync v0.17.0 - google.golang.org/grpc v1.75.1 + google.golang.org/grpc v1.76.0 ) require ( github.com/armon/go-metrics v0.5.4 // indirect + github.com/aws/aws-sdk-go-v2 v1.39.6 // indirect + github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.3 // indirect + github.com/aws/aws-sdk-go-v2/config v1.31.19 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.18.23 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.13 // indirect + github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.20.6 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.13 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.13 // indirect + github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 // indirect + github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.13 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.3 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.4 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.13 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.13 // indirect + github.com/aws/aws-sdk-go-v2/service/s3 v1.90.1 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.30.2 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.6 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.40.1 // indirect + github.com/aws/smithy-go v1.23.2 // indirect github.com/bahlo/generic-list-go v0.2.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/buger/jsonparser v1.1.1 // indirect @@ -43,12 +63,12 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3 // indirect github.com/hashicorp/go-hclog v1.6.3 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-metrics v0.5.4 // indirect github.com/hashicorp/go-msgpack v1.1.5 // indirect - github.com/hashicorp/go-msgpack/v2 v2.1.3 // indirect + github.com/hashicorp/go-msgpack/v2 v2.1.5 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/raft v1.7.3 // indirect github.com/json-iterator/go v1.1.12 // indirect @@ -58,6 +78,7 @@ require ( github.com/mailru/easyjson v0.9.0 // indirect github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mattn/go-sqlite3 v1.14.32 // indirect github.com/mfridman/interpolate v0.0.2 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect @@ -67,7 +88,6 @@ require ( github.com/prometheus/client_model v0.6.2 // indirect github.com/prometheus/common v0.66.1 // indirect github.com/prometheus/procfs v0.17.0 // indirect - github.com/rqlite/go-sqlite3 v1.38.0 // indirect github.com/rqlite/raft-boltdb/v2 v2.0.0-20230523104317-c08e70f4de48 // indirect github.com/rqlite/sql v0.0.0-20250623131620-453fa49cad04 // indirect github.com/sethvargo/go-retry v0.3.0 // indirect @@ -79,7 +99,7 @@ require ( github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect - go.etcd.io/bbolt v1.4.2 // indirect + go.etcd.io/bbolt v1.4.3 // indirect go.opentelemetry.io/auto/sdk v1.2.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.63.0 // indirect go.opentelemetry.io/otel v1.38.0 // indirect @@ -92,13 +112,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect go.yaml.in/yaml/v2 v2.4.3 // indirect - golang.org/x/crypto v0.42.0 // indirect - golang.org/x/net v0.44.0 // indirect - golang.org/x/sys v0.36.0 // indirect - golang.org/x/text v0.29.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20250908214217-97024824d090 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20250908214217-97024824d090 // indirect - google.golang.org/protobuf v1.36.9 // indirect + golang.org/x/crypto v0.44.0 // indirect + golang.org/x/net v0.47.0 // indirect + golang.org/x/sys v0.38.0 // indirect + golang.org/x/text v0.31.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20251020155222-88f65dc88635 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20251020155222-88f65dc88635 // indirect + google.golang.org/protobuf v1.36.10 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 3eb71f5..1b21e67 100644 --- a/go.sum +++ b/go.sum @@ -9,6 +9,44 @@ github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRF github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= +github.com/aws/aws-sdk-go-v2 v1.39.6 h1:2JrPCVgWJm7bm83BDwY5z8ietmeJUbh3O2ACnn+Xsqk= +github.com/aws/aws-sdk-go-v2 v1.39.6/go.mod h1:c9pm7VwuW0UPxAEYGyTmyurVcNrbF6Rt/wixFqDhcjE= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.3 h1:DHctwEM8P8iTXFxC/QK0MRjwEpWQeM9yzidCRjldUz0= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.3/go.mod h1:xdCzcZEtnSTKVDOmUZs4l/j3pSV6rpo1WXl5ugNsL8Y= +github.com/aws/aws-sdk-go-v2/config v1.31.19 h1:qdUtOw4JhZr2YcKO3g0ho/IcFXfXrrb8xlX05Y6EvSw= +github.com/aws/aws-sdk-go-v2/config v1.31.19/go.mod h1:tMJ8bur01t8eEm0atLadkIIFA154OJ4JCKZeQ+o+R7k= +github.com/aws/aws-sdk-go-v2/credentials v1.18.23 h1:IQILcxVgMO2BVLaJ2aAv21dKWvE1MduNrbvuK43XL2Q= +github.com/aws/aws-sdk-go-v2/credentials v1.18.23/go.mod h1:JRodHszhVdh5TPUknxDzJzrMiznG+M+FfR3WSWKgCI8= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.13 h1:T1brd5dR3/fzNFAQch/iBKeX07/ffu/cLu+q+RuzEWk= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.13/go.mod h1:Peg/GBAQ6JDt+RoBf4meB1wylmAipb7Kg2ZFakZTlwk= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.20.6 h1:ZzA0XhuftrrWhOb1POxvgJ3pb5IBo9+lSRn2DsM5FTM= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.20.6/go.mod h1:fNCXmb1171YzKE5TyQ88AkJZBLfqhFHKzls36eEv8Vk= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.13 h1:a+8/MLcWlIxo1lF9xaGt3J/u3yOZx+CdSveSNwjhD40= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.13/go.mod h1:oGnKwIYZ4XttyU2JWxFrwvhF6YKiK/9/wmE3v3Iu9K8= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.13 h1:HBSI2kDkMdWz4ZM7FjwE7e/pWDEZ+nR95x8Ztet1ooY= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.13/go.mod h1:YE94ZoDArI7awZqJzBAZ3PDD2zSfuP7w6P2knOzIn8M= +github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 h1:WKuaxf++XKWlHWu9ECbMlha8WOEGm0OUEZqm4K/Gcfk= +github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4/go.mod h1:ZWy7j6v1vWGmPReu0iSGvRiise4YI5SkR3OHKTZ6Wuc= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.13 h1:eg/WYAa12vqTphzIdWMzqYRVKKnCboVPRlvaybNCqPA= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.13/go.mod h1:/FDdxWhz1486obGrKKC1HONd7krpk38LBt+dutLcN9k= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.3 h1:x2Ibm/Af8Fi+BH+Hsn9TXGdT+hKbDd5XOTZxTMxDk7o= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.3/go.mod h1:IW1jwyrQgMdhisceG8fQLmQIydcT/jWY21rFhzgaKwo= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.4 h1:NvMjwvv8hpGUILarKw7Z4Q0w1H9anXKsesMxtw++MA4= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.4/go.mod h1:455WPHSwaGj2waRSpQp7TsnpOnBfw8iDfPfbwl7KPJE= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.13 h1:kDqdFvMY4AtKoACfzIGD8A0+hbT41KTKF//gq7jITfM= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.13/go.mod h1:lmKuogqSU3HzQCwZ9ZtcqOc5XGMqtDK7OIc2+DxiUEg= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.13 h1:zhBJXdhWIFZ1acfDYIhu4+LCzdUS2Vbcum7D01dXlHQ= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.13/go.mod h1:JaaOeCE368qn2Hzi3sEzY6FgAZVCIYcC2nwbro2QCh8= +github.com/aws/aws-sdk-go-v2/service/s3 v1.90.1 h1:kKJk9r6iLMfCGy8RL9GWg3n9gUE1IpSwqYP3/5bdL1s= +github.com/aws/aws-sdk-go-v2/service/s3 v1.90.1/go.mod h1:+wArOOrcHUevqdto9k1tKOF5++YTe9JEcPSc9Tx2ZSw= +github.com/aws/aws-sdk-go-v2/service/sso v1.30.2 h1:/p6MxkbQoCzaGQT3WO0JwG0FlQyG9RD8VmdmoKc5xqU= +github.com/aws/aws-sdk-go-v2/service/sso v1.30.2/go.mod h1:fKvyjJcz63iL/ftA6RaM8sRCtN4r4zl4tjL3qw5ec7k= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.6 h1:0dES42T2dhICCbVB3JSTTn7+Bz93wfJEK1b7jksZIyQ= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.6/go.mod h1:klO+ejMvYsB4QATfEOIXk8WAEwN4N0aBfJpvC+5SZBo= +github.com/aws/aws-sdk-go-v2/service/sts v1.40.1 h1:5sbIM57lHLaEaNWdIx23JH30LNBsSDkjN/QXGcRLAFc= +github.com/aws/aws-sdk-go-v2/service/sts v1.40.1/go.mod h1:E19xDjpzPZC7LS2knI9E6BaRFDK43Eul7vd6rSq2HWk= +github.com/aws/smithy-go v1.23.2 h1:Crv0eatJUQhaManss33hS5r40CG3ZFH+21XSkqMrIUM= +github.com/aws/smithy-go v1.23.2/go.mod h1:LEj2LM3rBRQJxPZTB4KuzZkaZYnZPnvgIhb4pu07mx0= github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk= github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= @@ -92,8 +130,8 @@ github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 h1:8Tjv8EJ+pM1xP8mK6egEbD1OgnVTyacbefKhmbLhIhU= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2/go.mod h1:pkJQ2tZHJ0aFOVEEot6oZmaVEZcRme73eIFmhiVuRWs= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3 h1:NmZ1PKzSTQbuGHw9DGPFomqkkLWMC+vZCkfs+FHv1Vg= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3/go.mod h1:zQrxl1YP88HQlA6i9c63DSVPFklWpGX4OWAc9bFuaH4= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-hclog v0.9.1/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= @@ -108,8 +146,8 @@ github.com/hashicorp/go-metrics v0.5.4/go.mod h1:CG5yz4NZ/AI/aQt9Ucm/vdBnbh7fvmv github.com/hashicorp/go-msgpack v0.5.5/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-msgpack v1.1.5 h1:9byZdVjKTe5mce63pRVNP1L7UAmdHOTEMGehn6KvJWs= github.com/hashicorp/go-msgpack v1.1.5/go.mod h1:gWVc3sv/wbDmR3rQsj1CAktEZzoz1YNK9NfGLXJ69/4= -github.com/hashicorp/go-msgpack/v2 v2.1.3 h1:cB1w4Zrk0O3jQBTcFMKqYQWRFfsSQ/TYKNyUUVyCP2c= -github.com/hashicorp/go-msgpack/v2 v2.1.3/go.mod h1:SjlwKKFnwBXvxD/I1bEcfJIBbEJ+MCUn39TxymNR5ZU= +github.com/hashicorp/go-msgpack/v2 v2.1.5 h1:Ue879bPnutj/hXfmUk6s/jtIK90XxgiUIcXRl656T44= +github.com/hashicorp/go-msgpack/v2 v2.1.5/go.mod h1:bjCsRXpZ7NsJdk45PoCQnzRGDaK8TKm5ZnDI/9y3J4M= github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= github.com/hashicorp/go-uuid v1.0.0 h1:RS8zrF7PhGwyNPOtxSClXXj9HA8feRnJzgnI1RJCSnM= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= @@ -221,16 +259,16 @@ github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94 github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/rqlite/go-sqlite3 v1.38.0 h1:o3qTaVEHRzPsvTabUpPGPyNqnCyxEW3ccxHuPeUW/YI= -github.com/rqlite/go-sqlite3 v1.38.0/go.mod h1:R9H7CatgYBt3c+fSV/5yo2vLh4ZjCB0aMHdkv69fP4A= +github.com/rqlite/go-sqlite3 v1.42.0 h1:xfOaauBRqJyww/6g2z910/p3gyw/vjb2GgQYKfrZSrU= +github.com/rqlite/go-sqlite3 v1.42.0/go.mod h1:R9H7CatgYBt3c+fSV/5yo2vLh4ZjCB0aMHdkv69fP4A= github.com/rqlite/gorqlite v0.0.0-20250609141355-ac86a4a1c9a8 h1:BoxiqWvhprOB2isgM59s8wkgKwAoyQH66Twfmof41oE= github.com/rqlite/gorqlite v0.0.0-20250609141355-ac86a4a1c9a8/go.mod h1:xF/KoXmrRyahPfo5L7Szb5cAAUl53dMWBh9cMruGEZg= github.com/rqlite/raft-boltdb/v2 v2.0.0-20230523104317-c08e70f4de48 h1:NZ62M+kT0JqhyFUMc8I4SMmfmD4NGJxhb2ePJQXjryc= github.com/rqlite/raft-boltdb/v2 v2.0.0-20230523104317-c08e70f4de48/go.mod h1:CRnsxgy5G8fAf5J+AM0yrsSdxXHKkIYOaq2sm+Q4DYc= github.com/rqlite/rqlite-disco-clients v0.0.0-20250205044118-8ada2b350099 h1:5cqkVLdl6sGJSY3kiF2dqaA3bD+8OS5FUdZqO0BxXLU= github.com/rqlite/rqlite-disco-clients v0.0.0-20250205044118-8ada2b350099/go.mod h1:6SVI8KegsW9Fyu2UQ+uvw0JI5CAILRYRyiQ/OFSJPrs= -github.com/rqlite/rqlite/v8 v8.39.1 h1:caR74AzX31Ov48RTu2/v0mqeNfxcqXvwdKkS2sSP244= -github.com/rqlite/rqlite/v8 v8.39.1/go.mod h1:ER5XWl9FcPXrnYUYEn+QJWWXm3zBt1ElrEDk2TVfTD8= +github.com/rqlite/rqlite/v9 v9.3.0 h1:JUMlEr7aCntDTkWLANO8IYNrtj8qB2K8JbI//ZFvWNI= +github.com/rqlite/rqlite/v9 v9.3.0/go.mod h1:f11xLaz0KlOXbURbx2WMh6IkLc/ePIlUbrHUsDDOvaU= github.com/rqlite/sql v0.0.0-20250623131620-453fa49cad04 h1:bjr7gZERAJhYhqkLHXbkBSpjbB+PlgW6e9CRCJ2+J/w= github.com/rqlite/sql v0.0.0-20250623131620-453fa49cad04/go.mod h1:ib9zVtNgRKiGuoMyUqqL5aNpk+r+++YlyiVIkclVqPg= github.com/sethvargo/go-retry v0.3.0 h1:EEt31A35QhrcRZtrYFDTBg91cqZVnFL2navjDrah2SE= @@ -269,8 +307,8 @@ github.com/txix-open/go-cmp v0.0.0-20240401171944-16b203530f60 h1:7SZ72lNU69g8ei github.com/txix-open/go-cmp v0.0.0-20240401171944-16b203530f60/go.mod h1:jzpq0uwcdGq0OSNXZ6vv6UJkCOU/fLPgeoz+KkGDYgo= github.com/txix-open/grmq v1.9.0 h1:ArDbJJcFX9zXKEcPf49rp9nYiRyGMJxGKJAxdbSsfaM= github.com/txix-open/grmq v1.9.0/go.mod h1:EyFOP17KrwEFOUjR+PH8iH3LCtiN9TSQ8t0ysyk62po= -github.com/txix-open/isp-kit v1.58.0 h1:xV9awM6pJiGYW/1pUmtGQ3y2Sb7ISo5OVXXE5k/Q7FY= -github.com/txix-open/isp-kit v1.58.0/go.mod h1:Mbprn7ExedjRg4yUPa9xShYx1oMJIU+a19x6ksVubaw= +github.com/txix-open/isp-kit v1.63.2 h1:TNk5JNNfrMXc964abLX4XYK4ofESI/4MofO1h7T5NLk= +github.com/txix-open/isp-kit v1.63.2/go.mod h1:rwqKqB3PyZxaoep6iH1PKL89LS9nzRklA6+S4II72M4= github.com/txix-open/jsonschema v1.3.0 h1:XGuOTg22G7PdqfKypjajM20/i5FyGfFYsJKmheebKi4= github.com/txix-open/jsonschema v1.3.0/go.mod h1:l8YDZ1nvJrw6uxWowSVOxCV/ebiMJyapffW87ZEqH00= github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb h1:UJgT4u/QMv5QHKOQeJ7igShHa36c2/vIRqJiRLdDlf0= @@ -286,8 +324,8 @@ github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17 github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= -go.etcd.io/bbolt v1.4.2 h1:IrUHp260R8c+zYx/Tm8QZr04CX+qWS5PGfPdevhdm1I= -go.etcd.io/bbolt v1.4.2/go.mod h1:Is8rSHO/b4f3XigBC0lL0+4FwAQv3HXEEIgFMuKHceM= +go.etcd.io/bbolt v1.4.3 h1:dEadXpI6G79deX5prL3QRNP6JB8UxVkqo4UPnHaNXJo= +go.etcd.io/bbolt v1.4.3/go.mod h1:tKQlpPaYCVFctUIgFKFnAlvbmB3tpy1vkTnDWohtc0E= go.opentelemetry.io/auto/sdk v1.2.0 h1:YpRtUFjvhSymycLS2T81lT6IGhcUP+LUPtv0iv1N8bM= go.opentelemetry.io/auto/sdk v1.2.0/go.mod h1:1deq2zL7rwjwC8mR7XgY2N+tlIl6pjmEUoLDENMEzwk= go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.63.0 h1:2pn7OzMewmYRiNtv1doZnLo3gONcnMHlFnmOR8Vgt+8= @@ -322,10 +360,10 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.42.0 h1:chiH31gIWm57EkTXpwnqf8qeuMUi0yekh6mT2AvFlqI= -golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8= -golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b h1:M2rDM6z3Fhozi9O7NWsxAkg/yqS/lQJ6PmkyIV3YP+o= -golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b/go.mod h1:3//PLf8L/X+8b4vuAfHzxeRUl04Adcb341+IGKfnqS8= +golang.org/x/crypto v0.44.0 h1:A97SsFvM3AIwEEmTBiaxPPTYpDC47w720rdiiUvgoAU= +golang.org/x/crypto v0.44.0/go.mod h1:013i+Nw79BMiQiMsOPcVCB5ZIJbYkerPrGnOa00tvmc= +golang.org/x/exp v0.0.0-20251017212417-90e834f514db h1:by6IehL4BH5k3e3SJmcoNbOobMey2SLpAF79iPOEBvw= +golang.org/x/exp v0.0.0-20251017212417-90e834f514db/go.mod h1:j/pmGrbnkbPtQfxEe5D0VQhZC6qKbfKifgD0oM7sR70= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -337,8 +375,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I= -golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY= +golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= +golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -371,8 +409,8 @@ golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k= -golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc= +golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.8 h1:nAL+RVCQ9uMn3vJZbV+MRnydTJFPf8qqY42YiA6MrqY= @@ -385,12 +423,12 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto/googleapis/api v0.0.0-20250908214217-97024824d090 h1:d8Nakh1G+ur7+P3GcMjpRDEkoLUcLW2iU92XVqR+XMQ= -google.golang.org/genproto/googleapis/api v0.0.0-20250908214217-97024824d090/go.mod h1:U8EXRNSd8sUYyDfs/It7KVWodQr+Hf9xtxyxWudSwEw= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250908214217-97024824d090 h1:/OQuEa4YWtDt7uQWHd3q3sUMb+QOLQUg1xa8CEsRv5w= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250908214217-97024824d090/go.mod h1:GmFNa4BdJZ2a8G+wCe9Bg3wwThLrJun751XstdJt5Og= -google.golang.org/grpc v1.75.1 h1:/ODCNEuf9VghjgO3rqLcfg8fiOP0nSluljWFlDxELLI= -google.golang.org/grpc v1.75.1/go.mod h1:JtPAzKiq4v1xcAB2hydNlWI2RnF85XXcV0mhKXr2ecQ= +google.golang.org/genproto/googleapis/api v0.0.0-20251020155222-88f65dc88635 h1:1wvBeYv+A2zfEbxROscJl69OP0m74S8wGEO+Syat26o= +google.golang.org/genproto/googleapis/api v0.0.0-20251020155222-88f65dc88635/go.mod h1:fDMmzKV90WSg1NbozdqrE64fkuTv6mlq2zxo9ad+3yo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251020155222-88f65dc88635 h1:3uycTxukehWrxH4HtPRtn1PDABTU331ViDjyqrUbaog= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251020155222-88f65dc88635/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= +google.golang.org/grpc v1.76.0 h1:UnVkv1+uMLYXoIz6o7chp59WfQUYA2ex/BXQ9rHZu7A= +google.golang.org/grpc v1.76.0/go.mod h1:Ju12QI8M6iQJtbcsV+awF5a4hfJMLi4X0JLo94ULZ6c= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -398,8 +436,8 @@ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miE google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw= -google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= +google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE= +google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From 2caed6b3f07ac29fb0b2cc54d9284ebf677e585e Mon Sep 17 00:00:00 2001 From: likhachevam Date: Thu, 20 Nov 2025 11:04:02 +0300 Subject: [PATCH 02/13] MSP-6703 up rqlite & add backups --- conf/config.yml | 12 + service/rqlite/config_flags.go | 486 ++++++++++++++++++++++ service/rqlite/credentials.go | 2 +- service/rqlite/flags.go | 459 -------------------- service/rqlite/goose_store/store.go | 15 +- service/rqlite/internal/rarchive/gzip.go | 65 +++ service/rqlite/internal/rarchive/targz.go | 137 ++++++ service/rqlite/internal/rarchive/zip.go | 113 +++++ service/rqlite/internal/rtls/certs.go | 196 +++++++++ service/rqlite/internal/rtls/config.go | 139 +++++++ service/rqlite/internal/rtls/reloader.go | 110 +++++ service/rqlite/main.go | 83 ++-- service/rqlite/runner.go | 4 +- service/startup/service.go | 19 +- 14 files changed, 1337 insertions(+), 503 deletions(-) create mode 100644 service/rqlite/config_flags.go create mode 100644 service/rqlite/internal/rarchive/gzip.go create mode 100644 service/rqlite/internal/rarchive/targz.go create mode 100644 service/rqlite/internal/rarchive/zip.go create mode 100644 service/rqlite/internal/rtls/certs.go create mode 100644 service/rqlite/internal/rtls/config.go create mode 100644 service/rqlite/internal/rtls/reloader.go diff --git a/conf/config.yml b/conf/config.yml index 5fca87d..1a9f8f8 100644 --- a/conf/config.yml +++ b/conf/config.yml @@ -37,5 +37,17 @@ rqlite: AutoVacInterval: 12h JoinAs: default +backup: + Enabled: true + Num: 10 + Version: 1 + Type: "file" + Interval: "2m" + ClearIntervalDays: 7 + Timestamp: true + Sub: + Dir: "app/data/backups/rqlite" + Name: "backup.sqlite.gz" + metricsAutodiscovery: enable: true \ No newline at end of file diff --git a/service/rqlite/config_flags.go b/service/rqlite/config_flags.go new file mode 100644 index 0000000..ffb602e --- /dev/null +++ b/service/rqlite/config_flags.go @@ -0,0 +1,486 @@ +// nolint +package rqlite + +import ( + "bytes" + "fmt" + "io" + "net" + "os" + "path/filepath" + "reflect" + "strconv" + "strings" + "time" + + "github.com/pkg/errors" +) + +// Config represents the configuration as set by command-line flags. +// All variables will be set, unless explicit noted. +type Config struct { + // DataPath is path to node data. Always set. + DataPath string + + // ExtensionPaths is a comma-delimited list of path to SQLite extensions to be loaded. + // Each element may be a directory path, zipfile, or tar.gz file. May not be set. + ExtensionPaths StringSliceValue + + // HTTPAddr is the bind network address for the HTTP Server. + // It never includes a trailing HTTP or HTTPS. + HTTPAddr string + + // HTTPAdv is the advertised HTTP server network. + HTTPAdv string + + // HTTPAllowOrigin is the value to set for Access-Control-Allow-Origin HTTP header. + HTTPAllowOrigin string + + // AuthFile is the path to the authentication file. May not be set. + AuthFile string `filepath:"true"` + + // AutoBackupFile is the path to the auto-backup file. May not be set. + AutoBackupFile string `filepath:"true"` + + // AutoRestoreFile is the path to the auto-restore file. May not be set. + AutoRestoreFile string `filepath:"true"` + + // HTTPx509CACert is the path to the CA certificate file for when this node verifies + // other certificates for any HTTP communications. May not be set. + HTTPx509CACert string `filepath:"true"` + + // HTTPx509Cert is the path to the X509 cert for the HTTP server. May not be set. + HTTPx509Cert string `filepath:"true"` + + // HTTPx509Key is the path to the private key for the HTTP server. May not be set. + HTTPx509Key string `filepath:"true"` + + // HTTPVerifyClient indicates whether the HTTP server should verify client certificates. + HTTPVerifyClient bool + + // NodeX509CACert is the path to the CA certificate file for when this node verifies + // other certificates for any inter-node communications. May not be set. + NodeX509CACert string `filepath:"true"` + + // NodeX509Cert is the path to the X509 cert for the Raft server. May not be set. + NodeX509Cert string `filepath:"true"` + + // NodeX509Key is the path to the X509 key for the Raft server. May not be set. + NodeX509Key string `filepath:"true"` + + // NoNodeVerify disables checking other nodes' Node X509 certs for validity. + NoNodeVerify bool + + // NodeVerifyClient enable mutual TLS for node-to-node communication. + NodeVerifyClient bool + + // NodeVerifyServerName is the hostname to verify on the certificates returned by nodes. + // If NoNodeVerify is true this field is ignored. + NodeVerifyServerName string + + // NodeID is the Raft ID for the node. + NodeID string + + // RaftAddr is the bind network address for the Raft server. + RaftAddr string + + // RaftAdv is the advertised Raft server address. + RaftAdv string + + // JoinAddrs is the list of Raft addresses to use for a join attempt. + JoinAddrs string + + // JoinAttempts is the number of times a node should attempt to join using a + // given address. + JoinAttempts int + + // JoinInterval is the time between retrying failed join operations. + JoinInterval time.Duration + + // JoinAs sets the user join attempts should be performed as. May not be set. + JoinAs string + + // BootstrapExpect is the minimum number of nodes required for a bootstrap. + BootstrapExpect int + + // BootstrapExpectTimeout is the maximum time a bootstrap operation can take. + BootstrapExpectTimeout time.Duration + + // DiscoMode sets the discovery mode. May not be set. + DiscoMode string + + // DiscoKey sets the discovery prefix key. + DiscoKey string + + // DiscoConfig sets the path to any discovery configuration file. May not be set. + DiscoConfig string + + // OnDiskPath sets the path to the SQLite file. May not be set. + OnDiskPath string + + // FKConstraints enables SQLite foreign key constraints. + FKConstraints bool + + // AutoVacInterval sets the automatic VACUUM interval. Use 0s to disable. + AutoVacInterval time.Duration + + // AutoOptimizeInterval sets the automatic optimization interval. Use 0s to disable. + AutoOptimizeInterval time.Duration + + // RaftLogLevel sets the minimum logging level for the Raft subsystem. + RaftLogLevel string + + // RaftNonVoter controls whether this node is a voting, read-only node. + RaftNonVoter bool + + // RaftSnapThreshold is the number of outstanding log entries that trigger snapshot. + RaftSnapThreshold uint64 + + // RaftSnapThreshold is the size of a SQLite WAL file which will trigger a snapshot. + RaftSnapThresholdWALSize uint64 + + // RaftSnapInterval sets the threshold check interval. + RaftSnapInterval time.Duration + + // RaftLeaderLeaseTimeout sets the leader lease timeout. + RaftLeaderLeaseTimeout time.Duration + + // RaftHeartbeatTimeout specifies the time in follower state without contact + // from a Leader before the node attempts an election. + RaftHeartbeatTimeout time.Duration + + // RaftElectionTimeout specifies the time in candidate state without contact + // from a Leader before the node attempts an election. + RaftElectionTimeout time.Duration + + // RaftApplyTimeout sets the Log-apply timeout. + RaftApplyTimeout time.Duration + + // RaftShutdownOnRemove sets whether Raft should be shutdown if the node is removed + RaftShutdownOnRemove bool + + // RaftClusterRemoveOnShutdown sets whether the node should remove itself from the cluster on shutdown + RaftClusterRemoveOnShutdown bool + + // RaftStepdownOnShutdown sets whether Leadership should be relinquished on shutdown + RaftStepdownOnShutdown bool + + // RaftReapNodeTimeout sets the duration after which a non-reachable voting node is + // reaped i.e. removed from the cluster. + RaftReapNodeTimeout time.Duration + + // RaftReapReadOnlyNodeTimeout sets the duration after which a non-reachable non-voting node is + // reaped i.e. removed from the cluster. + RaftReapReadOnlyNodeTimeout time.Duration + + // ClusterConnectTimeout sets the timeout when initially connecting to another node in + // the cluster, for non-Raft communications. + ClusterConnectTimeout time.Duration + + // WriteQueueCap is the default capacity of Execute queues + WriteQueueCap int + + // WriteQueueBatchSz is the default batch size for Execute queues + WriteQueueBatchSz int + + // WriteQueueTimeout is the default time after which any data will be sent on + // Execute queues, if a batch size has not been reached. + WriteQueueTimeout time.Duration + + // WriteQueueTx controls whether writes from the queue are done within a transaction. + WriteQueueTx bool + + // CPUProfile enables CPU profiling. + CPUProfile string + + // MemProfile enables memory profiling. + MemProfile string + + // TraceProfile enables trace profiling. + TraceProfile string +} + +type Backup struct { + Enabled bool + Amount int + Version int + Type string + Interval string + ClearIntervalDays int + Timestamp bool + Vacuum bool + Sub Sub +} + +type Sub struct { + Dir string + Name string +} + +// Validate checks the configuration for internal consistency, and activates +// important rqlite policies. It must be called at least once on a Config +// object before the Config object is used. It is OK to call more than +// once. +func (c *Config) Validate() error { + dataPath, err := filepath.Abs(c.DataPath) + if err != nil { + return errors.Errorf("failed to determine absolute data path: %s", err.Error()) + } + c.DataPath = dataPath + + err = c.CheckFilePaths() + if err != nil { + return err + } + + err = c.CheckDirPaths() + if err != nil { + return err + } + + if len(c.ExtensionPaths) > 0 { + for _, p := range c.ExtensionPaths { + if !fileExists(p) { + return errors.Errorf("extension path does not exist: %s", p) + } + } + } + + if !bothUnsetSet(c.HTTPx509Cert, c.HTTPx509Key) { + return errors.Errorf("either both -%s and -%s must be set, or neither", HTTPx509CertFlag, HTTPx509KeyFlag) + } + if !bothUnsetSet(c.NodeX509Cert, c.NodeX509Key) { + return errors.Errorf("either both -%s and -%s must be set, or neither", NodeX509CertFlag, NodeX509KeyFlag) + + } + + if c.RaftAddr == c.HTTPAddr { + return errors.New("HTTP and Raft addresses must differ") + } + + // Enforce policies regarding addresses + if c.RaftAdv == "" { + c.RaftAdv = c.RaftAddr + } + if c.HTTPAdv == "" { + c.HTTPAdv = c.HTTPAddr + } + + // Node ID policy + if c.NodeID == "" { + c.NodeID = c.RaftAdv + } + + // Perform some address validity checks. + if strings.HasPrefix(strings.ToLower(c.HTTPAddr), "http") || + strings.HasPrefix(strings.ToLower(c.HTTPAdv), "http") { + return errors.New("HTTP options should not include protocol (http:// or https://)") + } + if _, _, err := net.SplitHostPort(c.HTTPAddr); err != nil { + return errors.New("HTTP bind address not valid") + } + + hadv, _, err := net.SplitHostPort(c.HTTPAdv) + if err != nil { + return errors.New("HTTP advertised HTTP address not valid") + } + if addr := net.ParseIP(hadv); addr != nil && addr.IsUnspecified() { + return errors.Errorf("advertised HTTP address is not routable (%s), specify it via -%s or -%s", + hadv, HTTPAddrFlag, HTTPAdvAddrFlag) + } + + if _, rp, err := net.SplitHostPort(c.RaftAddr); err != nil { + return errors.New("raft bind address not valid") + } else if _, err := strconv.Atoi(rp); err != nil { + return errors.New("raft bind port not valid") + } + + radv, rp, err := net.SplitHostPort(c.RaftAdv) + if err != nil { + return errors.New("raft advertised address not valid") + } + if addr := net.ParseIP(radv); addr != nil && addr.IsUnspecified() { + return errors.Errorf("advertised Raft address is not routable (%s), specify it via -%s or -%s", + radv, RaftAddrFlag, RaftAdvAddrFlag) + } + if _, err := strconv.Atoi(rp); err != nil { + return errors.New("raft advertised port is not valid") + } + + if c.RaftAdv == c.HTTPAdv { + return errors.New("advertised HTTP and Raft addresses must differ") + } + + // Enforce bootstrapping policies + if c.BootstrapExpect > 0 && c.RaftNonVoter { + return errors.New("bootstrapping only applicable to voting nodes") + } + + // Join parameters OK? + if c.JoinAddrs != "" { + addrs := strings.Split(c.JoinAddrs, ",") + for i := range addrs { + if _, _, err := net.SplitHostPort(addrs[i]); err != nil { + return errors.Errorf("%s is an invalid join address", addrs[i]) + } + + if c.BootstrapExpect == 0 { + if addrs[i] == c.RaftAdv || addrs[i] == c.RaftAddr { + return errors.New("node cannot join with itself unless bootstrapping") + } + if c.AutoRestoreFile != "" { + return errors.New("auto-restoring cannot be used when joining a cluster") + } + } + } + + if c.DiscoMode != "" { + return errors.New("disco mode cannot be used when also explicitly joining a cluster") + } + } + + // Valid disco mode? + switch c.DiscoMode { + case "": + case DiscoModeEtcdKV, DiscoModeConsulKV: + if c.BootstrapExpect > 0 { + return errors.Errorf("bootstrapping not applicable when using %s", c.DiscoMode) + } + case DiscoModeDNS, DiscoModeDNSSRV: + if c.BootstrapExpect == 0 && !c.RaftNonVoter { + return errors.Errorf("bootstrap-expect value required when using %s with a voting node", c.DiscoMode) + } + default: + return errors.Errorf("disco mode must be one of %s, %s, %s, or %s", + DiscoModeConsulKV, DiscoModeEtcdKV, DiscoModeDNS, DiscoModeDNSSRV) + } + + return nil +} + +// JoinAddresses returns the join addresses set at the command line. Returns nil +// if no join addresses were set. +func (c *Config) JoinAddresses() []string { + if c.JoinAddrs == "" { + return nil + } + return strings.Split(c.JoinAddrs, ",") +} + +// HTTPURL returns the fully-formed, advertised HTTP API address for this config, including +// protocol, host and port. +func (c *Config) HTTPURL() string { + apiProto := "http" + if c.HTTPx509Cert != "" { + apiProto = "https" + } + return fmt.Sprintf("%s://%s", apiProto, c.HTTPAdv) +} + +// RaftPort returns the port on which the Raft system is listening. Validate must +// have been called before calling this method. +func (c *Config) RaftPort() int { + _, port, err := net.SplitHostPort(c.RaftAddr) + if err != nil { + panic("RaftAddr not valid") + } + p, err := strconv.Atoi(port) + if err != nil { + panic("RaftAddr port not valid") + } + return p +} + +// DiscoConfigReader returns a ReadCloser providing access to the Disco config. +// The caller must call close on the ReadCloser when finished with it. If no +// config was supplied, it returns nil. +func (c *Config) DiscoConfigReader() io.ReadCloser { + var rc io.ReadCloser + if c.DiscoConfig == "" { + return nil + } + + // Open config file. If opening fails, assume string is the literal config. + cfgFile, err := os.Open(c.DiscoConfig) + if err != nil { + rc = io.NopCloser(bytes.NewReader([]byte(c.DiscoConfig))) + } else { + rc = cfgFile + } + return rc +} + +// CheckFilePaths checks that all file paths in the config exist. +// Empty filepaths are ignored. +func (c *Config) CheckFilePaths() error { + v := reflect.ValueOf(c).Elem() + + // Iterate through the fields of the struct + for i := 0; i < v.NumField(); i++ { + field := v.Type().Field(i) + fieldValue := v.Field(i) + + if fieldValue.Kind() != reflect.String { + continue + } + + if tagValue, ok := field.Tag.Lookup("filepath"); ok && tagValue == "true" { + filePath := fieldValue.String() + if filePath == "" { + continue + } + if !fileExists(filePath) { + return errors.Errorf("%s does not exist", filePath) + } + } + } + return nil +} + +// CheckDirPaths checks that all directory paths in the config exist and are directories. +// Empty directory paths are ignored. +func (c *Config) CheckDirPaths() error { + v := reflect.ValueOf(c).Elem() + + // Iterate through the fields of the struct + for i := 0; i < v.NumField(); i++ { + field := v.Type().Field(i) + fieldValue := v.Field(i) + + if fieldValue.Kind() != reflect.String { + continue + } + + if tagValue, ok := field.Tag.Lookup("dirpath"); ok && tagValue == "true" { + dirPath := fieldValue.String() + if dirPath == "" { + continue + } + if !fileExists(dirPath) { + return errors.Errorf("%s does not exist", dirPath) + } + if !isDir(dirPath) { + return errors.Errorf("%s is not a directory", dirPath) + } + } + } + return nil +} + +// bothUnsetSet returns true if both a and b are unset, or both are set. +func bothUnsetSet(a, b string) bool { + return (a == "" && b == "") || (a != "" && b != "") +} + +func fileExists(path string) bool { + _, err := os.Stat(path) + return err == nil +} + +func isDir(path string) bool { + fi, err := os.Stat(path) + if err != nil { + return false + } + return fi.IsDir() +} diff --git a/service/rqlite/credentials.go b/service/rqlite/credentials.go index ccef6a9..729f845 100644 --- a/service/rqlite/credentials.go +++ b/service/rqlite/credentials.go @@ -4,7 +4,7 @@ import ( "bytes" "github.com/pkg/errors" - "github.com/rqlite/rqlite/v8/auth" + "github.com/rqlite/rqlite/v9/auth" "github.com/txix-open/isp-kit/json" ) diff --git a/service/rqlite/flags.go b/service/rqlite/flags.go index 425accf..1b01650 100644 --- a/service/rqlite/flags.go +++ b/service/rqlite/flags.go @@ -2,17 +2,10 @@ package rqlite import ( - "bytes" - "errors" "flag" "fmt" - "io" - "net" "os" - "path/filepath" - "reflect" "runtime" - "strconv" "strings" "time" ) @@ -56,440 +49,6 @@ func (s *StringSliceValue) Set(value string) error { return nil } -// Config represents the configuration as set by command-line flags. -// All variables will be set, unless explicit noted. -type Config struct { - // DataPath is path to node data. Always set. - DataPath string - - // ExtensionPaths is a comma-delimited list of path to SQLite extensions to be loaded. - // Each element may be a directory path, zipfile, or tar.gz file. May not be set. - ExtensionPaths StringSliceValue - - // HTTPAddr is the bind network address for the HTTP Server. - // It never includes a trailing HTTP or HTTPS. - HTTPAddr string - - // HTTPAdv is the advertised HTTP server network. - HTTPAdv string - - // HTTPAllowOrigin is the value to set for Access-Control-Allow-Origin HTTP header. - HTTPAllowOrigin string - - // AuthFile is the path to the authentication file. May not be set. - AuthFile string `filepath:"true"` - - // AutoBackupFile is the path to the auto-backup file. May not be set. - AutoBackupFile string `filepath:"true"` - - // AutoRestoreFile is the path to the auto-restore file. May not be set. - AutoRestoreFile string `filepath:"true"` - - // HTTPx509CACert is the path to the CA certificate file for when this node verifies - // other certificates for any HTTP communications. May not be set. - HTTPx509CACert string `filepath:"true"` - - // HTTPx509Cert is the path to the X509 cert for the HTTP server. May not be set. - HTTPx509Cert string `filepath:"true"` - - // HTTPx509Key is the path to the private key for the HTTP server. May not be set. - HTTPx509Key string `filepath:"true"` - - // HTTPVerifyClient indicates whether the HTTP server should verify client certificates. - HTTPVerifyClient bool - - // NodeX509CACert is the path to the CA certificate file for when this node verifies - // other certificates for any inter-node communications. May not be set. - NodeX509CACert string `filepath:"true"` - - // NodeX509Cert is the path to the X509 cert for the Raft server. May not be set. - NodeX509Cert string `filepath:"true"` - - // NodeX509Key is the path to the X509 key for the Raft server. May not be set. - NodeX509Key string `filepath:"true"` - - // NoNodeVerify disables checking other nodes' Node X509 certs for validity. - NoNodeVerify bool - - // NodeVerifyClient enable mutual TLS for node-to-node communication. - NodeVerifyClient bool - - // NodeVerifyServerName is the hostname to verify on the certificates returned by nodes. - // If NoNodeVerify is true this field is ignored. - NodeVerifyServerName string - - // NodeID is the Raft ID for the node. - NodeID string - - // RaftAddr is the bind network address for the Raft server. - RaftAddr string - - // RaftAdv is the advertised Raft server address. - RaftAdv string - - // JoinAddrs is the list of Raft addresses to use for a join attempt. - JoinAddrs string - - // JoinAttempts is the number of times a node should attempt to join using a - // given address. - JoinAttempts int - - // JoinInterval is the time between retrying failed join operations. - JoinInterval time.Duration - - // JoinAs sets the user join attempts should be performed as. May not be set. - JoinAs string - - // BootstrapExpect is the minimum number of nodes required for a bootstrap. - BootstrapExpect int - - // BootstrapExpectTimeout is the maximum time a bootstrap operation can take. - BootstrapExpectTimeout time.Duration - - // DiscoMode sets the discovery mode. May not be set. - DiscoMode string - - // DiscoKey sets the discovery prefix key. - DiscoKey string - - // DiscoConfig sets the path to any discovery configuration file. May not be set. - DiscoConfig string - - // OnDiskPath sets the path to the SQLite file. May not be set. - OnDiskPath string - - // FKConstraints enables SQLite foreign key constraints. - FKConstraints bool - - // AutoVacInterval sets the automatic VACUUM interval. Use 0s to disable. - AutoVacInterval time.Duration - - // AutoOptimizeInterval sets the automatic optimization interval. Use 0s to disable. - AutoOptimizeInterval time.Duration - - // RaftLogLevel sets the minimum logging level for the Raft subsystem. - RaftLogLevel string - - // RaftNonVoter controls whether this node is a voting, read-only node. - RaftNonVoter bool - - // RaftSnapThreshold is the number of outstanding log entries that trigger snapshot. - RaftSnapThreshold uint64 - - // RaftSnapThreshold is the size of a SQLite WAL file which will trigger a snapshot. - RaftSnapThresholdWALSize uint64 - - // RaftSnapInterval sets the threshold check interval. - RaftSnapInterval time.Duration - - // RaftLeaderLeaseTimeout sets the leader lease timeout. - RaftLeaderLeaseTimeout time.Duration - - // RaftHeartbeatTimeout specifies the time in follower state without contact - // from a Leader before the node attempts an election. - RaftHeartbeatTimeout time.Duration - - // RaftElectionTimeout specifies the time in candidate state without contact - // from a Leader before the node attempts an election. - RaftElectionTimeout time.Duration - - // RaftApplyTimeout sets the Log-apply timeout. - RaftApplyTimeout time.Duration - - // RaftShutdownOnRemove sets whether Raft should be shutdown if the node is removed - RaftShutdownOnRemove bool - - // RaftClusterRemoveOnShutdown sets whether the node should remove itself from the cluster on shutdown - RaftClusterRemoveOnShutdown bool - - // RaftStepdownOnShutdown sets whether Leadership should be relinquished on shutdown - RaftStepdownOnShutdown bool - - // RaftReapNodeTimeout sets the duration after which a non-reachable voting node is - // reaped i.e. removed from the cluster. - RaftReapNodeTimeout time.Duration - - // RaftReapReadOnlyNodeTimeout sets the duration after which a non-reachable non-voting node is - // reaped i.e. removed from the cluster. - RaftReapReadOnlyNodeTimeout time.Duration - - // ClusterConnectTimeout sets the timeout when initially connecting to another node in - // the cluster, for non-Raft communications. - ClusterConnectTimeout time.Duration - - // WriteQueueCap is the default capacity of Execute queues - WriteQueueCap int - - // WriteQueueBatchSz is the default batch size for Execute queues - WriteQueueBatchSz int - - // WriteQueueTimeout is the default time after which any data will be sent on - // Execute queues, if a batch size has not been reached. - WriteQueueTimeout time.Duration - - // WriteQueueTx controls whether writes from the queue are done within a transaction. - WriteQueueTx bool - - // CPUProfile enables CPU profiling. - CPUProfile string - - // MemProfile enables memory profiling. - MemProfile string - - // TraceProfile enables trace profiling. - TraceProfile string -} - -// Validate checks the configuration for internal consistency, and activates -// important rqlite policies. It must be called at least once on a Config -// object before the Config object is used. It is OK to call more than -// once. -func (c *Config) Validate() error { - dataPath, err := filepath.Abs(c.DataPath) - if err != nil { - return fmt.Errorf("failed to determine absolute data path: %s", err.Error()) - } - c.DataPath = dataPath - - err = c.CheckFilePaths() - if err != nil { - return err - } - - err = c.CheckDirPaths() - if err != nil { - return err - } - - if len(c.ExtensionPaths) > 0 { - for _, p := range c.ExtensionPaths { - if !fileExists(p) { - return fmt.Errorf("extension path does not exist: %s", p) - } - } - } - - if !bothUnsetSet(c.HTTPx509Cert, c.HTTPx509Key) { - return fmt.Errorf("either both -%s and -%s must be set, or neither", HTTPx509CertFlag, HTTPx509KeyFlag) - } - if !bothUnsetSet(c.NodeX509Cert, c.NodeX509Key) { - return fmt.Errorf("either both -%s and -%s must be set, or neither", NodeX509CertFlag, NodeX509KeyFlag) - - } - - if c.RaftAddr == c.HTTPAddr { - return errors.New("HTTP and Raft addresses must differ") - } - - // Enforce policies regarding addresses - if c.RaftAdv == "" { - c.RaftAdv = c.RaftAddr - } - if c.HTTPAdv == "" { - c.HTTPAdv = c.HTTPAddr - } - - // Node ID policy - if c.NodeID == "" { - c.NodeID = c.RaftAdv - } - - // Perform some address validity checks. - if strings.HasPrefix(strings.ToLower(c.HTTPAddr), "http") || - strings.HasPrefix(strings.ToLower(c.HTTPAdv), "http") { - return errors.New("HTTP options should not include protocol (http:// or https://)") - } - if _, _, err := net.SplitHostPort(c.HTTPAddr); err != nil { - return errors.New("HTTP bind address not valid") - } - - hadv, _, err := net.SplitHostPort(c.HTTPAdv) - if err != nil { - return errors.New("HTTP advertised HTTP address not valid") - } - if addr := net.ParseIP(hadv); addr != nil && addr.IsUnspecified() { - return fmt.Errorf("advertised HTTP address is not routable (%s), specify it via -%s or -%s", - hadv, HTTPAddrFlag, HTTPAdvAddrFlag) - } - - if _, rp, err := net.SplitHostPort(c.RaftAddr); err != nil { - return errors.New("raft bind address not valid") - } else if _, err := strconv.Atoi(rp); err != nil { - return errors.New("raft bind port not valid") - } - - radv, rp, err := net.SplitHostPort(c.RaftAdv) - if err != nil { - return errors.New("raft advertised address not valid") - } - if addr := net.ParseIP(radv); addr != nil && addr.IsUnspecified() { - return fmt.Errorf("advertised Raft address is not routable (%s), specify it via -%s or -%s", - radv, RaftAddrFlag, RaftAdvAddrFlag) - } - if _, err := strconv.Atoi(rp); err != nil { - return errors.New("raft advertised port is not valid") - } - - if c.RaftAdv == c.HTTPAdv { - return errors.New("advertised HTTP and Raft addresses must differ") - } - - // Enforce bootstrapping policies - if c.BootstrapExpect > 0 && c.RaftNonVoter { - return errors.New("bootstrapping only applicable to voting nodes") - } - - // Join parameters OK? - if c.JoinAddrs != "" { - addrs := strings.Split(c.JoinAddrs, ",") - for i := range addrs { - if _, _, err := net.SplitHostPort(addrs[i]); err != nil { - return fmt.Errorf("%s is an invalid join address", addrs[i]) - } - - if c.BootstrapExpect == 0 { - if addrs[i] == c.RaftAdv || addrs[i] == c.RaftAddr { - return errors.New("node cannot join with itself unless bootstrapping") - } - if c.AutoRestoreFile != "" { - return errors.New("auto-restoring cannot be used when joining a cluster") - } - } - } - - if c.DiscoMode != "" { - return errors.New("disco mode cannot be used when also explicitly joining a cluster") - } - } - - // Valid disco mode? - switch c.DiscoMode { - case "": - case DiscoModeEtcdKV, DiscoModeConsulKV: - if c.BootstrapExpect > 0 { - return fmt.Errorf("bootstrapping not applicable when using %s", c.DiscoMode) - } - case DiscoModeDNS, DiscoModeDNSSRV: - if c.BootstrapExpect == 0 && !c.RaftNonVoter { - return fmt.Errorf("bootstrap-expect value required when using %s with a voting node", c.DiscoMode) - } - default: - return fmt.Errorf("disco mode must be one of %s, %s, %s, or %s", - DiscoModeConsulKV, DiscoModeEtcdKV, DiscoModeDNS, DiscoModeDNSSRV) - } - - return nil -} - -// JoinAddresses returns the join addresses set at the command line. Returns nil -// if no join addresses were set. -func (c *Config) JoinAddresses() []string { - if c.JoinAddrs == "" { - return nil - } - return strings.Split(c.JoinAddrs, ",") -} - -// HTTPURL returns the fully-formed, advertised HTTP API address for this config, including -// protocol, host and port. -func (c *Config) HTTPURL() string { - apiProto := "http" - if c.HTTPx509Cert != "" { - apiProto = "https" - } - return fmt.Sprintf("%s://%s", apiProto, c.HTTPAdv) -} - -// RaftPort returns the port on which the Raft system is listening. Validate must -// have been called before calling this method. -func (c *Config) RaftPort() int { - _, port, err := net.SplitHostPort(c.RaftAddr) - if err != nil { - panic("RaftAddr not valid") - } - p, err := strconv.Atoi(port) - if err != nil { - panic("RaftAddr port not valid") - } - return p -} - -// DiscoConfigReader returns a ReadCloser providing access to the Disco config. -// The caller must call close on the ReadCloser when finished with it. If no -// config was supplied, it returns nil. -func (c *Config) DiscoConfigReader() io.ReadCloser { - var rc io.ReadCloser - if c.DiscoConfig == "" { - return nil - } - - // Open config file. If opening fails, assume string is the literal config. - cfgFile, err := os.Open(c.DiscoConfig) - if err != nil { - rc = io.NopCloser(bytes.NewReader([]byte(c.DiscoConfig))) - } else { - rc = cfgFile - } - return rc -} - -// CheckFilePaths checks that all file paths in the config exist. -// Empty filepaths are ignored. -func (c *Config) CheckFilePaths() error { - v := reflect.ValueOf(c).Elem() - - // Iterate through the fields of the struct - for i := 0; i < v.NumField(); i++ { - field := v.Type().Field(i) - fieldValue := v.Field(i) - - if fieldValue.Kind() != reflect.String { - continue - } - - if tagValue, ok := field.Tag.Lookup("filepath"); ok && tagValue == "true" { - filePath := fieldValue.String() - if filePath == "" { - continue - } - if !fileExists(filePath) { - return fmt.Errorf("%s does not exist", filePath) - } - } - } - return nil -} - -// CheckDirPaths checks that all directory paths in the config exist and are directories. -// Empty directory paths are ignored. -func (c *Config) CheckDirPaths() error { - v := reflect.ValueOf(c).Elem() - - // Iterate through the fields of the struct - for i := 0; i < v.NumField(); i++ { - field := v.Type().Field(i) - fieldValue := v.Field(i) - - if fieldValue.Kind() != reflect.String { - continue - } - - if tagValue, ok := field.Tag.Lookup("dirpath"); ok && tagValue == "true" { - dirPath := fieldValue.String() - if dirPath == "" { - continue - } - if !fileExists(dirPath) { - return fmt.Errorf("%s does not exist", dirPath) - } - if !isDir(dirPath) { - return fmt.Errorf("%s is not a directory", dirPath) - } - } - } - return nil -} - // BuildInfo is build information for display at command line. type BuildInfo struct { Version string @@ -601,24 +160,6 @@ func errorExit(code int, msg string) { os.Exit(code) } -// bothUnsetSet returns true if both a and b are unset, or both are set. -func bothUnsetSet(a, b string) bool { - return (a == "" && b == "") || (a != "" && b != "") -} - -func fileExists(path string) bool { - _, err := os.Stat(path) - return err == nil -} - -func isDir(path string) bool { - fi, err := os.Stat(path) - if err != nil { - return false - } - return fi.IsDir() -} - func mustParseDuration(d string) time.Duration { td, err := time.ParseDuration(d) if err != nil { diff --git a/service/rqlite/goose_store/store.go b/service/rqlite/goose_store/store.go index fe24607..5095a9c 100644 --- a/service/rqlite/goose_store/store.go +++ b/service/rqlite/goose_store/store.go @@ -3,7 +3,6 @@ package goose_store import ( "context" "database/sql" - "fmt" "isp-config-service/repository" @@ -33,7 +32,7 @@ func (s Store) CreateVersionTable(ctx context.Context, db database.DBTxConn) err q := s.querier.CreateTable(s.tablename) _, err := s.db.ExecContext(ctx, q) if err != nil { - return fmt.Errorf("failed to create version table %q: %w", s.tablename, err) + return errors.WithMessagef(err, "failed to create version table %q", s.tablename) } return nil } @@ -42,7 +41,7 @@ func (s Store) Insert(ctx context.Context, db database.DBTxConn, req database.In q := s.querier.InsertVersion(s.tablename) _, err := s.db.ExecContext(ctx, q, req.Version, true) if err != nil { - return fmt.Errorf("failed to insert version %d: %w", req.Version, err) + return errors.WithMessagef(err, "failed to insert version %d", req.Version) } return nil } @@ -51,7 +50,7 @@ func (s Store) Delete(ctx context.Context, db database.DBTxConn, version int64) q := s.querier.DeleteVersion(s.tablename) _, err := s.db.ExecContext(ctx, q, version) if err != nil { - return fmt.Errorf("failed to delete version %d: %w", version, err) + return errors.WithMessagef(err, "failed to delete version %d", version) } return nil } @@ -63,10 +62,10 @@ func (s Store) GetMigration(ctx context.Context, db database.DBTxConn, version i isApplied := float64(0) err := s.db.QueryRowContext(ctx, q, version).Scan(&result.Timestamp, &isApplied) if errors.Is(err, sql.ErrNoRows) { - return nil, fmt.Errorf("%w: %d", database.ErrVersionNotFound, version) + return nil, errors.WithMessagef(database.ErrVersionNotFound, "%d", version) } if err != nil { - return nil, fmt.Errorf("failed to get migration %d: %w", version, err) + return nil, errors.WithMessagef(err, "failed to get migration %d", version) } result.IsApplied = isApplied == 0 return &result, nil @@ -80,7 +79,7 @@ func (s Store) ListMigrations(ctx context.Context, db database.DBTxConn) ([]*dat q := s.querier.ListMigrations(s.tablename) rows, err := s.db.QueryContext(ctx, q) if err != nil { - return nil, fmt.Errorf("failed to list migrations: %w", err) + return nil, errors.WithMessage(err, "failed to list migrations") } defer rows.Close() @@ -91,7 +90,7 @@ func (s Store) ListMigrations(ctx context.Context, db database.DBTxConn) ([]*dat version := float64(0) err = rows.Scan(&version, &isApplied) if err != nil { - return nil, fmt.Errorf("failed to scan list migrations result: %w", err) + return nil, errors.WithMessage(err, "failed to scan list migrations result") } result.IsApplied = isApplied == 0 result.Version = int64(version) diff --git a/service/rqlite/internal/rarchive/gzip.go b/service/rqlite/internal/rarchive/gzip.go new file mode 100644 index 0000000..b68bf4f --- /dev/null +++ b/service/rqlite/internal/rarchive/gzip.go @@ -0,0 +1,65 @@ +// nolint +package rarchive + +import ( + "compress/gzip" + "io" + "os" +) + +// Gzip compresses the given file and returns the path to the +// compressed file. It is the caller's responsibility to remove +// the compressed file when it is no longer needed. +func Gzip(file string) (string, error) { + f, err := os.Open(file) + if err != nil { + return "", err + } + defer f.Close() + + tmpFd, err := os.CreateTemp("", "gzip") + if err != nil { + return "", err + } + + gz := gzip.NewWriter(tmpFd) + _, err = io.Copy(gz, f) + if err != nil { + return "", err + } + + err = gz.Close() + if err != nil { + return "", err + } + return tmpFd.Name(), nil +} + +// Gunzip decompresses the given GZIP file and returns the +// path to the decompressed file. It is the caller's responsibility +// to remove the decompressed file when it is no longer needed. +func Gunzip(file string) (string, error) { + f, err := os.Open(file) + if err != nil { + return "", err + } + defer f.Close() + + gz, err := gzip.NewReader(f) + if err != nil { + return "", err + } + defer gz.Close() + + tmpFd, err := os.CreateTemp("", "gunzip") + if err != nil { + return "", err + } + defer tmpFd.Close() + + _, err = io.Copy(tmpFd, gz) + if err != nil { + return "", err + } + return tmpFd.Name(), nil +} diff --git a/service/rqlite/internal/rarchive/targz.go b/service/rqlite/internal/rarchive/targz.go new file mode 100644 index 0000000..a8b4ebf --- /dev/null +++ b/service/rqlite/internal/rarchive/targz.go @@ -0,0 +1,137 @@ +// nolint +package rarchive + +import ( + "archive/tar" + "compress/gzip" + "errors" + "io" + "os" + "path/filepath" + "strings" +) + +// IsTarGzipFile checks if the file at the given path is a gzipped tarball +// by attempting to open it as such. +func IsTarGzipFile(path string) bool { + f, err := os.Open(path) + if err != nil { + return false + } + defer f.Close() + + // Attempt to create a gzip reader + gzr, err := gzip.NewReader(f) + if err != nil { + return false + } + defer gzr.Close() + + return true +} + +// TarGzipHasSubdirectories checks if the gzipped tarball contains any entries that +// represent subdirectories or files within subdirectories. +func TarGzipHasSubdirectories(path string) (bool, error) { + // Open the tar.gz file + file, err := os.Open(path) + if err != nil { + return false, err + } + defer file.Close() + + gzr, err := gzip.NewReader(file) + if err != nil { + return false, err + } + defer gzr.Close() + + tr := tar.NewReader(gzr) + + // Iterate through each file in the tar archive + for { + header, err := tr.Next() + if err == io.EOF { + break // End of tar archive + } + if err != nil { + return false, err + } + + // Check if the file is a directory or if the file path includes a subdirectory + if header.Typeflag == tar.TypeDir || + strings.Contains(header.Name, "/") || strings.Contains(header.Name, "\\") { + return true, nil + } + } + return false, nil +} + +// UntarGzipToDir decompresses the gzipped tarball at the given path into the specified directory. +func UntarGzipToDir(path, dir string) error { + // Open the tar.gz file + file, err := os.Open(path) + if err != nil { + return err + } + defer file.Close() + + gzr, err := gzip.NewReader(file) + if err != nil { + return err + } + defer gzr.Close() + + tr := tar.NewReader(gzr) + + // Ensure the output directory exists + if err := os.MkdirAll(dir, 0755); err != nil { + return err + } + + // Iterate through each file in the tar archive + for { + header, err := tr.Next() + if err == io.EOF { + break // End of tar archive + } + if err != nil { + return err + } + + // Construct the full path for the file + fpath := filepath.Join(dir, header.Name) + + // Check for directory traversal vulnerability + if !strings.HasPrefix(fpath, filepath.Clean(dir)+string(os.PathSeparator)) { + return errors.New("invalid file path") + } + + if header.Typeflag == tar.TypeDir { + // Create the directory + if err := os.MkdirAll(fpath, os.FileMode(header.Mode)); err != nil { + return err + } + } else { + // Create the file + if err := os.MkdirAll(filepath.Dir(fpath), os.FileMode(header.Mode)); err != nil { + return err + } + + outFile, err := os.OpenFile(fpath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, os.FileMode(header.Mode)) + if err != nil { + return err + } + + // Copy the file content to the destination + if _, err := io.Copy(outFile, tr); err != nil { + outFile.Close() + return err + } + + outFile.Close() + } + } + + return nil +} diff --git a/service/rqlite/internal/rarchive/zip.go b/service/rqlite/internal/rarchive/zip.go new file mode 100644 index 0000000..51b613b --- /dev/null +++ b/service/rqlite/internal/rarchive/zip.go @@ -0,0 +1,113 @@ +// nolint +package rarchive + +import ( + "archive/zip" + "bytes" + "errors" + "io" + "os" + "path/filepath" + "strings" +) + +// IsZipFile checks if the file at the given path is a ZIP file +// by verifying the magic number (the first few bytes of the file). +func IsZipFile(path string) bool { + f, err := os.Open(path) + if err != nil { + return false + } + defer f.Close() + + // Read the first 4 bytes of the file to check the magic number + buf := make([]byte, 4) + _, err = f.Read(buf) + if err != nil { + return false + } + + // ZIP files start with "PK\x03\x04" + return bytes.Equal(buf, []byte("PK\x03\x04")) +} + +// ZipHasSubdirectories checks if the ZIP file contains any entries that +// represent subdirectories or files within subdirectories. +func ZipHasSubdirectories(path string) (bool, error) { + // Open the ZIP file + r, err := zip.OpenReader(path) + if err != nil { + return false, err + } + defer r.Close() + + // Iterate through each file in the ZIP archive + for _, f := range r.File { + if f.FileInfo().IsDir() || + len(f.Name) > 0 && (f.Name[len(f.Name)-1] == '/' || + len(f.Name) > 0 && f.Name != filepath.Base(f.Name)) { + return true, nil + } + } + return false, nil +} + +// UnzipToDir decompresses the ZIP file at the given path into the specified directory. +func UnzipToDir(path, dir string) error { + // Open the ZIP file + r, err := zip.OpenReader(path) + if err != nil { + return err + } + defer r.Close() + + // Ensure the output directory exists + if err := os.MkdirAll(dir, 0755); err != nil { + return err + } + + // Iterate through each file in the ZIP archive + for _, f := range r.File { + // Construct the full path for the file + fpath := filepath.Join(dir, f.Name) + + // Check for directory traversal vulnerability + if !strings.HasPrefix(fpath, filepath.Clean(dir)+string(os.PathSeparator)) { + return errors.New("invalid file path") + } + + if f.FileInfo().IsDir() { + // Create the directory + if err := os.MkdirAll(fpath, f.Mode()); err != nil { + return err + } + } else { + // Create the file + if err := os.MkdirAll(filepath.Dir(fpath), f.Mode()); err != nil { + return err + } + + outFile, err := os.OpenFile(fpath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, f.Mode()) + if err != nil { + return err + } + + rc, err := f.Open() + if err != nil { + return err + } + + _, err = io.Copy(outFile, rc) + + // Close the file handles + outFile.Close() + rc.Close() + + if err != nil { + return err + } + } + } + + return nil +} diff --git a/service/rqlite/internal/rtls/certs.go b/service/rqlite/internal/rtls/certs.go new file mode 100644 index 0000000..80bee43 --- /dev/null +++ b/service/rqlite/internal/rtls/certs.go @@ -0,0 +1,196 @@ +// nolint +package rtls + +import ( + "crypto/rand" + "crypto/rsa" + "crypto/x509" + "crypto/x509/pkix" + "encoding/pem" + "math/big" + "net" + "time" +) + +// GenerateCACert generates a new CA certificate and returns the cert and key as PEM-encoded bytes. +func GenerateCACert(subject pkix.Name, validFor time.Duration, keySize int) ([]byte, []byte, error) { + // generate a new private key + key, err := rsa.GenerateKey(rand.Reader, keySize) + if err != nil { + return nil, nil, err + } + + // generate a new certificate + template := x509.Certificate{ + SerialNumber: big.NewInt(1), + Subject: subject, + NotBefore: time.Now(), + NotAfter: time.Now().Add(validFor), + KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign, + ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth, x509.ExtKeyUsageClientAuth}, + IsCA: true, + BasicConstraintsValid: true, + } + + // generate a new certificate + cert, err := x509.CreateCertificate(rand.Reader, &template, &template, &key.PublicKey, key) + if err != nil { + return nil, nil, err + } + + // encode the certificate and private key + certPEM := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: cert}) + keyPEM := pem.EncodeToMemory(&pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(key)}) + + return certPEM, keyPEM, nil +} + +// GenerateCert generates a new x509 certificate and returns the cert and key as PEM-encoded bytes. +// The function should take in a subject, a validity period, and a key size. It should optionally +// take in a parent certificate and key. If a parent certificate and key are provided, the new +// certificate should be signed by the parent. If no parent certificate and key are provided, +// the new certificate should be self-signed. +func GenerateCert(subject pkix.Name, validFor time.Duration, keySize int, parent *x509.Certificate, parentKey any) ([]byte, []byte, error) { + // generate a new private key + key, err := rsa.GenerateKey(rand.Reader, keySize) + if err != nil { + return nil, nil, err + } + + // generate a new certificate + template := x509.Certificate{ + SerialNumber: big.NewInt(1), + Subject: subject, + NotBefore: time.Now(), + NotAfter: time.Now().Add(validFor), + KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature, + ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth, x509.ExtKeyUsageClientAuth}, + } + + signerCert := parent + signerKey := parentKey + if signerCert == nil { + signerCert = &template + signerKey = key + } + cert, err := x509.CreateCertificate(rand.Reader, &template, signerCert, &key.PublicKey, signerKey) + if err != nil { + return nil, nil, err + } + + // encode the certificate and private key + certPEM := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: cert}) + keyPEM := pem.EncodeToMemory(&pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(key)}) + + return certPEM, keyPEM, nil +} + +func GenerateCertIPSAN(subject pkix.Name, validFor time.Duration, keySize int, parent *x509.Certificate, parentKey any, san net.IP) ([]byte, []byte, error) { + // generate a new private key + key, err := rsa.GenerateKey(rand.Reader, keySize) + if err != nil { + return nil, nil, err + } + + // generate a new certificate + template := x509.Certificate{ + SerialNumber: big.NewInt(1), + Subject: subject, + NotBefore: time.Now(), + NotAfter: time.Now().Add(validFor), + KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature, + ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth, x509.ExtKeyUsageClientAuth}, + } + + // generate cert template for new certificate suitable for client verification + + // Add IP SAN to the certificate + template.IPAddresses = append(template.IPAddresses, san) + + signerCert := parent + signerKey := parentKey + if signerCert == nil { + signerCert = &template + signerKey = key + } + cert, err := x509.CreateCertificate(rand.Reader, &template, signerCert, &key.PublicKey, signerKey) + if err != nil { + return nil, nil, err + } + + // encode the certificate and private key + certPEM := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: cert}) + keyPEM := pem.EncodeToMemory(&pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(key)}) + + return certPEM, keyPEM, nil +} + +// GenerateSelfSignedCert generates a new self-signed certificate and +// returns the cert and key as PEM-encoded bytes. +func GenerateSelfSignedCert(subject pkix.Name, validFor time.Duration, keySize int) ([]byte, []byte, error) { + // generate a new private key + key, err := rsa.GenerateKey(rand.Reader, keySize) + if err != nil { + return nil, nil, err + } + + // generate a new certificate + template := x509.Certificate{ + SerialNumber: big.NewInt(1), + Subject: subject, + NotBefore: time.Now(), + NotAfter: time.Now().Add(validFor), + KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign, + ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, + IsCA: true, + BasicConstraintsValid: true, + } + + // Add IP SAN to the certificate + //template.IPAddresses = append(template.IPAddresses, net.ParseIP("127.0.0.1")) + + cert, err := x509.CreateCertificate(rand.Reader, &template, &template, &key.PublicKey, key) + if err != nil { + return nil, nil, err + } + + // encode the certificate and private key + certPEM := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: cert}) + keyPEM := pem.EncodeToMemory(&pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(key)}) + + return certPEM, keyPEM, nil +} + +// GenerateSelfSignedCertIPSAN generates a new self-signed certificate and +// returns the cert and key as PEM-encoded bytes. +func GenerateSelfSignedCertIPSAN(subject pkix.Name, validFor time.Duration, keySize int, san net.IP) ([]byte, []byte, error) { + // generate a new private key + key, err := rsa.GenerateKey(rand.Reader, keySize) + if err != nil { + return nil, nil, err + } + + // generate a new certificate + template := x509.Certificate{ + SerialNumber: big.NewInt(1), + Subject: subject, + NotBefore: time.Now(), + NotAfter: time.Now().Add(validFor), + KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign, + ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, + IsCA: true, + BasicConstraintsValid: true, + } + template.IPAddresses = append(template.IPAddresses, san) + + cert, err := x509.CreateCertificate(rand.Reader, &template, &template, &key.PublicKey, key) + if err != nil { + return nil, nil, err + } + + // encode the certificate and private key + certPEM := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: cert}) + keyPEM := pem.EncodeToMemory(&pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(key)}) + + return certPEM, keyPEM, nil +} diff --git a/service/rqlite/internal/rtls/config.go b/service/rqlite/internal/rtls/config.go new file mode 100644 index 0000000..5a27ea7 --- /dev/null +++ b/service/rqlite/internal/rtls/config.go @@ -0,0 +1,139 @@ +// rtls is for creating TLS configurations for use by servers and clients. +// nolint +package rtls + +import ( + "crypto/tls" + "crypto/x509" + "os" + + "github.com/pkg/errors" +) + +const ( + NoCACert = "" + NoServerName = "" +) + +// MTLSState indicates whether mutual TLS is enabled or disabled. +type MTLSState tls.ClientAuthType + +const ( + MTLSStateDisabled MTLSState = MTLSState(tls.NoClientCert) + MTLSStateEnabled MTLSState = MTLSState(tls.RequireAndVerifyClientCert) +) + +// CreateClientConfig creates a new tls.Config for use by a client. The certFile and keyFile +// parameters are the paths to the client's certificate and key files, which will be used to +// authenticate the client to the server if mutual TLS is active. The caCertFile parameter +// is the path to the CA certificate file, which the client will use to verify any certificate +// presented by the server. serverName can also be set, informing the client which hostname +// should appear in the returned certificate. If noverify is true, the client will not verify +// the server's certificate. +func CreateClientConfig(certFile, keyFile, caCertFile, serverName string, noverify bool) (*tls.Config, error) { + var err error + + config := createBaseTLSConfig(serverName, noverify) + if certFile != "" && keyFile != "" { + config.Certificates = make([]tls.Certificate, 1) + config.Certificates[0], err = tls.LoadX509KeyPair(certFile, keyFile) + if err != nil { + return nil, err + } + } + if caCertFile != "" { + if err := setCertPool(caCertFile, &config.RootCAs); err != nil { + return nil, err + } + } + return config, nil +} + +// CreateClientConfigWithFunc creates a new tls.Config for use by a client. The certFunc +// parameter is a function that returns the client's certificate and key. The caCertFile +// parameter is the path to the CA certificate file, which the client will use to verify +// any certificate presented by the server. serverName can also be set, informing the client +// which hostname should appear in the returned certificate. If noverify is true, the client +// will not verify the server's certificate. +func CreateClientConfigWithFunc(certFunc func() (*tls.Certificate, error), caCertFile, serverName string, noverify bool) (*tls.Config, error) { + config := createBaseTLSConfig(serverName, noverify) + if certFunc != nil { + config.GetClientCertificate = func(hello *tls.CertificateRequestInfo) (*tls.Certificate, error) { + return certFunc() + } + } + if caCertFile != "" { + if err := setCertPool(caCertFile, &config.RootCAs); err != nil { + return nil, err + } + } + return config, nil +} + +// CreateServerConfig creates a new tls.Config for use by a server. The certFile and keyFile +// parameters are the paths to the server's certificate and key files, which will be used to +// authenticate the server to the client. The caCertFile parameter is the path to the CA +// certificate file, which the server will use to verify any certificate presented by the +// client. If mtls is MTLSStateEnabled, the server will require the client to present a +// valid certificate. +func CreateServerConfig(certFile, keyFile, caCertFile string, mtls MTLSState) (*tls.Config, error) { + var err error + + config := createBaseTLSConfig(NoServerName, false) + config.Certificates = make([]tls.Certificate, 1) + config.Certificates[0], err = tls.LoadX509KeyPair(certFile, keyFile) + if err != nil { + return nil, err + } + if caCertFile != "" { + if err := setCertPool(caCertFile, &config.ClientCAs); err != nil { + return nil, err + } + } + config.ClientAuth = tls.ClientAuthType(mtls) + return config, nil +} + +// CreateServerConfigWithFunc creates a new tls.Config for use by a server. The certFunc +// parameter is a function that returns the server's certificate and key. The caCertFile +// parameter is the path to the CA certificate file, which the server will use to verify +// any certificate presented by the client. If mtls is MTLSStateEnabled, the server will +// require the client to present a valid certificate. +func CreateServerConfigWithFunc(certFunc func() (*tls.Certificate, error), caCertFile string, mtls MTLSState) (*tls.Config, error) { + config := createBaseTLSConfig(NoServerName, false) + config.GetCertificate = func(hello *tls.ClientHelloInfo) (*tls.Certificate, error) { + return certFunc() + } + if caCertFile != "" { + if err := setCertPool(caCertFile, &config.ClientCAs); err != nil { + return nil, err + } + } + config.ClientAuth = tls.ClientAuthType(mtls) + return config, nil +} + +func createBaseTLSConfig(serverName string, noverify bool) *tls.Config { + return &tls.Config{ + ServerName: serverName, + InsecureSkipVerify: noverify, + NextProtos: []string{"h2", "http/1.1"}, + MinVersion: uint16(tls.VersionTLS12), + } +} + +// setCertPool sets the CA certificate pool for the given file. It reads the file and +// appends the certificates to the pool. If the file cannot be read or the certificates +// cannot be appended, it returns an error. +func setCertPool(caCertFile string, pool **x509.CertPool) error { + asn1Data, err := os.ReadFile(caCertFile) + if err != nil { + return err + } + *pool = x509.NewCertPool() + ok := (*pool).AppendCertsFromPEM(asn1Data) + if !ok { + return errors.Errorf("failed to load CA certificate(s) for verification in %q", caCertFile) + } + return nil +} diff --git a/service/rqlite/internal/rtls/reloader.go b/service/rqlite/internal/rtls/reloader.go new file mode 100644 index 0000000..7e17049 --- /dev/null +++ b/service/rqlite/internal/rtls/reloader.go @@ -0,0 +1,110 @@ +// nolint +package rtls + +import ( + "crypto/tls" + "log" + "os" + "sync" + "time" +) + +// CertReloader is a simple TLS certificate reloader. It loads the certificate +// and key files from the specified paths and reloads them if they have been +// modified since the last load. +type CertReloader struct { + certPath, keyPath string + modTime time.Time + logger *log.Logger + + mu sync.RWMutex + cert *tls.Certificate +} + +// NewCertReloader creates a new CertReloader instance. +func NewCertReloader(cert, key string) (*CertReloader, error) { + cr := &CertReloader{ + certPath: cert, + keyPath: key, + logger: log.New(os.Stderr, "[cert-reloader] ", log.LstdFlags), + } + pair, err := loadKeyPair(cr.certPath, cr.keyPath) + if err != nil { + return nil, err + } + cr.cert = &pair + latestTime, err := latestModTime(cr.certPath, cr.keyPath) + if err != nil { + return nil, err + } + cr.modTime = latestTime + return cr, nil +} + +// GetCertificate returns the current certificate. It reloads the certificate +// if it has been modified since the last load. GetCertificate is thread-safe +// and if the cert has not changed this function will execute concurrently with +// other GetCertificate calls. +func (cr *CertReloader) GetCertificate() (*tls.Certificate, error) { + cr.mu.RLock() + latestTime, err := latestModTime(cr.certPath, cr.keyPath) + if err != nil || !latestTime.After(cr.modTime) { + defer cr.mu.RUnlock() + if err != nil { + cr.logger.Printf("failed to get latest modification time (%s), returning prior cert", err) + } + return cr.cert, nil + } + + // The certificate or key file has changed, we need to reload. First we release + // the read lock, then we acquire a write lock to reload the certificate. + cr.mu.RUnlock() + cr.mu.Lock() + defer cr.mu.Unlock() + + // Now that we have the write lock, we check again if the certificate has actually + // been updated by another concurrent call to this function. + latestTime, err = latestModTime(cr.certPath, cr.keyPath) + if err != nil || !latestTime.After(cr.modTime) { + if err != nil { + cr.logger.Printf("failed to get latest modification time (%s), returning prior cert", err) + } + return cr.cert, nil + } + + pair, err := loadKeyPair(cr.certPath, cr.keyPath) + if err != nil { + cr.logger.Printf("failed to reload certificate (%s), returning prior cert", err) + return cr.cert, nil + } + cr.logger.Printf("reloading certificate at %s and key at %s", cr.certPath, cr.keyPath) + cr.cert = &pair + cr.modTime = latestTime + return cr.cert, nil +} + +// loadKeyPair loads a TLS certificate and key pair from the given files. +// It simply wraps tls.LoadX509KeyPair, ensuring that the rest of the code +// uses the same function to load the key pair. +func loadKeyPair(certFile, keyFile string) (tls.Certificate, error) { + return tls.LoadX509KeyPair(certFile, keyFile) +} + +// latestModTime returns the latest modification time of the given files. +// It returns os.ErrNotExist if no files are provided. +func latestModTime(file ...string) (time.Time, error) { + if len(file) == 0 { + return time.Time{}, os.ErrNotExist + } + var latest time.Time + for _, f := range file { + info, err := os.Stat(f) + if err != nil { + return time.Time{}, err + } + if info.ModTime().After(latest) { + latest = info.ModTime() + } + } + return latest, nil +} diff --git a/service/rqlite/main.go b/service/rqlite/main.go index d31557b..f6537f4 100644 --- a/service/rqlite/main.go +++ b/service/rqlite/main.go @@ -16,21 +16,22 @@ import ( "strings" "time" + "isp-config-service/service/rqlite/internal/rarchive" + "isp-config-service/service/rqlite/internal/rtls" + "github.com/pkg/errors" "github.com/rqlite/rqlite-disco-clients/dns" "github.com/rqlite/rqlite-disco-clients/dnssrv" + "github.com/rqlite/rqlite/v9/auth" + "github.com/rqlite/rqlite/v9/auto/backup" + "github.com/rqlite/rqlite/v9/cluster" + "github.com/rqlite/rqlite/v9/cmd" + "github.com/rqlite/rqlite/v9/db" + "github.com/rqlite/rqlite/v9/db/extensions" + httpd "github.com/rqlite/rqlite/v9/http" + "github.com/rqlite/rqlite/v9/store" + "github.com/rqlite/rqlite/v9/tcp" "github.com/txix-open/isp-kit/config" - - "github.com/rqlite/rqlite/v8/auth" - "github.com/rqlite/rqlite/v8/cluster" - "github.com/rqlite/rqlite/v8/cmd" - "github.com/rqlite/rqlite/v8/db" - "github.com/rqlite/rqlite/v8/extensions" - httpd "github.com/rqlite/rqlite/v8/http" - "github.com/rqlite/rqlite/v8/rarchive" - "github.com/rqlite/rqlite/v8/rtls" - "github.com/rqlite/rqlite/v8/store" - "github.com/rqlite/rqlite/v8/tcp" ) const name = `rqlite` @@ -47,6 +48,7 @@ func init() { type localConfig struct { Rqlite *Config + Backup *Backup } func main(ctx context.Context, r *Rqlite) error { @@ -186,6 +188,15 @@ func main(ctx context.Context, r *Rqlite) error { h, p, _ := net.SplitHostPort(cfg.HTTPAdv) log.Printf("connect using the command-line tool via 'rqlite -H %s -p %s'", h, p) + // Start any requested auto-backups + backupSrv, err := startAutoBackups(mainCtx, localCfg.Backup, str) + if err != nil { + log.Fatalf("failed to start auto-backups: %s", err.Error()) + } + if backupSrv != nil { + httpServ.RegisterStatus("auto_backups", backupSrv) + } + // Block until done. <-mainCtx.Done() @@ -210,7 +221,7 @@ func main(ctx context.Context, r *Rqlite) error { log.Printf("stepping down as Leader before shutdown") } // Perform a stepdown, ignore any errors. - str.Stepdown(true) + str.Stepdown(true, "") } muxLn.Close() @@ -222,6 +233,26 @@ func main(ctx context.Context, r *Rqlite) error { return nil } +func startAutoBackups(ctx context.Context, cfg *Backup, str *store.Store) (*backup.Uploader, error) { + if !cfg.Enabled { + return nil, nil + } + + b, err := json.Marshal(cfg) + if err != nil { + return nil, errors.Errorf("failed to marshal auto-backup settings: %s", err.Error()) + } + + uCfg, sc, err := backup.NewStorageClient(b) + if err != nil { + return nil, errors.Errorf("failed to parse auto-backup file: %s", err.Error()) + } + provider := store.NewProvider(str, uCfg.Vacuum, !uCfg.NoCompress) + u := backup.NewUploader(sc, provider, time.Duration(uCfg.Interval)) + u.Start(ctx, str.IsLeader) + return u, nil +} + func evaluateAdvAddresses(cfg *config.Config) error { httpAdv := cfg.Optional().String("rqlite.HTTPAdv", "") shouldEvalHttp := strings.Contains(httpAdv, "$HOSTNAME") @@ -290,11 +321,11 @@ func createStore(cfg *Config, ln *tcp.Layer, extensions []string) (*store.Store, dbConf.FKConstraints = cfg.FKConstraints dbConf.Extensions = extensions - str := store.New(ln, &store.Config{ + str := store.New(&store.Config{ DBConf: dbConf, Dir: cfg.DataPath, ID: cfg.NodeID, - }) + }, ln) // Set optional parameters on store. str.RaftLogLevel = cfg.RaftLogLevel @@ -363,17 +394,17 @@ func startNodeMux(cfg *Config, ln net.Listener) (*tcp.Mux, error) { } if cfg.NodeVerifyClient { b.WriteString(", mutual TLS enabled") + mux, err = tcp.NewMutualTLSMux(ln, adv, cfg.NodeX509Cert, cfg.NodeX509Key, cfg.NodeX509CACert) } else { b.WriteString(", mutual TLS disabled") + mux, err = tcp.NewTLSMux(ln, adv, cfg.NodeX509Cert, cfg.NodeX509Key) } log.Println(b.String()) - mux, err = tcp.NewTLSMux(ln, adv, cfg.NodeX509Cert, cfg.NodeX509Key, cfg.NodeX509CACert, - cfg.NoNodeVerify, cfg.NodeVerifyClient) } else { mux, err = tcp.NewMux(ln, adv) } if err != nil { - return nil, fmt.Errorf("failed to create node-to-node mux: %s", err.Error()) + return nil, errors.Errorf("failed to create node-to-node mux: %s", err.Error()) } go mux.Serve() return mux, nil @@ -403,13 +434,13 @@ func createClusterClient(cfg *Config, clstr *cluster.Service) (*cluster.Client, dialerTLSConfig, err = rtls.CreateClientConfig(cfg.NodeX509Cert, cfg.NodeX509Key, cfg.NodeX509CACert, cfg.NodeVerifyServerName, cfg.NoNodeVerify) if err != nil { - return nil, fmt.Errorf("failed to create TLS config for cluster dialer: %s", err.Error()) + return nil, errors.Errorf("failed to create TLS config for cluster dialer: %s", err.Error()) } } clstrDialer := tcp.NewDialer(cluster.MuxClusterHeader, dialerTLSConfig) clstrClient := cluster.NewClient(clstrDialer, cfg.ClusterConnectTimeout) if err := clstrClient.SetLocal(cfg.RaftAdv, clstr); err != nil { - return nil, fmt.Errorf("failed to set cluster client local parameters: %s", err.Error()) + return nil, errors.Errorf("failed to set cluster client local parameters: %s", err.Error()) } return clstrClient, nil } @@ -422,13 +453,13 @@ func createCluster(ctx context.Context, cfg *Config, hasPeers bool, client *clus } if joins == nil && cfg.DiscoMode == "" && !hasPeers { if cfg.RaftNonVoter { - return fmt.Errorf("cannot create a new non-voting node without joining it to an existing cluster") + return errors.Errorf("cannot create a new non-voting node without joining it to an existing cluster") } // Brand new node, told to bootstrap itself. So do it. log.Println("bootstrapping single new node") if err := str.Bootstrap(store.NewServer(str.ID(), cfg.RaftAdv, true)); err != nil { - return fmt.Errorf("failed to bootstrap single new node: %s", err.Error()) + return errors.Errorf("failed to bootstrap single new node: %s", err.Error()) } return nil } @@ -446,7 +477,7 @@ func createCluster(ctx context.Context, cfg *Config, hasPeers bool, client *clus // Explicit join operation requested, so do it. j, err := joiner.Do(ctx, joins, str.ID(), cfg.RaftAdv, clusterSuf) if err != nil { - return fmt.Errorf("failed to join cluster: %s", err.Error()) + return errors.Errorf("failed to join cluster: %s", err.Error()) } log.Println("successfully joined cluster at", j) return nil @@ -485,14 +516,14 @@ func createCluster(ctx context.Context, cfg *Config, hasPeers bool, client *clus if cfg.DiscoMode == DiscoModeDNS { dnsCfg, err := dns.NewConfigFromReader(rc) if err != nil { - return fmt.Errorf("error reading DNS configuration: %s", err.Error()) + return errors.Errorf("error reading DNS configuration: %s", err.Error()) } provider = dns.NewWithPort(dnsCfg, cfg.RaftPort()) } else { dnssrvCfg, err := dnssrv.NewConfigFromReader(rc) if err != nil { - return fmt.Errorf("error reading DNS configuration: %s", err.Error()) + return errors.Errorf("error reading DNS configuration: %s", err.Error()) } provider = dnssrv.New(dnssrvCfg) } @@ -502,7 +533,7 @@ func createCluster(ctx context.Context, cfg *Config, hasPeers bool, client *clus httpServ.RegisterStatus("disco", provider) return bs.Boot(ctx, str.ID(), cfg.RaftAdv, clusterSuf, bootDoneFn, cfg.BootstrapExpectTimeout) default: - return fmt.Errorf("invalid disco mode %s", cfg.DiscoMode) + return errors.Errorf("invalid disco mode %s", cfg.DiscoMode) } } @@ -510,7 +541,7 @@ func networkCheckJoinAddrs(joinAddrs []string) error { if len(joinAddrs) > 0 { log.Println("checking that supplied join addresses don't serve HTTP(S)") if addr, ok := httpd.AnyServingHTTP(joinAddrs); ok { - return fmt.Errorf("join address %s appears to be serving HTTP when it should be Raft", addr) + return errors.Errorf("join address %s appears to be serving HTTP when it should be Raft", addr) } } return nil diff --git a/service/rqlite/runner.go b/service/rqlite/runner.go index 04935b1..033bc30 100644 --- a/service/rqlite/runner.go +++ b/service/rqlite/runner.go @@ -6,12 +6,12 @@ import ( "fmt" "time" - "github.com/rqlite/rqlite/v8/auth" + "github.com/rqlite/rqlite/v9/auth" "github.com/txix-open/isp-kit/http/httpcli" "github.com/pkg/errors" _ "github.com/rqlite/gorqlite/stdlib" - "github.com/rqlite/rqlite/v8/store" + "github.com/rqlite/rqlite/v9/store" "github.com/txix-open/isp-kit/config" ) diff --git a/service/startup/service.go b/service/startup/service.go index d184fba..02f4624 100644 --- a/service/startup/service.go +++ b/service/startup/service.go @@ -5,6 +5,13 @@ import ( "fmt" "time" + "isp-config-service/assembly" + "isp-config-service/conf" + "isp-config-service/middlewares" + "isp-config-service/service/rqlite" + "isp-config-service/service/rqlite/db" + "isp-config-service/service/rqlite/goose_store" + "github.com/pkg/errors" "github.com/pressly/goose/v3" "github.com/txix-open/isp-kit/app" @@ -17,12 +24,6 @@ import ( "github.com/txix-open/isp-kit/http/httpclix" "github.com/txix-open/isp-kit/log" "github.com/txix-open/isp-kit/observability/sentry" - "isp-config-service/assembly" - "isp-config-service/conf" - "isp-config-service/middlewares" - "isp-config-service/service/rqlite" - "isp-config-service/service/rqlite/db" - "isp-config-service/service/rqlite/goose_store" ) const ( @@ -35,7 +36,7 @@ type Service struct { rqlite *rqlite.Rqlite grpcSrv *grpc.Server httpSrv *http.Server - clusterCli *cluster.Client + clusterCli bootstrap.ClusterClient logger log.Logger // initialized in Run @@ -138,6 +139,10 @@ func (s *Service) Run(ctx context.Context) error { s.locatorConfig.CleanEventWorker.Run(ctx) s.locatorConfig.CleanPhantomBackendWorker.Run(ctx) + if cfg.Local.Backup.Enabled { + s.locatorConfig.CleanBackupsWorker.Run(ctx) + } + go func() { s.logger.Debug(ctx, fmt.Sprintf("starting grpc server on %s", s.boot.BindingAddress)) err := s.grpcSrv.ListenAndServe(s.boot.BindingAddress) From 451d277644906ddc53eacdf5367dd45fe85e92de Mon Sep 17 00:00:00 2001 From: likhachevam Date: Thu, 20 Nov 2025 11:04:25 +0300 Subject: [PATCH 03/13] MSP-6703 add backup_cleaner --- assembly/locator.go | 6 +++ conf/local.go | 5 ++- main.go | 5 ++- service/event/backup_cleaner.go | 73 +++++++++++++++++++++++++++++++++ tests/acceptance_test.go | 8 ++-- tests/autodiscovery_test.go | 8 ++-- 6 files changed, 96 insertions(+), 9 deletions(-) create mode 100644 service/event/backup_cleaner.go diff --git a/assembly/locator.go b/assembly/locator.go index cb46ad2..59d6cf0 100644 --- a/assembly/locator.go +++ b/assembly/locator.go @@ -82,6 +82,7 @@ type Config struct { HandleEventWorker *worker.Worker CleanEventWorker *worker.Worker CleanPhantomBackendWorker *worker.Worker + CleanBackupsWorker *worker.Worker OwnBackendsCleaner OwnBackendsCleaner } @@ -185,6 +186,10 @@ func (l Locator) Config() *Config { cleanerJob := event.NewCleaner(eventRepo, l.leaderChecker, eventTtl, l.logger) cleanEventWorker := worker.New(cleanerJob, worker.WithInterval(cleanEventInterval)) + cleanBackupsJob := event.NewBackupCleaner(l.leaderChecker, l.cfg.Local.Backup, l.logger) + cleanBackupsWorker := worker.New(cleanBackupsJob, + worker.WithInterval(time.Duration(l.cfg.Local.Backup.ClearIntervalDays)*24*time.Hour)) + metricsSvc := metrics.New(backendRepo) metricsController := controller.NewMetrics(metricsSvc) httpWrapper := httpEndpoint.DefaultWrapper(l.logger, httplog.Log(l.logger, false)) @@ -197,6 +202,7 @@ func (l Locator) Config() *Config { HandleEventWorker: handleEventWorker, CleanEventWorker: cleanEventWorker, CleanPhantomBackendWorker: cleanPhantomBackendWorker, + CleanBackupsWorker: cleanBackupsWorker, OwnBackendsCleaner: backendService, } } diff --git a/conf/local.go b/conf/local.go index 93d534b..416ea21 100644 --- a/conf/local.go +++ b/conf/local.go @@ -1,7 +1,9 @@ package conf import ( - "github.com/rqlite/rqlite/v8/auth" + "isp-config-service/service/rqlite" + + "github.com/rqlite/rqlite/v9/auth" "github.com/txix-open/isp-kit/bootstrap" ) @@ -12,6 +14,7 @@ type Local struct { KeepConfigVersions int `validate:"required"` InternalClientCredential string `validate:"required"` Rqlite Rqlite + Backup *rqlite.Backup } type Rqlite struct { diff --git a/main.go b/main.go index a176b1e..65bca71 100644 --- a/main.go +++ b/main.go @@ -1,11 +1,12 @@ package main import ( - "github.com/txix-open/isp-kit/bootstrap" - "github.com/txix-open/isp-kit/shutdown" "isp-config-service/conf" "isp-config-service/routes" "isp-config-service/service/startup" + + "github.com/txix-open/isp-kit/bootstrap" + "github.com/txix-open/isp-kit/shutdown" ) var ( diff --git a/service/event/backup_cleaner.go b/service/event/backup_cleaner.go new file mode 100644 index 0000000..4fe1f77 --- /dev/null +++ b/service/event/backup_cleaner.go @@ -0,0 +1,73 @@ +package event + +import ( + "context" + "fmt" + "os" + "strings" + + "isp-config-service/service/rqlite" + + "github.com/txix-open/isp-kit/log" +) + +type BackupCleaner struct { + leaderChecker LeaderChecker + cfg *rqlite.Backup + logger log.Logger +} + +func NewBackupCleaner( + leaderChecker LeaderChecker, + cfg *rqlite.Backup, + logger log.Logger, +) BackupCleaner { + return BackupCleaner{ + leaderChecker: leaderChecker, + cfg: cfg, + logger: logger, + } +} + +func (c BackupCleaner) Do(ctx context.Context) { + ctx = log.ToContext(ctx, log.String("worker", "backupCleaner")) + if !c.leaderChecker.IsLeader() { + c.logger.Debug(ctx, "is not a leader, skip work") + return + } + + files, err := os.ReadDir(c.cfg.Sub.Dir) + if err != nil { + c.logger.Error(ctx, fmt.Sprintf("failed to read files from %s: %s", c.cfg.Sub.Dir, err.Error())) + return + } + + backups := make([]os.DirEntry, 0) + for _, file := range files { + if !strings.Contains(file.Name(), "backup") { + continue + } + + backups = append(backups, file) + } + + if len(backups) <= c.cfg.Amount { + return + } + + deleteAmount := len(backups) - c.cfg.Amount + deleted := 0 + + for i := range deleteAmount { + err = os.Remove(c.cfg.Sub.Dir + "/" + backups[i].Name()) + if err != nil { + c.logger.Error(ctx, fmt.Sprintf("failed to remove %s: %s", backups[i].Name(), err.Error())) + continue + } + + deleted++ + c.logger.Debug(ctx, fmt.Sprintf("delete backup %s", backups[i].Name())) + } + + c.logger.Debug(ctx, fmt.Sprintf("delete %d old backups", deleted)) +} diff --git a/tests/acceptance_test.go b/tests/acceptance_test.go index bd0429f..bdc4b73 100644 --- a/tests/acceptance_test.go +++ b/tests/acceptance_test.go @@ -9,6 +9,10 @@ import ( "testing" "time" + "isp-config-service/conf" + "isp-config-service/domain" + "isp-config-service/service/startup" + "github.com/stretchr/testify/require" "github.com/txix-open/isp-kit/bootstrap" "github.com/txix-open/isp-kit/cluster" @@ -16,9 +20,6 @@ import ( "github.com/txix-open/isp-kit/json" "github.com/txix-open/isp-kit/log" "github.com/txix-open/isp-kit/rc/schema" - "isp-config-service/conf" - "isp-config-service/domain" - "isp-config-service/service/startup" ) //nolint:funlen,paralleltest @@ -175,6 +176,7 @@ func setupTest(t *testing.T) log.Logger { boot.MigrationsDir = "../migrations" dataPath := dataDir(t) boot.App.Config().Set("rqlite.DataPath", dataPath) + boot.App.Config().Set("backup.Enabled", false) logger := boot.App.Logger() startup, err := startup.New(boot) diff --git a/tests/autodiscovery_test.go b/tests/autodiscovery_test.go index 0b96420..496876d 100644 --- a/tests/autodiscovery_test.go +++ b/tests/autodiscovery_test.go @@ -6,15 +6,16 @@ import ( "testing" "time" + "isp-config-service/conf" + "isp-config-service/domain" + "isp-config-service/service/startup" + "github.com/stretchr/testify/require" "github.com/txix-open/isp-kit/bootstrap" "github.com/txix-open/isp-kit/cluster" "github.com/txix-open/isp-kit/http/httpclix" "github.com/txix-open/isp-kit/log" "github.com/txix-open/isp-kit/test/fake" - "isp-config-service/conf" - "isp-config-service/domain" - "isp-config-service/service/startup" ) // nolint:paralleltest @@ -95,6 +96,7 @@ func setupTestWithAppRun(t *testing.T) (*require.Assertions, log.Logger) { boot.MigrationsDir = "../migrations" dataPath := dataDir(t) boot.App.Config().Set("rqlite.DataPath", dataPath) + boot.App.Config().Set("backup.Enabled", false) logger := boot.App.Logger() startup, err := startup.New(boot) From 392e5f5cff2a826c46e45581808872c5b65cc42f Mon Sep 17 00:00:00 2001 From: likhachevam Date: Thu, 20 Nov 2025 11:10:47 +0300 Subject: [PATCH 04/13] MSP-6703 fix go version --- cmd/migrate/go.mod | 26 ++++----- cmd/migrate/go.sum | 86 +++++++++++++-------------- go.mod | 72 ++++++++++++----------- go.sum | 142 +++++++++++++++++++++++---------------------- 4 files changed, 163 insertions(+), 163 deletions(-) diff --git a/cmd/migrate/go.mod b/cmd/migrate/go.mod index 01feded..bc49675 100644 --- a/cmd/migrate/go.mod +++ b/cmd/migrate/go.mod @@ -8,8 +8,8 @@ require ( github.com/jmoiron/sqlx v1.4.0 github.com/mattn/go-sqlite3 v1.14.32 github.com/pkg/errors v0.9.1 - github.com/pressly/goose/v3 v3.25.0 - github.com/txix-open/isp-kit v1.58.0 + github.com/pressly/goose/v3 v3.26.0 + github.com/txix-open/isp-kit v1.63.2 isp-config-service v0.0.0-00010101000000-000000000000 ) @@ -19,7 +19,7 @@ require ( github.com/cenkalti/backoff/v5 v5.0.3 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/coder/websocket v1.8.14 // indirect - github.com/gabriel-vasile/mimetype v1.4.10 // indirect + github.com/gabriel-vasile/mimetype v1.4.11 // indirect github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-playground/locales v0.14.1 // indirect @@ -42,16 +42,16 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.66.1 // indirect - github.com/prometheus/procfs v0.17.0 // indirect + github.com/prometheus/common v0.67.3 // indirect + github.com/prometheus/procfs v0.19.2 // indirect github.com/sethvargo/go-retry v0.3.0 // indirect github.com/tidwall/gjson v1.18.0 // indirect - github.com/tidwall/match v1.1.1 // indirect + github.com/tidwall/match v1.2.0 // indirect github.com/tidwall/pretty v1.2.1 // indirect github.com/txix-open/bellows v1.2.0 // indirect github.com/txix-open/etp/v4 v4.0.1 // indirect github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb // indirect - go.opentelemetry.io/auto/sdk v1.2.0 // indirect + go.opentelemetry.io/auto/sdk v1.2.1 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.63.0 // indirect go.opentelemetry.io/otel v1.38.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 // indirect @@ -59,18 +59,18 @@ require ( go.opentelemetry.io/otel/metric v1.38.0 // indirect go.opentelemetry.io/otel/sdk v1.38.0 // indirect go.opentelemetry.io/otel/trace v1.38.0 // indirect - go.opentelemetry.io/proto/otlp v1.8.0 // indirect + go.opentelemetry.io/proto/otlp v1.9.0 // indirect go.uber.org/multierr v1.11.0 // indirect - go.uber.org/zap v1.27.0 // indirect + go.uber.org/zap v1.27.1 // indirect go.yaml.in/yaml/v2 v2.4.3 // indirect - golang.org/x/crypto v0.44.0 // indirect + golang.org/x/crypto v0.45.0 // indirect golang.org/x/net v0.47.0 // indirect golang.org/x/sync v0.18.0 // indirect golang.org/x/sys v0.38.0 // indirect golang.org/x/text v0.31.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20251020155222-88f65dc88635 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20251020155222-88f65dc88635 // indirect - google.golang.org/grpc v1.76.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20251111163417-95abcf5c77ba // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20251111163417-95abcf5c77ba // indirect + google.golang.org/grpc v1.77.0 // indirect google.golang.org/protobuf v1.36.10 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/cmd/migrate/go.sum b/cmd/migrate/go.sum index bf02762..d9a822b 100644 --- a/cmd/migrate/go.sum +++ b/cmd/migrate/go.sum @@ -15,16 +15,17 @@ github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/coder/websocket v1.8.14 h1:9L0p0iKiNOibykf283eHkKUHHrpG7f65OE3BhhO7v9g= github.com/coder/websocket v1.8.14/go.mod h1:NX3SzP+inril6yawo5CQXx8+fk145lPDC6pumgx0mVg= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/gabriel-vasile/mimetype v1.4.10 h1:zyueNbySn/z8mJZHLt6IPw0KoZsiQNszIpU+bX4+ZK0= -github.com/gabriel-vasile/mimetype v1.4.10/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s= -github.com/getsentry/sentry-go v0.35.2 h1:jKuujpRwa8FFRYMIwwZpu83Xh0voll9bmvyc6310WBM= -github.com/getsentry/sentry-go v0.35.2/go.mod h1:mdL49ixwT2yi57k5eh7mpnDyPybixPzlzEJFu0Z76QA= +github.com/gabriel-vasile/mimetype v1.4.11 h1:AQvxbp830wPhHTqc1u7nzoLT+ZFxGY7emj5DR5DYFik= +github.com/gabriel-vasile/mimetype v1.4.11/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s= +github.com/getsentry/sentry-go v0.38.0 h1:S8Xui7gLeAvXINVLMOaX94HnsDf1GexnfXGSNC4+KQs= +github.com/getsentry/sentry-go v0.38.0/go.mod h1:eRXCoh3uvmjQLY6qu63BjUZnaBu5L5WhMV1RwYO8W5s= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= @@ -48,8 +49,7 @@ github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 h1:8Tjv8EJ+pM1xP8mK6egEbD1OgnVTyacbefKhmbLhIhU= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2/go.mod h1:pkJQ2tZHJ0aFOVEEot6oZmaVEZcRme73eIFmhiVuRWs= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3 h1:NmZ1PKzSTQbuGHw9DGPFomqkkLWMC+vZCkfs+FHv1Vg= github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3/go.mod h1:zQrxl1YP88HQlA6i9c63DSVPFklWpGX4OWAc9bFuaH4= github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= @@ -86,8 +86,7 @@ github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= -github.com/mattn/go-sqlite3 v1.14.28 h1:ThEiQrnbtumT+QMknw63Befp/ce/nUPgBPMlRFEum7A= -github.com/mattn/go-sqlite3 v1.14.28/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= +github.com/mattn/go-sqlite3 v1.14.32 h1:JD12Ag3oLy1zQA+BNn74xRgaBbdhbNIDYvQUEuuErjs= github.com/mattn/go-sqlite3 v1.14.32/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/mfridman/interpolate v0.0.2 h1:pnuTK7MQIxxFz1Gr+rjSIx9u7qVjf5VOoM/u6BbAxPY= github.com/mfridman/interpolate v0.0.2/go.mod h1:p+7uk6oE07mpE/Ik1b8EckO0O4ZXiGAfshKBWLUM9Xg= @@ -104,18 +103,19 @@ github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdh github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pressly/goose/v3 v3.25.0 h1:6WeYhMWGRCzpyd89SpODFnCBCKz41KrVbRT58nVjGng= -github.com/pressly/goose/v3 v3.25.0/go.mod h1:4hC1KrritdCxtuFsqgs1R4AU5bWtTAf+cnWvfhf2DNY= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pressly/goose/v3 v3.26.0 h1:KJakav68jdH0WDvoAcj8+n61WqOIaPGgH0bJWS6jpmM= +github.com/pressly/goose/v3 v3.26.0/go.mod h1:4hC1KrritdCxtuFsqgs1R4AU5bWtTAf+cnWvfhf2DNY= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= -github.com/prometheus/common v0.66.1 h1:h5E0h5/Y8niHc5DlaLlWLArTQI7tMrsfQjHV+d9ZoGs= -github.com/prometheus/common v0.66.1/go.mod h1:gcaUsgf3KfRSwHY4dIMXLPV0K/Wg1oZ8+SbZk/HH/dA= -github.com/prometheus/procfs v0.17.0 h1:FuLQ+05u4ZI+SS/w9+BWEM2TXiHKsUQ9TADiRH7DuK0= -github.com/prometheus/procfs v0.17.0/go.mod h1:oPQLaDAMRbA+u8H5Pbfq+dl3VDAvHxMUOVhe0wYB2zw= +github.com/prometheus/common v0.67.3 h1:shd26MlnwTw5jksTDhC7rTQIteBxy+ZZDr3t7F2xN2Q= +github.com/prometheus/common v0.67.3/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI= +github.com/prometheus/procfs v0.19.2 h1:zUMhqEW66Ex7OXIiDkll3tl9a1ZdilUOd/F6ZXw4Vws= +github.com/prometheus/procfs v0.19.2/go.mod h1:M0aotyiemPhBCM0z5w87kL22CxfcH05ZpYlu+b4J7mw= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -137,8 +137,9 @@ github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= -github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= +github.com/tidwall/match v1.2.0 h1:0pt8FlkOwjN2fPt4bIl4BoNxb98gGHN2ObFEDkrfZnM= +github.com/tidwall/match v1.2.0/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4= github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= @@ -146,12 +147,12 @@ github.com/txix-open/bellows v1.2.0 h1:CXv8nQaZtB/micraeRilYyj/gtfv+bqBgP5aPYQgj github.com/txix-open/bellows v1.2.0/go.mod h1:qbKCy+RTgD30Qpw1fyb3y3jp5Y9mGhLLxgae1l0W92o= github.com/txix-open/etp/v4 v4.0.1 h1:5VSYgGsvnMz0tvUHsjVWFETI0qWBTCF1O3ARCHaCIgA= github.com/txix-open/etp/v4 v4.0.1/go.mod h1:FIu7TUDdwcgmtmF6tFTV1bGA2fRY/iVaPQdsGzvqYc8= -github.com/txix-open/isp-kit v1.58.0 h1:xV9awM6pJiGYW/1pUmtGQ3y2Sb7ISo5OVXXE5k/Q7FY= -github.com/txix-open/isp-kit v1.58.0/go.mod h1:Mbprn7ExedjRg4yUPa9xShYx1oMJIU+a19x6ksVubaw= +github.com/txix-open/isp-kit v1.63.2 h1:TNk5JNNfrMXc964abLX4XYK4ofESI/4MofO1h7T5NLk= +github.com/txix-open/isp-kit v1.63.2/go.mod h1:rwqKqB3PyZxaoep6iH1PKL89LS9nzRklA6+S4II72M4= github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb h1:UJgT4u/QMv5QHKOQeJ7igShHa36c2/vIRqJiRLdDlf0= github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb/go.mod h1:0biAFE0bgbcKeBBAwgEDhbZz6uT1vuSETCrFQlv2RiA= -go.opentelemetry.io/auto/sdk v1.2.0 h1:YpRtUFjvhSymycLS2T81lT6IGhcUP+LUPtv0iv1N8bM= -go.opentelemetry.io/auto/sdk v1.2.0/go.mod h1:1deq2zL7rwjwC8mR7XgY2N+tlIl6pjmEUoLDENMEzwk= +go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= +go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.63.0 h1:2pn7OzMewmYRiNtv1doZnLo3gONcnMHlFnmOR8Vgt+8= go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.63.0/go.mod h1:rjbQTDEPQymPE0YnRQp9/NuPwwtL0sesz/fnqRW/v84= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 h1:RbKq8BG0FI8OiXhBfcRtqqHcZcka+gU3cskNuf05R18= @@ -170,46 +171,37 @@ go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6 go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= -go.opentelemetry.io/proto/otlp v1.8.0 h1:fRAZQDcAFHySxpJ1TwlA1cJ4tvcrw7nXl9xWWC8N5CE= -go.opentelemetry.io/proto/otlp v1.8.0/go.mod h1:tIeYOeNBU4cvmPqpaji1P+KbB4Oloai8wN4rWzRrFF0= +go.opentelemetry.io/proto/otlp v1.9.0 h1:l706jCMITVouPOqEnii2fIAuO3IVGBRPV5ICjceRb/A= +go.opentelemetry.io/proto/otlp v1.9.0/go.mod h1:xE+Cx5E/eEHw+ISFkwPLwCZefwVjY+pqKg1qcK03+/4= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= -go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +go.uber.org/zap v1.27.1 h1:08RqriUEv8+ArZRYSTXy1LeBScaMpVSTBhCeaZYfMYc= +go.uber.org/zap v1.27.1/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= -golang.org/x/crypto v0.42.0 h1:chiH31gIWm57EkTXpwnqf8qeuMUi0yekh6mT2AvFlqI= -golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8= -golang.org/x/crypto v0.44.0/go.mod h1:013i+Nw79BMiQiMsOPcVCB5ZIJbYkerPrGnOa00tvmc= +golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q= +golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4= golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b h1:M2rDM6z3Fhozi9O7NWsxAkg/yqS/lQJ6PmkyIV3YP+o= golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b/go.mod h1:3//PLf8L/X+8b4vuAfHzxeRUl04Adcb341+IGKfnqS8= -golang.org/x/net v0.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I= -golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY= +golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= -golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug= -golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= +golang.org/x/sync v0.18.0 h1:kr88TuHDroi+UVf+0hZnirlk8o8T+4MrK6mr60WkH/I= golang.org/x/sync v0.18.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= -golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k= -golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc= golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= -golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk= -golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4= +golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM= golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM= gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= -google.golang.org/genproto/googleapis/api v0.0.0-20250908214217-97024824d090 h1:d8Nakh1G+ur7+P3GcMjpRDEkoLUcLW2iU92XVqR+XMQ= -google.golang.org/genproto/googleapis/api v0.0.0-20250908214217-97024824d090/go.mod h1:U8EXRNSd8sUYyDfs/It7KVWodQr+Hf9xtxyxWudSwEw= -google.golang.org/genproto/googleapis/api v0.0.0-20251020155222-88f65dc88635/go.mod h1:fDMmzKV90WSg1NbozdqrE64fkuTv6mlq2zxo9ad+3yo= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250908214217-97024824d090 h1:/OQuEa4YWtDt7uQWHd3q3sUMb+QOLQUg1xa8CEsRv5w= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250908214217-97024824d090/go.mod h1:GmFNa4BdJZ2a8G+wCe9Bg3wwThLrJun751XstdJt5Og= -google.golang.org/genproto/googleapis/rpc v0.0.0-20251020155222-88f65dc88635/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= -google.golang.org/grpc v1.75.1 h1:/ODCNEuf9VghjgO3rqLcfg8fiOP0nSluljWFlDxELLI= -google.golang.org/grpc v1.75.1/go.mod h1:JtPAzKiq4v1xcAB2hydNlWI2RnF85XXcV0mhKXr2ecQ= -google.golang.org/grpc v1.76.0/go.mod h1:Ju12QI8M6iQJtbcsV+awF5a4hfJMLi4X0JLo94ULZ6c= -google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw= -google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= +google.golang.org/genproto/googleapis/api v0.0.0-20251111163417-95abcf5c77ba h1:B14OtaXuMaCQsl2deSvNkyPKIzq3BjfxQp8d00QyWx4= +google.golang.org/genproto/googleapis/api v0.0.0-20251111163417-95abcf5c77ba/go.mod h1:G5IanEx8/PgI9w6CFcYQf7jMtHQhZruvfM1i3qOqk5U= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251111163417-95abcf5c77ba h1:UKgtfRM7Yh93Sya0Fo8ZzhDP4qBckrrxEr2oF5UIVb8= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251111163417-95abcf5c77ba/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= +google.golang.org/grpc v1.77.0 h1:wVVY6/8cGA6vvffn+wWK5ToddbgdU3d8MNENr4evgXM= +google.golang.org/grpc v1.77.0/go.mod h1:z0BY1iVj0q8E1uSQCjL9cppRj+gnZjzDnzV0dHhrNig= +google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE= google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= diff --git a/go.mod b/go.mod index e19a65e..345c720 100644 --- a/go.mod +++ b/go.mod @@ -12,41 +12,42 @@ require ( github.com/Masterminds/squirrel v1.5.4 github.com/google/uuid v1.6.0 github.com/pkg/errors v0.9.1 - github.com/pressly/goose/v3 v3.25.0 + github.com/pressly/goose/v3 v3.26.0 github.com/prometheus/client_golang v1.23.2 github.com/rqlite/gorqlite v0.0.0-20250609141355-ac86a4a1c9a8 github.com/rqlite/rqlite-disco-clients v0.0.0-20250205044118-8ada2b350099 - github.com/rqlite/rqlite/v9 v9.3.0 + github.com/rqlite/rqlite/v9 v9.3.1 github.com/stretchr/testify v1.11.1 github.com/tidwall/gjson v1.18.0 github.com/txix-open/etp/v4 v4.0.1 github.com/txix-open/go-cmp v0.0.0-20240401171944-16b203530f60 github.com/txix-open/isp-kit v1.63.2 github.com/xeipuuv/gojsonschema v1.2.0 - golang.org/x/sync v0.17.0 - google.golang.org/grpc v1.76.0 + golang.org/x/sync v0.18.0 + google.golang.org/grpc v1.77.0 ) require ( github.com/armon/go-metrics v0.5.4 // indirect - github.com/aws/aws-sdk-go-v2 v1.39.6 // indirect + github.com/aws/aws-sdk-go-v2 v1.40.0 // indirect github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.3 // indirect - github.com/aws/aws-sdk-go-v2/config v1.31.19 // indirect - github.com/aws/aws-sdk-go-v2/credentials v1.18.23 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.13 // indirect - github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.20.6 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.13 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.13 // indirect + github.com/aws/aws-sdk-go-v2/config v1.32.0 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.19.0 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.14 // indirect + github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.20.9 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.14 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.14 // indirect github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 // indirect - github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.13 // indirect + github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.14 // indirect github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.3 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.4 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.13 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.13 // indirect - github.com/aws/aws-sdk-go-v2/service/s3 v1.90.1 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.30.2 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.6 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.40.1 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.5 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.14 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.14 // indirect + github.com/aws/aws-sdk-go-v2/service/s3 v1.91.1 // indirect + github.com/aws/aws-sdk-go-v2/service/signin v1.0.1 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.30.4 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.8 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.41.1 // indirect github.com/aws/smithy-go v1.23.2 // indirect github.com/bahlo/generic-list-go v0.2.0 // indirect github.com/beorn7/perks v1.0.1 // indirect @@ -54,11 +55,11 @@ require ( github.com/cenkalti/backoff/v5 v5.0.3 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/coder/websocket v1.8.14 // indirect - github.com/davecgh/go-spew v1.1.1 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/fatih/color v1.18.0 // indirect - github.com/gabriel-vasile/mimetype v1.4.10 // indirect - github.com/getsentry/sentry-go v0.35.2 // indirect - github.com/go-faker/faker/v4 v4.6.1 // indirect + github.com/gabriel-vasile/mimetype v1.4.11 // indirect + github.com/getsentry/sentry-go v0.38.0 // indirect + github.com/go-faker/faker/v4 v4.7.0 // indirect github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-playground/locales v0.14.1 // indirect @@ -69,13 +70,14 @@ require ( github.com/hashicorp/go-metrics v0.5.4 // indirect github.com/hashicorp/go-msgpack v1.1.5 // indirect github.com/hashicorp/go-msgpack/v2 v2.1.5 // indirect + github.com/hashicorp/go-uuid v1.0.3 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/raft v1.7.3 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect github.com/leodido/go-urn v1.4.0 // indirect - github.com/mailru/easyjson v0.9.0 // indirect + github.com/mailru/easyjson v0.9.1 // indirect github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-sqlite3 v1.14.32 // indirect @@ -84,14 +86,14 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.66.1 // indirect - github.com/prometheus/procfs v0.17.0 // indirect + github.com/prometheus/common v0.67.3 // indirect + github.com/prometheus/procfs v0.19.2 // indirect github.com/rqlite/raft-boltdb/v2 v2.0.0-20230523104317-c08e70f4de48 // indirect - github.com/rqlite/sql v0.0.0-20250623131620-453fa49cad04 // indirect + github.com/rqlite/sql v0.0.0-20251114131613-ef07423e7137 // indirect github.com/sethvargo/go-retry v0.3.0 // indirect - github.com/tidwall/match v1.1.1 // indirect + github.com/tidwall/match v1.2.0 // indirect github.com/tidwall/pretty v1.2.1 // indirect github.com/txix-open/bellows v1.2.0 // indirect github.com/txix-open/jsonschema v1.3.0 // indirect @@ -100,7 +102,7 @@ require ( github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect go.etcd.io/bbolt v1.4.3 // indirect - go.opentelemetry.io/auto/sdk v1.2.0 // indirect + go.opentelemetry.io/auto/sdk v1.2.1 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.63.0 // indirect go.opentelemetry.io/otel v1.38.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 // indirect @@ -108,16 +110,16 @@ require ( go.opentelemetry.io/otel/metric v1.38.0 // indirect go.opentelemetry.io/otel/sdk v1.38.0 // indirect go.opentelemetry.io/otel/trace v1.38.0 // indirect - go.opentelemetry.io/proto/otlp v1.8.0 // indirect + go.opentelemetry.io/proto/otlp v1.9.0 // indirect go.uber.org/multierr v1.11.0 // indirect - go.uber.org/zap v1.27.0 // indirect + go.uber.org/zap v1.27.1 // indirect go.yaml.in/yaml/v2 v2.4.3 // indirect - golang.org/x/crypto v0.44.0 // indirect + golang.org/x/crypto v0.45.0 // indirect golang.org/x/net v0.47.0 // indirect golang.org/x/sys v0.38.0 // indirect golang.org/x/text v0.31.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20251020155222-88f65dc88635 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20251020155222-88f65dc88635 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20251111163417-95abcf5c77ba // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20251111163417-95abcf5c77ba // indirect google.golang.org/protobuf v1.36.10 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index 1b21e67..6a5d5d1 100644 --- a/go.sum +++ b/go.sum @@ -9,42 +9,44 @@ github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRF github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= -github.com/aws/aws-sdk-go-v2 v1.39.6 h1:2JrPCVgWJm7bm83BDwY5z8ietmeJUbh3O2ACnn+Xsqk= -github.com/aws/aws-sdk-go-v2 v1.39.6/go.mod h1:c9pm7VwuW0UPxAEYGyTmyurVcNrbF6Rt/wixFqDhcjE= +github.com/aws/aws-sdk-go-v2 v1.40.0 h1:/WMUA0kjhZExjOQN2z3oLALDREea1A7TobfuiBrKlwc= +github.com/aws/aws-sdk-go-v2 v1.40.0/go.mod h1:c9pm7VwuW0UPxAEYGyTmyurVcNrbF6Rt/wixFqDhcjE= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.3 h1:DHctwEM8P8iTXFxC/QK0MRjwEpWQeM9yzidCRjldUz0= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.3/go.mod h1:xdCzcZEtnSTKVDOmUZs4l/j3pSV6rpo1WXl5ugNsL8Y= -github.com/aws/aws-sdk-go-v2/config v1.31.19 h1:qdUtOw4JhZr2YcKO3g0ho/IcFXfXrrb8xlX05Y6EvSw= -github.com/aws/aws-sdk-go-v2/config v1.31.19/go.mod h1:tMJ8bur01t8eEm0atLadkIIFA154OJ4JCKZeQ+o+R7k= -github.com/aws/aws-sdk-go-v2/credentials v1.18.23 h1:IQILcxVgMO2BVLaJ2aAv21dKWvE1MduNrbvuK43XL2Q= -github.com/aws/aws-sdk-go-v2/credentials v1.18.23/go.mod h1:JRodHszhVdh5TPUknxDzJzrMiznG+M+FfR3WSWKgCI8= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.13 h1:T1brd5dR3/fzNFAQch/iBKeX07/ffu/cLu+q+RuzEWk= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.13/go.mod h1:Peg/GBAQ6JDt+RoBf4meB1wylmAipb7Kg2ZFakZTlwk= -github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.20.6 h1:ZzA0XhuftrrWhOb1POxvgJ3pb5IBo9+lSRn2DsM5FTM= -github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.20.6/go.mod h1:fNCXmb1171YzKE5TyQ88AkJZBLfqhFHKzls36eEv8Vk= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.13 h1:a+8/MLcWlIxo1lF9xaGt3J/u3yOZx+CdSveSNwjhD40= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.13/go.mod h1:oGnKwIYZ4XttyU2JWxFrwvhF6YKiK/9/wmE3v3Iu9K8= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.13 h1:HBSI2kDkMdWz4ZM7FjwE7e/pWDEZ+nR95x8Ztet1ooY= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.13/go.mod h1:YE94ZoDArI7awZqJzBAZ3PDD2zSfuP7w6P2knOzIn8M= +github.com/aws/aws-sdk-go-v2/config v1.32.0 h1:T5WWJYnam9SzBLbsVYDu2HscLDe+GU1AUJtfcDAc/vA= +github.com/aws/aws-sdk-go-v2/config v1.32.0/go.mod h1:pSRm/+D3TxBixGMXlgtX4+MPO9VNtEEtiFmNpxksoxw= +github.com/aws/aws-sdk-go-v2/credentials v1.19.0 h1:7zm+ez+qEqLaNsCSRaistkvJRJv8sByDOVuCnyHbP7M= +github.com/aws/aws-sdk-go-v2/credentials v1.19.0/go.mod h1:pHKPblrT7hqFGkNLxqoS3FlGoPrQg4hMIa+4asZzBfs= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.14 h1:WZVR5DbDgxzA0BJeudId89Kmgy6DIU4ORpxwsVHz0qA= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.14/go.mod h1:Dadl9QO0kHgbrH1GRqGiZdYtW5w+IXXaBNCHTIaheM4= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.20.9 h1:luPCleinMpiPLuC73psYTKmrIVpQ9NhmyNxNGIPkcUE= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.20.9/go.mod h1:szPVaB6mJ+FuNpHH8LTG32DP6Abr+aGEMdDAyFl5klE= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.14 h1:PZHqQACxYb8mYgms4RZbhZG0a7dPW06xOjmaH0EJC/I= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.14/go.mod h1:VymhrMJUWs69D8u0/lZ7jSB6WgaG/NqHi3gX0aYf6U0= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.14 h1:bOS19y6zlJwagBfHxs0ESzr1XCOU2KXJCWcq3E2vfjY= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.14/go.mod h1:1ipeGBMAxZ0xcTm6y6paC2C/J6f6OO7LBODV9afuAyM= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 h1:WKuaxf++XKWlHWu9ECbMlha8WOEGm0OUEZqm4K/Gcfk= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4/go.mod h1:ZWy7j6v1vWGmPReu0iSGvRiise4YI5SkR3OHKTZ6Wuc= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.13 h1:eg/WYAa12vqTphzIdWMzqYRVKKnCboVPRlvaybNCqPA= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.13/go.mod h1:/FDdxWhz1486obGrKKC1HONd7krpk38LBt+dutLcN9k= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.14 h1:ITi7qiDSv/mSGDSWNpZ4k4Ve0DQR6Ug2SJQ8zEHoDXg= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.14/go.mod h1:k1xtME53H1b6YpZt74YmwlONMWf4ecM+lut1WQLAF/U= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.3 h1:x2Ibm/Af8Fi+BH+Hsn9TXGdT+hKbDd5XOTZxTMxDk7o= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.3/go.mod h1:IW1jwyrQgMdhisceG8fQLmQIydcT/jWY21rFhzgaKwo= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.4 h1:NvMjwvv8hpGUILarKw7Z4Q0w1H9anXKsesMxtw++MA4= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.4/go.mod h1:455WPHSwaGj2waRSpQp7TsnpOnBfw8iDfPfbwl7KPJE= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.13 h1:kDqdFvMY4AtKoACfzIGD8A0+hbT41KTKF//gq7jITfM= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.13/go.mod h1:lmKuogqSU3HzQCwZ9ZtcqOc5XGMqtDK7OIc2+DxiUEg= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.13 h1:zhBJXdhWIFZ1acfDYIhu4+LCzdUS2Vbcum7D01dXlHQ= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.13/go.mod h1:JaaOeCE368qn2Hzi3sEzY6FgAZVCIYcC2nwbro2QCh8= -github.com/aws/aws-sdk-go-v2/service/s3 v1.90.1 h1:kKJk9r6iLMfCGy8RL9GWg3n9gUE1IpSwqYP3/5bdL1s= -github.com/aws/aws-sdk-go-v2/service/s3 v1.90.1/go.mod h1:+wArOOrcHUevqdto9k1tKOF5++YTe9JEcPSc9Tx2ZSw= -github.com/aws/aws-sdk-go-v2/service/sso v1.30.2 h1:/p6MxkbQoCzaGQT3WO0JwG0FlQyG9RD8VmdmoKc5xqU= -github.com/aws/aws-sdk-go-v2/service/sso v1.30.2/go.mod h1:fKvyjJcz63iL/ftA6RaM8sRCtN4r4zl4tjL3qw5ec7k= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.6 h1:0dES42T2dhICCbVB3JSTTn7+Bz93wfJEK1b7jksZIyQ= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.6/go.mod h1:klO+ejMvYsB4QATfEOIXk8WAEwN4N0aBfJpvC+5SZBo= -github.com/aws/aws-sdk-go-v2/service/sts v1.40.1 h1:5sbIM57lHLaEaNWdIx23JH30LNBsSDkjN/QXGcRLAFc= -github.com/aws/aws-sdk-go-v2/service/sts v1.40.1/go.mod h1:E19xDjpzPZC7LS2knI9E6BaRFDK43Eul7vd6rSq2HWk= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.5 h1:Hjkh7kE6D81PgrHlE/m9gx+4TyyeLHuY8xJs7yXN5C4= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.5/go.mod h1:nPRXgyCfAurhyaTMoBMwRBYBhaHI4lNPAnJmjM0Tslc= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.14 h1:FIouAnCE46kyYqyhs0XEBDFFSREtdnr8HQuLPQPLCrY= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.14/go.mod h1:UTwDc5COa5+guonQU8qBikJo1ZJ4ln2r1MkF7Dqag1E= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.14 h1:FzQE21lNtUor0Fb7QNgnEyiRCBlolLTX/Z1j65S7teM= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.14/go.mod h1:s1ydyWG9pm3ZwmmYN21HKyG9WzAZhYVW85wMHs5FV6w= +github.com/aws/aws-sdk-go-v2/service/s3 v1.91.1 h1:f3CVT98cvySOZslMZHusyQHTMY8Xt+F1i0YaR6oEJ4s= +github.com/aws/aws-sdk-go-v2/service/s3 v1.91.1/go.mod h1:wYNqY3L02Z3IgRYxOBPH9I1zD9Cjh9hI5QOy/eOjQvw= +github.com/aws/aws-sdk-go-v2/service/signin v1.0.1 h1:BDgIUYGEo5TkayOWv/oBLPphWwNm/A91AebUjAu5L5g= +github.com/aws/aws-sdk-go-v2/service/signin v1.0.1/go.mod h1:iS6EPmNeqCsGo+xQmXv0jIMjyYtQfnwg36zl2FwEouk= +github.com/aws/aws-sdk-go-v2/service/sso v1.30.4 h1:U//SlnkE1wOQiIImxzdY5PXat4Wq+8rlfVEw4Y7J8as= +github.com/aws/aws-sdk-go-v2/service/sso v1.30.4/go.mod h1:av+ArJpoYf3pgyrj6tcehSFW+y9/QvAY8kMooR9bZCw= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.8 h1:MvlNs/f+9eM0mOjD9JzBUbf5jghyTk3p+O9yHMXX94Y= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.8/go.mod h1:/j67Z5XBVDx8nZVp9EuFM9/BS5dvBznbqILGuu73hug= +github.com/aws/aws-sdk-go-v2/service/sts v1.41.1 h1:GdGmKtG+/Krag7VfyOXV17xjTCz0i9NT+JnqLTOI5nA= +github.com/aws/aws-sdk-go-v2/service/sts v1.41.1/go.mod h1:6TxbXoDSgBQ225Qd8Q+MbxUxUh6TtNKwbRt/EPS9xso= github.com/aws/smithy-go v1.23.2 h1:Crv0eatJUQhaManss33hS5r40CG3ZFH+21XSkqMrIUM= github.com/aws/smithy-go v1.23.2/go.mod h1:LEj2LM3rBRQJxPZTB4KuzZkaZYnZPnvgIhb4pu07mx0= github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk= @@ -68,8 +70,9 @@ github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp github.com/coder/websocket v1.8.14 h1:9L0p0iKiNOibykf283eHkKUHHrpG7f65OE3BhhO7v9g= github.com/coder/websocket v1.8.14/go.mod h1:NX3SzP+inril6yawo5CQXx8+fk145lPDC6pumgx0mVg= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= @@ -77,14 +80,14 @@ github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/gabriel-vasile/mimetype v1.4.10 h1:zyueNbySn/z8mJZHLt6IPw0KoZsiQNszIpU+bX4+ZK0= -github.com/gabriel-vasile/mimetype v1.4.10/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s= -github.com/getsentry/sentry-go v0.35.2 h1:jKuujpRwa8FFRYMIwwZpu83Xh0voll9bmvyc6310WBM= -github.com/getsentry/sentry-go v0.35.2/go.mod h1:mdL49ixwT2yi57k5eh7mpnDyPybixPzlzEJFu0Z76QA= +github.com/gabriel-vasile/mimetype v1.4.11 h1:AQvxbp830wPhHTqc1u7nzoLT+ZFxGY7emj5DR5DYFik= +github.com/gabriel-vasile/mimetype v1.4.11/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s= +github.com/getsentry/sentry-go v0.38.0 h1:S8Xui7gLeAvXINVLMOaX94HnsDf1GexnfXGSNC4+KQs= +github.com/getsentry/sentry-go v0.38.0/go.mod h1:eRXCoh3uvmjQLY6qu63BjUZnaBu5L5WhMV1RwYO8W5s= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= -github.com/go-faker/faker/v4 v4.6.1 h1:xUyVpAjEtB04l6XFY0V/29oR332rOSPWV4lU8RwDt4k= -github.com/go-faker/faker/v4 v4.6.1/go.mod h1:arSdxNCSt7mOhdk8tEolvHeIJ7eX4OX80wXjKKvkKBY= +github.com/go-faker/faker/v4 v4.7.0 h1:VboC02cXHl/NuQh5lM2W8b87yp4iFXIu59x4w0RZi4E= +github.com/go-faker/faker/v4 v4.7.0/go.mod h1:u1dIRP5neLB6kTzgyVjdBOV5R1uP7BdxkcWk7tiKQXk= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= @@ -149,8 +152,9 @@ github.com/hashicorp/go-msgpack v1.1.5/go.mod h1:gWVc3sv/wbDmR3rQsj1CAktEZzoz1YN github.com/hashicorp/go-msgpack/v2 v2.1.5 h1:Ue879bPnutj/hXfmUk6s/jtIK90XxgiUIcXRl656T44= github.com/hashicorp/go-msgpack/v2 v2.1.5/go.mod h1:bjCsRXpZ7NsJdk45PoCQnzRGDaK8TKm5ZnDI/9y3J4M= github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= -github.com/hashicorp/go-uuid v1.0.0 h1:RS8zrF7PhGwyNPOtxSClXXj9HA8feRnJzgnI1RJCSnM= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= +github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= @@ -188,8 +192,8 @@ github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 h1:P6pPBnrTSX3DEVR4fDembhR github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0/go.mod h1:vmVJ0l/dxyfGW6FmdpVm2joNMFikkuWg0EoCKLGUMNw= github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= -github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4= -github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU= +github.com/mailru/easyjson v0.9.1 h1:LbtsOm5WAswyWbvTEOqhypdPeZzHavpZx96/n553mR8= +github.com/mailru/easyjson v0.9.1/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= @@ -224,10 +228,11 @@ github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pressly/goose/v3 v3.25.0 h1:6WeYhMWGRCzpyd89SpODFnCBCKz41KrVbRT58nVjGng= -github.com/pressly/goose/v3 v3.25.0/go.mod h1:4hC1KrritdCxtuFsqgs1R4AU5bWtTAf+cnWvfhf2DNY= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pressly/goose/v3 v3.26.0 h1:KJakav68jdH0WDvoAcj8+n61WqOIaPGgH0bJWS6jpmM= +github.com/pressly/goose/v3 v3.26.0/go.mod h1:4hC1KrritdCxtuFsqgs1R4AU5bWtTAf+cnWvfhf2DNY= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= @@ -244,15 +249,15 @@ github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/common v0.66.1 h1:h5E0h5/Y8niHc5DlaLlWLArTQI7tMrsfQjHV+d9ZoGs= -github.com/prometheus/common v0.66.1/go.mod h1:gcaUsgf3KfRSwHY4dIMXLPV0K/Wg1oZ8+SbZk/HH/dA= +github.com/prometheus/common v0.67.3 h1:shd26MlnwTw5jksTDhC7rTQIteBxy+ZZDr3t7F2xN2Q= +github.com/prometheus/common v0.67.3/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.17.0 h1:FuLQ+05u4ZI+SS/w9+BWEM2TXiHKsUQ9TADiRH7DuK0= -github.com/prometheus/procfs v0.17.0/go.mod h1:oPQLaDAMRbA+u8H5Pbfq+dl3VDAvHxMUOVhe0wYB2zw= +github.com/prometheus/procfs v0.19.2 h1:zUMhqEW66Ex7OXIiDkll3tl9a1ZdilUOd/F6ZXw4Vws= +github.com/prometheus/procfs v0.19.2/go.mod h1:M0aotyiemPhBCM0z5w87kL22CxfcH05ZpYlu+b4J7mw= github.com/rabbitmq/amqp091-go v1.10.0 h1:STpn5XsHlHGcecLmMFCtg7mqq0RnD+zFr4uzukfVhBw= github.com/rabbitmq/amqp091-go v1.10.0/go.mod h1:Hy4jKW5kQART1u+JkDTF9YYOQUHXqMuhrgxOEeS7G4o= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= @@ -267,10 +272,10 @@ github.com/rqlite/raft-boltdb/v2 v2.0.0-20230523104317-c08e70f4de48 h1:NZ62M+kT0 github.com/rqlite/raft-boltdb/v2 v2.0.0-20230523104317-c08e70f4de48/go.mod h1:CRnsxgy5G8fAf5J+AM0yrsSdxXHKkIYOaq2sm+Q4DYc= github.com/rqlite/rqlite-disco-clients v0.0.0-20250205044118-8ada2b350099 h1:5cqkVLdl6sGJSY3kiF2dqaA3bD+8OS5FUdZqO0BxXLU= github.com/rqlite/rqlite-disco-clients v0.0.0-20250205044118-8ada2b350099/go.mod h1:6SVI8KegsW9Fyu2UQ+uvw0JI5CAILRYRyiQ/OFSJPrs= -github.com/rqlite/rqlite/v9 v9.3.0 h1:JUMlEr7aCntDTkWLANO8IYNrtj8qB2K8JbI//ZFvWNI= -github.com/rqlite/rqlite/v9 v9.3.0/go.mod h1:f11xLaz0KlOXbURbx2WMh6IkLc/ePIlUbrHUsDDOvaU= -github.com/rqlite/sql v0.0.0-20250623131620-453fa49cad04 h1:bjr7gZERAJhYhqkLHXbkBSpjbB+PlgW6e9CRCJ2+J/w= -github.com/rqlite/sql v0.0.0-20250623131620-453fa49cad04/go.mod h1:ib9zVtNgRKiGuoMyUqqL5aNpk+r+++YlyiVIkclVqPg= +github.com/rqlite/rqlite/v9 v9.3.1 h1:lCnQa1bqMzhjeypj7BMzA+VZneVisyqh3t559rIO7WM= +github.com/rqlite/rqlite/v9 v9.3.1/go.mod h1:T2z3ZoxwC30bl9stu+GSB4aGrWm/OznZPae2tODNioE= +github.com/rqlite/sql v0.0.0-20251114131613-ef07423e7137 h1:OG5MfYAA0yaWgllfPdOq9Xa2bo1vpurCNx1LWz7+Zh0= +github.com/rqlite/sql v0.0.0-20251114131613-ef07423e7137/go.mod h1:ib9zVtNgRKiGuoMyUqqL5aNpk+r+++YlyiVIkclVqPg= github.com/sethvargo/go-retry v0.3.0 h1:EEt31A35QhrcRZtrYFDTBg91cqZVnFL2navjDrah2SE= github.com/sethvargo/go-retry v0.3.0/go.mod h1:mNX17F0C/HguQMyMyJxcnU471gOZGxCLyYaFyAZraas= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= @@ -293,8 +298,9 @@ github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= -github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= +github.com/tidwall/match v1.2.0 h1:0pt8FlkOwjN2fPt4bIl4BoNxb98gGHN2ObFEDkrfZnM= +github.com/tidwall/match v1.2.0/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4= github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= @@ -326,8 +332,8 @@ github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5t go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= go.etcd.io/bbolt v1.4.3 h1:dEadXpI6G79deX5prL3QRNP6JB8UxVkqo4UPnHaNXJo= go.etcd.io/bbolt v1.4.3/go.mod h1:tKQlpPaYCVFctUIgFKFnAlvbmB3tpy1vkTnDWohtc0E= -go.opentelemetry.io/auto/sdk v1.2.0 h1:YpRtUFjvhSymycLS2T81lT6IGhcUP+LUPtv0iv1N8bM= -go.opentelemetry.io/auto/sdk v1.2.0/go.mod h1:1deq2zL7rwjwC8mR7XgY2N+tlIl6pjmEUoLDENMEzwk= +go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= +go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.63.0 h1:2pn7OzMewmYRiNtv1doZnLo3gONcnMHlFnmOR8Vgt+8= go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.63.0/go.mod h1:rjbQTDEPQymPE0YnRQp9/NuPwwtL0sesz/fnqRW/v84= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 h1:RbKq8BG0FI8OiXhBfcRtqqHcZcka+gU3cskNuf05R18= @@ -346,22 +352,22 @@ go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6 go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= -go.opentelemetry.io/proto/otlp v1.8.0 h1:fRAZQDcAFHySxpJ1TwlA1cJ4tvcrw7nXl9xWWC8N5CE= -go.opentelemetry.io/proto/otlp v1.8.0/go.mod h1:tIeYOeNBU4cvmPqpaji1P+KbB4Oloai8wN4rWzRrFF0= +go.opentelemetry.io/proto/otlp v1.9.0 h1:l706jCMITVouPOqEnii2fIAuO3IVGBRPV5ICjceRb/A= +go.opentelemetry.io/proto/otlp v1.9.0/go.mod h1:xE+Cx5E/eEHw+ISFkwPLwCZefwVjY+pqKg1qcK03+/4= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= -go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +go.uber.org/zap v1.27.1 h1:08RqriUEv8+ArZRYSTXy1LeBScaMpVSTBhCeaZYfMYc= +go.uber.org/zap v1.27.1/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.44.0 h1:A97SsFvM3AIwEEmTBiaxPPTYpDC47w720rdiiUvgoAU= -golang.org/x/crypto v0.44.0/go.mod h1:013i+Nw79BMiQiMsOPcVCB5ZIJbYkerPrGnOa00tvmc= +golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q= +golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4= golang.org/x/exp v0.0.0-20251017212417-90e834f514db h1:by6IehL4BH5k3e3SJmcoNbOobMey2SLpAF79iPOEBvw= golang.org/x/exp v0.0.0-20251017212417-90e834f514db/go.mod h1:j/pmGrbnkbPtQfxEe5D0VQhZC6qKbfKifgD0oM7sR70= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= @@ -384,8 +390,8 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug= -golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= +golang.org/x/sync v0.18.0 h1:kr88TuHDroi+UVf+0hZnirlk8o8T+4MrK6mr60WkH/I= +golang.org/x/sync v0.18.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -423,12 +429,12 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto/googleapis/api v0.0.0-20251020155222-88f65dc88635 h1:1wvBeYv+A2zfEbxROscJl69OP0m74S8wGEO+Syat26o= -google.golang.org/genproto/googleapis/api v0.0.0-20251020155222-88f65dc88635/go.mod h1:fDMmzKV90WSg1NbozdqrE64fkuTv6mlq2zxo9ad+3yo= -google.golang.org/genproto/googleapis/rpc v0.0.0-20251020155222-88f65dc88635 h1:3uycTxukehWrxH4HtPRtn1PDABTU331ViDjyqrUbaog= -google.golang.org/genproto/googleapis/rpc v0.0.0-20251020155222-88f65dc88635/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= -google.golang.org/grpc v1.76.0 h1:UnVkv1+uMLYXoIz6o7chp59WfQUYA2ex/BXQ9rHZu7A= -google.golang.org/grpc v1.76.0/go.mod h1:Ju12QI8M6iQJtbcsV+awF5a4hfJMLi4X0JLo94ULZ6c= +google.golang.org/genproto/googleapis/api v0.0.0-20251111163417-95abcf5c77ba h1:B14OtaXuMaCQsl2deSvNkyPKIzq3BjfxQp8d00QyWx4= +google.golang.org/genproto/googleapis/api v0.0.0-20251111163417-95abcf5c77ba/go.mod h1:G5IanEx8/PgI9w6CFcYQf7jMtHQhZruvfM1i3qOqk5U= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251111163417-95abcf5c77ba h1:UKgtfRM7Yh93Sya0Fo8ZzhDP4qBckrrxEr2oF5UIVb8= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251111163417-95abcf5c77ba/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= +google.golang.org/grpc v1.77.0 h1:wVVY6/8cGA6vvffn+wWK5ToddbgdU3d8MNENr4evgXM= +google.golang.org/grpc v1.77.0/go.mod h1:z0BY1iVj0q8E1uSQCjL9cppRj+gnZjzDnzV0dHhrNig= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= From 35e15b7ae1d0feec0bd82670253b30ae9d6bc439 Mon Sep 17 00:00:00 2001 From: likhachevam Date: Thu, 20 Nov 2025 12:54:47 +0300 Subject: [PATCH 05/13] MSP-6703 update config.yml --- conf/config.yml | 9 +++------ conf/local.go | 2 +- service/event/backup_cleaner.go | 5 ++--- service/rqlite/config_flags.go | 6 ++++++ service/rqlite/main.go | 19 ++++++++++--------- 5 files changed, 22 insertions(+), 19 deletions(-) diff --git a/conf/config.yml b/conf/config.yml index 1a9f8f8..fac082c 100644 --- a/conf/config.yml +++ b/conf/config.yml @@ -39,14 +39,11 @@ rqlite: backup: Enabled: true - Num: 10 - Version: 1 - Type: "file" - Interval: "2m" + Amount: 5 + Interval: "24h" ClearIntervalDays: 7 - Timestamp: true Sub: - Dir: "app/data/backups/rqlite" + Dir: "/app/data/backups/rqlite" Name: "backup.sqlite.gz" metricsAutodiscovery: diff --git a/conf/local.go b/conf/local.go index 416ea21..6380e3d 100644 --- a/conf/local.go +++ b/conf/local.go @@ -14,7 +14,7 @@ type Local struct { KeepConfigVersions int `validate:"required"` InternalClientCredential string `validate:"required"` Rqlite Rqlite - Backup *rqlite.Backup + Backup rqlite.Backup } type Rqlite struct { diff --git a/service/event/backup_cleaner.go b/service/event/backup_cleaner.go index 4fe1f77..338f488 100644 --- a/service/event/backup_cleaner.go +++ b/service/event/backup_cleaner.go @@ -13,13 +13,13 @@ import ( type BackupCleaner struct { leaderChecker LeaderChecker - cfg *rqlite.Backup + cfg rqlite.Backup logger log.Logger } func NewBackupCleaner( leaderChecker LeaderChecker, - cfg *rqlite.Backup, + cfg rqlite.Backup, logger log.Logger, ) BackupCleaner { return BackupCleaner{ @@ -66,7 +66,6 @@ func (c BackupCleaner) Do(ctx context.Context) { } deleted++ - c.logger.Debug(ctx, fmt.Sprintf("delete backup %s", backups[i].Name())) } c.logger.Debug(ctx, fmt.Sprintf("delete %d old backups", deleted)) diff --git a/service/rqlite/config_flags.go b/service/rqlite/config_flags.go index ffb602e..9415a7c 100644 --- a/service/rqlite/config_flags.go +++ b/service/rqlite/config_flags.go @@ -217,6 +217,12 @@ type Sub struct { Name string } +func (b *Backup) SetParams() { + b.Version = 1 + b.Type = "file" + b.Timestamp = true +} + // Validate checks the configuration for internal consistency, and activates // important rqlite policies. It must be called at least once on a Config // object before the Config object is used. It is OK to call more than diff --git a/service/rqlite/main.go b/service/rqlite/main.go index f6537f4..2aeee5b 100644 --- a/service/rqlite/main.go +++ b/service/rqlite/main.go @@ -48,7 +48,7 @@ func init() { type localConfig struct { Rqlite *Config - Backup *Backup + Backup Backup } func main(ctx context.Context, r *Rqlite) error { @@ -189,7 +189,7 @@ func main(ctx context.Context, r *Rqlite) error { log.Printf("connect using the command-line tool via 'rqlite -H %s -p %s'", h, p) // Start any requested auto-backups - backupSrv, err := startAutoBackups(mainCtx, localCfg.Backup, str) + backupSrv, err := startAutoBackups(mainCtx, &localCfg.Backup, str) if err != nil { log.Fatalf("failed to start auto-backups: %s", err.Error()) } @@ -238,6 +238,7 @@ func startAutoBackups(ctx context.Context, cfg *Backup, str *store.Store) (*back return nil, nil } + cfg.SetParams() b, err := json.Marshal(cfg) if err != nil { return nil, errors.Errorf("failed to marshal auto-backup settings: %s", err.Error()) @@ -404,7 +405,7 @@ func startNodeMux(cfg *Config, ln net.Listener) (*tcp.Mux, error) { mux, err = tcp.NewMux(ln, adv) } if err != nil { - return nil, errors.Errorf("failed to create node-to-node mux: %s", err.Error()) + return nil, errors.WithMessage(err, "failed to create node-to-node mux") } go mux.Serve() return mux, nil @@ -434,13 +435,13 @@ func createClusterClient(cfg *Config, clstr *cluster.Service) (*cluster.Client, dialerTLSConfig, err = rtls.CreateClientConfig(cfg.NodeX509Cert, cfg.NodeX509Key, cfg.NodeX509CACert, cfg.NodeVerifyServerName, cfg.NoNodeVerify) if err != nil { - return nil, errors.Errorf("failed to create TLS config for cluster dialer: %s", err.Error()) + return nil, errors.WithMessage(err, "failed to create TLS config for cluster dialer") } } clstrDialer := tcp.NewDialer(cluster.MuxClusterHeader, dialerTLSConfig) clstrClient := cluster.NewClient(clstrDialer, cfg.ClusterConnectTimeout) if err := clstrClient.SetLocal(cfg.RaftAdv, clstr); err != nil { - return nil, errors.Errorf("failed to set cluster client local parameters: %s", err.Error()) + return nil, errors.WithMessage(err, "failed to set cluster client local parameters") } return clstrClient, nil } @@ -459,7 +460,7 @@ func createCluster(ctx context.Context, cfg *Config, hasPeers bool, client *clus // Brand new node, told to bootstrap itself. So do it. log.Println("bootstrapping single new node") if err := str.Bootstrap(store.NewServer(str.ID(), cfg.RaftAdv, true)); err != nil { - return errors.Errorf("failed to bootstrap single new node: %s", err.Error()) + return errors.WithMessage(err, "failed to bootstrap single new node") } return nil } @@ -477,7 +478,7 @@ func createCluster(ctx context.Context, cfg *Config, hasPeers bool, client *clus // Explicit join operation requested, so do it. j, err := joiner.Do(ctx, joins, str.ID(), cfg.RaftAdv, clusterSuf) if err != nil { - return errors.Errorf("failed to join cluster: %s", err.Error()) + return errors.WithMessage(err, "failed to join cluster") } log.Println("successfully joined cluster at", j) return nil @@ -516,14 +517,14 @@ func createCluster(ctx context.Context, cfg *Config, hasPeers bool, client *clus if cfg.DiscoMode == DiscoModeDNS { dnsCfg, err := dns.NewConfigFromReader(rc) if err != nil { - return errors.Errorf("error reading DNS configuration: %s", err.Error()) + return errors.WithMessage(err, "error reading DNS configuration") } provider = dns.NewWithPort(dnsCfg, cfg.RaftPort()) } else { dnssrvCfg, err := dnssrv.NewConfigFromReader(rc) if err != nil { - return errors.Errorf("error reading DNS configuration: %s", err.Error()) + return errors.WithMessage(err, "error reading DNS configuration") } provider = dnssrv.New(dnssrvCfg) } From 960b87d86dbc77cd8def36d58b6c97568b21d998 Mon Sep 17 00:00:00 2001 From: likhachevam Date: Thu, 20 Nov 2025 17:10:12 +0300 Subject: [PATCH 06/13] MSP-6703 update waitForLeaderTimeout --- service/startup/service.go | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/service/startup/service.go b/service/startup/service.go index 02f4624..fbd8e25 100644 --- a/service/startup/service.go +++ b/service/startup/service.go @@ -27,7 +27,8 @@ import ( ) const ( - waitForLeaderTimeout = 30 * time.Second + waitForLeaderTimeout = 180 * time.Second + waitingLogsTimeout = 30 * time.Second ) type Service struct { @@ -98,8 +99,11 @@ func (s *Service) Run(ctx context.Context) error { }() time.Sleep(1 * time.Second) // optimistically wait for store initialization - s.logger.Debug(ctx, fmt.Sprintf("waiting for cluster startup for %s...", waitForLeaderTimeout)) + waitingCtx, stopWaiting := context.WithCancel(ctx) + go s.writeWaitingLogs(waitingCtx) + err := s.rqlite.WaitForLeader(waitForLeaderTimeout) + stopWaiting() if err != nil { return errors.WithMessage(err, "wait for leader") } @@ -230,3 +234,19 @@ func internalClientCredentials(cfg conf.Local) (*httpcli.BasicAuth, error) { } return nil, errors.Errorf("internal client credential '%s' not found", cfg.InternalClientCredential) } + +func (s *Service) writeWaitingLogs(ctx context.Context) { + s.logger.Debug(ctx, fmt.Sprintf("waiting for cluster startup for %s...", waitForLeaderTimeout)) + + t := time.NewTicker(waitingLogsTimeout) + defer t.Stop() + + for { + select { + case <-ctx.Done(): + return + case <-t.C: + s.logger.Debug(ctx, fmt.Sprintf("continue waiting for cluster startup for %s...", waitForLeaderTimeout)) + } + } +} From 2f614a5c752bb910bc727eaa939d912f3f25c9d5 Mon Sep 17 00:00:00 2001 From: likhachevam Date: Fri, 21 Nov 2025 13:24:32 +0300 Subject: [PATCH 07/13] MSP-6703 update clearInterval format --- assembly/locator.go | 3 +-- conf/config.yml | 2 +- service/rqlite/config_flags.go | 18 +++++++++--------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/assembly/locator.go b/assembly/locator.go index 59d6cf0..1a4b73a 100644 --- a/assembly/locator.go +++ b/assembly/locator.go @@ -187,8 +187,7 @@ func (l Locator) Config() *Config { cleanEventWorker := worker.New(cleanerJob, worker.WithInterval(cleanEventInterval)) cleanBackupsJob := event.NewBackupCleaner(l.leaderChecker, l.cfg.Local.Backup, l.logger) - cleanBackupsWorker := worker.New(cleanBackupsJob, - worker.WithInterval(time.Duration(l.cfg.Local.Backup.ClearIntervalDays)*24*time.Hour)) + cleanBackupsWorker := worker.New(cleanBackupsJob, worker.WithInterval(l.cfg.Local.Backup.ClearInterval)) metricsSvc := metrics.New(backendRepo) metricsController := controller.NewMetrics(metricsSvc) diff --git a/conf/config.yml b/conf/config.yml index fac082c..c6dee3a 100644 --- a/conf/config.yml +++ b/conf/config.yml @@ -41,7 +41,7 @@ backup: Enabled: true Amount: 5 Interval: "24h" - ClearIntervalDays: 7 + ClearInterval: "168h" Sub: Dir: "/app/data/backups/rqlite" Name: "backup.sqlite.gz" diff --git a/service/rqlite/config_flags.go b/service/rqlite/config_flags.go index 9415a7c..5011c07 100644 --- a/service/rqlite/config_flags.go +++ b/service/rqlite/config_flags.go @@ -201,15 +201,15 @@ type Config struct { } type Backup struct { - Enabled bool - Amount int - Version int - Type string - Interval string - ClearIntervalDays int - Timestamp bool - Vacuum bool - Sub Sub + Enabled bool + Amount int + Version int + Type string + Interval string + ClearInterval time.Duration + Timestamp bool + Vacuum bool + Sub Sub } type Sub struct { From 99d4aaca4584f85ed3f7f33cc114551274780aec Mon Sep 17 00:00:00 2001 From: likhachevam Date: Fri, 21 Nov 2025 13:24:48 +0300 Subject: [PATCH 08/13] MSP-6703 fix race conditions --- service/rqlite/main.go | 2 +- service/rqlite/runner.go | 14 ++++++++------ service/startup/service.go | 4 ++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/service/rqlite/main.go b/service/rqlite/main.go index 2aeee5b..97d2abe 100644 --- a/service/rqlite/main.go +++ b/service/rqlite/main.go @@ -123,7 +123,7 @@ func main(ctx context.Context, r *Rqlite) error { log.Fatalf("failed to create store: %s", err.Error()) } - r.store = str + r.storePtr.Store(str) credStr, err := credentialsStore(r.credentials) if err != nil { diff --git a/service/rqlite/runner.go b/service/rqlite/runner.go index 033bc30..2dc81df 100644 --- a/service/rqlite/runner.go +++ b/service/rqlite/runner.go @@ -4,6 +4,7 @@ import ( "context" "database/sql" "fmt" + "sync/atomic" "time" "github.com/rqlite/rqlite/v9/auth" @@ -25,7 +26,7 @@ type Rqlite struct { credentials []auth.Credential localHttpAddr string - store *store.Store + storePtr *atomic.Pointer[store.Store] closed chan struct{} cancel context.CancelFunc } @@ -40,6 +41,7 @@ func New( internalClientCredential: internalClientCredential, credentials: credentials, closed: make(chan struct{}), + storePtr: &atomic.Pointer[store.Store]{}, } } @@ -51,10 +53,10 @@ func (r *Rqlite) Run(ctx context.Context) error { } func (r *Rqlite) WaitForLeader(timeout time.Duration) error { - if r.store == nil { + if r.storePtr.Load() == nil { return ErrNotRun } - _, err := r.store.WaitForLeader(timeout) + _, err := r.storePtr.Load().WaitForLeader(timeout) if err != nil { return errors.WithMessage(err, "wait for leader in rqlite store") } @@ -62,14 +64,14 @@ func (r *Rqlite) WaitForLeader(timeout time.Duration) error { } func (r *Rqlite) IsLeader() bool { - if r.store == nil { + if r.storePtr.Load() == nil { return false } - return r.store.IsLeader() + return r.storePtr.Load().IsLeader() } func (r *Rqlite) SqlDB() (*sql.DB, error) { - if r.store == nil { + if r.storePtr.Load() == nil { return nil, ErrNotRun } diff --git a/service/startup/service.go b/service/startup/service.go index fbd8e25..3077586 100644 --- a/service/startup/service.go +++ b/service/startup/service.go @@ -99,11 +99,11 @@ func (s *Service) Run(ctx context.Context) error { }() time.Sleep(1 * time.Second) // optimistically wait for store initialization - waitingCtx, stopWaiting := context.WithCancel(ctx) + waitingCtx, waitingDone := context.WithCancel(ctx) go s.writeWaitingLogs(waitingCtx) err := s.rqlite.WaitForLeader(waitForLeaderTimeout) - stopWaiting() + waitingDone() if err != nil { return errors.WithMessage(err, "wait for leader") } From a6d72ec1a40784b1b34e8a4db158f5b7f86e8d02 Mon Sep 17 00:00:00 2001 From: likhachevam Date: Fri, 21 Nov 2025 16:03:57 +0300 Subject: [PATCH 09/13] MSP-6703 add rqlite backup proxy --- assembly/locator.go | 9 ++++++++- routes/routes.go | 3 ++- service/rqlite/main.go | 20 ++++++++++---------- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/assembly/locator.go b/assembly/locator.go index 1a4b73a..c8a5e46 100644 --- a/assembly/locator.go +++ b/assembly/locator.go @@ -177,7 +177,14 @@ func (l Locator) Config() *Config { panic(err) } rqliteProxy := httputil.NewSingleHostReverseProxy(rqliteUrl) - httpMux := routes.HttpHandler(etpSrv, l.cfg.Local, rqliteProxy) + + rqliteBackupUrl, err := url.Parse(l.cfg.RqliteAddress + "/db/backup") + if err != nil { + panic(err) + } + rqliteBackupProxy := httputil.NewSingleHostReverseProxy(rqliteBackupUrl) + + httpMux := routes.HttpHandler(etpSrv, l.cfg.Local, rqliteProxy, rqliteBackupProxy) eventHandler := event.NewHandler(subscriptionService, l.logger) handleEventJob := event.NewWorker(eventRepo, eventHandler, l.logger) diff --git a/routes/routes.go b/routes/routes.go index ea5f104..ce365f2 100644 --- a/routes/routes.go +++ b/routes/routes.go @@ -56,12 +56,13 @@ func BindEtp(etpSrv *etp.Server, c Controllers, logger log.Logger) { etpSrv.On(cluster.ModuleReady, onModuleReady) } -func HttpHandler(etpSrv *etp.Server, conf conf.Local, rqliteProxy http.Handler) http.Handler { +func HttpHandler(etpSrv *etp.Server, conf conf.Local, rqliteProxy, rqliteBackupProxy http.Handler) http.Handler { httpMux := http.NewServeMux() if conf.MaintenanceMode { httpMux.Handle("/", rqliteProxy) } else { httpMux.Handle("/isp-etp/", etpSrv) + httpMux.Handle("/backup", rqliteBackupProxy) } return httpMux } diff --git a/service/rqlite/main.go b/service/rqlite/main.go index 97d2abe..0723872 100644 --- a/service/rqlite/main.go +++ b/service/rqlite/main.go @@ -405,7 +405,7 @@ func startNodeMux(cfg *Config, ln net.Listener) (*tcp.Mux, error) { mux, err = tcp.NewMux(ln, adv) } if err != nil { - return nil, errors.WithMessage(err, "failed to create node-to-node mux") + return nil, fmt.Errorf("failed to create node-to-node mux: %s", err.Error()) } go mux.Serve() return mux, nil @@ -435,13 +435,13 @@ func createClusterClient(cfg *Config, clstr *cluster.Service) (*cluster.Client, dialerTLSConfig, err = rtls.CreateClientConfig(cfg.NodeX509Cert, cfg.NodeX509Key, cfg.NodeX509CACert, cfg.NodeVerifyServerName, cfg.NoNodeVerify) if err != nil { - return nil, errors.WithMessage(err, "failed to create TLS config for cluster dialer") + return nil, fmt.Errorf("failed to create TLS config for cluster dialer: %s", err.Error()) } } clstrDialer := tcp.NewDialer(cluster.MuxClusterHeader, dialerTLSConfig) clstrClient := cluster.NewClient(clstrDialer, cfg.ClusterConnectTimeout) if err := clstrClient.SetLocal(cfg.RaftAdv, clstr); err != nil { - return nil, errors.WithMessage(err, "failed to set cluster client local parameters") + return nil, fmt.Errorf("failed to set cluster client local parameters: %s", err.Error()) } return clstrClient, nil } @@ -454,13 +454,13 @@ func createCluster(ctx context.Context, cfg *Config, hasPeers bool, client *clus } if joins == nil && cfg.DiscoMode == "" && !hasPeers { if cfg.RaftNonVoter { - return errors.Errorf("cannot create a new non-voting node without joining it to an existing cluster") + return fmt.Errorf("cannot create a new non-voting node without joining it to an existing cluster") } // Brand new node, told to bootstrap itself. So do it. log.Println("bootstrapping single new node") if err := str.Bootstrap(store.NewServer(str.ID(), cfg.RaftAdv, true)); err != nil { - return errors.WithMessage(err, "failed to bootstrap single new node") + return fmt.Errorf("failed to bootstrap single new node: %s", err.Error()) } return nil } @@ -478,7 +478,7 @@ func createCluster(ctx context.Context, cfg *Config, hasPeers bool, client *clus // Explicit join operation requested, so do it. j, err := joiner.Do(ctx, joins, str.ID(), cfg.RaftAdv, clusterSuf) if err != nil { - return errors.WithMessage(err, "failed to join cluster") + return fmt.Errorf("failed to join cluster: %s", err.Error()) } log.Println("successfully joined cluster at", j) return nil @@ -517,14 +517,14 @@ func createCluster(ctx context.Context, cfg *Config, hasPeers bool, client *clus if cfg.DiscoMode == DiscoModeDNS { dnsCfg, err := dns.NewConfigFromReader(rc) if err != nil { - return errors.WithMessage(err, "error reading DNS configuration") + return fmt.Errorf("error reading DNS configuration: %s", err.Error()) } provider = dns.NewWithPort(dnsCfg, cfg.RaftPort()) } else { dnssrvCfg, err := dnssrv.NewConfigFromReader(rc) if err != nil { - return errors.WithMessage(err, "error reading DNS configuration") + return fmt.Errorf("error reading DNS configuration: %s", err.Error()) } provider = dnssrv.New(dnssrvCfg) } @@ -534,7 +534,7 @@ func createCluster(ctx context.Context, cfg *Config, hasPeers bool, client *clus httpServ.RegisterStatus("disco", provider) return bs.Boot(ctx, str.ID(), cfg.RaftAdv, clusterSuf, bootDoneFn, cfg.BootstrapExpectTimeout) default: - return errors.Errorf("invalid disco mode %s", cfg.DiscoMode) + return fmt.Errorf("invalid disco mode %s", cfg.DiscoMode) } } @@ -542,7 +542,7 @@ func networkCheckJoinAddrs(joinAddrs []string) error { if len(joinAddrs) > 0 { log.Println("checking that supplied join addresses don't serve HTTP(S)") if addr, ok := httpd.AnyServingHTTP(joinAddrs); ok { - return errors.Errorf("join address %s appears to be serving HTTP when it should be Raft", addr) + return fmt.Errorf("join address %s appears to be serving HTTP when it should be Raft", addr) } } return nil From 4763d88628d07194a282ca5ca4baaa93aa0d4cd4 Mon Sep 17 00:00:00 2001 From: likhachevam Date: Fri, 21 Nov 2025 16:10:27 +0300 Subject: [PATCH 10/13] MSP-6703 remove unused utils --- service/rqlite/internal/rarchive/gzip.go | 65 ------- service/rqlite/internal/rarchive/targz.go | 111 ------------ service/rqlite/internal/rarchive/zip.go | 86 ---------- service/rqlite/internal/rtls/certs.go | 196 ---------------------- service/rqlite/internal/rtls/config.go | 74 -------- service/rqlite/internal/rtls/reloader.go | 20 --- 6 files changed, 552 deletions(-) delete mode 100644 service/rqlite/internal/rarchive/gzip.go delete mode 100644 service/rqlite/internal/rtls/certs.go diff --git a/service/rqlite/internal/rarchive/gzip.go b/service/rqlite/internal/rarchive/gzip.go deleted file mode 100644 index b68bf4f..0000000 --- a/service/rqlite/internal/rarchive/gzip.go +++ /dev/null @@ -1,65 +0,0 @@ -// nolint -package rarchive - -import ( - "compress/gzip" - "io" - "os" -) - -// Gzip compresses the given file and returns the path to the -// compressed file. It is the caller's responsibility to remove -// the compressed file when it is no longer needed. -func Gzip(file string) (string, error) { - f, err := os.Open(file) - if err != nil { - return "", err - } - defer f.Close() - - tmpFd, err := os.CreateTemp("", "gzip") - if err != nil { - return "", err - } - - gz := gzip.NewWriter(tmpFd) - _, err = io.Copy(gz, f) - if err != nil { - return "", err - } - - err = gz.Close() - if err != nil { - return "", err - } - return tmpFd.Name(), nil -} - -// Gunzip decompresses the given GZIP file and returns the -// path to the decompressed file. It is the caller's responsibility -// to remove the decompressed file when it is no longer needed. -func Gunzip(file string) (string, error) { - f, err := os.Open(file) - if err != nil { - return "", err - } - defer f.Close() - - gz, err := gzip.NewReader(f) - if err != nil { - return "", err - } - defer gz.Close() - - tmpFd, err := os.CreateTemp("", "gunzip") - if err != nil { - return "", err - } - defer tmpFd.Close() - - _, err = io.Copy(tmpFd, gz) - if err != nil { - return "", err - } - return tmpFd.Name(), nil -} diff --git a/service/rqlite/internal/rarchive/targz.go b/service/rqlite/internal/rarchive/targz.go index a8b4ebf..73a789e 100644 --- a/service/rqlite/internal/rarchive/targz.go +++ b/service/rqlite/internal/rarchive/targz.go @@ -2,13 +2,8 @@ package rarchive import ( - "archive/tar" "compress/gzip" - "errors" - "io" "os" - "path/filepath" - "strings" ) // IsTarGzipFile checks if the file at the given path is a gzipped tarball @@ -29,109 +24,3 @@ func IsTarGzipFile(path string) bool { return true } - -// TarGzipHasSubdirectories checks if the gzipped tarball contains any entries that -// represent subdirectories or files within subdirectories. -func TarGzipHasSubdirectories(path string) (bool, error) { - // Open the tar.gz file - file, err := os.Open(path) - if err != nil { - return false, err - } - defer file.Close() - - gzr, err := gzip.NewReader(file) - if err != nil { - return false, err - } - defer gzr.Close() - - tr := tar.NewReader(gzr) - - // Iterate through each file in the tar archive - for { - header, err := tr.Next() - if err == io.EOF { - break // End of tar archive - } - if err != nil { - return false, err - } - - // Check if the file is a directory or if the file path includes a subdirectory - if header.Typeflag == tar.TypeDir || - strings.Contains(header.Name, "/") || strings.Contains(header.Name, "\\") { - return true, nil - } - } - return false, nil -} - -// UntarGzipToDir decompresses the gzipped tarball at the given path into the specified directory. -func UntarGzipToDir(path, dir string) error { - // Open the tar.gz file - file, err := os.Open(path) - if err != nil { - return err - } - defer file.Close() - - gzr, err := gzip.NewReader(file) - if err != nil { - return err - } - defer gzr.Close() - - tr := tar.NewReader(gzr) - - // Ensure the output directory exists - if err := os.MkdirAll(dir, 0755); err != nil { - return err - } - - // Iterate through each file in the tar archive - for { - header, err := tr.Next() - if err == io.EOF { - break // End of tar archive - } - if err != nil { - return err - } - - // Construct the full path for the file - fpath := filepath.Join(dir, header.Name) - - // Check for directory traversal vulnerability - if !strings.HasPrefix(fpath, filepath.Clean(dir)+string(os.PathSeparator)) { - return errors.New("invalid file path") - } - - if header.Typeflag == tar.TypeDir { - // Create the directory - if err := os.MkdirAll(fpath, os.FileMode(header.Mode)); err != nil { - return err - } - } else { - // Create the file - if err := os.MkdirAll(filepath.Dir(fpath), os.FileMode(header.Mode)); err != nil { - return err - } - - outFile, err := os.OpenFile(fpath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, os.FileMode(header.Mode)) - if err != nil { - return err - } - - // Copy the file content to the destination - if _, err := io.Copy(outFile, tr); err != nil { - outFile.Close() - return err - } - - outFile.Close() - } - } - - return nil -} diff --git a/service/rqlite/internal/rarchive/zip.go b/service/rqlite/internal/rarchive/zip.go index 51b613b..7364b3c 100644 --- a/service/rqlite/internal/rarchive/zip.go +++ b/service/rqlite/internal/rarchive/zip.go @@ -2,13 +2,8 @@ package rarchive import ( - "archive/zip" "bytes" - "errors" - "io" "os" - "path/filepath" - "strings" ) // IsZipFile checks if the file at the given path is a ZIP file @@ -30,84 +25,3 @@ func IsZipFile(path string) bool { // ZIP files start with "PK\x03\x04" return bytes.Equal(buf, []byte("PK\x03\x04")) } - -// ZipHasSubdirectories checks if the ZIP file contains any entries that -// represent subdirectories or files within subdirectories. -func ZipHasSubdirectories(path string) (bool, error) { - // Open the ZIP file - r, err := zip.OpenReader(path) - if err != nil { - return false, err - } - defer r.Close() - - // Iterate through each file in the ZIP archive - for _, f := range r.File { - if f.FileInfo().IsDir() || - len(f.Name) > 0 && (f.Name[len(f.Name)-1] == '/' || - len(f.Name) > 0 && f.Name != filepath.Base(f.Name)) { - return true, nil - } - } - return false, nil -} - -// UnzipToDir decompresses the ZIP file at the given path into the specified directory. -func UnzipToDir(path, dir string) error { - // Open the ZIP file - r, err := zip.OpenReader(path) - if err != nil { - return err - } - defer r.Close() - - // Ensure the output directory exists - if err := os.MkdirAll(dir, 0755); err != nil { - return err - } - - // Iterate through each file in the ZIP archive - for _, f := range r.File { - // Construct the full path for the file - fpath := filepath.Join(dir, f.Name) - - // Check for directory traversal vulnerability - if !strings.HasPrefix(fpath, filepath.Clean(dir)+string(os.PathSeparator)) { - return errors.New("invalid file path") - } - - if f.FileInfo().IsDir() { - // Create the directory - if err := os.MkdirAll(fpath, f.Mode()); err != nil { - return err - } - } else { - // Create the file - if err := os.MkdirAll(filepath.Dir(fpath), f.Mode()); err != nil { - return err - } - - outFile, err := os.OpenFile(fpath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, f.Mode()) - if err != nil { - return err - } - - rc, err := f.Open() - if err != nil { - return err - } - - _, err = io.Copy(outFile, rc) - - // Close the file handles - outFile.Close() - rc.Close() - - if err != nil { - return err - } - } - } - - return nil -} diff --git a/service/rqlite/internal/rtls/certs.go b/service/rqlite/internal/rtls/certs.go deleted file mode 100644 index 80bee43..0000000 --- a/service/rqlite/internal/rtls/certs.go +++ /dev/null @@ -1,196 +0,0 @@ -// nolint -package rtls - -import ( - "crypto/rand" - "crypto/rsa" - "crypto/x509" - "crypto/x509/pkix" - "encoding/pem" - "math/big" - "net" - "time" -) - -// GenerateCACert generates a new CA certificate and returns the cert and key as PEM-encoded bytes. -func GenerateCACert(subject pkix.Name, validFor time.Duration, keySize int) ([]byte, []byte, error) { - // generate a new private key - key, err := rsa.GenerateKey(rand.Reader, keySize) - if err != nil { - return nil, nil, err - } - - // generate a new certificate - template := x509.Certificate{ - SerialNumber: big.NewInt(1), - Subject: subject, - NotBefore: time.Now(), - NotAfter: time.Now().Add(validFor), - KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign, - ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth, x509.ExtKeyUsageClientAuth}, - IsCA: true, - BasicConstraintsValid: true, - } - - // generate a new certificate - cert, err := x509.CreateCertificate(rand.Reader, &template, &template, &key.PublicKey, key) - if err != nil { - return nil, nil, err - } - - // encode the certificate and private key - certPEM := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: cert}) - keyPEM := pem.EncodeToMemory(&pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(key)}) - - return certPEM, keyPEM, nil -} - -// GenerateCert generates a new x509 certificate and returns the cert and key as PEM-encoded bytes. -// The function should take in a subject, a validity period, and a key size. It should optionally -// take in a parent certificate and key. If a parent certificate and key are provided, the new -// certificate should be signed by the parent. If no parent certificate and key are provided, -// the new certificate should be self-signed. -func GenerateCert(subject pkix.Name, validFor time.Duration, keySize int, parent *x509.Certificate, parentKey any) ([]byte, []byte, error) { - // generate a new private key - key, err := rsa.GenerateKey(rand.Reader, keySize) - if err != nil { - return nil, nil, err - } - - // generate a new certificate - template := x509.Certificate{ - SerialNumber: big.NewInt(1), - Subject: subject, - NotBefore: time.Now(), - NotAfter: time.Now().Add(validFor), - KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature, - ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth, x509.ExtKeyUsageClientAuth}, - } - - signerCert := parent - signerKey := parentKey - if signerCert == nil { - signerCert = &template - signerKey = key - } - cert, err := x509.CreateCertificate(rand.Reader, &template, signerCert, &key.PublicKey, signerKey) - if err != nil { - return nil, nil, err - } - - // encode the certificate and private key - certPEM := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: cert}) - keyPEM := pem.EncodeToMemory(&pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(key)}) - - return certPEM, keyPEM, nil -} - -func GenerateCertIPSAN(subject pkix.Name, validFor time.Duration, keySize int, parent *x509.Certificate, parentKey any, san net.IP) ([]byte, []byte, error) { - // generate a new private key - key, err := rsa.GenerateKey(rand.Reader, keySize) - if err != nil { - return nil, nil, err - } - - // generate a new certificate - template := x509.Certificate{ - SerialNumber: big.NewInt(1), - Subject: subject, - NotBefore: time.Now(), - NotAfter: time.Now().Add(validFor), - KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature, - ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth, x509.ExtKeyUsageClientAuth}, - } - - // generate cert template for new certificate suitable for client verification - - // Add IP SAN to the certificate - template.IPAddresses = append(template.IPAddresses, san) - - signerCert := parent - signerKey := parentKey - if signerCert == nil { - signerCert = &template - signerKey = key - } - cert, err := x509.CreateCertificate(rand.Reader, &template, signerCert, &key.PublicKey, signerKey) - if err != nil { - return nil, nil, err - } - - // encode the certificate and private key - certPEM := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: cert}) - keyPEM := pem.EncodeToMemory(&pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(key)}) - - return certPEM, keyPEM, nil -} - -// GenerateSelfSignedCert generates a new self-signed certificate and -// returns the cert and key as PEM-encoded bytes. -func GenerateSelfSignedCert(subject pkix.Name, validFor time.Duration, keySize int) ([]byte, []byte, error) { - // generate a new private key - key, err := rsa.GenerateKey(rand.Reader, keySize) - if err != nil { - return nil, nil, err - } - - // generate a new certificate - template := x509.Certificate{ - SerialNumber: big.NewInt(1), - Subject: subject, - NotBefore: time.Now(), - NotAfter: time.Now().Add(validFor), - KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign, - ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, - IsCA: true, - BasicConstraintsValid: true, - } - - // Add IP SAN to the certificate - //template.IPAddresses = append(template.IPAddresses, net.ParseIP("127.0.0.1")) - - cert, err := x509.CreateCertificate(rand.Reader, &template, &template, &key.PublicKey, key) - if err != nil { - return nil, nil, err - } - - // encode the certificate and private key - certPEM := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: cert}) - keyPEM := pem.EncodeToMemory(&pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(key)}) - - return certPEM, keyPEM, nil -} - -// GenerateSelfSignedCertIPSAN generates a new self-signed certificate and -// returns the cert and key as PEM-encoded bytes. -func GenerateSelfSignedCertIPSAN(subject pkix.Name, validFor time.Duration, keySize int, san net.IP) ([]byte, []byte, error) { - // generate a new private key - key, err := rsa.GenerateKey(rand.Reader, keySize) - if err != nil { - return nil, nil, err - } - - // generate a new certificate - template := x509.Certificate{ - SerialNumber: big.NewInt(1), - Subject: subject, - NotBefore: time.Now(), - NotAfter: time.Now().Add(validFor), - KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign, - ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, - IsCA: true, - BasicConstraintsValid: true, - } - template.IPAddresses = append(template.IPAddresses, san) - - cert, err := x509.CreateCertificate(rand.Reader, &template, &template, &key.PublicKey, key) - if err != nil { - return nil, nil, err - } - - // encode the certificate and private key - certPEM := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: cert}) - keyPEM := pem.EncodeToMemory(&pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(key)}) - - return certPEM, keyPEM, nil -} diff --git a/service/rqlite/internal/rtls/config.go b/service/rqlite/internal/rtls/config.go index 5a27ea7..c0f277a 100644 --- a/service/rqlite/internal/rtls/config.go +++ b/service/rqlite/internal/rtls/config.go @@ -10,19 +10,9 @@ import ( "github.com/pkg/errors" ) -const ( - NoCACert = "" - NoServerName = "" -) - // MTLSState indicates whether mutual TLS is enabled or disabled. type MTLSState tls.ClientAuthType -const ( - MTLSStateDisabled MTLSState = MTLSState(tls.NoClientCert) - MTLSStateEnabled MTLSState = MTLSState(tls.RequireAndVerifyClientCert) -) - // CreateClientConfig creates a new tls.Config for use by a client. The certFile and keyFile // parameters are the paths to the client's certificate and key files, which will be used to // authenticate the client to the server if mutual TLS is active. The caCertFile parameter @@ -49,70 +39,6 @@ func CreateClientConfig(certFile, keyFile, caCertFile, serverName string, noveri return config, nil } -// CreateClientConfigWithFunc creates a new tls.Config for use by a client. The certFunc -// parameter is a function that returns the client's certificate and key. The caCertFile -// parameter is the path to the CA certificate file, which the client will use to verify -// any certificate presented by the server. serverName can also be set, informing the client -// which hostname should appear in the returned certificate. If noverify is true, the client -// will not verify the server's certificate. -func CreateClientConfigWithFunc(certFunc func() (*tls.Certificate, error), caCertFile, serverName string, noverify bool) (*tls.Config, error) { - config := createBaseTLSConfig(serverName, noverify) - if certFunc != nil { - config.GetClientCertificate = func(hello *tls.CertificateRequestInfo) (*tls.Certificate, error) { - return certFunc() - } - } - if caCertFile != "" { - if err := setCertPool(caCertFile, &config.RootCAs); err != nil { - return nil, err - } - } - return config, nil -} - -// CreateServerConfig creates a new tls.Config for use by a server. The certFile and keyFile -// parameters are the paths to the server's certificate and key files, which will be used to -// authenticate the server to the client. The caCertFile parameter is the path to the CA -// certificate file, which the server will use to verify any certificate presented by the -// client. If mtls is MTLSStateEnabled, the server will require the client to present a -// valid certificate. -func CreateServerConfig(certFile, keyFile, caCertFile string, mtls MTLSState) (*tls.Config, error) { - var err error - - config := createBaseTLSConfig(NoServerName, false) - config.Certificates = make([]tls.Certificate, 1) - config.Certificates[0], err = tls.LoadX509KeyPair(certFile, keyFile) - if err != nil { - return nil, err - } - if caCertFile != "" { - if err := setCertPool(caCertFile, &config.ClientCAs); err != nil { - return nil, err - } - } - config.ClientAuth = tls.ClientAuthType(mtls) - return config, nil -} - -// CreateServerConfigWithFunc creates a new tls.Config for use by a server. The certFunc -// parameter is a function that returns the server's certificate and key. The caCertFile -// parameter is the path to the CA certificate file, which the server will use to verify -// any certificate presented by the client. If mtls is MTLSStateEnabled, the server will -// require the client to present a valid certificate. -func CreateServerConfigWithFunc(certFunc func() (*tls.Certificate, error), caCertFile string, mtls MTLSState) (*tls.Config, error) { - config := createBaseTLSConfig(NoServerName, false) - config.GetCertificate = func(hello *tls.ClientHelloInfo) (*tls.Certificate, error) { - return certFunc() - } - if caCertFile != "" { - if err := setCertPool(caCertFile, &config.ClientCAs); err != nil { - return nil, err - } - } - config.ClientAuth = tls.ClientAuthType(mtls) - return config, nil -} - func createBaseTLSConfig(serverName string, noverify bool) *tls.Config { return &tls.Config{ ServerName: serverName, diff --git a/service/rqlite/internal/rtls/reloader.go b/service/rqlite/internal/rtls/reloader.go index 7e17049..06daa0e 100644 --- a/service/rqlite/internal/rtls/reloader.go +++ b/service/rqlite/internal/rtls/reloader.go @@ -21,26 +21,6 @@ type CertReloader struct { cert *tls.Certificate } -// NewCertReloader creates a new CertReloader instance. -func NewCertReloader(cert, key string) (*CertReloader, error) { - cr := &CertReloader{ - certPath: cert, - keyPath: key, - logger: log.New(os.Stderr, "[cert-reloader] ", log.LstdFlags), - } - pair, err := loadKeyPair(cr.certPath, cr.keyPath) - if err != nil { - return nil, err - } - cr.cert = &pair - latestTime, err := latestModTime(cr.certPath, cr.keyPath) - if err != nil { - return nil, err - } - cr.modTime = latestTime - return cr, nil -} - // GetCertificate returns the current certificate. It reloads the certificate // if it has been modified since the last load. GetCertificate is thread-safe // and if the cert has not changed this function will execute concurrently with From fc5a21d6bb64686b28c3e3a9b76008114dbfb5ce Mon Sep 17 00:00:00 2001 From: likhachevam Date: Mon, 24 Nov 2025 15:21:15 +0300 Subject: [PATCH 11/13] MSP-6703 add AutoOptimizeInterval to config.yml --- conf/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/conf/config.yml b/conf/config.yml index c6dee3a..39869c0 100644 --- a/conf/config.yml +++ b/conf/config.yml @@ -35,6 +35,7 @@ rqlite: JoinAddrs: "127.0.0.1:9008" FKConstraints: true AutoVacInterval: 12h + AutoOptimizeInterval: 23h JoinAs: default backup: From de3e456617d49a85d7d9bd5a368168fbe717dd1a Mon Sep 17 00:00:00 2001 From: likhachevam Date: Mon, 1 Dec 2025 11:39:16 +0300 Subject: [PATCH 12/13] MSP-6703 fix 'enabled' config field --- cmd/migrate/go.mod | 4 ++-- cmd/migrate/go.sum | 8 ++++---- conf/config.yml | 2 +- go.mod | 6 +++--- go.sum | 12 ++++++------ service/rqlite/config_flags.go | 2 +- service/rqlite/main.go | 8 ++++---- service/startup/service.go | 2 +- tests/acceptance_test.go | 2 +- tests/autodiscovery_test.go | 2 +- 10 files changed, 24 insertions(+), 24 deletions(-) diff --git a/cmd/migrate/go.mod b/cmd/migrate/go.mod index bc49675..9b40cc1 100644 --- a/cmd/migrate/go.mod +++ b/cmd/migrate/go.mod @@ -9,7 +9,7 @@ require ( github.com/mattn/go-sqlite3 v1.14.32 github.com/pkg/errors v0.9.1 github.com/pressly/goose/v3 v3.26.0 - github.com/txix-open/isp-kit v1.63.2 + github.com/txix-open/isp-kit v1.63.3 isp-config-service v0.0.0-00010101000000-000000000000 ) @@ -69,7 +69,7 @@ require ( golang.org/x/sys v0.38.0 // indirect golang.org/x/text v0.31.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20251111163417-95abcf5c77ba // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20251111163417-95abcf5c77ba // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20251124214823-79d6a2a48846 // indirect google.golang.org/grpc v1.77.0 // indirect google.golang.org/protobuf v1.36.10 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect diff --git a/cmd/migrate/go.sum b/cmd/migrate/go.sum index d9a822b..d3cb399 100644 --- a/cmd/migrate/go.sum +++ b/cmd/migrate/go.sum @@ -147,8 +147,8 @@ github.com/txix-open/bellows v1.2.0 h1:CXv8nQaZtB/micraeRilYyj/gtfv+bqBgP5aPYQgj github.com/txix-open/bellows v1.2.0/go.mod h1:qbKCy+RTgD30Qpw1fyb3y3jp5Y9mGhLLxgae1l0W92o= github.com/txix-open/etp/v4 v4.0.1 h1:5VSYgGsvnMz0tvUHsjVWFETI0qWBTCF1O3ARCHaCIgA= github.com/txix-open/etp/v4 v4.0.1/go.mod h1:FIu7TUDdwcgmtmF6tFTV1bGA2fRY/iVaPQdsGzvqYc8= -github.com/txix-open/isp-kit v1.63.2 h1:TNk5JNNfrMXc964abLX4XYK4ofESI/4MofO1h7T5NLk= -github.com/txix-open/isp-kit v1.63.2/go.mod h1:rwqKqB3PyZxaoep6iH1PKL89LS9nzRklA6+S4II72M4= +github.com/txix-open/isp-kit v1.63.3 h1:UJLgR4z8sYXUX6r1sl6Ww1aijPx6b7ieMeB+elZoViM= +github.com/txix-open/isp-kit v1.63.3/go.mod h1:rwqKqB3PyZxaoep6iH1PKL89LS9nzRklA6+S4II72M4= github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb h1:UJgT4u/QMv5QHKOQeJ7igShHa36c2/vIRqJiRLdDlf0= github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb/go.mod h1:0biAFE0bgbcKeBBAwgEDhbZz6uT1vuSETCrFQlv2RiA= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= @@ -197,8 +197,8 @@ gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= google.golang.org/genproto/googleapis/api v0.0.0-20251111163417-95abcf5c77ba h1:B14OtaXuMaCQsl2deSvNkyPKIzq3BjfxQp8d00QyWx4= google.golang.org/genproto/googleapis/api v0.0.0-20251111163417-95abcf5c77ba/go.mod h1:G5IanEx8/PgI9w6CFcYQf7jMtHQhZruvfM1i3qOqk5U= -google.golang.org/genproto/googleapis/rpc v0.0.0-20251111163417-95abcf5c77ba h1:UKgtfRM7Yh93Sya0Fo8ZzhDP4qBckrrxEr2oF5UIVb8= -google.golang.org/genproto/googleapis/rpc v0.0.0-20251111163417-95abcf5c77ba/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251124214823-79d6a2a48846 h1:Wgl1rcDNThT+Zn47YyCXOXyX/COgMTIdhJ717F0l4xk= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251124214823-79d6a2a48846/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= google.golang.org/grpc v1.77.0 h1:wVVY6/8cGA6vvffn+wWK5ToddbgdU3d8MNENr4evgXM= google.golang.org/grpc v1.77.0/go.mod h1:z0BY1iVj0q8E1uSQCjL9cppRj+gnZjzDnzV0dHhrNig= google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE= diff --git a/conf/config.yml b/conf/config.yml index 39869c0..3036a71 100644 --- a/conf/config.yml +++ b/conf/config.yml @@ -39,7 +39,7 @@ rqlite: JoinAs: default backup: - Enabled: true + Enable: true Amount: 5 Interval: "24h" ClearInterval: "168h" diff --git a/go.mod b/go.mod index 345c720..fde551a 100644 --- a/go.mod +++ b/go.mod @@ -16,12 +16,12 @@ require ( github.com/prometheus/client_golang v1.23.2 github.com/rqlite/gorqlite v0.0.0-20250609141355-ac86a4a1c9a8 github.com/rqlite/rqlite-disco-clients v0.0.0-20250205044118-8ada2b350099 - github.com/rqlite/rqlite/v9 v9.3.1 + github.com/rqlite/rqlite/v9 v9.3.2 github.com/stretchr/testify v1.11.1 github.com/tidwall/gjson v1.18.0 github.com/txix-open/etp/v4 v4.0.1 github.com/txix-open/go-cmp v0.0.0-20240401171944-16b203530f60 - github.com/txix-open/isp-kit v1.63.2 + github.com/txix-open/isp-kit v1.63.3 github.com/xeipuuv/gojsonschema v1.2.0 golang.org/x/sync v0.18.0 google.golang.org/grpc v1.77.0 @@ -119,7 +119,7 @@ require ( golang.org/x/sys v0.38.0 // indirect golang.org/x/text v0.31.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20251111163417-95abcf5c77ba // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20251111163417-95abcf5c77ba // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20251124214823-79d6a2a48846 // indirect google.golang.org/protobuf v1.36.10 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index 6a5d5d1..ac0fe20 100644 --- a/go.sum +++ b/go.sum @@ -272,8 +272,8 @@ github.com/rqlite/raft-boltdb/v2 v2.0.0-20230523104317-c08e70f4de48 h1:NZ62M+kT0 github.com/rqlite/raft-boltdb/v2 v2.0.0-20230523104317-c08e70f4de48/go.mod h1:CRnsxgy5G8fAf5J+AM0yrsSdxXHKkIYOaq2sm+Q4DYc= github.com/rqlite/rqlite-disco-clients v0.0.0-20250205044118-8ada2b350099 h1:5cqkVLdl6sGJSY3kiF2dqaA3bD+8OS5FUdZqO0BxXLU= github.com/rqlite/rqlite-disco-clients v0.0.0-20250205044118-8ada2b350099/go.mod h1:6SVI8KegsW9Fyu2UQ+uvw0JI5CAILRYRyiQ/OFSJPrs= -github.com/rqlite/rqlite/v9 v9.3.1 h1:lCnQa1bqMzhjeypj7BMzA+VZneVisyqh3t559rIO7WM= -github.com/rqlite/rqlite/v9 v9.3.1/go.mod h1:T2z3ZoxwC30bl9stu+GSB4aGrWm/OznZPae2tODNioE= +github.com/rqlite/rqlite/v9 v9.3.2 h1:/gpsmjbKqRTb4LEF0G5ik0g3jxKFmvMKK3L11Rk6UYE= +github.com/rqlite/rqlite/v9 v9.3.2/go.mod h1:2TBF943qiqoJI+4/o46Rfgec2il/IL6hjlqHXvj0uII= github.com/rqlite/sql v0.0.0-20251114131613-ef07423e7137 h1:OG5MfYAA0yaWgllfPdOq9Xa2bo1vpurCNx1LWz7+Zh0= github.com/rqlite/sql v0.0.0-20251114131613-ef07423e7137/go.mod h1:ib9zVtNgRKiGuoMyUqqL5aNpk+r+++YlyiVIkclVqPg= github.com/sethvargo/go-retry v0.3.0 h1:EEt31A35QhrcRZtrYFDTBg91cqZVnFL2navjDrah2SE= @@ -313,8 +313,8 @@ github.com/txix-open/go-cmp v0.0.0-20240401171944-16b203530f60 h1:7SZ72lNU69g8ei github.com/txix-open/go-cmp v0.0.0-20240401171944-16b203530f60/go.mod h1:jzpq0uwcdGq0OSNXZ6vv6UJkCOU/fLPgeoz+KkGDYgo= github.com/txix-open/grmq v1.9.0 h1:ArDbJJcFX9zXKEcPf49rp9nYiRyGMJxGKJAxdbSsfaM= github.com/txix-open/grmq v1.9.0/go.mod h1:EyFOP17KrwEFOUjR+PH8iH3LCtiN9TSQ8t0ysyk62po= -github.com/txix-open/isp-kit v1.63.2 h1:TNk5JNNfrMXc964abLX4XYK4ofESI/4MofO1h7T5NLk= -github.com/txix-open/isp-kit v1.63.2/go.mod h1:rwqKqB3PyZxaoep6iH1PKL89LS9nzRklA6+S4II72M4= +github.com/txix-open/isp-kit v1.63.3 h1:UJLgR4z8sYXUX6r1sl6Ww1aijPx6b7ieMeB+elZoViM= +github.com/txix-open/isp-kit v1.63.3/go.mod h1:rwqKqB3PyZxaoep6iH1PKL89LS9nzRklA6+S4II72M4= github.com/txix-open/jsonschema v1.3.0 h1:XGuOTg22G7PdqfKypjajM20/i5FyGfFYsJKmheebKi4= github.com/txix-open/jsonschema v1.3.0/go.mod h1:l8YDZ1nvJrw6uxWowSVOxCV/ebiMJyapffW87ZEqH00= github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb h1:UJgT4u/QMv5QHKOQeJ7igShHa36c2/vIRqJiRLdDlf0= @@ -431,8 +431,8 @@ gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto/googleapis/api v0.0.0-20251111163417-95abcf5c77ba h1:B14OtaXuMaCQsl2deSvNkyPKIzq3BjfxQp8d00QyWx4= google.golang.org/genproto/googleapis/api v0.0.0-20251111163417-95abcf5c77ba/go.mod h1:G5IanEx8/PgI9w6CFcYQf7jMtHQhZruvfM1i3qOqk5U= -google.golang.org/genproto/googleapis/rpc v0.0.0-20251111163417-95abcf5c77ba h1:UKgtfRM7Yh93Sya0Fo8ZzhDP4qBckrrxEr2oF5UIVb8= -google.golang.org/genproto/googleapis/rpc v0.0.0-20251111163417-95abcf5c77ba/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251124214823-79d6a2a48846 h1:Wgl1rcDNThT+Zn47YyCXOXyX/COgMTIdhJ717F0l4xk= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251124214823-79d6a2a48846/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= google.golang.org/grpc v1.77.0 h1:wVVY6/8cGA6vvffn+wWK5ToddbgdU3d8MNENr4evgXM= google.golang.org/grpc v1.77.0/go.mod h1:z0BY1iVj0q8E1uSQCjL9cppRj+gnZjzDnzV0dHhrNig= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= diff --git a/service/rqlite/config_flags.go b/service/rqlite/config_flags.go index 5011c07..76bd077 100644 --- a/service/rqlite/config_flags.go +++ b/service/rqlite/config_flags.go @@ -201,7 +201,7 @@ type Config struct { } type Backup struct { - Enabled bool + Enable bool Amount int Version int Type string diff --git a/service/rqlite/main.go b/service/rqlite/main.go index 0723872..e4d398f 100644 --- a/service/rqlite/main.go +++ b/service/rqlite/main.go @@ -233,13 +233,13 @@ func main(ctx context.Context, r *Rqlite) error { return nil } -func startAutoBackups(ctx context.Context, cfg *Backup, str *store.Store) (*backup.Uploader, error) { - if !cfg.Enabled { +func startAutoBackups(ctx context.Context, backupCfg *Backup, str *store.Store) (*backup.Uploader, error) { + if !backupCfg.Enable { return nil, nil } - cfg.SetParams() - b, err := json.Marshal(cfg) + backupCfg.SetParams() + b, err := json.Marshal(backupCfg) if err != nil { return nil, errors.Errorf("failed to marshal auto-backup settings: %s", err.Error()) } diff --git a/service/startup/service.go b/service/startup/service.go index 3077586..5993201 100644 --- a/service/startup/service.go +++ b/service/startup/service.go @@ -143,7 +143,7 @@ func (s *Service) Run(ctx context.Context) error { s.locatorConfig.CleanEventWorker.Run(ctx) s.locatorConfig.CleanPhantomBackendWorker.Run(ctx) - if cfg.Local.Backup.Enabled { + if cfg.Local.Backup.Enable { s.locatorConfig.CleanBackupsWorker.Run(ctx) } diff --git a/tests/acceptance_test.go b/tests/acceptance_test.go index bdc4b73..fbdcdd1 100644 --- a/tests/acceptance_test.go +++ b/tests/acceptance_test.go @@ -176,7 +176,7 @@ func setupTest(t *testing.T) log.Logger { boot.MigrationsDir = "../migrations" dataPath := dataDir(t) boot.App.Config().Set("rqlite.DataPath", dataPath) - boot.App.Config().Set("backup.Enabled", false) + boot.App.Config().Set("backup.Enable", false) logger := boot.App.Logger() startup, err := startup.New(boot) diff --git a/tests/autodiscovery_test.go b/tests/autodiscovery_test.go index 496876d..abf2639 100644 --- a/tests/autodiscovery_test.go +++ b/tests/autodiscovery_test.go @@ -96,7 +96,7 @@ func setupTestWithAppRun(t *testing.T) (*require.Assertions, log.Logger) { boot.MigrationsDir = "../migrations" dataPath := dataDir(t) boot.App.Config().Set("rqlite.DataPath", dataPath) - boot.App.Config().Set("backup.Enabled", false) + boot.App.Config().Set("backup.Enable", false) logger := boot.App.Logger() startup, err := startup.New(boot) From 924d1cf6fe4964408d60301ee815d1c897f53c9b Mon Sep 17 00:00:00 2001 From: likhachevam Date: Mon, 1 Dec 2025 12:34:15 +0300 Subject: [PATCH 13/13] MSP-6703 up version to v3.7.0 --- .version | 2 +- changelog.md | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.version b/.version index 40c341b..7c69a55 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -3.6.0 +3.7.0 diff --git a/changelog.md b/changelog.md index e4c3796..7d378e2 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,9 @@ +## v3.7.0 +* добавлены rqlite-автобэкапы и прокси-эндпоинт `/backup` для создания резервных копий +* изменен таймаут ожидания лидера с 30 до 180 секунд +* исправлены потенциальные race conditions +* добавлен параметр периодической оптимизации sqlite `AutoOptimizeInterval: 23h` +* обновлены зависимости ## v3.6.0 * добавлен новый эндпоинт `config/config/purge_versions` для удаления старых версий всех конфигураций модуля, за исключением n последних * обновлены зависимости