From ac36a0d5dfbd08f45615c100f87913826bf2fa3c Mon Sep 17 00:00:00 2001 From: Brad Soper Date: Fri, 28 Jun 2024 13:58:18 -0700 Subject: [PATCH] updating readme and fixing minor syntax --- README.md | 33 +++++++++++++++++++++++++++++++-- cmd/.DS_Store | Bin 6148 -> 6148 bytes cmd/backup/postgres.go | 20 ++++++++++++++------ 3 files changed, 45 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index a3ee15f..484ffe9 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # cnvrgctl cnvrg.io delivery cli tool -### How to use +## How to Install 1. Download and install golang. `https://go.dev/doc/install` @@ -13,8 +13,37 @@ cnvrg.io delivery cli tool `make mac` #Create binary for arm on MacOS `make linux` #Create binary for amd64 on Linux + +## How to Use +1. Run cnvrgctl as a normal cli tool -### Minio +2. `cnvrgctl --help` to bring up the help menu to navigate available commands. + +#### Backup sub-command +Run `cnvrgctl backup` to backup the current cnvrg.io installation. This includes both the files and the Postgres database. + +Example: +`cnvrgctl backup files -n cnvrg` This will backup the minio `cnvrg-storage` bucket locally to be migrated to new installs. + +#### Restore sub-command +Run `cnvrgctl restore` to restore either files or the Postgres database to your new installation of cnvrg.io + +Example: +Run `cnvrgctl restore files -n cnvrg` to restore the local files in the `./cnvrg-storage` folder to your new cnvrg.io installation. + +#### Logs sub-command +Run `cnvrgctl logs` to pull all logs from the running pods in the namespace selected. + +Example: +Run `cnvrgctl logs -n cnvrg` to grab all logs from the namespace and output the logs to a local folder called `./logs`. + +#### Install sub-command +Run `cnvrgctl install` to deploy ArgoCD, minio operator and a tenant, nginx, or sealed secrets. + +Example: +Run `cnvrgctl -n argocd install argocd -d argocd.dilerous.cloud` to install ArgoCD in the `argocd` namespace while setting the ingress host to `argocd.dilerous.cloud`. + +## Minio How to connect to the minio bucket using the `mc` cli tool. 1. Following the deployment of the operator and tenant you need to set an alias to access the minio bucket. The default bucket created during installation is diff --git a/cmd/.DS_Store b/cmd/.DS_Store index 4f442e00183322f498347c1d65071b33ef88d0cf..118439641ea96d5f9ee6e796f1723a1bbc15ad11 100644 GIT binary patch delta 15 WcmZoMXffEJ#lmE>d$SJ94PgK%%LNVq delta 15 WcmZoMXffEJ#lmDAyIF_jhA;pokOZ#) diff --git a/cmd/backup/postgres.go b/cmd/backup/postgres.go index dcc7d4e..c82a05a 100644 --- a/cmd/backup/postgres.go +++ b/cmd/backup/postgres.go @@ -21,7 +21,7 @@ import ( // databaseCmd represents the database command var postgresCmd = &cobra.Command{ Use: "postgres", - Short: "Will backup the postgres database", + Short: "Backup the postgres database", Long: `Backs up the postgres database by performing a pg_dump on the running postgres pod. This command will scale down the cnvrg.io application, so use during a downtime window. @@ -31,7 +31,7 @@ Examples: # Backups the default postgres database and files in the cnvrg namespace. cnvrgctl backup postgres -n cnvrg`, Run: func(cmd *cobra.Command, args []string) { - log.Println("database called") + log.Println("postgress command called") // set result to false until a successfull backup result := false @@ -45,6 +45,9 @@ Examples: // Define the key of the deployment label for the postgres deployment labelFlag, _ := cmd.Flags().GetString("label") + // flag to disable scaling the pods before the backup + disableScaleFlag, _ := cmd.Flags().GetBool("disable-scale") + // connect to kubernetes and define clientset and rest client api, err := root.ConnectToK8s() if err != nil { @@ -53,10 +56,12 @@ Examples: } // scale down the application pods to prepare for backups - err = root.ScaleDeployDown(api, nsFlag) - if err != nil { - fmt.Fprintf(os.Stderr, "error scaling the deployment. %v", err) - log.Fatalf("error scaling the deployment. %v\n", err) + if !disableScaleFlag { + err = root.ScaleDeployDown(api, nsFlag) + if err != nil { + fmt.Fprintf(os.Stderr, "error scaling the deployment. %v", err) + log.Fatalf("error scaling the deployment. %v\n", err) + } } // get the pod name from the deployment defined @@ -97,6 +102,9 @@ func init() { // flag to define the release name postgresCmd.Flags().StringP("target", "t", "postgres", "Name of postgres deployment to backup.") + // flag to disable scaling the pods before the backup + postgresCmd.Flags().BoolP("disable-scale", "", false, "Disable scaling the app, cnvrg-operator and 'kiq' pods to 0 before the backup.") + // flag to define the app label key postgresCmd.Flags().StringP("label", "l", "app", "Define the key of the deployment label for the postgres deployment. example: app.kubernetes.io/name") }