Skip to content

Commit f1bf82b

Browse files
committed
Add droplet command
This adds a `droplet` command with one subcommand: `create` It will create a DigitalOcean droplet (server) via their API and automatically provision it. A `DIGITALOCEAN_ACCESS_TOKEN` environment variable is needed to run this command. If it's not found, a prompt will export it. This command also requires an SSH key to be added to your DO account. By default it will look in `~/.ssh/id_rsa.pub` and add it to your account if it's not already there. A different key path can be specified with the `--ssh-key` option. trellis-cli will create a Ubuntu 18.04 x64 server. The region and size of the droplet is up to the user either via options or prompt selections. The name of the droplet will default to the first site name in your Trellis `wordpress_sites`. This can be changed via a prompt as well. The droplet will be created with two tags: * `trellis` * environment name Once the server is created, `ansible-galaxy install` will be run to ensure the Galaxy roles exist. Then the server will be provisioned via the CLI.
1 parent 1b9c705 commit f1bf82b

20 files changed

+840
-32
lines changed

Diff for: cmd/droplet.go

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package cmd
2+
3+
import (
4+
"strings"
5+
6+
"github.com/mitchellh/cli"
7+
"trellis-cli/trellis"
8+
)
9+
10+
type DropletCommand struct {
11+
UI cli.Ui
12+
Trellis *trellis.Trellis
13+
}
14+
15+
func (c *DropletCommand) Run(args []string) int {
16+
return cli.RunResultHelp
17+
}
18+
19+
func (c *DropletCommand) Synopsis() string {
20+
return "Commands for DigitalOcean Droplets"
21+
}
22+
23+
func (c *DropletCommand) Help() string {
24+
helpText := `
25+
Usage: trellis droplet <subcommand> [<args>]
26+
`
27+
28+
return strings.TrimSpace(helpText)
29+
}

0 commit comments

Comments
 (0)