Skip to content

Commit

Permalink
updating readme and fixing minor syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
dilerous committed Jun 28, 2024
1 parent f55bcd3 commit ac36a0d
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 8 deletions.
33 changes: 31 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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`
Expand All @@ -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
Expand Down
Binary file modified cmd/.DS_Store
Binary file not shown.
20 changes: 14 additions & 6 deletions cmd/backup/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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 {
Expand All @@ -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
Expand Down Expand Up @@ -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")
}
Expand Down

0 comments on commit ac36a0d

Please sign in to comment.