Compare commits
61 Commits
0.4.0-alph
...
docker-dep
Author | SHA1 | Date | |
---|---|---|---|
d6fd95c045 | |||
f918798c3d
|
|||
0540e42168
|
|||
4bc95a5b52
|
|||
febc6e2874
|
|||
b2c990bf12
|
|||
3b8893502a
|
|||
e0a0378f73 | |||
0837045d44 | |||
cd8137a7d8
|
|||
ece4537a2d
|
|||
16fe1b68c6
|
|||
e37f235fd4 | |||
0423ce7e84
|
|||
d46ac22bd7
|
|||
cef5cd8611
|
|||
8b38dac9ab | |||
89fc875088 | |||
026a9ba2d7
|
|||
99f2b9c6dc | |||
578e91eeec
|
|||
49f79dbd45
|
|||
574d556bb9
|
|||
801aad64df
|
|||
b0a0829712
|
|||
6aae06c3ec | |||
d0c6fa5b45 | |||
c947354ee3 | |||
9b7e5752fb
|
|||
9bc51629d4 | |||
4ba15df9b7
|
|||
5721b357a2
|
|||
6140abbcac | |||
996255188b | |||
11d78234b2
|
|||
c214937e4a
|
|||
3a3f41988b
|
|||
f6690a80bd
|
|||
2337c4648b
|
|||
a1190f1352
|
|||
e421922f5b
|
|||
10d5705d1a
|
|||
a4f1634b24
|
|||
cbd924060f
|
|||
3c4bb6a55e
|
|||
a0d7a76f9d
|
|||
c71efb46ba
|
|||
ce69967ec5
|
|||
1a04439b1f | |||
979f417a63
|
|||
b27acb2f61
|
|||
622ecc4885
|
|||
ed5bbda811
|
|||
7b627ea518
|
|||
1ac66da83f
|
|||
061de96b62 | |||
6998298d32
|
|||
323f4467c8
|
|||
e8e41850b5
|
|||
0e23ec53d7
|
|||
b943a8b9b1
|
@ -7,7 +7,6 @@ gitea_urls:
|
|||||||
before:
|
before:
|
||||||
hooks:
|
hooks:
|
||||||
- go mod tidy
|
- go mod tidy
|
||||||
- go generate ./...
|
|
||||||
builds:
|
builds:
|
||||||
- env:
|
- env:
|
||||||
- CGO_ENABLED=0
|
- CGO_ENABLED=0
|
||||||
@ -15,6 +14,15 @@ builds:
|
|||||||
goos:
|
goos:
|
||||||
- linux
|
- linux
|
||||||
- darwin
|
- darwin
|
||||||
|
goarch:
|
||||||
|
- 386
|
||||||
|
- amd64
|
||||||
|
- arm
|
||||||
|
- arm64
|
||||||
|
goarm:
|
||||||
|
- 5
|
||||||
|
- 6
|
||||||
|
- 7
|
||||||
ldflags:
|
ldflags:
|
||||||
- "-X 'main.Commit={{ .Commit }}'"
|
- "-X 'main.Commit={{ .Commit }}'"
|
||||||
- "-X 'main.Version={{ .Version }}'"
|
- "-X 'main.Version={{ .Version }}'"
|
||||||
|
15
LICENSE
Normal file
15
LICENSE
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
Abra: The Co-op Cloud utility belt
|
||||||
|
Copyright (C) 2022 Co-op Cloud <helo@coopcloud.tech>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
10
README.md
10
README.md
@ -1,12 +1,12 @@
|
|||||||
# abra
|
# `abra`
|
||||||
|
|
||||||
> https://coopcloud.tech
|
|
||||||
|
|
||||||
[](https://build.coopcloud.tech/coop-cloud/abra)
|
[](https://build.coopcloud.tech/coop-cloud/abra)
|
||||||
[](https://goreportcard.com/report/git.coopcloud.tech/coop-cloud/abra)
|
[](https://goreportcard.com/report/git.coopcloud.tech/coop-cloud/abra)
|
||||||
|
|
||||||
The Co-op Cloud utility belt 🎩🐇
|
The Co-op Cloud utility belt 🎩🐇
|
||||||
|
|
||||||
`abra` is our flagship client & command-line tool which has been developed specifically in the context of the Co-op Cloud project for the purpose of making day-to-day operations for [operators](https://docs.coopcloud.tech/operators/) and [maintainers](https://docs.coopcloud.tech/maintainers/) as convenient as possible. It is libre software, written in [Go](https://go.dev) and maintained and extended by the community ❤
|
<a href="https://github.com/egonelbre/gophers"><img align="right" width="150" src="https://github.com/egonelbre/gophers/raw/master/.thumb/sketch/adventure/poking-fire.png"/></a>
|
||||||
|
|
||||||
Please see [docs.coopcloud.tech/abra/](https://docs.coopcloud.tech/abra/) for help on install, upgrade, hacking, troubleshooting & more!
|
`abra` is our flagship client & command-line tool which has been developed specifically in the context of the Co-op Cloud project for the purpose of making the day-to-day operations of [operators](https://docs.coopcloud.tech/operators/) and [maintainers](https://docs.coopcloud.tech/maintainers/) pleasant & convenient. It is libre software, written in [Go](https://go.dev) and maintained and extended by the community :heart:
|
||||||
|
|
||||||
|
Please see [docs.coopcloud.tech/abra](https://docs.coopcloud.tech/abra) for help on install, upgrade, hacking, troubleshooting & more!
|
||||||
|
@ -9,7 +9,7 @@ var AppCommand = cli.Command{
|
|||||||
Aliases: []string{"a"},
|
Aliases: []string{"a"},
|
||||||
Usage: "Manage apps",
|
Usage: "Manage apps",
|
||||||
ArgsUsage: "<domain>",
|
ArgsUsage: "<domain>",
|
||||||
Description: "This command provides functionality for managing the life cycle of your apps",
|
Description: "Functionality for managing the life cycle of your apps",
|
||||||
Subcommands: []cli.Command{
|
Subcommands: []cli.Command{
|
||||||
appNewCommand,
|
appNewCommand,
|
||||||
appConfigCommand,
|
appConfigCommand,
|
||||||
@ -30,5 +30,7 @@ var AppCommand = cli.Command{
|
|||||||
appVersionCommand,
|
appVersionCommand,
|
||||||
appErrorsCommand,
|
appErrorsCommand,
|
||||||
appCmdCommand,
|
appCmdCommand,
|
||||||
|
appBackupCommand,
|
||||||
|
appRestoreCommand,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
389
cli/app/backup.go
Normal file
389
cli/app/backup.go
Normal file
@ -0,0 +1,389 @@
|
|||||||
|
package app
|
||||||
|
|
||||||
|
import (
|
||||||
|
"archive/tar"
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"coopcloud.tech/abra/cli/internal"
|
||||||
|
"coopcloud.tech/abra/pkg/autocomplete"
|
||||||
|
"coopcloud.tech/abra/pkg/client"
|
||||||
|
"coopcloud.tech/abra/pkg/config"
|
||||||
|
containerPkg "coopcloud.tech/abra/pkg/container"
|
||||||
|
"coopcloud.tech/abra/pkg/recipe"
|
||||||
|
"coopcloud.tech/abra/pkg/upstream/container"
|
||||||
|
"github.com/docker/cli/cli/command"
|
||||||
|
"github.com/docker/docker/api/types"
|
||||||
|
"github.com/docker/docker/api/types/filters"
|
||||||
|
"github.com/docker/docker/pkg/archive"
|
||||||
|
"github.com/docker/docker/pkg/system"
|
||||||
|
"github.com/klauspost/pgzip"
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
|
"github.com/urfave/cli"
|
||||||
|
)
|
||||||
|
|
||||||
|
type backupConfig struct {
|
||||||
|
preHookCmd string
|
||||||
|
postHookCmd string
|
||||||
|
backupPaths []string
|
||||||
|
}
|
||||||
|
|
||||||
|
var appBackupCommand = cli.Command{
|
||||||
|
Name: "backup",
|
||||||
|
Aliases: []string{"bk"},
|
||||||
|
Usage: "Run app backup",
|
||||||
|
ArgsUsage: "<domain> [<service>]",
|
||||||
|
Flags: []cli.Flag{
|
||||||
|
internal.DebugFlag,
|
||||||
|
},
|
||||||
|
Before: internal.SubCommandBefore,
|
||||||
|
BashComplete: autocomplete.AppNameComplete,
|
||||||
|
Description: `
|
||||||
|
Run an app backup.
|
||||||
|
|
||||||
|
A backup command and pre/post hook commands are defined in the recipe
|
||||||
|
configuration. Abra reads this configuration and run the comands in the context
|
||||||
|
of the deployed services. Pass <service> if you only want to back up a single
|
||||||
|
service. All backups are placed in the ~/.abra/backups directory.
|
||||||
|
|
||||||
|
A single backup file is produced for all backup paths specified for a service.
|
||||||
|
If we have the following backup configuration:
|
||||||
|
|
||||||
|
- "backupbot.backup.path=/var/lib/foo,/var/lib/bar"
|
||||||
|
|
||||||
|
And we run "abra app backup example.com app", Abra will produce a file that
|
||||||
|
looks like:
|
||||||
|
|
||||||
|
~/.abra/backups/example_com_app_609341138.tar.gz
|
||||||
|
|
||||||
|
This file is a compressed archive which contains all backup paths. To see paths, run:
|
||||||
|
|
||||||
|
tar -tf ~/.abra/backups/example_com_app_609341138.tar.gz
|
||||||
|
|
||||||
|
(Make sure to change the name of the backup file)
|
||||||
|
|
||||||
|
This single file can be used to restore your app. See "abra app restore" for more.
|
||||||
|
`,
|
||||||
|
Action: func(c *cli.Context) error {
|
||||||
|
app := internal.ValidateApp(c)
|
||||||
|
|
||||||
|
recipe, err := recipe.Get(app.Recipe)
|
||||||
|
if err != nil {
|
||||||
|
logrus.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
backupConfigs := make(map[string]backupConfig)
|
||||||
|
for _, service := range recipe.Config.Services {
|
||||||
|
if backupsEnabled, ok := service.Deploy.Labels["backupbot.backup"]; ok {
|
||||||
|
if backupsEnabled == "true" {
|
||||||
|
fullServiceName := fmt.Sprintf("%s_%s", app.StackName(), service.Name)
|
||||||
|
bkConfig := backupConfig{}
|
||||||
|
|
||||||
|
logrus.Debugf("backup config detected for %s", fullServiceName)
|
||||||
|
|
||||||
|
if paths, ok := service.Deploy.Labels["backupbot.backup.path"]; ok {
|
||||||
|
logrus.Debugf("detected backup paths for %s: %s", fullServiceName, paths)
|
||||||
|
bkConfig.backupPaths = strings.Split(paths, ",")
|
||||||
|
}
|
||||||
|
|
||||||
|
if preHookCmd, ok := service.Deploy.Labels["backupbot.backup.pre-hook"]; ok {
|
||||||
|
logrus.Debugf("detected pre-hook command for %s: %s", fullServiceName, preHookCmd)
|
||||||
|
bkConfig.preHookCmd = preHookCmd
|
||||||
|
}
|
||||||
|
|
||||||
|
if postHookCmd, ok := service.Deploy.Labels["backupbot.backup.post-hook"]; ok {
|
||||||
|
logrus.Debugf("detected post-hook command for %s: %s", fullServiceName, postHookCmd)
|
||||||
|
bkConfig.postHookCmd = postHookCmd
|
||||||
|
}
|
||||||
|
|
||||||
|
backupConfigs[service.Name] = bkConfig
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
serviceName := c.Args().Get(1)
|
||||||
|
if serviceName != "" {
|
||||||
|
backupConfig, ok := backupConfigs[serviceName]
|
||||||
|
if !ok {
|
||||||
|
logrus.Fatalf("no backup config for %s? does %s exist?", serviceName, serviceName)
|
||||||
|
}
|
||||||
|
|
||||||
|
logrus.Infof("running backup for the %s service", serviceName)
|
||||||
|
|
||||||
|
if err := runBackup(app, serviceName, backupConfig); err != nil {
|
||||||
|
logrus.Fatal(err)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for serviceName, backupConfig := range backupConfigs {
|
||||||
|
logrus.Infof("running backup for the %s service", serviceName)
|
||||||
|
|
||||||
|
if err := runBackup(app, serviceName, backupConfig); err != nil {
|
||||||
|
logrus.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// runBackup does the actual backup logic.
|
||||||
|
func runBackup(app config.App, serviceName string, bkConfig backupConfig) error {
|
||||||
|
if len(bkConfig.backupPaths) == 0 {
|
||||||
|
return fmt.Errorf("backup paths are empty for %s?", serviceName)
|
||||||
|
}
|
||||||
|
|
||||||
|
cl, err := client.New(app.Server)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIXME: avoid instantiating a new CLI
|
||||||
|
dcli, err := command.NewDockerCli()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
filters := filters.NewArgs()
|
||||||
|
filters.Add("name", fmt.Sprintf("^%s_%s", app.StackName(), serviceName))
|
||||||
|
|
||||||
|
targetContainer, err := containerPkg.GetContainer(context.Background(), cl, filters, true)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
fullServiceName := fmt.Sprintf("%s_%s", app.StackName(), serviceName)
|
||||||
|
if bkConfig.preHookCmd != "" {
|
||||||
|
splitCmd := internal.SafeSplit(bkConfig.preHookCmd)
|
||||||
|
|
||||||
|
logrus.Debugf("split pre-hook command for %s into %s", fullServiceName, splitCmd)
|
||||||
|
|
||||||
|
preHookExecOpts := types.ExecConfig{
|
||||||
|
AttachStderr: true,
|
||||||
|
AttachStdin: true,
|
||||||
|
AttachStdout: true,
|
||||||
|
Cmd: splitCmd,
|
||||||
|
Detach: false,
|
||||||
|
Tty: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := container.RunExec(dcli, cl, targetContainer.ID, &preHookExecOpts); err != nil {
|
||||||
|
return fmt.Errorf("failed to run %s on %s: %s", bkConfig.preHookCmd, targetContainer.ID, err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
logrus.Infof("succesfully ran %s pre-hook command: %s", fullServiceName, bkConfig.preHookCmd)
|
||||||
|
}
|
||||||
|
|
||||||
|
var tempBackupPaths []string
|
||||||
|
for _, remoteBackupPath := range bkConfig.backupPaths {
|
||||||
|
timestamp := strconv.Itoa(time.Now().Nanosecond())
|
||||||
|
sanitisedPath := strings.ReplaceAll(remoteBackupPath, "/", "_")
|
||||||
|
localBackupPath := filepath.Join(config.BACKUP_DIR, fmt.Sprintf("%s%s_%s.tar.gz", fullServiceName, sanitisedPath, timestamp))
|
||||||
|
logrus.Debugf("temporarily backing up %s:%s to %s", fullServiceName, remoteBackupPath, localBackupPath)
|
||||||
|
|
||||||
|
logrus.Infof("backing up %s:%s", fullServiceName, remoteBackupPath)
|
||||||
|
|
||||||
|
content, _, err := cl.CopyFromContainer(context.Background(), targetContainer.ID, remoteBackupPath)
|
||||||
|
if err != nil {
|
||||||
|
logrus.Debugf("failed to copy %s from container: %s", remoteBackupPath, err.Error())
|
||||||
|
if err := cleanupTempArchives(tempBackupPaths); err != nil {
|
||||||
|
return fmt.Errorf("failed to clean up temporary archives: %s", err.Error())
|
||||||
|
}
|
||||||
|
return fmt.Errorf("failed to copy %s from container: %s", remoteBackupPath, err.Error())
|
||||||
|
}
|
||||||
|
defer content.Close()
|
||||||
|
|
||||||
|
_, srcBase := archive.SplitPathDirEntry(remoteBackupPath)
|
||||||
|
preArchive := archive.RebaseArchiveEntries(content, srcBase, remoteBackupPath)
|
||||||
|
if err := copyToFile(localBackupPath, preArchive); err != nil {
|
||||||
|
logrus.Debugf("failed to create tar archive (%s): %s", localBackupPath, err.Error())
|
||||||
|
if err := cleanupTempArchives(tempBackupPaths); err != nil {
|
||||||
|
return fmt.Errorf("failed to clean up temporary archives: %s", err.Error())
|
||||||
|
}
|
||||||
|
return fmt.Errorf("failed to create tar archive (%s): %s", localBackupPath, err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
tempBackupPaths = append(tempBackupPaths, localBackupPath)
|
||||||
|
}
|
||||||
|
|
||||||
|
logrus.Infof("compressing and merging archives...")
|
||||||
|
|
||||||
|
if err := mergeArchives(tempBackupPaths, fullServiceName); err != nil {
|
||||||
|
logrus.Debugf("failed to merge archive files: %s", err.Error())
|
||||||
|
if err := cleanupTempArchives(tempBackupPaths); err != nil {
|
||||||
|
return fmt.Errorf("failed to clean up temporary archives: %s", err.Error())
|
||||||
|
}
|
||||||
|
return fmt.Errorf("failed to merge archive files: %s", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := cleanupTempArchives(tempBackupPaths); err != nil {
|
||||||
|
return fmt.Errorf("failed to clean up temporary archives: %s", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
if bkConfig.postHookCmd != "" {
|
||||||
|
splitCmd := internal.SafeSplit(bkConfig.postHookCmd)
|
||||||
|
|
||||||
|
logrus.Debugf("split post-hook command for %s into %s", fullServiceName, splitCmd)
|
||||||
|
|
||||||
|
postHookExecOpts := types.ExecConfig{
|
||||||
|
AttachStderr: true,
|
||||||
|
AttachStdin: true,
|
||||||
|
AttachStdout: true,
|
||||||
|
Cmd: splitCmd,
|
||||||
|
Detach: false,
|
||||||
|
Tty: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := container.RunExec(dcli, cl, targetContainer.ID, &postHookExecOpts); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
logrus.Infof("succesfully ran %s post-hook command: %s", fullServiceName, bkConfig.postHookCmd)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func copyToFile(outfile string, r io.Reader) error {
|
||||||
|
tmpFile, err := system.TempFileSequential(filepath.Dir(outfile), ".tar_temp")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
tmpPath := tmpFile.Name()
|
||||||
|
|
||||||
|
_, err = io.Copy(tmpFile, r)
|
||||||
|
tmpFile.Close()
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
os.Remove(tmpPath)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err = os.Rename(tmpPath, outfile); err != nil {
|
||||||
|
os.Remove(tmpPath)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func cleanupTempArchives(tarPaths []string) error {
|
||||||
|
for _, tarPath := range tarPaths {
|
||||||
|
if err := os.RemoveAll(tarPath); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
logrus.Debugf("remove temporary archive file %s", tarPath)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func mergeArchives(tarPaths []string, serviceName string) error {
|
||||||
|
var out io.Writer
|
||||||
|
var cout *pgzip.Writer
|
||||||
|
|
||||||
|
timestamp := strconv.Itoa(time.Now().Nanosecond())
|
||||||
|
localBackupPath := filepath.Join(config.BACKUP_DIR, fmt.Sprintf("%s_%s.tar.gz", serviceName, timestamp))
|
||||||
|
|
||||||
|
fout, err := os.Create(localBackupPath)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Failed to open %s: %s", localBackupPath, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
defer fout.Close()
|
||||||
|
out = fout
|
||||||
|
|
||||||
|
cout = pgzip.NewWriter(out)
|
||||||
|
out = cout
|
||||||
|
|
||||||
|
tw := tar.NewWriter(out)
|
||||||
|
|
||||||
|
for _, tarPath := range tarPaths {
|
||||||
|
if err := addTar(tw, tarPath); err != nil {
|
||||||
|
return fmt.Errorf("failed to merge %s: %v", tarPath, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := tw.Close(); err != nil {
|
||||||
|
return fmt.Errorf("failed to close tar writer %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if cout != nil {
|
||||||
|
if err := cout.Flush(); err != nil {
|
||||||
|
return fmt.Errorf("failed to flush: %s", err)
|
||||||
|
} else if err = cout.Close(); err != nil {
|
||||||
|
return fmt.Errorf("failed to close compressed writer: %s", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
logrus.Infof("backed up %s to %s", serviceName, localBackupPath)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func addTar(tw *tar.Writer, pth string) (err error) {
|
||||||
|
var tr *tar.Reader
|
||||||
|
var rc io.ReadCloser
|
||||||
|
var hdr *tar.Header
|
||||||
|
|
||||||
|
if tr, rc, err = openTarFile(pth); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for {
|
||||||
|
if hdr, err = tr.Next(); err != nil {
|
||||||
|
if err == io.EOF {
|
||||||
|
err = nil
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if err = tw.WriteHeader(hdr); err != nil {
|
||||||
|
break
|
||||||
|
} else if _, err = io.Copy(tw, tr); err != nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err == nil {
|
||||||
|
err = rc.Close()
|
||||||
|
} else {
|
||||||
|
rc.Close()
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func openTarFile(pth string) (tr *tar.Reader, rc io.ReadCloser, err error) {
|
||||||
|
var fin *os.File
|
||||||
|
var n int
|
||||||
|
buff := make([]byte, 1024)
|
||||||
|
|
||||||
|
if fin, err = os.Open(pth); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if n, err = fin.Read(buff); err != nil {
|
||||||
|
fin.Close()
|
||||||
|
return
|
||||||
|
} else if n == 0 {
|
||||||
|
fin.Close()
|
||||||
|
err = fmt.Errorf("%s is empty", pth)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err = fin.Seek(0, 0); err != nil {
|
||||||
|
fin.Close()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = fin
|
||||||
|
tr = tar.NewReader(rc)
|
||||||
|
|
||||||
|
return tr, rc, nil
|
||||||
|
}
|
@ -32,12 +32,20 @@ var localCmdFlag = &cli.BoolFlag{
|
|||||||
Destination: &localCmd,
|
Destination: &localCmd,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var remoteUser string
|
||||||
|
var remoteUserFlag = &cli.StringFlag{
|
||||||
|
Name: "user, u",
|
||||||
|
Value: "",
|
||||||
|
Usage: "User to run command within a service context",
|
||||||
|
Destination: &remoteUser,
|
||||||
|
}
|
||||||
|
|
||||||
var appCmdCommand = cli.Command{
|
var appCmdCommand = cli.Command{
|
||||||
Name: "command",
|
Name: "command",
|
||||||
Aliases: []string{"cmd"},
|
Aliases: []string{"cmd"},
|
||||||
Usage: "Run app commands",
|
Usage: "Run app commands",
|
||||||
Description: `
|
Description: `
|
||||||
This command runs app specific commands.
|
Run an app specific command.
|
||||||
|
|
||||||
These commands are bash functions, defined in the abra.sh of the recipe itself.
|
These commands are bash functions, defined in the abra.sh of the recipe itself.
|
||||||
They can be run within the context of a service (e.g. app) or locally on your
|
They can be run within the context of a service (e.g. app) or locally on your
|
||||||
@ -52,18 +60,15 @@ Example:
|
|||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
internal.DebugFlag,
|
internal.DebugFlag,
|
||||||
localCmdFlag,
|
localCmdFlag,
|
||||||
|
remoteUserFlag,
|
||||||
},
|
},
|
||||||
BashComplete: autocomplete.AppNameComplete,
|
BashComplete: autocomplete.AppNameComplete,
|
||||||
Before: internal.SubCommandBefore,
|
Before: internal.SubCommandBefore,
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
app := internal.ValidateApp(c)
|
app := internal.ValidateApp(c)
|
||||||
|
|
||||||
if len(c.Args()) <= 2 && !localCmd {
|
if localCmd && remoteUser != "" {
|
||||||
internal.ShowSubcommandHelpAndError(c, errors.New("missing <service>/<command>? did you mean to pass --local?"))
|
internal.ShowSubcommandHelpAndError(c, errors.New("cannot use --local & <user> together"))
|
||||||
}
|
|
||||||
|
|
||||||
if len(c.Args()) > 2 && localCmd {
|
|
||||||
internal.ShowSubcommandHelpAndError(c, errors.New("cannot specify <service> and --local together"))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
abraSh := path.Join(config.RECIPES_DIR, app.Recipe, "abra.sh")
|
abraSh := path.Join(config.RECIPES_DIR, app.Recipe, "abra.sh")
|
||||||
@ -74,6 +79,20 @@ Example:
|
|||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var parsedCmdArgs string
|
||||||
|
var cmdArgsIdx int
|
||||||
|
var hasCmdArgs bool
|
||||||
|
for idx, arg := range c.Args() {
|
||||||
|
if arg == "--" {
|
||||||
|
cmdArgsIdx = idx
|
||||||
|
hasCmdArgs = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if hasCmdArgs && idx > cmdArgsIdx {
|
||||||
|
parsedCmdArgs += fmt.Sprintf("%s ", c.Args().Get(idx))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if localCmd {
|
if localCmd {
|
||||||
cmdName := c.Args().Get(1)
|
cmdName := c.Args().Get(1)
|
||||||
if err := ensureCommand(abraSh, app.Recipe, cmdName); err != nil {
|
if err := ensureCommand(abraSh, app.Recipe, cmdName); err != nil {
|
||||||
@ -82,8 +101,17 @@ Example:
|
|||||||
|
|
||||||
logrus.Debugf("--local detected, running %s on local work station", cmdName)
|
logrus.Debugf("--local detected, running %s on local work station", cmdName)
|
||||||
|
|
||||||
sourceAndExec := fmt.Sprintf("TARGET=local; APP_NAME=%s; . %s; %s", app.StackName(), abraSh, cmdName)
|
var sourceAndExec string
|
||||||
|
if hasCmdArgs {
|
||||||
|
logrus.Debugf("parsed following command arguments: %s", parsedCmdArgs)
|
||||||
|
sourceAndExec = fmt.Sprintf("TARGET=local; APP_NAME=%s; STACK_NAME=%s; . %s; %s %s", app.Name, app.StackName(), abraSh, cmdName, parsedCmdArgs)
|
||||||
|
} else {
|
||||||
|
logrus.Debug("did not detect any command arguments")
|
||||||
|
sourceAndExec = fmt.Sprintf("TARGET=local; APP_NAME=%s; STACK_NAME=%s; . %s; %s", app.Name, app.StackName(), abraSh, cmdName)
|
||||||
|
}
|
||||||
|
|
||||||
cmd := exec.Command("/bin/sh", "-c", sourceAndExec)
|
cmd := exec.Command("/bin/sh", "-c", sourceAndExec)
|
||||||
|
|
||||||
if err := internal.RunCmd(cmd); err != nil {
|
if err := internal.RunCmd(cmd); err != nil {
|
||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -113,20 +141,6 @@ Example:
|
|||||||
|
|
||||||
logrus.Debugf("running command %s within the context of %s_%s", cmdName, app.StackName(), targetServiceName)
|
logrus.Debugf("running command %s within the context of %s_%s", cmdName, app.StackName(), targetServiceName)
|
||||||
|
|
||||||
var parsedCmdArgs string
|
|
||||||
var cmdArgsIdx int
|
|
||||||
var hasCmdArgs bool
|
|
||||||
for idx, arg := range c.Args() {
|
|
||||||
if arg == "--" {
|
|
||||||
cmdArgsIdx = idx
|
|
||||||
hasCmdArgs = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if hasCmdArgs && idx > cmdArgsIdx {
|
|
||||||
parsedCmdArgs += fmt.Sprintf("%s ", c.Args().Get(idx))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if hasCmdArgs {
|
if hasCmdArgs {
|
||||||
logrus.Debugf("parsed following command arguments: %s", parsedCmdArgs)
|
logrus.Debugf("parsed following command arguments: %s", parsedCmdArgs)
|
||||||
} else {
|
} else {
|
||||||
@ -184,9 +198,9 @@ func runCmdRemote(app config.App, abraSh, serviceName, cmdName, cmdArgs string)
|
|||||||
|
|
||||||
var cmd []string
|
var cmd []string
|
||||||
if cmdArgs != "" {
|
if cmdArgs != "" {
|
||||||
cmd = []string{"/bin/sh", "-c", fmt.Sprintf("TARGET=%s; APP_NAME=%s; . /tmp/abra.sh; %s %s", serviceName, app.StackName(), cmdName, cmdArgs)}
|
cmd = []string{"/bin/sh", "-c", fmt.Sprintf("TARGET=%s; APP_NAME=%s; STACK_NAME=%s; . /tmp/abra.sh; %s %s", serviceName, app.Name, app.StackName(), cmdName, cmdArgs)}
|
||||||
} else {
|
} else {
|
||||||
cmd = []string{"/bin/sh", "-c", fmt.Sprintf("TARGET=%s; APP_NAME=%s; . /tmp/abra.sh; %s", serviceName, app.StackName(), cmdName)}
|
cmd = []string{"/bin/sh", "-c", fmt.Sprintf("TARGET=%s; APP_NAME=%s; STACK_NAME=%s; . /tmp/abra.sh; %s", serviceName, app.Name, app.StackName(), cmdName)}
|
||||||
}
|
}
|
||||||
|
|
||||||
logrus.Debugf("running command: %s", strings.Join(cmd, " "))
|
logrus.Debugf("running command: %s", strings.Join(cmd, " "))
|
||||||
@ -200,6 +214,11 @@ func runCmdRemote(app config.App, abraSh, serviceName, cmdName, cmdArgs string)
|
|||||||
Tty: true,
|
Tty: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if remoteUser != "" {
|
||||||
|
logrus.Debugf("running command with user %s", remoteUser)
|
||||||
|
execCreateOpts.User = remoteUser
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME: avoid instantiating a new CLI
|
// FIXME: avoid instantiating a new CLI
|
||||||
dcli, err := command.NewDockerCli()
|
dcli, err := command.NewDockerCli()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -30,7 +30,7 @@ var appCpCommand = cli.Command{
|
|||||||
Before: internal.SubCommandBefore,
|
Before: internal.SubCommandBefore,
|
||||||
Usage: "Copy files to/from a running app service",
|
Usage: "Copy files to/from a running app service",
|
||||||
Description: `
|
Description: `
|
||||||
This command supports copying files to and from any app service file system.
|
Copy files to and from any app service file system.
|
||||||
|
|
||||||
If you want to copy a myfile.txt to the root of the app service:
|
If you want to copy a myfile.txt to the root of the app service:
|
||||||
|
|
||||||
|
@ -21,9 +21,8 @@ var appDeployCommand = cli.Command{
|
|||||||
},
|
},
|
||||||
Before: internal.SubCommandBefore,
|
Before: internal.SubCommandBefore,
|
||||||
Description: `
|
Description: `
|
||||||
This command deploys an app. It does not support incrementing the version of a
|
Deploy an app. It does not support incrementing the version of a deployed app,
|
||||||
deployed app, for this you need to look at the "abra app upgrade <domain>"
|
for this you need to look at the "abra app upgrade <domain>" command.
|
||||||
command.
|
|
||||||
|
|
||||||
You may pass "--force" to re-deploy the same version again. This can be useful
|
You may pass "--force" to re-deploy the same version again. This can be useful
|
||||||
if the container runtime has gotten into a weird state.
|
if the container runtime has gotten into a weird state.
|
||||||
|
@ -25,7 +25,7 @@ var appErrorsCommand = cli.Command{
|
|||||||
Usage: "List errors for a deployed app",
|
Usage: "List errors for a deployed app",
|
||||||
ArgsUsage: "<domain>",
|
ArgsUsage: "<domain>",
|
||||||
Description: `
|
Description: `
|
||||||
This command lists errors for a deployed app.
|
List errors for a deployed app.
|
||||||
|
|
||||||
This is a best-effort implementation and an attempt to gather a number of tips
|
This is a best-effort implementation and an attempt to gather a number of tips
|
||||||
& tricks for finding errors together into one convenient command. When an app
|
& tricks for finding errors together into one convenient command. When an app
|
||||||
|
@ -62,8 +62,8 @@ var appListCommand = cli.Command{
|
|||||||
Aliases: []string{"ls"},
|
Aliases: []string{"ls"},
|
||||||
Usage: "List all managed apps",
|
Usage: "List all managed apps",
|
||||||
Description: `
|
Description: `
|
||||||
This command looks at your local file system listing of apps and servers (e.g.
|
Read the local file system listing of apps and servers (e.g. ~/.abra/) to
|
||||||
in ~/.abra/) to generate a report of all your apps.
|
generate a report of all your apps.
|
||||||
|
|
||||||
By passing the "--status/-S" flag, you can query all your servers for the
|
By passing the "--status/-S" flag, you can query all your servers for the
|
||||||
actual live deployment status. Depending on how many servers you manage, this
|
actual live deployment status. Depending on how many servers you manage, this
|
||||||
|
@ -30,7 +30,7 @@ var logOpts = types.ContainerLogsOptions{
|
|||||||
|
|
||||||
// stackLogs lists logs for all stack services
|
// stackLogs lists logs for all stack services
|
||||||
func stackLogs(c *cli.Context, app config.App, client *dockerClient.Client) {
|
func stackLogs(c *cli.Context, app config.App, client *dockerClient.Client) {
|
||||||
filters, err := app.Filters()
|
filters, err := app.Filters(true, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -103,7 +103,7 @@ var appLogsCommand = cli.Command{
|
|||||||
|
|
||||||
func tailServiceLogs(c *cli.Context, cl *dockerClient.Client, app config.App, serviceName string) error {
|
func tailServiceLogs(c *cli.Context, cl *dockerClient.Client, app config.App, serviceName string) error {
|
||||||
filters := filters.NewArgs()
|
filters := filters.NewArgs()
|
||||||
filters.Add("name", fmt.Sprintf("^%s_%s", app.StackName(), serviceName))
|
filters.Add("name", fmt.Sprintf("%s_%s", app.StackName(), serviceName))
|
||||||
|
|
||||||
chosenService, err := service.GetService(context.Background(), cl, filters, internal.NoInput)
|
chosenService, err := service.GetService(context.Background(), cl, filters, internal.NoInput)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var appNewDescription = `
|
var appNewDescription = `
|
||||||
This command takes a recipe and uses it to create a new app. This new app
|
Take a recipe and uses it to create a new app. This new app configuration is
|
||||||
configuration is stored in your ~/.abra directory under the appropriate server.
|
stored in your ~/.abra directory under the appropriate server.
|
||||||
|
|
||||||
This command does not deploy your app for you. You will need to run "abra app
|
This command does not deploy your app for you. You will need to run "abra app
|
||||||
deploy <domain>" to do so.
|
deploy <domain>" to do so.
|
||||||
|
@ -25,7 +25,7 @@ var appPsCommand = cli.Command{
|
|||||||
Aliases: []string{"p"},
|
Aliases: []string{"p"},
|
||||||
Usage: "Check app status",
|
Usage: "Check app status",
|
||||||
ArgsUsage: "<domain>",
|
ArgsUsage: "<domain>",
|
||||||
Description: "This command shows a more detailed status output of a specific deployed app.",
|
Description: "Show a more detailed status output of a specific deployed app",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
internal.WatchFlag,
|
internal.WatchFlag,
|
||||||
internal.DebugFlag,
|
internal.DebugFlag,
|
||||||
@ -66,7 +66,7 @@ var appPsCommand = cli.Command{
|
|||||||
|
|
||||||
// showPSOutput renders ps output.
|
// showPSOutput renders ps output.
|
||||||
func showPSOutput(c *cli.Context, app config.App, cl *dockerClient.Client) {
|
func showPSOutput(c *cli.Context, app config.App, cl *dockerClient.Client) {
|
||||||
filters, err := app.Filters()
|
filters, err := app.Filters(true, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ var appRemoveCommand = cli.Command{
|
|||||||
logrus.Fatalf("%s is still deployed. Run \"abra app undeploy %s\"", app.Name, app.Name)
|
logrus.Fatalf("%s is still deployed. Run \"abra app undeploy %s\"", app.Name, app.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
fs, err := app.Filters()
|
fs, err := app.Filters(false, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -114,6 +114,11 @@ var appRemoveCommand = cli.Command{
|
|||||||
logrus.Info("no secrets to remove")
|
logrus.Info("no secrets to remove")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fs, err = app.Filters(false, true)
|
||||||
|
if err != nil {
|
||||||
|
logrus.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
volumeListOKBody, err := cl.VolumeList(context.Background(), fs)
|
volumeListOKBody, err := cl.VolumeList(context.Background(), fs)
|
||||||
volumeList := volumeListOKBody.Volumes
|
volumeList := volumeListOKBody.Volumes
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
201
cli/app/restore.go
Normal file
201
cli/app/restore.go
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
package app
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"coopcloud.tech/abra/cli/internal"
|
||||||
|
"coopcloud.tech/abra/pkg/autocomplete"
|
||||||
|
"coopcloud.tech/abra/pkg/client"
|
||||||
|
"coopcloud.tech/abra/pkg/config"
|
||||||
|
containerPkg "coopcloud.tech/abra/pkg/container"
|
||||||
|
"coopcloud.tech/abra/pkg/recipe"
|
||||||
|
"coopcloud.tech/abra/pkg/upstream/container"
|
||||||
|
"github.com/docker/cli/cli/command"
|
||||||
|
"github.com/docker/docker/api/types"
|
||||||
|
"github.com/docker/docker/api/types/filters"
|
||||||
|
"github.com/docker/docker/pkg/archive"
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
|
"github.com/urfave/cli"
|
||||||
|
)
|
||||||
|
|
||||||
|
type restoreConfig struct {
|
||||||
|
preHookCmd string
|
||||||
|
postHookCmd string
|
||||||
|
}
|
||||||
|
|
||||||
|
var appRestoreCommand = cli.Command{
|
||||||
|
Name: "restore",
|
||||||
|
Aliases: []string{"rs"},
|
||||||
|
Usage: "Run app restore",
|
||||||
|
ArgsUsage: "<domain> <service> <file>",
|
||||||
|
Flags: []cli.Flag{
|
||||||
|
internal.DebugFlag,
|
||||||
|
},
|
||||||
|
Before: internal.SubCommandBefore,
|
||||||
|
BashComplete: autocomplete.AppNameComplete,
|
||||||
|
Description: `
|
||||||
|
Run an app restore.
|
||||||
|
|
||||||
|
Pre/post hook commands are defined in the recipe configuration. Abra reads this
|
||||||
|
configuration and run the comands in the context of the service before
|
||||||
|
restoring the backup.
|
||||||
|
|
||||||
|
Unlike "abra app backup", restore must be run on a per-service basis. You can
|
||||||
|
not restore all services in one go. Backup files produced by Abra are
|
||||||
|
compressed archives which use absolute paths. This allows Abra to restore
|
||||||
|
according to standard tar command logic.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
abra app restore example.com app ~/.abra/backups/example_com_app_609341138.tar.gz
|
||||||
|
`,
|
||||||
|
Action: func(c *cli.Context) error {
|
||||||
|
app := internal.ValidateApp(c)
|
||||||
|
|
||||||
|
serviceName := c.Args().Get(1)
|
||||||
|
if serviceName == "" {
|
||||||
|
internal.ShowSubcommandHelpAndError(c, errors.New("missing <service>?"))
|
||||||
|
}
|
||||||
|
|
||||||
|
backupPath := c.Args().Get(2)
|
||||||
|
if backupPath == "" {
|
||||||
|
internal.ShowSubcommandHelpAndError(c, errors.New("missing <file>?"))
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := os.Stat(backupPath); err != nil {
|
||||||
|
if os.IsNotExist(err) {
|
||||||
|
logrus.Fatalf("%s doesn't exist?", backupPath)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
recipe, err := recipe.Get(app.Recipe)
|
||||||
|
if err != nil {
|
||||||
|
logrus.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
restoreConfigs := make(map[string]restoreConfig)
|
||||||
|
for _, service := range recipe.Config.Services {
|
||||||
|
if restoreEnabled, ok := service.Deploy.Labels["backupbot.restore"]; ok {
|
||||||
|
if restoreEnabled == "true" {
|
||||||
|
fullServiceName := fmt.Sprintf("%s_%s", app.StackName(), service.Name)
|
||||||
|
rsConfig := restoreConfig{}
|
||||||
|
|
||||||
|
logrus.Debugf("restore config detected for %s", fullServiceName)
|
||||||
|
|
||||||
|
if preHookCmd, ok := service.Deploy.Labels["backupbot.restore.pre-hook"]; ok {
|
||||||
|
logrus.Debugf("detected pre-hook command for %s: %s", fullServiceName, preHookCmd)
|
||||||
|
rsConfig.preHookCmd = preHookCmd
|
||||||
|
}
|
||||||
|
|
||||||
|
if postHookCmd, ok := service.Deploy.Labels["backupbot.restore.post-hook"]; ok {
|
||||||
|
logrus.Debugf("detected post-hook command for %s: %s", fullServiceName, postHookCmd)
|
||||||
|
rsConfig.postHookCmd = postHookCmd
|
||||||
|
}
|
||||||
|
|
||||||
|
restoreConfigs[service.Name] = rsConfig
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rsConfig, ok := restoreConfigs[serviceName]
|
||||||
|
if !ok {
|
||||||
|
rsConfig = restoreConfig{}
|
||||||
|
}
|
||||||
|
if err := runRestore(app, backupPath, serviceName, rsConfig); err != nil {
|
||||||
|
logrus.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// runRestore does the actual restore logic.
|
||||||
|
func runRestore(app config.App, backupPath, serviceName string, rsConfig restoreConfig) error {
|
||||||
|
cl, err := client.New(app.Server)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIXME: avoid instantiating a new CLI
|
||||||
|
dcli, err := command.NewDockerCli()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
filters := filters.NewArgs()
|
||||||
|
filters.Add("name", fmt.Sprintf("^%s_%s", app.StackName(), serviceName))
|
||||||
|
|
||||||
|
targetContainer, err := containerPkg.GetContainer(context.Background(), cl, filters, true)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
fullServiceName := fmt.Sprintf("%s_%s", app.StackName(), serviceName)
|
||||||
|
if rsConfig.preHookCmd != "" {
|
||||||
|
splitCmd := internal.SafeSplit(rsConfig.preHookCmd)
|
||||||
|
|
||||||
|
logrus.Debugf("split pre-hook command for %s into %s", fullServiceName, splitCmd)
|
||||||
|
|
||||||
|
preHookExecOpts := types.ExecConfig{
|
||||||
|
AttachStderr: true,
|
||||||
|
AttachStdin: true,
|
||||||
|
AttachStdout: true,
|
||||||
|
Cmd: splitCmd,
|
||||||
|
Detach: false,
|
||||||
|
Tty: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := container.RunExec(dcli, cl, targetContainer.ID, &preHookExecOpts); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
logrus.Infof("succesfully ran %s pre-hook command: %s", fullServiceName, rsConfig.preHookCmd)
|
||||||
|
}
|
||||||
|
|
||||||
|
backupReader, err := os.Open(backupPath)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
content, err := archive.DecompressStream(backupReader)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// we use absolute paths so tar knows what to do. it will restore files
|
||||||
|
// according to the paths set in the compresed archive
|
||||||
|
restorePath := "/"
|
||||||
|
|
||||||
|
copyOpts := types.CopyToContainerOptions{AllowOverwriteDirWithFile: false, CopyUIDGID: false}
|
||||||
|
if err := cl.CopyToContainer(context.Background(), targetContainer.ID, restorePath, content, copyOpts); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
logrus.Infof("restored %s to %s", backupPath, fullServiceName)
|
||||||
|
|
||||||
|
if rsConfig.postHookCmd != "" {
|
||||||
|
splitCmd := internal.SafeSplit(rsConfig.postHookCmd)
|
||||||
|
|
||||||
|
logrus.Debugf("split post-hook command for %s into %s", fullServiceName, splitCmd)
|
||||||
|
|
||||||
|
postHookExecOpts := types.ExecConfig{
|
||||||
|
AttachStderr: true,
|
||||||
|
AttachStdin: true,
|
||||||
|
AttachStdout: true,
|
||||||
|
Cmd: splitCmd,
|
||||||
|
Detach: false,
|
||||||
|
Tty: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := container.RunExec(dcli, cl, targetContainer.ID, &postHookExecOpts); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
logrus.Infof("succesfully ran %s post-hook command: %s", fullServiceName, rsConfig.postHookCmd)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
@ -216,7 +216,7 @@ Example:
|
|||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
filters, err := app.Filters()
|
filters, err := app.Filters(false, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -293,7 +293,7 @@ var appSecretLsCommand = cli.Command{
|
|||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
filters, err := app.Filters()
|
filters, err := app.Filters(false, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -32,8 +32,8 @@ var appUpgradeCommand = cli.Command{
|
|||||||
},
|
},
|
||||||
Before: internal.SubCommandBefore,
|
Before: internal.SubCommandBefore,
|
||||||
Description: `
|
Description: `
|
||||||
This command supports upgrading an app. You can use it to choose and roll out a
|
Upgrade an app. You can use it to choose and roll out a new upgrade to an
|
||||||
new upgrade to an existing app.
|
existing app.
|
||||||
|
|
||||||
This command specifically supports incrementing the version of running apps, as
|
This command specifically supports incrementing the version of running apps, as
|
||||||
opposed to "abra app deploy <domain>" which will not change the version of a
|
opposed to "abra app deploy <domain>" which will not change the version of a
|
||||||
|
@ -41,9 +41,9 @@ var appVersionCommand = cli.Command{
|
|||||||
Before: internal.SubCommandBefore,
|
Before: internal.SubCommandBefore,
|
||||||
Usage: "Show app versions",
|
Usage: "Show app versions",
|
||||||
Description: `
|
Description: `
|
||||||
This command shows all information about versioning related to a deployed app.
|
Show all information about versioning related to a deployed app. This includes
|
||||||
This includes the individual image names, tags and digests. But also the Co-op
|
the individual image names, tags and digests. But also the Co-op Cloud recipe
|
||||||
Cloud recipe version.
|
version.
|
||||||
`,
|
`,
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
app := internal.ValidateApp(c)
|
app := internal.ValidateApp(c)
|
||||||
|
@ -26,7 +26,7 @@ var appVolumeListCommand = cli.Command{
|
|||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
app := internal.ValidateApp(c)
|
app := internal.ValidateApp(c)
|
||||||
|
|
||||||
filters, err := app.Filters()
|
filters, err := app.Filters(false, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -80,7 +80,7 @@ Passing "--force/-f" will select all volumes for removal. Be careful.
|
|||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
app := internal.ValidateApp(c)
|
app := internal.ValidateApp(c)
|
||||||
|
|
||||||
filters, err := app.Filters()
|
filters, err := app.Filters(false, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -71,13 +71,14 @@ var catalogueGenerateCommand = cli.Command{
|
|||||||
},
|
},
|
||||||
Before: internal.SubCommandBefore,
|
Before: internal.SubCommandBefore,
|
||||||
Description: `
|
Description: `
|
||||||
This command generates a new copy of the recipe catalogue which can be found on:
|
Generate a new copy of the recipe catalogue which can be found on:
|
||||||
|
|
||||||
https://recipes.coopcloud.tech
|
https://recipes.coopcloud.tech (website that humans read)
|
||||||
|
https://recipes.coopcloud.tech/recipes.json (JSON that Abra reads)
|
||||||
|
|
||||||
It polls the entire git.coopcloud.tech/coop-cloud/... recipe repository
|
It polls the entire git.coopcloud.tech/coop-cloud/... recipe repository
|
||||||
listing, parses README.md and git tags of those repositories to produce recipe
|
listing, parses README.md and git tags to produce recipe metadata which is
|
||||||
metadata and produces a recipes JSON file.
|
loaded into the catalogue JSON file.
|
||||||
|
|
||||||
It is possible to generate new metadata for a single recipe by passing
|
It is possible to generate new metadata for a single recipe by passing
|
||||||
<recipe>. The existing local catalogue will be updated, not overwritten.
|
<recipe>. The existing local catalogue will be updated, not overwritten.
|
||||||
|
27
cli/cli.go
27
cli/cli.go
@ -27,19 +27,13 @@ var AutoCompleteCommand = cli.Command{
|
|||||||
Aliases: []string{"ac"},
|
Aliases: []string{"ac"},
|
||||||
Usage: "Configure shell autocompletion (recommended)",
|
Usage: "Configure shell autocompletion (recommended)",
|
||||||
Description: `
|
Description: `
|
||||||
This command helps set up autocompletion in your shell by downloading the
|
Set up auto-completion in your shell by downloading the relevant files and
|
||||||
relevant autocompletion files and laying out what additional information must
|
laying out what additional information must be loaded. Supported shells are as
|
||||||
be loaded.
|
follows: bash, fizsh & zsh.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
abra autocomplete bash
|
abra autocomplete bash
|
||||||
|
|
||||||
Supported shells are as follows:
|
|
||||||
|
|
||||||
fizsh
|
|
||||||
zsh
|
|
||||||
bash
|
|
||||||
`,
|
`,
|
||||||
ArgsUsage: "<shell>",
|
ArgsUsage: "<shell>",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
@ -86,7 +80,7 @@ Supported shells are as follows:
|
|||||||
switch shellType {
|
switch shellType {
|
||||||
case "bash":
|
case "bash":
|
||||||
fmt.Println(fmt.Sprintf(`
|
fmt.Println(fmt.Sprintf(`
|
||||||
# Run the following commands to install autocompletion
|
# Run the following commands to install auto-completion
|
||||||
sudo mkdir /etc/bash_completion.d/
|
sudo mkdir /etc/bash_completion.d/
|
||||||
sudo cp %s /etc/bash_completion.d/abra
|
sudo cp %s /etc/bash_completion.d/abra
|
||||||
echo "source /etc/bash_completion.d/abra" >> ~/.bashrc
|
echo "source /etc/bash_completion.d/abra" >> ~/.bashrc
|
||||||
@ -94,7 +88,7 @@ echo "source /etc/bash_completion.d/abra" >> ~/.bashrc
|
|||||||
`, autocompletionFile))
|
`, autocompletionFile))
|
||||||
case "zsh":
|
case "zsh":
|
||||||
fmt.Println(fmt.Sprintf(`
|
fmt.Println(fmt.Sprintf(`
|
||||||
# Run the following commands to install autocompletion
|
# Run the following commands to install auto-completion
|
||||||
sudo mkdir /etc/zsh/completion.d/
|
sudo mkdir /etc/zsh/completion.d/
|
||||||
sudo cp %s /etc/zsh/completion.d/abra
|
sudo cp %s /etc/zsh/completion.d/abra
|
||||||
echo "PROG=abra\n_CLI_ZSH_AUTOCOMPLETE_HACK=1\nsource /etc/zsh/completion.d/abra" >> ~/.zshrc
|
echo "PROG=abra\n_CLI_ZSH_AUTOCOMPLETE_HACK=1\nsource /etc/zsh/completion.d/abra" >> ~/.zshrc
|
||||||
@ -112,13 +106,11 @@ var UpgradeCommand = cli.Command{
|
|||||||
Aliases: []string{"u"},
|
Aliases: []string{"u"},
|
||||||
Usage: "Upgrade Abra itself",
|
Usage: "Upgrade Abra itself",
|
||||||
Description: `
|
Description: `
|
||||||
This command allows you to upgrade Abra in-place with the latest stable or
|
Upgrade Abra in-place with the latest stable or release candidate.
|
||||||
release candidate.
|
|
||||||
|
|
||||||
If you would like to install the latest release candidate, please pass the
|
Pass "-r/--rc" to install the latest release candidate. Please bear in mind
|
||||||
"-r/--rc" option. Please bear in mind that the latest release candidate may
|
that it may contain catastrophic bugs. Thank you very much for the testing
|
||||||
have some catastrophic bugs contained in it. In any case, thank you very much
|
efforts!
|
||||||
for the testing efforts!
|
|
||||||
`,
|
`,
|
||||||
Flags: []cli.Flag{internal.RCFlag},
|
Flags: []cli.Flag{internal.RCFlag},
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
@ -172,6 +164,7 @@ func newAbraApp(version, commit string) *cli.App {
|
|||||||
path.Join(config.SERVERS_DIR),
|
path.Join(config.SERVERS_DIR),
|
||||||
path.Join(config.RECIPES_DIR),
|
path.Join(config.RECIPES_DIR),
|
||||||
path.Join(config.VENDOR_DIR),
|
path.Join(config.VENDOR_DIR),
|
||||||
|
path.Join(config.BACKUP_DIR),
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, path := range paths {
|
for _, path := range paths {
|
||||||
|
35
cli/internal/backup.go
Normal file
35
cli/internal/backup.go
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
package internal
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
// SafeSplit splits up a string into a list of commands safely.
|
||||||
|
func SafeSplit(s string) []string {
|
||||||
|
split := strings.Split(s, " ")
|
||||||
|
|
||||||
|
var result []string
|
||||||
|
var inquote string
|
||||||
|
var block string
|
||||||
|
for _, i := range split {
|
||||||
|
if inquote == "" {
|
||||||
|
if strings.HasPrefix(i, "'") || strings.HasPrefix(i, "\"") {
|
||||||
|
inquote = string(i[0])
|
||||||
|
block = strings.TrimPrefix(i, inquote) + " "
|
||||||
|
} else {
|
||||||
|
result = append(result, i)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if !strings.HasSuffix(i, inquote) {
|
||||||
|
block += i + " "
|
||||||
|
} else {
|
||||||
|
block += strings.TrimSuffix(i, inquote)
|
||||||
|
inquote = ""
|
||||||
|
result = append(result, block)
|
||||||
|
block = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
@ -41,9 +41,9 @@ var recipeNewCommand = cli.Command{
|
|||||||
Usage: "Create a new recipe",
|
Usage: "Create a new recipe",
|
||||||
ArgsUsage: "<recipe>",
|
ArgsUsage: "<recipe>",
|
||||||
Description: `
|
Description: `
|
||||||
This command creates a new recipe.
|
Create a new recipe.
|
||||||
|
|
||||||
Abra uses our built-in example repository which is available here:
|
Abra uses the built-in example repository which is available here:
|
||||||
|
|
||||||
https://git.coopcloud.tech/coop-cloud/example
|
https://git.coopcloud.tech/coop-cloud/example
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ In order to share your recipe, you can upload it the git repository to:
|
|||||||
|
|
||||||
If you're not sure how to do that, come chat with us:
|
If you're not sure how to do that, come chat with us:
|
||||||
|
|
||||||
https://docs.coopcloud.tech/contact
|
https://docs.coopcloud.tech/intro/contact
|
||||||
|
|
||||||
See "abra recipe -h" for additional recipe maintainer commands.
|
See "abra recipe -h" for additional recipe maintainer commands.
|
||||||
|
|
||||||
|
@ -13,7 +13,8 @@ var RecipeCommand = cli.Command{
|
|||||||
Description: `
|
Description: `
|
||||||
A recipe is a blueprint for an app. It is a bunch of config files which
|
A recipe is a blueprint for an app. It is a bunch of config files which
|
||||||
describe how to deploy and maintain an app. Recipes are maintained by the Co-op
|
describe how to deploy and maintain an app. Recipes are maintained by the Co-op
|
||||||
Cloud community and you can use Abra to read them and create apps for you.
|
Cloud community and you can use Abra to read them, deploy them and create apps
|
||||||
|
for you.
|
||||||
|
|
||||||
Anyone who uses a recipe can become a maintainer. Maintainers typically make
|
Anyone who uses a recipe can become a maintainer. Maintainers typically make
|
||||||
sure the recipe is in good working order and the config upgraded in a timely
|
sure the recipe is in good working order and the config upgraded in a timely
|
||||||
|
@ -27,17 +27,16 @@ var recipeReleaseCommand = cli.Command{
|
|||||||
Usage: "Release a new recipe version",
|
Usage: "Release a new recipe version",
|
||||||
ArgsUsage: "<recipe> [<version>]",
|
ArgsUsage: "<recipe> [<version>]",
|
||||||
Description: `
|
Description: `
|
||||||
This command is used to specify a new version of a recipe. These versions are
|
Create a new version of a recipe. These versions are then published on the
|
||||||
then published on the Co-op Cloud recipe catalogue. These versions take the
|
Co-op Cloud recipe catalogue. These versions take the following form:
|
||||||
following form:
|
|
||||||
|
|
||||||
a.b.c+x.y.z
|
a.b.c+x.y.z
|
||||||
|
|
||||||
Where the "a.b.c" part is a semantic version determined by the maintainer. And
|
Where the "a.b.c" part is a semantic version determined by the maintainer. The
|
||||||
the "x.y.z" part is the image tag of the recipe "app" service (the main
|
"x.y.z" part is the image tag of the recipe "app" service (the main container
|
||||||
container which contains the software to be used).
|
which contains the software to be used, by naming convention).
|
||||||
|
|
||||||
We maintain a semantic versioning scheme ("a.b.c") alongside the libre app
|
We maintain a semantic versioning scheme ("a.b.c") alongside the recipe
|
||||||
versioning scheme ("x.y.z") in order to maximise the chances that the nature of
|
versioning scheme ("x.y.z") in order to maximise the chances that the nature of
|
||||||
recipe updates are properly communicated. I.e. developers of an app might
|
recipe updates are properly communicated. I.e. developers of an app might
|
||||||
publish a minor version but that might lead to changes in the recipe which are
|
publish a minor version but that might lead to changes in the recipe which are
|
||||||
@ -393,15 +392,15 @@ func createReleaseFromPreviousTag(tagString, mainAppVersion string, recipe recip
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := commitRelease(recipe, tagString); err != nil {
|
if err := commitRelease(recipe, tagString); err != nil {
|
||||||
logrus.Fatal(err)
|
logrus.Fatalf("failed to commit changes: %s", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := tagRelease(tagString, repo); err != nil {
|
if err := tagRelease(tagString, repo); err != nil {
|
||||||
logrus.Fatal(err)
|
logrus.Fatalf("failed to tag release: %s", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := pushRelease(recipe, tagString); err != nil {
|
if err := pushRelease(recipe, tagString); err != nil {
|
||||||
logrus.Fatal(err)
|
logrus.Fatalf("failed to publish new release: %s", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -31,8 +31,8 @@ var recipeSyncCommand = cli.Command{
|
|||||||
},
|
},
|
||||||
Before: internal.SubCommandBefore,
|
Before: internal.SubCommandBefore,
|
||||||
Description: `
|
Description: `
|
||||||
This command will generate labels for the main recipe service (i.e. by
|
Generate labels for the main recipe service (i.e. by convention, the service
|
||||||
convention, the service named 'app') which corresponds to the following format:
|
named "app") which corresponds to the following format:
|
||||||
|
|
||||||
coop-cloud.${STACK_NAME}.version=<version>
|
coop-cloud.${STACK_NAME}.version=<version>
|
||||||
|
|
||||||
|
@ -31,9 +31,9 @@ var recipeUpgradeCommand = cli.Command{
|
|||||||
Aliases: []string{"u"},
|
Aliases: []string{"u"},
|
||||||
Usage: "Upgrade recipe image tags",
|
Usage: "Upgrade recipe image tags",
|
||||||
Description: `
|
Description: `
|
||||||
This command reads and attempts to parse all image tags within the given
|
Parse all image tags within the given <recipe> configuration and prompt with
|
||||||
<recipe> configuration and prompt with more recent tags to upgrade to. It will
|
more recent tags to upgrade to. It will update the relevant compose file tags
|
||||||
update the relevant compose file tags on the local file system.
|
on the local file system.
|
||||||
|
|
||||||
Some image tags cannot be parsed because they do not follow some sort of
|
Some image tags cannot be parsed because they do not follow some sort of
|
||||||
semver-like convention. In this case, all possible tags will be listed and it
|
semver-like convention. In this case, all possible tags will be listed and it
|
||||||
@ -61,6 +61,10 @@ You may invoke this command in "wizard" mode and be prompted for input:
|
|||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
recipe := internal.ValidateRecipeWithPrompt(c, true)
|
recipe := internal.ValidateRecipeWithPrompt(c, true)
|
||||||
|
|
||||||
|
if err := recipePkg.EnsureUpToDate(recipe.Name); err != nil {
|
||||||
|
logrus.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
bumpType := btoi(internal.Major)*4 + btoi(internal.Minor)*2 + btoi(internal.Patch)
|
bumpType := btoi(internal.Major)*4 + btoi(internal.Minor)*2 + btoi(internal.Patch)
|
||||||
if bumpType != 0 {
|
if bumpType != 0 {
|
||||||
// a bitwise check if the number is a power of 2
|
// a bitwise check if the number is a power of 2
|
||||||
|
@ -25,8 +25,8 @@ var RecordListCommand = cli.Command{
|
|||||||
},
|
},
|
||||||
Before: internal.SubCommandBefore,
|
Before: internal.SubCommandBefore,
|
||||||
Description: `
|
Description: `
|
||||||
This command lists all domain name records managed by a 3rd party provider for
|
List all domain name records managed by a 3rd party provider for a specific
|
||||||
a specific zone.
|
zone.
|
||||||
|
|
||||||
You must specify a zone (e.g. example.com) under which your domain name records
|
You must specify a zone (e.g. example.com) under which your domain name records
|
||||||
are listed. This zone must already be created on your provider account.
|
are listed. This zone must already be created on your provider account.
|
||||||
|
@ -33,7 +33,7 @@ var RecordNewCommand = cli.Command{
|
|||||||
},
|
},
|
||||||
Before: internal.SubCommandBefore,
|
Before: internal.SubCommandBefore,
|
||||||
Description: `
|
Description: `
|
||||||
This command creates a new domain name record for a specific zone.
|
Create a new domain name record for a specific zone.
|
||||||
|
|
||||||
You must specify a zone (e.g. example.com) under which your domain name records
|
You must specify a zone (e.g. example.com) under which your domain name records
|
||||||
are listed. This zone must already be created on your provider account.
|
are listed. This zone must already be created on your provider account.
|
||||||
|
@ -11,9 +11,9 @@ var RecordCommand = cli.Command{
|
|||||||
Aliases: []string{"rc"},
|
Aliases: []string{"rc"},
|
||||||
ArgsUsage: "<record>",
|
ArgsUsage: "<record>",
|
||||||
Description: `
|
Description: `
|
||||||
This command supports managing domain name records via 3rd party providers such
|
Manage domain name records via 3rd party providers such as Gandi DNS. It
|
||||||
as Gandi DNS. It supports listing, creating and removing all types of records
|
supports listing, creating and removing all types of records that you might
|
||||||
that you might need for managing Co-op Cloud apps.
|
need for managing Co-op Cloud apps.
|
||||||
|
|
||||||
The following providers are supported:
|
The following providers are supported:
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ var RecordRemoveCommand = cli.Command{
|
|||||||
},
|
},
|
||||||
Before: internal.SubCommandBefore,
|
Before: internal.SubCommandBefore,
|
||||||
Description: `
|
Description: `
|
||||||
This command removes a domain name record for a specific zone.
|
Remove a domain name record for a specific zone.
|
||||||
|
|
||||||
It uses the type of record and name to match existing records and choose one
|
It uses the type of record and name to match existing records and choose one
|
||||||
for deletion. You must specify a zone (e.g. example.com) under which your
|
for deletion. You must specify a zone (e.g. example.com) under which your
|
||||||
|
@ -28,8 +28,8 @@ import (
|
|||||||
var (
|
var (
|
||||||
dockerInstallMsg = `
|
dockerInstallMsg = `
|
||||||
A docker installation cannot be found on %s. This is a required system
|
A docker installation cannot be found on %s. This is a required system
|
||||||
dependency for running Co-op Cloud on your server. If you would like, Abra can
|
dependency for running Co-op Cloud apps on your server. If you would like, Abra
|
||||||
attempt to install Docker for you using the upstream non-interactive
|
can attempt to install Docker for you using the upstream non-interactive
|
||||||
installation script.
|
installation script.
|
||||||
|
|
||||||
See the following documentation for more:
|
See the following documentation for more:
|
||||||
@ -246,7 +246,7 @@ Abra was unable to bootstrap Docker, see below for logs:
|
|||||||
|
|
||||||
%s
|
%s
|
||||||
|
|
||||||
If nothing works, you try running the Docker install script manually on your server:
|
If nothing works, you can try running the Docker install script manually on your server:
|
||||||
|
|
||||||
wget -O- https://get.docker.com | bash
|
wget -O- https://get.docker.com | bash
|
||||||
|
|
||||||
@ -276,7 +276,7 @@ Abra was unable to bootstrap Docker, see below for logs:
|
|||||||
|
|
||||||
%s
|
%s
|
||||||
|
|
||||||
This could be due to a number of things but one of the most common is that your
|
This could be due to several reasons. One of the most common is that your
|
||||||
server user account does not have sudo access, and if it does, you need to pass
|
server user account does not have sudo access, and if it does, you need to pass
|
||||||
"--ask-sudo-pass" in order to supply Abra with your password.
|
"--ask-sudo-pass" in order to supply Abra with your password.
|
||||||
|
|
||||||
@ -370,9 +370,9 @@ var serverAddCommand = cli.Command{
|
|||||||
Aliases: []string{"a"},
|
Aliases: []string{"a"},
|
||||||
Usage: "Add a server to your configuration",
|
Usage: "Add a server to your configuration",
|
||||||
Description: `
|
Description: `
|
||||||
This command adds a new server to your configuration so that it can be managed
|
Add a new server to your configuration so that it can be managed by Abra. This
|
||||||
by Abra. This command can also provision your server ("--provision/-p") with a
|
command can also provision your server ("--provision/-p") with a Docker
|
||||||
Docker installation so that it is capable of hosting Co-op Cloud apps.
|
installation so that it is capable of hosting Co-op Cloud apps.
|
||||||
|
|
||||||
Abra will default to expecting that you have a running ssh-agent and are using
|
Abra will default to expecting that you have a running ssh-agent and are using
|
||||||
SSH keys to connect to your new server. Abra will also read your SSH config
|
SSH keys to connect to your new server. Abra will also read your SSH config
|
||||||
@ -385,9 +385,9 @@ password. "--ask-sudo-pass" may be passed if you run your provisioning commands
|
|||||||
via sudo privilege escalation.
|
via sudo privilege escalation.
|
||||||
|
|
||||||
The <domain> argument must be a publicy accessible domain name which points to
|
The <domain> argument must be a publicy accessible domain name which points to
|
||||||
your server. You should working SSH access to this server already, Abra will
|
your server. You should have working SSH access to this server already, Abra
|
||||||
assume port 22 and will use your current system username to make an initial
|
will assume port 22 and will use your current system username to make an
|
||||||
connection. You can use the <user> and <port> arguments to adjust this.
|
initial connection. You can use the <user> and <port> arguments to adjust this.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
|
@ -99,9 +99,10 @@ You can access this new VPS via SSH using the following command:
|
|||||||
ssh root@%s
|
ssh root@%s
|
||||||
|
|
||||||
Please note, this server is not managed by Abra yet (i.e. "abra server ls" will
|
Please note, this server is not managed by Abra yet (i.e. "abra server ls" will
|
||||||
not list this server)! You will need to assign a domain name record ("abra
|
not list this server)! You will need to assign a domain name record (manually
|
||||||
record new") and add the server to your Abra configuration ("abra server add")
|
or by using "abra record new") and add the server to your Abra configuration
|
||||||
to have a working server that you can deploy Co-op Cloud apps to.
|
("abra server add") to have a working server that you can deploy Co-op Cloud
|
||||||
|
apps to.
|
||||||
|
|
||||||
When setting up domain name records, you probably want to set up the following
|
When setting up domain name records, you probably want to set up the following
|
||||||
2 A records. This supports deploying apps to your root domain (e.g.
|
2 A records. This supports deploying apps to your root domain (e.g.
|
||||||
@ -110,7 +111,6 @@ bar.example.com).
|
|||||||
|
|
||||||
@ 1800 IN A %s
|
@ 1800 IN A %s
|
||||||
* 1800 IN A %s
|
* 1800 IN A %s
|
||||||
|
|
||||||
`,
|
`,
|
||||||
internal.HetznerCloudName, ip, rootPassword,
|
internal.HetznerCloudName, ip, rootPassword,
|
||||||
ip, ip, ip,
|
ip, ip, ip,
|
||||||
@ -181,9 +181,10 @@ address. You can learn all about how to get SSH access to your new Capsul on:
|
|||||||
%s/about-ssh
|
%s/about-ssh
|
||||||
|
|
||||||
Please note, this server is not managed by Abra yet (i.e. "abra server ls" will
|
Please note, this server is not managed by Abra yet (i.e. "abra server ls" will
|
||||||
not list this server)! You will need to assign a domain name record ("abra
|
not list this server)! You will need to assign a domain name record (manually
|
||||||
record new") and add the server to your Abra configuration ("abra server add")
|
or by using "abra record new") and add the server to your Abra configuration
|
||||||
to have a working server that you can deploy Co-op Cloud apps to.
|
("abra server add") to have a working server that you can deploy Co-op Cloud
|
||||||
|
apps to.
|
||||||
|
|
||||||
When setting up domain name records, you probably want to set up the following
|
When setting up domain name records, you probably want to set up the following
|
||||||
2 A records. This supports deploying apps to your root domain (e.g.
|
2 A records. This supports deploying apps to your root domain (e.g.
|
||||||
@ -192,7 +193,6 @@ bar.example.com).
|
|||||||
|
|
||||||
@ 1800 IN A <your-capsul-ip>
|
@ 1800 IN A <your-capsul-ip>
|
||||||
* 1800 IN A <your-capsul-ip>
|
* 1800 IN A <your-capsul-ip>
|
||||||
|
|
||||||
`, internal.CapsulName, resp.ID, internal.CapsulInstanceURL))
|
`, internal.CapsulName, resp.ID, internal.CapsulInstanceURL))
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -203,7 +203,7 @@ var serverNewCommand = cli.Command{
|
|||||||
Aliases: []string{"n"},
|
Aliases: []string{"n"},
|
||||||
Usage: "Create a new server using a 3rd party provider",
|
Usage: "Create a new server using a 3rd party provider",
|
||||||
Description: `
|
Description: `
|
||||||
This command creates a new server via a 3rd party provider.
|
Create a new server via a 3rd party provider.
|
||||||
|
|
||||||
The following providers are supported:
|
The following providers are supported:
|
||||||
|
|
||||||
@ -217,8 +217,6 @@ You may invoke this command in "wizard" mode and be prompted for input:
|
|||||||
API tokens are read from the environment if specified, e.g.
|
API tokens are read from the environment if specified, e.g.
|
||||||
|
|
||||||
export HCLOUD_TOKEN=...
|
export HCLOUD_TOKEN=...
|
||||||
|
|
||||||
Where "$provider_TOKEN" is the expected env var format.
|
|
||||||
`,
|
`,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
internal.DebugFlag,
|
internal.DebugFlag,
|
||||||
|
@ -104,7 +104,7 @@ var serverRemoveCommand = cli.Command{
|
|||||||
ArgsUsage: "[<server>]",
|
ArgsUsage: "[<server>]",
|
||||||
Usage: "Remove a managed server",
|
Usage: "Remove a managed server",
|
||||||
Description: `
|
Description: `
|
||||||
This command removes a server from Abra management.
|
Remova a server from Abra management.
|
||||||
|
|
||||||
Depending on whether you used a 3rd party provider to create this server ("abra
|
Depending on whether you used a 3rd party provider to create this server ("abra
|
||||||
server new"), you can also destroy the virtual server as well. Pass
|
server new"), you can also destroy the virtual server as well. Pass
|
||||||
|
@ -10,13 +10,12 @@ var ServerCommand = cli.Command{
|
|||||||
Aliases: []string{"s"},
|
Aliases: []string{"s"},
|
||||||
Usage: "Manage servers",
|
Usage: "Manage servers",
|
||||||
Description: `
|
Description: `
|
||||||
These commands support creating, managing and removing servers using 3rd party
|
Create, manage and remove servers using 3rd party integrations.
|
||||||
integrations.
|
|
||||||
|
|
||||||
Servers can be created from scratch using the "abra server new" command. If you
|
Servers can be created from scratch using the "abra server new" command. If you
|
||||||
already have a server, you can add it to your configuration using "abra server
|
already have a server, you can add it to your configuration using "abra server
|
||||||
add". Abra can provision servers so that they are ready to deploy Co-op Cloud
|
add". Abra can provision servers so that they are ready to deploy Co-op Cloud
|
||||||
apps, see available flags on "server add" for more.
|
recipes, see available flags on "abra server add" for more.
|
||||||
`,
|
`,
|
||||||
Subcommands: []cli.Command{
|
Subcommands: []cli.Command{
|
||||||
serverNewCommand,
|
serverNewCommand,
|
||||||
|
17
go.mod
17
go.mod
@ -7,12 +7,12 @@ require (
|
|||||||
github.com/AlecAivazis/survey/v2 v2.3.4
|
github.com/AlecAivazis/survey/v2 v2.3.4
|
||||||
github.com/Autonomic-Cooperative/godotenv v1.3.1-0.20210731094149-b031ea1211e7
|
github.com/Autonomic-Cooperative/godotenv v1.3.1-0.20210731094149-b031ea1211e7
|
||||||
github.com/Gurpartap/logrus-stack v0.0.0-20170710170904-89c00d8a28f4
|
github.com/Gurpartap/logrus-stack v0.0.0-20170710170904-89c00d8a28f4
|
||||||
github.com/docker/cli v20.10.14+incompatible
|
github.com/docker/cli v20.10.16+incompatible
|
||||||
github.com/docker/distribution v2.8.1+incompatible
|
github.com/docker/distribution v2.8.1+incompatible
|
||||||
github.com/docker/docker v20.10.14+incompatible
|
github.com/docker/docker v20.10.16+incompatible
|
||||||
github.com/docker/go-units v0.4.0
|
github.com/docker/go-units v0.4.0
|
||||||
github.com/go-git/go-git/v5 v5.4.2
|
github.com/go-git/go-git/v5 v5.4.2
|
||||||
github.com/hetznercloud/hcloud-go v1.33.1
|
github.com/hetznercloud/hcloud-go v1.33.2
|
||||||
github.com/moby/sys/signal v0.7.0
|
github.com/moby/sys/signal v0.7.0
|
||||||
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6
|
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6
|
||||||
github.com/olekukonko/tablewriter v0.0.5
|
github.com/olekukonko/tablewriter v0.0.5
|
||||||
@ -20,7 +20,7 @@ require (
|
|||||||
github.com/schollz/progressbar/v3 v3.8.6
|
github.com/schollz/progressbar/v3 v3.8.6
|
||||||
github.com/schultz-is/passgen v1.0.1
|
github.com/schultz-is/passgen v1.0.1
|
||||||
github.com/sirupsen/logrus v1.8.1
|
github.com/sirupsen/logrus v1.8.1
|
||||||
gotest.tools/v3 v3.1.0
|
gotest.tools/v3 v3.2.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
@ -33,11 +33,12 @@ require (
|
|||||||
github.com/docker/docker-credential-helpers v0.6.4 // indirect
|
github.com/docker/docker-credential-helpers v0.6.4 // indirect
|
||||||
github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 // indirect
|
github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 // indirect
|
||||||
github.com/fvbommel/sortorder v1.0.2 // indirect
|
github.com/fvbommel/sortorder v1.0.2 // indirect
|
||||||
github.com/gliderlabs/ssh v0.3.3
|
github.com/gliderlabs/ssh v0.3.4
|
||||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
|
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
|
||||||
github.com/gorilla/mux v1.8.0 // indirect
|
github.com/gorilla/mux v1.8.0 // indirect
|
||||||
github.com/hashicorp/go-retryablehttp v0.7.0
|
github.com/hashicorp/go-retryablehttp v0.7.1
|
||||||
github.com/kevinburke/ssh_config v1.1.0
|
github.com/kevinburke/ssh_config v1.2.0
|
||||||
|
github.com/klauspost/pgzip v1.2.5
|
||||||
github.com/libdns/gandi v1.0.2
|
github.com/libdns/gandi v1.0.2
|
||||||
github.com/libdns/libdns v0.2.1
|
github.com/libdns/libdns v0.2.1
|
||||||
github.com/moby/sys/mount v0.2.0 // indirect
|
github.com/moby/sys/mount v0.2.0 // indirect
|
||||||
@ -45,7 +46,7 @@ require (
|
|||||||
github.com/sergi/go-diff v1.2.0 // indirect
|
github.com/sergi/go-diff v1.2.0 // indirect
|
||||||
github.com/spf13/cobra v1.3.0 // indirect
|
github.com/spf13/cobra v1.3.0 // indirect
|
||||||
github.com/theupdateframework/notary v0.7.0 // indirect
|
github.com/theupdateframework/notary v0.7.0 // indirect
|
||||||
github.com/urfave/cli v1.22.5
|
github.com/urfave/cli v1.22.9
|
||||||
github.com/xanzy/ssh-agent v0.3.1 // indirect
|
github.com/xanzy/ssh-agent v0.3.1 // indirect
|
||||||
github.com/xeipuuv/gojsonpointer v0.0.0-20190809123943-df4f5c81cb3b // indirect
|
github.com/xeipuuv/gojsonpointer v0.0.0-20190809123943-df4f5c81cb3b // indirect
|
||||||
golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838
|
golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838
|
||||||
|
36
go.sum
36
go.sum
@ -332,16 +332,16 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm
|
|||||||
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
|
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
|
||||||
github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E=
|
github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E=
|
||||||
github.com/docker/cli v0.0.0-20191017083524-a8ff7f821017/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
|
github.com/docker/cli v0.0.0-20191017083524-a8ff7f821017/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
|
||||||
github.com/docker/cli v20.10.14+incompatible h1:dSBKJOVesDgHo7rbxlYjYsXe7gPzrTT+/cKQgpDAazg=
|
github.com/docker/cli v20.10.16+incompatible h1:aLQ8XowgKpR3/IysPj8qZQJBVQ+Qws61icFuZl6iKYs=
|
||||||
github.com/docker/cli v20.10.14+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
|
github.com/docker/cli v20.10.16+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
|
||||||
github.com/docker/distribution v0.0.0-20190905152932-14b96e55d84c/go.mod h1:0+TTO4EOBfRPhZXAeF1Vu+W3hHZ8eLp8PgKVZlcvtFY=
|
github.com/docker/distribution v0.0.0-20190905152932-14b96e55d84c/go.mod h1:0+TTO4EOBfRPhZXAeF1Vu+W3hHZ8eLp8PgKVZlcvtFY=
|
||||||
github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
||||||
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
||||||
github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68=
|
github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68=
|
||||||
github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
||||||
github.com/docker/docker v1.4.2-0.20190924003213-a8608b5b67c7/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
github.com/docker/docker v1.4.2-0.20190924003213-a8608b5b67c7/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||||
github.com/docker/docker v20.10.14+incompatible h1:+T9/PRYWNDo5SZl5qS1r9Mo/0Q8AwxKKPtu9S1yxM0w=
|
github.com/docker/docker v20.10.16+incompatible h1:2Db6ZR/+FUR3hqPMwnogOPHFn405crbpxvWzKovETOQ=
|
||||||
github.com/docker/docker v20.10.14+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
github.com/docker/docker v20.10.16+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||||
github.com/docker/docker-credential-helpers v0.6.3/go.mod h1:WRaJzqw3CTB9bk10avuGsjVBZsD05qeibJ1/TYlvc0Y=
|
github.com/docker/docker-credential-helpers v0.6.3/go.mod h1:WRaJzqw3CTB9bk10avuGsjVBZsD05qeibJ1/TYlvc0Y=
|
||||||
github.com/docker/docker-credential-helpers v0.6.4 h1:axCks+yV+2MR3/kZhAmy07yC56WZ2Pwu/fKWtKuZB0o=
|
github.com/docker/docker-credential-helpers v0.6.4 h1:axCks+yV+2MR3/kZhAmy07yC56WZ2Pwu/fKWtKuZB0o=
|
||||||
github.com/docker/docker-credential-helpers v0.6.4/go.mod h1:ofX3UI0Gz1TteYBjtgs07O36Pyasyp66D2uKT7H8W1c=
|
github.com/docker/docker-credential-helpers v0.6.4/go.mod h1:ofX3UI0Gz1TteYBjtgs07O36Pyasyp66D2uKT7H8W1c=
|
||||||
@ -403,8 +403,8 @@ github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2H
|
|||||||
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
|
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
|
||||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||||
github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
|
github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
|
||||||
github.com/gliderlabs/ssh v0.3.3 h1:mBQ8NiOgDkINJrZtoizkC3nDNYgSaWtxyem6S2XHBtA=
|
github.com/gliderlabs/ssh v0.3.4 h1:+AXBtim7MTKaLVPgvE+3mhewYRawNLTd+jEEz/wExZw=
|
||||||
github.com/gliderlabs/ssh v0.3.3/go.mod h1:ZSS+CUoKHDrqVakTfTWUlKSr9MtMFkC4UvtQKD7O914=
|
github.com/gliderlabs/ssh v0.3.4/go.mod h1:ZSS+CUoKHDrqVakTfTWUlKSr9MtMFkC4UvtQKD7O914=
|
||||||
github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4=
|
github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4=
|
||||||
github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E=
|
github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E=
|
||||||
github.com/go-git/go-billy/v5 v5.2.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0=
|
github.com/go-git/go-billy/v5 v5.2.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0=
|
||||||
@ -583,8 +583,8 @@ github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHh
|
|||||||
github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA=
|
github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA=
|
||||||
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
|
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
|
||||||
github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=
|
github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=
|
||||||
github.com/hashicorp/go-retryablehttp v0.7.0 h1:eu1EI/mbirUgP5C8hVsTNaGZreBDlYiwC1FZWkvQPQ4=
|
github.com/hashicorp/go-retryablehttp v0.7.1 h1:sUiuQAnLlbvmExtFQs72iFW/HXeUn8Z1aJLQ4LJJbTQ=
|
||||||
github.com/hashicorp/go-retryablehttp v0.7.0/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY=
|
github.com/hashicorp/go-retryablehttp v0.7.1/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY=
|
||||||
github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8=
|
github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8=
|
||||||
github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
|
github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
|
||||||
github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
|
github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
|
||||||
@ -602,8 +602,8 @@ github.com/hashicorp/memberlist v0.2.2/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOn
|
|||||||
github.com/hashicorp/memberlist v0.3.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE=
|
github.com/hashicorp/memberlist v0.3.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE=
|
||||||
github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk=
|
github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk=
|
||||||
github.com/hashicorp/serf v0.9.6/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4=
|
github.com/hashicorp/serf v0.9.6/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4=
|
||||||
github.com/hetznercloud/hcloud-go v1.33.1 h1:W1HdO2bRLTKU4WsyqAasDSpt54fYO4WNckWYfH5AuCQ=
|
github.com/hetznercloud/hcloud-go v1.33.2 h1:ptWKVYLW7YtjXzsqTFKFxwpVo3iM9UMkVPBYQE4teLU=
|
||||||
github.com/hetznercloud/hcloud-go v1.33.1/go.mod h1:XX/TQub3ge0yWR2yHWmnDVIrB+MQbda1pHxkUmDlUME=
|
github.com/hetznercloud/hcloud-go v1.33.2/go.mod h1:XX/TQub3ge0yWR2yHWmnDVIrB+MQbda1pHxkUmDlUME=
|
||||||
github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec h1:qv2VnGeEQHchGaZ/u7lxST/RaJw+cv273q79D81Xbog=
|
github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec h1:qv2VnGeEQHchGaZ/u7lxST/RaJw+cv273q79D81Xbog=
|
||||||
github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec/go.mod h1:Q48J4R4DvxnHolD5P8pOtXigYlRuPLGl6moFx3ulM68=
|
github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec/go.mod h1:Q48J4R4DvxnHolD5P8pOtXigYlRuPLGl6moFx3ulM68=
|
||||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||||
@ -648,15 +648,17 @@ github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213/go.mod h1:vNUNkEQ1
|
|||||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
|
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
|
||||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
|
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
|
||||||
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
|
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
|
||||||
github.com/kevinburke/ssh_config v1.1.0 h1:pH/t1WS9NzT8go394IqZeJTMHVm6Cr6ZJ6AQ+mdNo/o=
|
github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4=
|
||||||
github.com/kevinburke/ssh_config v1.1.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
|
github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
|
||||||
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
|
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
|
||||||
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
|
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
|
||||||
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
|
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
|
||||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||||
github.com/klauspost/compress v1.11.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
|
github.com/klauspost/compress v1.11.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
|
||||||
github.com/klauspost/compress v1.11.13/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
|
github.com/klauspost/compress v1.11.13/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
|
||||||
|
github.com/klauspost/compress v1.14.2 h1:S0OHlFk/Gbon/yauFJ4FfJJF5V0fc5HbBTJazi28pRw=
|
||||||
github.com/klauspost/compress v1.14.2/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
|
github.com/klauspost/compress v1.14.2/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
|
||||||
|
github.com/klauspost/pgzip v1.2.5 h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE=
|
||||||
github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
|
github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
|
||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||||
@ -979,8 +981,8 @@ github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijb
|
|||||||
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||||
github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||||
github.com/urfave/cli v1.22.4/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
github.com/urfave/cli v1.22.4/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||||
github.com/urfave/cli v1.22.5 h1:lNq9sAHXK2qfdI8W+GRItjCEkI+2oR4d+MEHy1CKXoU=
|
github.com/urfave/cli v1.22.9 h1:cv3/KhXGBGjEXLC4bH0sLuJ9BewaAbpk5oyMOveu4pw=
|
||||||
github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
github.com/urfave/cli v1.22.9/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||||
github.com/vbatts/tar-split v0.11.2/go.mod h1:vV3ZuO2yWSVsz+pfFzDG/upWH1JhjOiEaWq6kXyQ3VI=
|
github.com/vbatts/tar-split v0.11.2/go.mod h1:vV3ZuO2yWSVsz+pfFzDG/upWH1JhjOiEaWq6kXyQ3VI=
|
||||||
github.com/vishvananda/netlink v0.0.0-20181108222139-023a6dafdcdf/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk=
|
github.com/vishvananda/netlink v0.0.0-20181108222139-023a6dafdcdf/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk=
|
||||||
github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE=
|
github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE=
|
||||||
@ -1489,7 +1491,6 @@ google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ6
|
|||||||
google.golang.org/genproto v0.0.0-20211129164237-f09f9a12af12/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
google.golang.org/genproto v0.0.0-20211129164237-f09f9a12af12/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
||||||
google.golang.org/genproto v0.0.0-20211203200212-54befc351ae9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
google.golang.org/genproto v0.0.0-20211203200212-54befc351ae9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
||||||
google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
||||||
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa h1:I0YcKz0I7OAhddo7ya8kMnvprhcWM045PmkBdMO9zN0=
|
|
||||||
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
||||||
google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
|
google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
|
||||||
google.golang.org/grpc v1.0.5/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
|
google.golang.org/grpc v1.0.5/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
|
||||||
@ -1522,7 +1523,6 @@ google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnD
|
|||||||
google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE=
|
google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE=
|
||||||
google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
|
google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
|
||||||
google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
|
google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
|
||||||
google.golang.org/grpc v1.42.0 h1:XT2/MFpuPFsEX2fWh3YQtHkZ+WYZFQRfaUgLZYj/p6A=
|
|
||||||
google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
|
google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
|
||||||
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
|
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
|
||||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||||
@ -1584,8 +1584,8 @@ gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
|
|||||||
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
|
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
|
||||||
gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk=
|
gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk=
|
||||||
gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8=
|
gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8=
|
||||||
gotest.tools/v3 v3.1.0 h1:rVV8Tcg/8jHUkPUorwjaMTtemIMVXfIPKiOqnhEhakk=
|
gotest.tools/v3 v3.2.0 h1:I0DwBVMGAx26dttAj1BtJLAkVGncrkkUXfJLC4Flt/I=
|
||||||
gotest.tools/v3 v3.1.0/go.mod h1:fHy7eyTmJFO5bQbUsEGQ1v4m2J3Jz9eWL54TP2/ZuYQ=
|
gotest.tools/v3 v3.2.0/go.mod h1:Mcr9QNxkg0uMvy/YElmo4SpXgJKWgQvYrT7Kw5RzJ1A=
|
||||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
|
@ -64,8 +64,13 @@ func (a App) StackName() string {
|
|||||||
return stackName
|
return stackName
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filters retrieves exact app filters for querying the container runtime.
|
// Filters retrieves exact app filters for querying the container runtime. Due
|
||||||
func (a App) Filters() (filters.Args, error) {
|
// to upstream issues, filtering works different depending on what you're
|
||||||
|
// querying. So, for example, secrets don't work with regex! The caller needs
|
||||||
|
// to implement their own validation that the right secrets are matched. In
|
||||||
|
// order to handle these cases, we provide the `appendServiceNames` /
|
||||||
|
// `exactMatch` modifiers.
|
||||||
|
func (a App) Filters(appendServiceNames, exactMatch bool) (filters.Args, error) {
|
||||||
filters := filters.NewArgs()
|
filters := filters.NewArgs()
|
||||||
|
|
||||||
composeFiles, err := GetAppComposeFiles(a.Recipe, a.Env)
|
composeFiles, err := GetAppComposeFiles(a.Recipe, a.Env)
|
||||||
@ -80,7 +85,22 @@ func (a App) Filters() (filters.Args, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, service := range compose.Services {
|
for _, service := range compose.Services {
|
||||||
filter := fmt.Sprintf("^%s_%s", a.StackName(), service.Name)
|
var filter string
|
||||||
|
|
||||||
|
if appendServiceNames {
|
||||||
|
if exactMatch {
|
||||||
|
filter = fmt.Sprintf("^%s_%s", a.StackName(), service.Name)
|
||||||
|
} else {
|
||||||
|
filter = fmt.Sprintf("%s_%s", a.StackName(), service.Name)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if exactMatch {
|
||||||
|
filter = fmt.Sprintf("^%s", a.StackName())
|
||||||
|
} else {
|
||||||
|
filter = fmt.Sprintf("%s", a.StackName())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
filters.Add("name", filter)
|
filters.Add("name", filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ var ABRA_DIR = os.ExpandEnv("$HOME/.abra")
|
|||||||
var SERVERS_DIR = path.Join(ABRA_DIR, "servers")
|
var SERVERS_DIR = path.Join(ABRA_DIR, "servers")
|
||||||
var RECIPES_DIR = path.Join(ABRA_DIR, "recipes")
|
var RECIPES_DIR = path.Join(ABRA_DIR, "recipes")
|
||||||
var VENDOR_DIR = path.Join(ABRA_DIR, "vendor")
|
var VENDOR_DIR = path.Join(ABRA_DIR, "vendor")
|
||||||
|
var BACKUP_DIR = path.Join(ABRA_DIR, "backups")
|
||||||
var RECIPES_JSON = path.Join(ABRA_DIR, "catalogue", "recipes.json")
|
var RECIPES_JSON = path.Join(ABRA_DIR, "catalogue", "recipes.json")
|
||||||
var REPOS_BASE_URL = "https://git.coopcloud.tech/coop-cloud"
|
var REPOS_BASE_URL = "https://git.coopcloud.tech/coop-cloud"
|
||||||
var CATALOGUE_JSON_REPO_NAME = "recipes-catalogue-json"
|
var CATALOGUE_JSON_REPO_NAME = "recipes-catalogue-json"
|
||||||
|
@ -26,7 +26,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// RecipeCatalogueURL is the only current recipe catalogue available.
|
// RecipeCatalogueURL is the only current recipe catalogue available.
|
||||||
const RecipeCatalogueURL = "https://recipes.coopcloud.tech"
|
const RecipeCatalogueURL = "https://recipes.coopcloud.tech/recipes.json"
|
||||||
|
|
||||||
// ReposMetadataURL is the recipe repository metadata
|
// ReposMetadataURL is the recipe repository metadata
|
||||||
const ReposMetadataURL = "https://git.coopcloud.tech/api/v1/orgs/coop-cloud/repos"
|
const ReposMetadataURL = "https://git.coopcloud.tech/api/v1/orgs/coop-cloud/repos"
|
||||||
@ -572,7 +572,7 @@ func EnsureUpToDate(recipeName string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !isClean {
|
if !isClean {
|
||||||
return fmt.Errorf("%s has locally unstaged changes", recipeName)
|
return fmt.Errorf("%s (%s) has locally unstaged changes? please commit/remove your changes before proceeding", recipeName, recipeDir)
|
||||||
}
|
}
|
||||||
|
|
||||||
repo, err := git.PlainOpen(recipeDir)
|
repo, err := git.PlainOpen(recipeDir)
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
ABRA_VERSION="0.3.0-alpha"
|
ABRA_VERSION="0.5.1-beta"
|
||||||
ABRA_RELEASE_URL="https://git.coopcloud.tech/api/v1/repos/coop-cloud/abra/releases/tags/$ABRA_VERSION"
|
ABRA_RELEASE_URL="https://git.coopcloud.tech/api/v1/repos/coop-cloud/abra/releases/tags/$ABRA_VERSION"
|
||||||
RC_VERSION="0.4.0-alpha-rc7"
|
RC_VERSION="0.5.1-beta"
|
||||||
RC_VERSION_URL="https://git.coopcloud.tech/api/v1/repos/coop-cloud/abra/releases/tags/$RC_VERSION"
|
RC_VERSION_URL="https://git.coopcloud.tech/api/v1/repos/coop-cloud/abra/releases/tags/$RC_VERSION"
|
||||||
|
|
||||||
for arg in "$@"; do
|
for arg in "$@"; do
|
||||||
@ -12,6 +12,35 @@ for arg in "$@"; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
function check_docker {
|
||||||
|
dockerpath=$(which dockker)
|
||||||
|
if [ -z $dockerpath ]; then
|
||||||
|
echo "Docker was not found in your \$PATH. Attempt automatic installation? [y/N]"
|
||||||
|
read answer
|
||||||
|
if [[ $answer == "y" ]]; then
|
||||||
|
wget -O- https://get.docker.com | bash
|
||||||
|
else
|
||||||
|
echo "Please install docker manually or add it to your \$PATH and re-run the installation script"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
docker info > /dev/null
|
||||||
|
if [[ $? != 0 ]]; then
|
||||||
|
echo "docker info returned a non-zero value. This could be caused by your user not being in the docker group. Add user to docker group? [y/N]"
|
||||||
|
read answer
|
||||||
|
if [[ $answer == "y" ]]; then
|
||||||
|
sudo usermod -aG docker $USER
|
||||||
|
if [[ $? != 0 ]]; then
|
||||||
|
echo "Adding user failed. Add your user to docker group and re-run the installer"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Add your user to docker group and re-run the installer"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function show_banner {
|
function show_banner {
|
||||||
echo ""
|
echo ""
|
||||||
echo " ____ ____ _ _ "
|
echo " ____ ____ _ _ "
|
||||||
@ -44,8 +73,17 @@ function install_abra_release {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
ARCH=$(uname -m)
|
||||||
PLATFORM=$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m)
|
if [[ $ARCH =~ "aarch64" ]]; then
|
||||||
|
ARCH="arm64"
|
||||||
|
elif [[ $ARCH =~ "armv5l" ]]; then
|
||||||
|
ARCH="armv5"
|
||||||
|
elif [[ $ARCH =~ "armv6l" ]]; then
|
||||||
|
ARCH="armv6"
|
||||||
|
elif [[ $ARCH =~ "armv7l" ]]; then
|
||||||
|
ARCH="armv7"
|
||||||
|
fi
|
||||||
|
PLATFORM=$(uname -s | tr '[:upper:]' '[:lower:]')_$ARCH
|
||||||
FILENAME="abra_"$ABRA_VERSION"_"$PLATFORM""
|
FILENAME="abra_"$ABRA_VERSION"_"$PLATFORM""
|
||||||
sed_command_rel='s/.*"assets":\[\{[^]]*"name":"'$FILENAME'"[^}]*"browser_download_url":"([^"]*)".*\].*/\1/p'
|
sed_command_rel='s/.*"assets":\[\{[^]]*"name":"'$FILENAME'"[^}]*"browser_download_url":"([^"]*)".*\].*/\1/p'
|
||||||
sed_command_checksums='s/.*"assets":\[\{[^\]*"name":"checksums.txt"[^}]*"browser_download_url":"([^"]*)".*\].*/\1/p'
|
sed_command_checksums='s/.*"assets":\[\{[^\]*"name":"checksums.txt"[^}]*"browser_download_url":"([^"]*)".*\].*/\1/p'
|
||||||
@ -92,6 +130,7 @@ function install_abra_release {
|
|||||||
|
|
||||||
|
|
||||||
function run_installation {
|
function run_installation {
|
||||||
|
check_docker
|
||||||
show_banner
|
show_banner
|
||||||
install_abra_release
|
install_abra_release
|
||||||
}
|
}
|
||||||
|
5
scripts/release/upx.sh
Executable file
5
scripts/release/upx.sh
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
upx ./dist/abra_*/abra
|
Reference in New Issue
Block a user