Add a flag to restart development on provision

Open
#451 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
ansible, go
Domain
cli, devops

Research direction

Trace the trellis provision command and its --tags handling, then inspect the vm/vagrant stop/start flow and the provisioning step that runs “Setup composer authentications.” Done means a reload option mounts site folders before provisioning so the example command succeeds without manually stopping and starting the VM.

Written by the indexing model from the issue text.

Description

enhancement
Summary

Would a flag to also restart the vm on provision be possible, something like trellis provision --reload --tags wordpress development (taking reload from vagrant)?

Currently to perform actions such as adding a new site, assuming the vm/vagrant is running, you must do the following:

  • trellis vm stop (or trellis down for vagrant)
  • trellis vm start (or trellis up for vagrant)
  • trellis provision --tags wordpress development

If you don't perform these steps, the provision fails on "Setup composer authentications":

TASK [wordpress-install : Setup composer authentications (HTTP Basic) - example.com] ***
failed: [default] (item=default-type.composer.deliciousbrains.com) => {"ansible_loop_var": "item", "changed": false, "item": {"hostname": "composer.deliciousbrains.com", "password": "hahayeahright", "username": "notleavingthishere"}, "msg": "In ConfigCommand.php line 218: File \"./composer.json\" cannot be found in the current directory config [-g|--global] [-e|--editor] [-a|--auth] [--unset] [-l|--list] [-f|--file FILE] [--absolute] [-j|--json] [-m|--merge] [--append] [--source] [--] [<setting-key> [<setting-value>...]]", "stdout": "\nIn ConfigCommand.php line 218:\n                                                                   \n  File \"./composer.json\" cannot be found in the current directory [the rest redacted, you get the gist]

This is because the folders haven't been mounted yet. Navigating to the site folder within the vm/vagrant box shows only an empty web folder, hence the composer.json cannot be found error.

Additional context

Originally posted by @dalepgrant in https://github.com/roots/trellis-cli/issues/421#issuecomment-2274692127

As ever, thank you Roots team 🙏

Dominant language
Go
Stars
169
Forks
31
Avg merge
1h 2m
Merged PRs (30d)
17

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from roots/trellis-cli

All issues in roots/trellis-cli

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.