Skip to content

Commit 9d4b061

Browse files
authored
Drop Vagrant support (#598)
1 parent 2df053e commit 9d4b061

File tree

16 files changed

+10
-687
lines changed

16 files changed

+10
-687
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ Supported commands so far:
164164
| `db` | Commands for database management |
165165
| `deploy` | Deploys a site to the specified environment |
166166
| `dotenv` | Template .env files to local system |
167-
| `down` | Stops the Vagrant machine by running `vagrant halt`|
168167
| `droplet` | Commands for DigitalOcean Droplets |
169168
| `exec` | Exec runs a command in the Trellis virtualenv |
170169
| `galaxy` | Commands for Ansible Galaxy |
@@ -177,7 +176,6 @@ Supported commands so far:
177176
| `provision` | Provisions the specified environment |
178177
| `rollback` | Rollsback the last deploy of the site on the specified environment |
179178
| `ssh` | Connects to host via SSH |
180-
| `up` | Starts and provisions the Vagrant environment by running `vagrant up` |
181179
| `valet` | Commands for Laravel Valet |
182180
| `vault` | Commands for Ansible Vault |
183181
| `xdebug-tunnel` | Commands for managing Xdebug tunnels |

cmd/alias.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ Usage: trellis alias [options]
214214
215215
Generate WP CLI aliases for remote environments
216216
217-
Don't include local env (useful for non-Vagrant users):
217+
Don't include local env (useful for non-Lima users):
218218
219219
$ trellis alias --skip-local
220220

cmd/check.go

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,15 @@ var Requirements = []trellis.Requirement{
2525
},
2626
},
2727
{
28-
Name: "Vagrant",
29-
Command: "vagrant",
28+
Name: "Lima",
29+
Command: "limactl",
3030
Optional: true,
31-
Url: "https://www.vagrantup.com/downloads.html",
32-
VersionConstraint: ">= 2.1.0",
31+
Url: "https://lima-vm.io/",
32+
VersionConstraint: ">= 1.0.2",
3333
ExtractVersion: func(output string) string {
34-
return strings.Replace(output, "Vagrant ", "", 1)
34+
return strings.Replace(output, "limactl version ", "", 1)
3535
},
3636
},
37-
{
38-
Name: "VirtualBox",
39-
Command: "VBoxManage",
40-
Optional: true,
41-
Url: "https://www.virtualbox.org/wiki/Downloads",
42-
VersionConstraint: ">= 4.3.10",
43-
},
4437
}
4538

