Skip to content

Commit c256dc5

Browse files
swalkinshawclaude
andauthored
Add server commands with extensible provider support (#619)
Introduce a new provider abstraction layer in pkg/server that enables support for multiple cloud providers. This refactor: - Adds Provider and DNSProvider interfaces for cloud operations - Implements DigitalOcean provider using the new abstraction - Adds `trellis server create` command to replace `trellis droplet create` - Adds `trellis server dns` command to replace `trellis droplet dns` - Marks existing `droplet` commands as deprecated - Adds deprecatedCommandHelpFunc to show deprecated commands separately - Updates default image to Ubuntu 24.04 - Adds server.provider config option in trellis.cli.yml The provider can be configured via: 1. --provider flag 2. TRELLIS_SERVER_PROVIDER environment variable 3. server.provider in trellis.cli.yml 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 0511076 commit c256dc5

11 files changed

Lines changed: 1469 additions & 2 deletions

File tree

cli_config/cli_config.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ type VmConfig struct {
2525
ForwardHttpPort bool `yaml:"forward_http_port"`
2626
}
2727

28+
type ServerConfig struct {
29+
Provider string `yaml:"provider"`
30+
}
31+
2832
type Config struct {
2933
AllowDevelopmentDeploys bool `yaml:"allow_development_deploys"`
3034
AskVaultPass bool `yaml:"ask_vault_pass"`
@@ -34,6 +38,7 @@ type Config struct {
3438
Open map[string]string `yaml:"open"`
3539
VirtualenvIntegration bool `yaml:"virtualenv_integration"`
3640
Vm VmConfig `yaml:"vm"`
41+
Server ServerConfig `yaml:"server"`
3742
}
3843

3944
var (
@@ -73,6 +78,10 @@ func (c *Config) LoadFile(path string) error {
7378
return fmt.Errorf("%w: unsupported value for `database_app`. Must be one of: tableplus, sequel-ace", InvalidConfigErr)
7479
}
7580

81+
if c.Server.Provider != "" && c.Server.Provider != "digitalocean" {
82+
return fmt.Errorf("%w: unsupported value for `server.provider`. Must be one of: digitalocean", InvalidConfigErr)
83+
}
84+
7685
return nil
7786
}
7887

cmd/droplet_create.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ func (c *DropletCreateCommand) init() {
5050
}
5151

5252
func (c *DropletCreateCommand) Run(args []string) int {
53+
c.UI.Warn("DEPRECATED: 'trellis droplet create' is deprecated. Use 'trellis server create' instead.")
54+
c.UI.Warn("This command will be removed in a future version.\n")
55+
5356
if err := c.Trellis.LoadProject(); err != nil {
5457
c.UI.Error(err.Error())
5558
return 1

cmd/droplet_dns.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ func (c *DropletDnsCommand) init() {
3838
}
3939

4040
func (c *DropletDnsCommand) Run(args []string) int {
41+
c.UI.Warn("DEPRECATED: 'trellis droplet dns' is deprecated. Use 'trellis server dns' instead.")
42+
c.UI.Warn("This command will be removed in a future version.\n")
43+
4144
if err := c.Trellis.LoadProject(); err != nil {
4245
c.UI.Error(err.Error())
4346
return 1

0 commit comments

Comments
 (0)