Skip to content

Commit

Permalink
Blow the dust off, update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
theandrew168 committed Sep 27, 2022
1 parent 635c224 commit e7b05c1
Show file tree
Hide file tree
Showing 14 changed files with 131 additions and 125 deletions.
11 changes: 6 additions & 5 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,16 @@ nfpms:
- deb
bindir: /usr/bin
contents:
- src: scripts/pg2s3.service
- src: script/pg2s3.service
dst: /lib/systemd/system/pg2s3.service
- src: pg2s3.conf
type: config
- src: script/pg2s3.conf
dst: /etc/pg2s3.conf
type: config
scripts:
postinstall: scripts/postinstall.sh
preremove: scripts/preremove.sh
postremove: scripts/postremove.sh
postinstall: script/postinstall.sh
preremove: script/preremove.sh
postremove: script/postremove.sh

checksum:
name_template: checksums.txt
Expand Down
17 changes: 15 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,29 @@ build:

.PHONY: test
test:
go test -count=1 -v ./...
go test -count=1 ./...

.PHONY: cover
cover:
go test -coverprofile=c.out -coverpkg=./... -count=1 ./...
go tool cover -html=c.out

.PHONY: release
release:
goreleaser release --snapshot --rm-dist

.PHONY: lint
lint:
go run github.com/golangci/golangci-lint/cmd/golangci-lint@latest run --fast

.PHONY: format
format:
go fmt ./...
gofmt -l -s -w .

.PHONY: update
update:
go get -u ./...
go mod tidy

.PHONY: clean
clean:
Expand Down
2 changes: 1 addition & 1 deletion cmd/cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func main() {

if count == 0 && cfg.BackupSchedule != "" {
s := gocron.NewScheduler(time.UTC)
s.Cron(cfg.BackupSchedule).Do(func(){
s.Cron(cfg.BackupSchedule).Do(func() {
err := backup(client, cfg)
if err != nil {
log.Println(err)
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ services:
- 9001:9001
command: minio server /data --console-address :9001
environment:
MINIO_ROOT_USER: AKIAIOSFODNN7EXAMPLE
MINIO_ROOT_PASSWORD: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadmin
35 changes: 17 additions & 18 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,39 @@ go 1.17

require (
filippo.io/age v1.0.0
github.com/BurntSushi/toml v0.4.1
github.com/BurntSushi/toml v1.2.0
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf
github.com/djherbis/buffer v1.2.0
github.com/go-co-op/gocron v1.9.0
github.com/jackc/pgx/v4 v4.14.1
github.com/minio/minio-go/v7 v7.0.16
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b
github.com/go-co-op/gocron v1.17.0
github.com/jackc/pgx/v4 v4.17.2
github.com/minio/minio-go/v7 v7.0.38
golang.org/x/term v0.0.0-20220919170432-7a66f970e087
)

require (
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.10.1 // indirect
github.com/jackc/pgconn v1.13.0 // indirect
github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgproto3/v2 v2.2.0 // indirect
github.com/jackc/pgproto3/v2 v2.3.1 // indirect
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
github.com/jackc/pgtype v1.9.1 // indirect
github.com/jackc/pgtype v1.12.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.13.6 // indirect
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
github.com/klauspost/compress v1.15.11 // indirect
github.com/klauspost/cpuid/v2 v2.1.1 // indirect
github.com/minio/md5-simd v1.1.2 // indirect
github.com/minio/sha256-simd v1.0.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/rs/xid v1.3.0 // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
golang.org/x/crypto v0.0.0-20211202192323-5770296d904e // indirect
golang.org/x/net v0.0.0-20211203184738-4852103109b8 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/sys v0.0.0-20211124211545-fe61309f8881 // indirect
github.com/rs/xid v1.4.0 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
golang.org/x/crypto v0.0.0-20220926161630-eccd6366d1be // indirect
golang.org/x/net v0.0.0-20220926192436-02166a98028e // indirect
golang.org/x/sync v0.0.0-20220923202941-7f9b1623fab7 // indirect
golang.org/x/sys v0.0.0-20220926163933-8cfa568d3c25 // indirect
golang.org/x/text v0.3.7 // indirect
gopkg.in/ini.v1 v1.66.2 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
)
111 changes: 52 additions & 59 deletions go.sum

Large diffs are not rendered by default.

35 changes: 9 additions & 26 deletions pg2s3.conf
Original file line number Diff line number Diff line change
@@ -1,26 +1,9 @@
# REQUIRED - PostgreSQL connection string
#pg_connection_uri = ""

# REQUIRED - S3-compatible storage endpoint
#s3_endpoint = ""

# REQUIRED - S3-compatible storage access key ID
#s3_access_key_id = ""

# REQUIRED - S3-compatible storage secret access key
#s3_secret_access_key = ""

# REQUIRED - S3-compatible storage bucket name
#s3_bucket_name = ""

# REQUIRED - Prefix attached to the name of each backup
#backup_prefix = ""

# OPTIONAL - Number of backups to retain after pruning
#backup_retention = 0

# OPTIONAL - Backup schedule as a standard cron expression (UTC)
#backup_schedule = ""

# OPTIONAL - Public key for backup encryption
#age_public_key = ""
pg_connection_uri = "postgresql://postgres:postgres@localhost:5432/postgres"
s3_endpoint = "localhost:9000"
s3_access_key_id = "minioadmin"
s3_secret_access_key = "minioadmin"
s3_bucket_name = "pg2s3"
backup_prefix = "pg2s3"
backup_retention = 30
backup_schedule = "0 9 * * *"
age_public_key = "age156hm5jvxfvf8xf0zjs52gc5hhq64rt23gw3fehqj2vu77sk07a5qvplj52"
6 changes: 3 additions & 3 deletions pg2s3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func TestParseBackupTimestamp(t *testing.T) {
}

func TestBackup(t *testing.T) {
cfg, err := pg2s3.ReadConfig("./testdata/pg2s3.conf")
cfg, err := pg2s3.ReadConfig("./pg2s3.conf")
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -158,7 +158,7 @@ func TestBackup(t *testing.T) {
}

func TestRestore(t *testing.T) {
cfg, err := pg2s3.ReadConfig("./testdata/pg2s3.conf")
cfg, err := pg2s3.ReadConfig("./pg2s3.conf")
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -203,7 +203,7 @@ func TestRestore(t *testing.T) {
}

func TestPrune(t *testing.T) {
cfg, err := pg2s3.ReadConfig("./testdata/pg2s3.conf")
cfg, err := pg2s3.ReadConfig("./pg2s3.conf")
if err != nil {
t.Fatal(err)
}
Expand Down
26 changes: 26 additions & 0 deletions script/pg2s3.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# REQUIRED - PostgreSQL connection string
#pg_connection_uri = ""

# REQUIRED - S3-compatible storage endpoint
#s3_endpoint = ""

# REQUIRED - S3-compatible storage access key ID
#s3_access_key_id = ""

# REQUIRED - S3-compatible storage secret access key
#s3_secret_access_key = ""

# REQUIRED - S3-compatible storage bucket name
#s3_bucket_name = ""

# REQUIRED - Prefix attached to the name of each backup
#backup_prefix = ""

# OPTIONAL - Number of backups to retain after pruning
#backup_retention = 0

# OPTIONAL - Backup schedule as a standard cron expression (UTC)
#backup_schedule = ""

# OPTIONAL - Public key for backup encryption
#age_public_key = ""
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 0 additions & 9 deletions testdata/pg2s3.conf

This file was deleted.

0 comments on commit e7b05c1

Please sign in to comment.