Compare commits
	
		
			20 Commits
		
	
	
		
			0.4.0-alph
			...
			0.4.0-alph
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| e38a0078f3 | |||
| 25b44dc54e | |||
| 0c2f6fb676 | |||
| 10e4a8b97f | |||
| eed2756784 | |||
| b61b8f0d2a | |||
| 763e7b5bff | |||
| d5ab9aedbf | |||
| 2ebb00c9d4 | |||
| 6d76b3646a | |||
| 636dc82258 | |||
| 66d5453248 | |||
| ba9abcb0d7 | |||
| a1cbf21f61 | |||
| bd1da39374 | |||
| 8b90519bc9 | |||
| 65feda7f1d | |||
| 64e223a810 | |||
| 379e01d855 | |||
| a421c0dca5 | 
| @ -30,10 +30,10 @@ is failing to deploy or having issues, it could be a lot of things. | ||||
|  | ||||
| This command currently takes into account: | ||||
|  | ||||
| 		Is the service deployed? | ||||
|     Is the service deployed? | ||||
|     Is the service killed by an OOM error? | ||||
| 		Is the service reporting an error (like in "ps --no-trunc" output) | ||||
| 		Is the service healthcheck failing? what are the healthcheck logs? | ||||
|     Is the service reporting an error (like in "ps --no-trunc" output) | ||||
|     Is the service healthcheck failing? what are the healthcheck logs? | ||||
|  | ||||
| Got any more ideas? Please let us know: | ||||
|  | ||||
|  | ||||
| @ -39,13 +39,13 @@ var appRemoveCommand = &cli.Command{ | ||||
| 		if !internal.Force { | ||||
| 			response := false | ||||
| 			prompt := &survey.Confirm{ | ||||
| 				Message: fmt.Sprintf("about to delete %s, are you sure?", app.Name), | ||||
| 				Message: fmt.Sprintf("about to remove %s, are you sure?", app.Name), | ||||
| 			} | ||||
| 			if err := survey.AskOne(prompt, &response); err != nil { | ||||
| 				logrus.Fatal(err) | ||||
| 			} | ||||
| 			if !response { | ||||
| 				logrus.Fatal("user aborted app removal") | ||||
| 				logrus.Fatal("aborting as requested") | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| @ -54,18 +54,16 @@ var appRemoveCommand = &cli.Command{ | ||||
| 			logrus.Fatal(err) | ||||
| 		} | ||||
|  | ||||
| 		if !internal.Force { | ||||
| 			isDeployed, _, err := stack.IsDeployed(c.Context, cl, app.StackName()) | ||||
| 			if err != nil { | ||||
| 				logrus.Fatal(err) | ||||
| 			} | ||||
| 			if isDeployed { | ||||
| 				logrus.Fatalf("%s is still deployed. Run \"abra app undeploy %s \" or pass --force", app.Name, app.Name) | ||||
| 			} | ||||
| 		isDeployed, _, err := stack.IsDeployed(c.Context, cl, app.StackName()) | ||||
| 		if err != nil { | ||||
| 			logrus.Fatal(err) | ||||
| 		} | ||||
| 		if isDeployed { | ||||
| 			logrus.Fatalf("%s is still deployed. Run \"abra app undeploy %s \" or pass --force", app.Name, app.Name) | ||||
| 		} | ||||
|  | ||||
| 		fs := filters.NewArgs() | ||||
| 		fs.Add("name", app.Name) | ||||
| 		fs.Add("name", app.StackName()) | ||||
| 		secretList, err := cl.SecretList(c.Context, types.SecretListOptions{Filters: fs}) | ||||
| 		if err != nil { | ||||
| 			logrus.Fatal(err) | ||||
| @ -81,6 +79,7 @@ var appRemoveCommand = &cli.Command{ | ||||
|  | ||||
| 		if len(secrets) > 0 { | ||||
| 			var secretNamesToRemove []string | ||||
|  | ||||
| 			if !internal.Force { | ||||
| 				secretsPrompt := &survey.MultiSelect{ | ||||
| 					Message: "which secrets do you want to remove?", | ||||
|  | ||||
| @ -20,18 +20,19 @@ import ( | ||||
| var allSecrets bool | ||||
| var allSecretsFlag = &cli.BoolFlag{ | ||||
| 	Name:        "all", | ||||
| 	Aliases:     []string{"A"}, | ||||
| 	Aliases:     []string{"a"}, | ||||
| 	Value:       false, | ||||
| 	Destination: &allSecrets, | ||||
| 	Usage:       "Generate all secrets", | ||||
| } | ||||
|  | ||||
| var appSecretGenerateCommand = &cli.Command{ | ||||
| 	Name:      "generate", | ||||
| 	Aliases:   []string{"g"}, | ||||
| 	Usage:     "Generate secrets", | ||||
| 	ArgsUsage: "<secret> <version>", | ||||
| 	Flags:     []cli.Flag{allSecretsFlag, internal.PassFlag}, | ||||
| 	Name:         "generate", | ||||
| 	Aliases:      []string{"g"}, | ||||
| 	Usage:        "Generate secrets", | ||||
| 	ArgsUsage:    "<secret> <version>", | ||||
| 	Flags:        []cli.Flag{allSecretsFlag, internal.PassFlag}, | ||||
| 	BashComplete: autocomplete.AppNameComplete, | ||||
| 	Action: func(c *cli.Context) error { | ||||
| 		app := internal.ValidateApp(c) | ||||
|  | ||||
| @ -95,11 +96,12 @@ var appSecretGenerateCommand = &cli.Command{ | ||||
| } | ||||
|  | ||||
| var appSecretInsertCommand = &cli.Command{ | ||||
| 	Name:      "insert", | ||||
| 	Aliases:   []string{"i"}, | ||||
| 	Usage:     "Insert secret", | ||||
| 	Flags:     []cli.Flag{internal.PassFlag}, | ||||
| 	ArgsUsage: "<app> <secret-name> <version> <data>", | ||||
| 	Name:         "insert", | ||||
| 	Aliases:      []string{"i"}, | ||||
| 	Usage:        "Insert secret", | ||||
| 	Flags:        []cli.Flag{internal.PassFlag}, | ||||
| 	ArgsUsage:    "<app> <secret-name> <version> <data>", | ||||
| 	BashComplete: autocomplete.AppNameComplete, | ||||
| 	Description: ` | ||||
| This command inserts a secret into an app environment. | ||||
|  | ||||
| @ -139,11 +141,12 @@ Example: | ||||
| } | ||||
|  | ||||
| var appSecretRmCommand = &cli.Command{ | ||||
| 	Name:      "remove", | ||||
| 	Usage:     "Remove a secret", | ||||
| 	Aliases:   []string{"rm"}, | ||||
| 	Flags:     []cli.Flag{allSecretsFlag, internal.PassFlag}, | ||||
| 	ArgsUsage: "<app> <secret-name>", | ||||
| 	Name:         "remove", | ||||
| 	Usage:        "Remove a secret", | ||||
| 	Aliases:      []string{"rm"}, | ||||
| 	Flags:        []cli.Flag{allSecretsFlag, internal.PassFlag}, | ||||
| 	ArgsUsage:    "<app> <secret-name>", | ||||
| 	BashComplete: autocomplete.AppNameComplete, | ||||
| 	Description: ` | ||||
| This command removes a secret from an app environment. | ||||
|  | ||||
|  | ||||
| @ -113,7 +113,7 @@ recipes. | ||||
| 			} | ||||
|  | ||||
| 			if len(availableUpgrades) == 0 && !internal.Force { | ||||
| 				logrus.Info("no available upgrades, you're on latest ✌️") | ||||
| 				logrus.Infof("no available upgrades, you're on latest (%s) ✌️", deployedVersion) | ||||
| 				return nil | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| @ -58,7 +58,7 @@ func DeployAction(c *cli.Context) error { | ||||
| 	} | ||||
|  | ||||
| 	version := deployedVersion | ||||
| 	if version == "" && !Chaos { | ||||
| 	if version == "unknown" && !Chaos { | ||||
| 		catl, err := recipe.ReadRecipeCatalogue() | ||||
| 		if err != nil { | ||||
| 			logrus.Fatal(err) | ||||
| @ -86,14 +86,14 @@ func DeployAction(c *cli.Context) error { | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	if version == "" && !Chaos { | ||||
| 	if version == "unknown" && !Chaos { | ||||
| 		logrus.Debugf("choosing %s as version to deploy", version) | ||||
| 		if err := recipe.EnsureVersion(app.Type, version); err != nil { | ||||
| 			logrus.Fatal(err) | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	if version != "" && !Chaos { | ||||
| 	if version != "unknown" && !Chaos { | ||||
| 		if err := recipe.EnsureVersion(app.Type, version); err != nil { | ||||
| 			logrus.Fatal(err) | ||||
| 		} | ||||
| @ -221,7 +221,7 @@ func NewVersionOverview(app config.App, currentVersion, newVersion, releaseNotes | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	if releaseNotes != "" { | ||||
| 	if releaseNotes != "" && newVersion != "" { | ||||
| 		fmt.Println() | ||||
| 		fmt.Println(fmt.Sprintf("%s release notes:\n\n%s", newVersion, releaseNotes)) | ||||
| 	} else { | ||||
| @ -250,6 +250,10 @@ func NewVersionOverview(app config.App, currentVersion, newVersion, releaseNotes | ||||
|  | ||||
| // GetReleaseNotes prints release notes for a recipe version | ||||
| func GetReleaseNotes(recipeName, version string) (string, error) { | ||||
| 	if version == "" { | ||||
| 		return "", nil | ||||
| 	} | ||||
|  | ||||
| 	fpath := path.Join(config.RECIPES_DIR, recipeName, "release", version) | ||||
|  | ||||
| 	if _, err := os.Stat(fpath); !os.IsNotExist(err) { | ||||
|  | ||||
| @ -163,9 +163,9 @@ func NewAction(c *cli.Context) error { | ||||
| 		NewAppServer = "local" | ||||
| 	} | ||||
|  | ||||
| 	tableCol := []string{"Name", "Domain", "Type", "Server"} | ||||
| 	tableCol := []string{"server", "type", "domain", "app name"} | ||||
| 	table := formatter.CreateTable(tableCol) | ||||
| 	table.Append([]string{sanitisedAppName, Domain, recipe.Name, NewAppServer}) | ||||
| 	table.Append([]string{NewAppServer, recipe.Name, Domain, NewAppName}) | ||||
|  | ||||
| 	fmt.Println("") | ||||
| 	fmt.Println(fmt.Sprintf("A new %s app has been created! Here is an overview:", recipe.Name)) | ||||
| @ -173,10 +173,10 @@ func NewAction(c *cli.Context) error { | ||||
| 	table.Render() | ||||
| 	fmt.Println("") | ||||
| 	fmt.Println("You can configure this app by running the following:") | ||||
| 	fmt.Println(fmt.Sprintf("\n    abra app config %s", sanitisedAppName)) | ||||
| 	fmt.Println(fmt.Sprintf("\n    abra app config %s", NewAppName)) | ||||
| 	fmt.Println("") | ||||
| 	fmt.Println("You can deploy this app by running the following:") | ||||
| 	fmt.Println(fmt.Sprintf("\n    abra app deploy %s", sanitisedAppName)) | ||||
| 	fmt.Println(fmt.Sprintf("\n    abra app deploy %s", NewAppName)) | ||||
| 	fmt.Println("") | ||||
|  | ||||
| 	return nil | ||||
|  | ||||
| @ -479,24 +479,28 @@ func WaitOnService(ctx context.Context, cl *dockerclient.Client, serviceID, appN | ||||
|  | ||||
| 	go io.Copy(ioutil.Discard, pipeReader) | ||||
|  | ||||
| 	timeout := 30 * time.Second | ||||
| 	timeout := 50 * time.Second | ||||
|  | ||||
| 	select { | ||||
| 	case err := <-errChan: | ||||
| 		return err | ||||
| 	case <-time.After(timeout): | ||||
| 		return fmt.Errorf(fmt.Sprintf(` | ||||
| %s has still not converged (%s second timeout reached) | ||||
| %s has not converged (%s second timeout reached). | ||||
|  | ||||
| This does not necessarily mean your deployment has failed, it may just be that | ||||
| the app is taking longer to deploy based on your server resources or network | ||||
| latency. Please run the following the inspect the logs of your deployed app: | ||||
| latency. | ||||
|  | ||||
| You can track latest deployment status with: | ||||
|  | ||||
|     abra app ps --watch %s | ||||
|  | ||||
| And inspect the logs with: | ||||
|  | ||||
|     abra app logs %s | ||||
|  | ||||
| If a service is failing to even start (run "abra app ps %s" to see what | ||||
| services are running) there could be a few things. The follow command will | ||||
| try to smoke those out for you: | ||||
| If a service is failing to even start, try smoke out the error with: | ||||
|  | ||||
|     abra app errors --watch %s | ||||
|  | ||||
|  | ||||
| @ -2,7 +2,7 @@ | ||||
|  | ||||
| ABRA_VERSION="0.3.0-alpha" | ||||
| ABRA_RELEASE_URL="https://git.coopcloud.tech/api/v1/repos/coop-cloud/abra/releases/tags/$ABRA_VERSION" | ||||
| RC_VERSION="0.4.0-alpha-rc1" | ||||
| RC_VERSION="0.4.0-alpha-rc3" | ||||
| RC_VERSION_URL="https://git.coopcloud.tech/api/v1/repos/coop-cloud/abra/releases/tags/$RC_VERSION" | ||||
|  | ||||
| for arg in "$@"; do | ||||
| @ -58,7 +58,7 @@ function install_abra_release { | ||||
|   checksum=$(echo "$checksums" | grep "$FILENAME" - | sed -En 's/([0-9a-f]{64})\s+'"$FILENAME"'.*/\1/p') | ||||
|  | ||||
|   echo "downloading $ABRA_VERSION $PLATFORM binary release for abra..." | ||||
|   wget -q --show-progress "$release_url" -O "$HOME/.local/bin/.abra-download" | ||||
|   wget -q "$release_url" -O "$HOME/.local/bin/.abra-download" | ||||
|   localsum=$(sha256sum $HOME/.local/bin/.abra-download | sed -En 's/([0-9a-f]{64})\s+.*/\1/p') | ||||
|   echo "checking if checksums match..." | ||||
|   if [[ "$localsum" != "$checksum" ]]; then | ||||
|  | ||||
| @ -61,9 +61,9 @@ $ABRA autocomplete zsh | ||||
| # ======================================================================== | ||||
| # record command | ||||
| # ======================================================================== | ||||
| $ABRA record new -p gandi -t A -n e2e -v 192.157.2.21 coopcloud.tech | ||||
| $ABRA record list -p gandi coopcloud.tech | grep -q e2e | ||||
| $ABRA -n record rm -p gandi -t A -n e2e coopcloud.tech | ||||
| $ABRA record new -p gandi -t A -n int-core -v 192.157.2.21 coopcloud.tech | ||||
| $ABRA record list -p gandi coopcloud.tech | grep -q int-core | ||||
| $ABRA -n record rm -p gandi -t A -n int-core coopcloud.tech | ||||
|  | ||||
| # ======================================================================== | ||||
| # catalogue command | ||||
| @ -86,11 +86,11 @@ $ABRA recipe lint gitea | ||||
| # ======================================================================== | ||||
| # server command | ||||
| # ======================================================================== | ||||
| $ABRA -n server new -p hetzner-cloud --hn e2e | ||||
| $ABRA -n server new -p hetzner-cloud --hn int-core | ||||
|  | ||||
| $ABRA server ls | grep -q e2e | ||||
| $ABRA server ls | grep -q int-core | ||||
|  | ||||
| $ABRA -n server rm -s -p hetzner-cloud --hn e2e | ||||
| $ABRA -n server rm -s -p hetzner-cloud --hn int-core | ||||
|  | ||||
| # ======================================================================== | ||||
| # app command | ||||
|  | ||||
| @ -33,6 +33,10 @@ wire up for testing in an automated way. | ||||
|  | ||||
| ### easy mode | ||||
|  | ||||
| - `abra app ls -t <recipe>` | ||||
| - `abra app ls -s <server>` | ||||
| - `abra app ls -s <server> -t <recipe>` | ||||
| - `abra app ls -s <server> -t <recipe> -S` | ||||
| - `abra app config <app>` | ||||
| - `abra app check <app>` | ||||
| - `abra app ps <app>` | ||||
|  | ||||
		Reference in New Issue
	
	Block a user