4639
func (c *CheckCommand) Run(args []string) int {

cmd/down.go

Lines changed: 0 additions & 65 deletions
This file was deleted.

cmd/down_test.go

Lines changed: 0 additions & 92 deletions
This file was deleted.

cmd/droplet_create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ Usage: trellis droplet create [options] ENVIRONMENT
182182
Creates a droplet (server) on DigitalOcean for the environment specified.
183183
184184
Only remote servers (for staging and production) are currently supported.
185-
Development should be managed separately through Vagrant.
185+
Development should be managed separately through Lima.
186186
187187
This command requires a DigitalOcean personal access token.
188188
Link: https://cloud.digitalocean.com/account/api/tokens/new

cmd/logs_test.go

Lines changed: 0 additions & 155 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
package cmd
22

33
import (
4-
"fmt"
5-
"os"
6-
"path/filepath"
74
"strings"
85
"testing"
96

@@ -71,155 +68,3 @@ func TestLogsRunValidations(t *testing.T) {
7168
})
7269
}
7370
}
74-
75-
func TestLogsRun(t *testing.T) {
76-
defer trellis.LoadFixtureProject(t)()
77-
trellis := trellis.NewTrellis()
78-
79-
cases := []struct {
80-
name string
81-
args []string
82-
out string
83-
code int
84-
}{
85-
{
86-
"default",
87-
[]string{"development"},
88-
"ssh vagrant@example.test tail -f /srv/www/example.com/logs/*[^gz]?",
89-
0,
90-
},
91-
{
92-
"access option",
93-
[]string{"--access", "development"},
94-
"ssh vagrant@example.test tail -f /srv/www/example.com/logs/access.log",
95-
0,
96-
},
97-
{
98-
"error option",
99-
[]string{"--error", "development"},
100-
"ssh vagrant@example.test tail -f /srv/www/example.com/logs/error.log",
101-
0,
102-
},
103-
{
104-
"number option",
105-
[]string{"--number=10", "development"},
106-
"ssh vagrant@example.test tail -n 10 -f /srv/www/example.com/logs/*[^gz]?",
107-
0,
108-
},
109-
}
110-
111-
for _, tc := range cases {
112-
t.Run(tc.name, func(t *testing.T) {
113-
ui := cli.NewMockUi()
114-
defer MockUiExec(t, ui)()
115-
116-
logsCommand := NewLogsCommand(ui, trellis)
117-
code := logsCommand.Run(tc.args)
118-
119-
if code != tc.code {
120-
t.Errorf("expected code %d to be %d", code, tc.code)
121-
}
122-
123-
combined := ui.OutputWriter.String() + ui.ErrorWriter.String()
124-
125-
if !strings.Contains(combined, tc.out) {
126-
t.Errorf("expected output %q to contain %q", combined, tc.out)
127-
}
128-
})
129-
}
130-
}
131-
132-
func TestLogsRunGoAccess(t *testing.T) {
133-
defer trellis.LoadFixtureProject(t)()
134-
trellis := trellis.NewTrellis()
135-
136-
tmpDir := t.TempDir()
137-
138-
// fake goaccess binary to satisfy ok.LookPath
139-
goAccessPath := filepath.Join(tmpDir, "goaccess")
140-
_, _ = os.OpenFile(goAccessPath, os.O_CREATE, 0555)
141-
path := os.Getenv("PATH")
142-
t.Setenv("PATH", fmt.Sprintf("PATH=%s:%s", path, tmpDir))
143-
144-
cases := []struct {
145-
name string
146-
args []string
147-
out []string
148-
code int
149-
}{
150-
{
151-
"goaccess",
152-
[]string{"--goaccess", "development"},
153-
[]string{
154-
"ssh vagrant@example.test tail -n +0 -f /srv/www/example.com/logs/*",
155-
"goaccess --log-format=COMBINED",
156-
},
157-
0,
158-
},
159-
{
160-
"goaccess flags",
161-
[]string{"--goaccess", "--goaccess-flags=-a -m", "development"},
162-
[]string{
163-
"ssh vagrant@example.test tail -n +0 -f /srv/www/example.com/logs/*",
164-
"goaccess --log-format=COMBINED -a -m",
165-
},
166-
0,
167-
},
168-
{
169-
"goaccess with access only",
170-
[]string{"--goaccess", "--access", "development"},
171-
[]string{
172-
"ssh vagrant@example.test tail -n +0 -f /srv/www/example.com/logs/access.log",
173-
"goaccess --log-format=COMBINED",
174-
},
175-
0,
176-
},
177-
{
178-
"goaccess with error only",
179-
[]string{"--goaccess", "--error", "development"},
180-
[]string{
181-
"ssh vagrant@example.test tail -n +0 -f /srv/www/example.com/logs/error.log",
182-
"goaccess --log-format=COMBINED",
183-
},
184-
0,
185-
},
186-
}
187-
188-
for _, tc := range cases {
189-
t.Run(tc.name, func(t *testing.T) {
190-
ui := cli.NewMockUi()
191-
defer MockUiExec(t, ui)()
192-
193-
logsCommand := NewLogsCommand(ui, trellis)
194-
code := logsCommand.Run(tc.args)
195-
196-
if code != tc.code {
197-
t.Errorf("%s - actual code %d expected to be %d", tc.name, code, tc.code)
198-
}
199-
200-
combined := ui.OutputWriter.String() + ui.ErrorWriter.String()
201-
202-
for _, out := range tc.out {
203-
if !strings.Contains(combined, out) {
204-
t.Errorf("%s - actual output %q expected to contain %q", tc.name, combined, out)
205-
}
206-
}
207-
})
208-
}
209-
}
210-
211-
func TestLogsHelperProcess(t *testing.T) {
212-
if os.Getenv("GO_WANT_HELPER_PROCESS") != "1" {
213-
return
214-
}
215-
216-
switch os.Args[3] {
217-
case "ssh":
218-
fmt.Fprintf(os.Stdout, "nginx log")
219-
os.Exit(0)
220-
case "tail":
221-
os.Exit(0)
222-
default:
223-
t.Fatalf("unexpected command %s", os.Args[3])
224-
}
225-
}

cmd/ssh.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,6 @@ Connects to production as web user:
105105
106106
$ trellis ssh -u web production
107107
108-
Connects to main development site host:
109-
110-
$ trellis ssh development
111-
112-
Note: development always connects with 'vagrant' user
113-
114108
Arguments:
115109
ENVIRONMENT Name of environment (ie: production)
116110
SITE Name of the site (ie: example.com)

0 commit comments

Comments
 (0)