From 0d66ebe6c1903d573938b66914b7cbd4407ed7ba Mon Sep 17 00:00:00 2001 From: Jonas Kaninda Date: Fri, 6 Dec 2024 03:08:17 +0100 Subject: [PATCH 1/2] Add LICENSE --- README.md | 5 ----- cmd/backup.go | 23 +++++++++++++++++++++++ cmd/migrate.go | 27 ++++++++++++++++++++++----- cmd/restore.go | 27 ++++++++++++++++++++++----- cmd/root.go | 28 ++++++++++++++++++++++------ cmd/version.go | 27 ++++++++++++++++++++++----- docs/index.md | 5 ----- internal/backup.go | 24 ++++++++++++++++++++++++ internal/config.go | 27 ++++++++++++++++++++++----- internal/helper.go | 27 ++++++++++++++++++++++----- internal/migrate.go | 27 ++++++++++++++++++++++----- internal/restore.go | 30 ++++++++++++++++++++++++------ internal/var.go | 24 ++++++++++++++++++++++++ main.go | 27 ++++++++++++++++++++++----- pkg/logger/logger.go | 24 ++++++++++++++++++++++++ pkg/logger/var.go | 23 +++++++++++++++++++++++ pkg/storage/ftp/ftp.go | 24 ++++++++++++++++++++++++ pkg/storage/local/local.go | 24 ++++++++++++++++++++++++ pkg/storage/s3/s3.go | 24 ++++++++++++++++++++++++ pkg/storage/ssh/ssh.go | 24 ++++++++++++++++++++++++ pkg/storage/storage.go | 26 +++++++++++++++++++++++++- utils/config.go | 24 ++++++++++++++++++++++++ utils/constant.go | 24 ++++++++++++++++++++++++ utils/notification.go | 24 ++++++++++++++++++++++++ utils/utils.go | 27 ++++++++++++++++++++++----- 25 files changed, 533 insertions(+), 63 deletions(-) diff --git a/README.md b/README.md index 1607bed..bb701d9 100644 --- a/README.md +++ b/README.md @@ -163,11 +163,6 @@ docker pull ghcr.io/jkaninda/pg-bkup Documentation references Docker Hub, but all examples will work using ghcr.io just as well. -## Supported Engines - -This image is developed and tested against the Docker CE engine and Kubernetes exclusively. -While it may work against different implementations, there are no guarantees about support for non-Docker engines. - ## References We decided to publish this image as a simpler and more lightweight alternative because of the following requirements: diff --git a/cmd/backup.go b/cmd/backup.go index 99a7fc5..d826e46 100644 --- a/cmd/backup.go +++ b/cmd/backup.go @@ -1,6 +1,29 @@ // Package cmd / package cmd +/* +MIT License + +Copyright (c) 2023 Jonas Kaninda + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ import ( "github.com/jkaninda/pg-bkup/internal" "github.com/jkaninda/pg-bkup/pkg/logger" diff --git a/cmd/migrate.go b/cmd/migrate.go index 6f45159..c898ce1 100644 --- a/cmd/migrate.go +++ b/cmd/migrate.go @@ -1,10 +1,27 @@ // Package cmd / /* -**** -@author Jonas Kaninda -@license MIT License -@Copyright © 2024 Jonas Kaninda -**/ +MIT License + +Copyright (c) 2023 Jonas Kaninda + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ package cmd import ( diff --git a/cmd/restore.go b/cmd/restore.go index b944a4b..c8ab136 100644 --- a/cmd/restore.go +++ b/cmd/restore.go @@ -1,10 +1,27 @@ // Package cmd / /* -**** -@author Jonas Kaninda -@license MIT License -@Copyright © 2024 Jonas Kaninda -**/ +MIT License + +Copyright (c) 2023 Jonas Kaninda + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ package cmd import ( diff --git a/cmd/root.go b/cmd/root.go index 7f31ffa..7f26955 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -1,11 +1,27 @@ // Package cmd / /* -* -*** -@author Jonas Kaninda -@license MIT License -@Copyright © 2024 Jonas Kaninda -**/ +MIT License + +Copyright (c) 2023 Jonas Kaninda + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ package cmd import ( diff --git a/cmd/version.go b/cmd/version.go index 8b3932a..b88279a 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -1,10 +1,27 @@ // Package cmd / /* -**** -@author Jonas Kaninda -@license MIT License -@Copyright © 2024 Jonas Kaninda -**/ +MIT License + +Copyright (c) 2023 Jonas Kaninda + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ package cmd import ( diff --git a/docs/index.md b/docs/index.md index 0538ad4..f6a4665 100644 --- a/docs/index.md +++ b/docs/index.md @@ -152,11 +152,6 @@ docker pull ghcr.io/jkaninda/pg-bkup Documentation references Docker Hub, but all examples will work using ghcr.io just as well. -## Supported Engines - -This image is developed and tested against the Docker CE engine and Kubernetes exclusively. -While it may work against different implementations, there are no guarantees about support for non-Docker engines. - ## References We decided to publish this image as a simpler and more lightweight alternative because of the following requirements: diff --git a/internal/backup.go b/internal/backup.go index 494e3da..0699245 100644 --- a/internal/backup.go +++ b/internal/backup.go @@ -18,6 +18,30 @@ import ( "time" ) +/* +MIT License + +Copyright (c) 2023 Jonas Kaninda + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + func StartBackup(cmd *cobra.Command) { intro() // Initialize backup configs diff --git a/internal/config.go b/internal/config.go index 2d041b0..f133804 100644 --- a/internal/config.go +++ b/internal/config.go @@ -1,10 +1,27 @@ // Package internal / /* -**** -@author Jonas Kaninda -@license MIT License -@Copyright © 2024 Jonas Kaninda -**/ +MIT License + +Copyright (c) 2023 Jonas Kaninda + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ package internal import ( diff --git a/internal/helper.go b/internal/helper.go index 3c4b246..7469118 100644 --- a/internal/helper.go +++ b/internal/helper.go @@ -1,10 +1,27 @@ // Package internal / /* -**** -@author Jonas Kaninda -@license MIT License -@Copyright © 2024 Jonas Kaninda -**/ +MIT License + +Copyright (c) 2023 Jonas Kaninda + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ package internal import ( diff --git a/internal/migrate.go b/internal/migrate.go index 31fb99e..fc809ad 100644 --- a/internal/migrate.go +++ b/internal/migrate.go @@ -1,10 +1,27 @@ // Package internal / /* -**** -@author Jonas Kaninda -@license MIT License -@Copyright © 2024 Jonas Kaninda -**/ +MIT License + +Copyright (c) 2023 Jonas Kaninda + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ package internal import ( diff --git a/internal/restore.go b/internal/restore.go index d29bf82..9490962 100644 --- a/internal/restore.go +++ b/internal/restore.go @@ -1,12 +1,30 @@ // Package internal / -/* -**** -@author Jonas Kaninda -@license MIT License -@Copyright © 2024 Jonas Kaninda -**/ package internal +/* +MIT License + +Copyright (c) 2023 Jonas Kaninda + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + import ( "github.com/jkaninda/pg-bkup/pkg/logger" "github.com/jkaninda/pg-bkup/pkg/storage/ftp" diff --git a/internal/var.go b/internal/var.go index 4b16738..1cfd348 100644 --- a/internal/var.go +++ b/internal/var.go @@ -1,6 +1,30 @@ // Package internal / package internal +/* +MIT License + +Copyright (c) 2023 Jonas Kaninda + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + const tmpPath = "/tmp/backup" const gpgHome = "/config/gnupg" const gpgExtension = "gpg" diff --git a/main.go b/main.go index c0ec9c1..c00a9d1 100644 --- a/main.go +++ b/main.go @@ -1,10 +1,27 @@ // Package main / /* -**** -@author Jonas Kaninda -@license MIT License -@Copyright © 2024 Jonas Kaninda -**/ +MIT License + +Copyright (c) 2023 Jonas Kaninda + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ package main import "github.com/jkaninda/pg-bkup/cmd" diff --git a/pkg/logger/logger.go b/pkg/logger/logger.go index 291d7d7..d4215c4 100644 --- a/pkg/logger/logger.go +++ b/pkg/logger/logger.go @@ -8,6 +8,30 @@ import ( "strings" ) +/* +MIT License + +Copyright (c) 2023 Jonas Kaninda + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + // Info returns info log func Info(msg string, args ...interface{}) { log.SetOutput(getStd("/dev/stdout")) diff --git a/pkg/logger/var.go b/pkg/logger/var.go index 7ce6c56..4cb68af 100644 --- a/pkg/logger/var.go +++ b/pkg/logger/var.go @@ -1,3 +1,26 @@ package logger +/* +MIT License + +# Copyright (c) 2023 Jonas Kaninda + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ const traceLog = "trace" diff --git a/pkg/storage/ftp/ftp.go b/pkg/storage/ftp/ftp.go index 86d76a2..8a95394 100644 --- a/pkg/storage/ftp/ftp.go +++ b/pkg/storage/ftp/ftp.go @@ -10,6 +10,30 @@ import ( "time" ) +/* +MIT License + +Copyright (c) 2023 Jonas Kaninda + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + type ftpStorage struct { *pkg.Backend client *ftp.ServerConn diff --git a/pkg/storage/local/local.go b/pkg/storage/local/local.go index eecb32c..7589c56 100644 --- a/pkg/storage/local/local.go +++ b/pkg/storage/local/local.go @@ -8,6 +8,30 @@ import ( "time" ) +/* +MIT License + +Copyright (c) 2023 Jonas Kaninda + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + type localStorage struct { *pkg.Backend } diff --git a/pkg/storage/s3/s3.go b/pkg/storage/s3/s3.go index e974329..02d841d 100644 --- a/pkg/storage/s3/s3.go +++ b/pkg/storage/s3/s3.go @@ -15,6 +15,30 @@ import ( "time" ) +/* +MIT License + +Copyright (c) 2023 Jonas Kaninda + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + type s3Storage struct { *pkg.Backend client *session.Session diff --git a/pkg/storage/ssh/ssh.go b/pkg/storage/ssh/ssh.go index b4c5d3c..ada5eee 100644 --- a/pkg/storage/ssh/ssh.go +++ b/pkg/storage/ssh/ssh.go @@ -12,6 +12,30 @@ import ( "path/filepath" ) +/* +MIT License + +Copyright (c) 2023 Jonas Kaninda + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + type sshStorage struct { *pkg.Backend client scp.Client diff --git a/pkg/storage/storage.go b/pkg/storage/storage.go index 140fed9..f77fff8 100644 --- a/pkg/storage/storage.go +++ b/pkg/storage/storage.go @@ -1,4 +1,28 @@ -package pkg +package storage + +/* +MIT License + +Copyright (c) 2023 Jonas Kaninda + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ type Storage interface { Copy(fileName string) error diff --git a/utils/config.go b/utils/config.go index c498f03..7583de9 100644 --- a/utils/config.go +++ b/utils/config.go @@ -1,5 +1,29 @@ package utils +/* +MIT License + +Copyright (c) 2023 Jonas Kaninda + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + import "os" type MailConfig struct { diff --git a/utils/constant.go b/utils/constant.go index 84ac1d6..f39c811 100644 --- a/utils/constant.go +++ b/utils/constant.go @@ -1,6 +1,30 @@ // Package utils / package utils +/* +MIT License + +Copyright (c) 2023 Jonas Kaninda + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + import "os" const RestoreExample = "restore --dbname database --file db_20231219_022941.sql.gz\n" + diff --git a/utils/notification.go b/utils/notification.go index bfbce2d..dcb8fc1 100644 --- a/utils/notification.go +++ b/utils/notification.go @@ -1,5 +1,29 @@ package utils +/* +MIT License + +Copyright (c) 2023 Jonas Kaninda + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + import ( "bytes" "crypto/tls" diff --git a/utils/utils.go b/utils/utils.go index c808275..cc3a714 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -1,10 +1,27 @@ // Package utils / /* -**** -@author Jonas Kaninda -@license MIT License -@Copyright © 2024 Jonas Kaninda -**/ +MIT License + +Copyright (c) 2023 Jonas Kaninda + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ package utils import ( From 9f25a20a2865b4beacafb894243a0aaf6c566c03 Mon Sep 17 00:00:00 2001 From: Jonas Kaninda Date: Fri, 6 Dec 2024 03:11:49 +0100 Subject: [PATCH 2/2] docs: update core features --- README.md | 44 +++++++++++++++++++++++++++++++++----------- docs/index.md | 42 +++++++++++++++++++++++++++++++----------- 2 files changed, 64 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index bb701d9..490690b 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,7 @@ -# PostgreSQL Backup -PostgreSQL Backup is a Docker container image that can be used to backup, restore and migrate Postgres database. It supports local storage, AWS S3 or any S3 Alternatives for Object Storage, FTP and SSH compatible storage. -It also supports __encrypting__ your backups using GPG. - -The [jkaninda/pg-bkup](https://hub.docker.com/r/jkaninda/pg-bkup) Docker image can be deployed on Docker, Docker Swarm and Kubernetes. -It handles __recurring__ backups of postgres database on Docker and can be deployed as __Job or CronJob on Kubernetes__ using local, AWS S3 or SSH compatible storage. - -It also supports __encrypting__ your backups using GPG. - -Telegram and Email notifications on successful and failed backups. +# PG-BKUP +**PG-BKUP** is a Docker container image designed to **backup, restore, and migrate PostgreSQL databases**. +It supports a variety of storage options and ensures data security through GPG encryption. [![Build](https://github.com/jkaninda/pg-bkup/actions/workflows/release.yml/badge.svg)](https://github.com/jkaninda/pg-bkup/actions/workflows/release.yml) [![Go Report](https://goreportcard.com/badge/github.com/jkaninda/mysql-bkup)](https://goreportcard.com/report/github.com/jkaninda/pg-bkup) @@ -16,6 +9,35 @@ Telegram and Email notifications on successful and failed backups. ![Docker Pulls](https://img.shields.io/docker/pulls/jkaninda/pg-bkup?style=flat-square) buy ma a coffee +## Features + +- **Storage Options:** + - Local storage + - AWS S3 or any S3-compatible object storage + - FTP + - SSH-compatible storage + +- **Data Security:** + - Backups can be encrypted using **GPG** to ensure confidentiality. + +- **Deployment Flexibility:** + - Available as the [jkaninda/pg-bkup](https://hub.docker.com/r/jkaninda/pg-bkup) Docker image. + - Deployable on **Docker**, **Docker Swarm**, and **Kubernetes**. + - Supports recurring backups of PostgreSQL databases when deployed: + - On Docker for automated backup schedules. + - As a **Job** or **CronJob** on Kubernetes. + +- **Notifications:** + - Get real-time updates on backup success or failure via: + - **Telegram** + - **Email** + +## Use Cases + +- **Automated Recurring Backups:** Schedule regular backups for PostgreSQL databases. +- **Cross-Environment Migration:** Easily migrate your PostgreSQL databases across different environments using supported storage options. +- **Secure Backup Management:** Protect your data with GPG encryption. + Successfully tested on: - Docker @@ -88,7 +110,7 @@ services: - TZ=Europe/Paris # pg-bkup container must be connected to the same network with your database networks: - - web + - web networks: web: ``` diff --git a/docs/index.md b/docs/index.md index f6a4665..9a2e11c 100644 --- a/docs/index.md +++ b/docs/index.md @@ -4,13 +4,40 @@ layout: home nav_order: 1 --- -# About pg-bkup +# About PG-BKUP {:.no_toc} -PostreSQL Backup is a Docker container image that can be used to backup, restore and migrate Postgres database. It supports local storage, AWS S3 or any S3 Alternatives for Object Storage, ftp and SSH compatible storage. -It also supports database __encryption__ using GPG. -Telegram and Email notifications on successful and failed backups. +**PG-BKUP** is a Docker container image designed to **backup, restore, and migrate PostgreSQL databases**. +It supports a variety of storage options and ensures data security through GPG encryption. +## Features + +- **Storage Options:** + - Local storage + - AWS S3 or any S3-compatible object storage + - FTP + - SSH-compatible storage + +- **Data Security:** + - Backups can be encrypted using **GPG** to ensure confidentiality. + +- **Deployment Flexibility:** + - Available as the [jkaninda/pg-bkup](https://hub.docker.com/r/jkaninda/pg-bkup) Docker image. + - Deployable on **Docker**, **Docker Swarm**, and **Kubernetes**. + - Supports recurring backups of PostgreSQL databases when deployed: + - On Docker for automated backup schedules. + - As a **Job** or **CronJob** on Kubernetes. + +- **Notifications:** + - Get real-time updates on backup success or failure via: + - **Telegram** + - **Email** + +## Use Cases + +- **Automated Recurring Backups:** Schedule regular backups for PostgreSQL databases. +- **Cross-Environment Migration:** Easily migrate your PostgreSQL databases across different environments using supported storage options. +- **Secure Backup Management:** Protect your data with GPG encryption. We are open to receiving stars, PRs, and issues! @@ -20,13 +47,6 @@ We are open to receiving stars, PRs, and issues! --- -The [jkaninda/pg-bkup](https://hub.docker.com/r/jkaninda/pg-bkup) Docker image can be deployed on Docker, Docker Swarm and Kubernetes. -It handles __recurring__ backups of postgres database on Docker and can be deployed as __CronJob on Kubernetes__ using local, AWS S3 or SSH compatible storage. - -It also supports database __encryption__ using GPG. - - - {: .note } Code and documentation for `v1` version on [this branch][v1-branch].