BeryJu / gravity

Fully-replicated DNS and DHCP Server with ad-blocking powered by etcd
https://gravity.beryju.io
GNU General Public License v3.0
532 stars 12 forks source link

backup #1072

Open Simon-CR opened 5 months ago

Simon-CR commented 5 months ago

I'm trying to create a backup (local single file). When I start the backup process, I get those files created in the backup folder: temp-gravity-snapshot.2769572314.etcd temp-gravity-snapshot.2930763333.etcd but they are empty. Not sure how to troubleshoot this next.

BeryJu commented 4 months ago

you should be able to see some more info related to this in the logs when grepping for "role":"backup"

Simon-CR commented 4 months ago

I'm kind of a fringe case. I'm running this in a mikrotik container, which works perfect except for this...

thanks

{"level":"info","ts":1718711843.5828357,"logger":"role.api","msg":"/api/v1/backup/status","instance":"scr-gravity1","version":"0.9.0-3f90c704","host":"10.0.0.101:8008","remote":"192.168.172.208:62262","runtime":0,"method":"GET","size":16,"status":200,"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0","user":"admin"}
{"level":"info","ts":1718711847.1169844,"logger":"role.api","msg":"/api/v1/backup/start?wait=false","instance":"scr-gravity1","version":"0.9.0-3f90c704","host":"10.0.0.101:8008","remote":"192.168.172.208:62265","runtime":0,"method":"POST","size":51,"status":200,"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0","user":"admin"}
{"level":"error","ts":1718711847.1171348,"logger":"etcd.client","msg":"streamer failed to create ClientStream","instance":"scr-gravity1","version":"0.9.0-3f90c704","error":"rpc error: code = Canceled desc = context canceled","stacktrace":"go.etcd.io/etcd/client/v3.(*Client).streamClientInterceptor.func1\n\t/go/pkg/mod/go.etcd.io/etcd/client/v3@v3.5.14/retry_interceptor.go:130\ngoogle.golang.org/grpc.(*ClientConn).NewStream\n\t/go/pkg/mod/google.golang.org/grpc@v1.63.2/stream.go:167\ngo.etcd.io/etcd/api/v3/etcdserverpb.(*maintenanceClient).Snapshot\n\t/go/pkg/mod/go.etcd.io/etcd/api/v3@v3.5.14/etcdserverpb/rpc.pb.go:7358\ngo.etcd.io/etcd/client/v3.(*retryMaintenanceClient).Snapshot\n\t/go/pkg/mod/go.etcd.io/etcd/client/v3@v3.5.14/retry.go:214\ngo.etcd.io/etcd/client/v3.(*maintenance).Snapshot\n\t/go/pkg/mod/go.etcd.io/etcd/client/v3@v3.5.14/maintenance.go:207\nberyju.io/gravity/pkg/roles/backup.(*Role).snapshotToFile\n\t/workspace/pkg/roles/backup/backup.go:81\nberyju.io/gravity/pkg/roles/backup.(*Role).SaveSnapshot\n\t/workspace/pkg/roles/backup/backup.go:119"}
{"level":"warn","ts":1718711847.1172833,"logger":"role.backup","msg":"failed to snapshot","instance":"scr-gravity1","version":"0.9.0-3f90c704","error":"context canceled"}
{"level":"warn","ts":1718711847.117487,"logger":"role.backup","msg":"failed to save status","instance":"scr-gravity1","version":"0.9.0-3f90c704","error":"context canceled"}
{"level":"info","ts":1718711847.2174735,"logger":"role.api","msg":"/api/v1/backup/status","instance":"scr-gravity1","version":"0.9.0-3f90c704","host":"10.0.0.101:8008","remote":"192.168.172.208:62261","runtime":0,"method":"GET","size":16,"status":200,"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0","user":"admin"}
BeryJu commented 4 months ago

the above commit should fix that, you can switch to the latest build (which is pretty closet o 0.9 anyways) after the CI is done

Simon-CR commented 4 months ago

Hi, Just to confirm, backup trigger now works.

out of curiosity, "Starting with 0.4.5, Gravity will also keep 1 snapshot locally", will that backup be updated daily or can I force update it daily somehow, and have some other script pull it to maintain some history. I don't use S3

BeryJu commented 4 months ago

that local snapshot is created everytime you trigger a backup start or with whatever cron expression is configured in the backup role config