Trellis VM Main Domain & Subdomain Same Virtual Machine

I added blocks as an additional site to my trellis setup so now I have these directories in my project root:

blocks/
site/
trellis/

I added the blocks site with Bedrock command composer create-project roots/bedrock blocks . Once done I updated the wordpress_sites.yml for development , staging and production to add the additional site. For development it looks like this

# Created by trellis-cli v1.13.0
# Documentation: https://roots.io/trellis/docs/wordpress-sites/

wordpress_sites:
  imagewize.com:
    site_hosts:
    - canonical: imagewize.test
      redirects:
      - www.imagewize.test
    local_path: ../site
    admin_email: admin@imagewize.test
    multisite:
      enabled: false
    ssl:
      enabled: false
      provider: self-signed
    cache:
      enabled: false
  blocks.imagewize.com:
    site_hosts:
    - canonical: blocks.imagewize.test
      redirects:
      - www.blocks.imagewize.test
    local_path: ../blocks
    admin_email: admin@blocks.imagewize.test
    multisite:
      enabled: false
    ssl:
      enabled: false
      provider: self-signed
    cache:
      enabled: false

Then I ran trellis vm start to restart the existing virtual machine. It instead created another virtual machine blocks.imagewize.com , but did not add matters to an existing but stopped virtual machine imagewize.com.

limactl list
NAME                    STATUS     SSH                VMTYPE    ARCH       CPUS    MEMORY    DISK      DIR
blocks.imagewize.com    Running    127.0.0.1:57764    vz        aarch64    4       4GiB      100GiB    ~/.lima/blocks.imagewize.com
imagewize.com           Stopped    127.0.0.1:0        vz        aarch64    4       4GiB      100GiB    ~/.lima/imagewize.com
thaiconomics.com        Stopped    127.0.0.1:0        vz        aarch64    4       4GiB      100GiB    ~/.lima/thaiconomics.com
ubuntu                  Stopped    127.0.0.1:2022     vz        aarch64    4       4GiB      100GiB    ~/.lima/ubuntu

When I tried trellis vm start imagewize.com I realized that is not possible or at least it did not work for me. And I did not see domain as a parameter checking either

trellis vm start --help
Usage: trellis vm start [options]

Starts a development virtual machine.
If a VM doesn't exist yet, it will be created. If a VM already exists, it will be started.

Note: VM management (under the 'trellis vm' subcommands) is currently only available for macOS Ventura (13.0) and later.
Lima (https://lima-vm.io/) is the underlying VM manager which requires macOS's new virtualization framework.

Options:
  -h, --help show this help

Perhaps what I want - subdomain and tld in same virtual machine is not possible with the trellis vm for macOS yet?

Thanks to @ben I saw that @dalepgrant opened up an issue at Add ability to set vm instance name · Issue #514 · roots/trellis-cli · GitHub and is working on a solution .

Also trying something at https://github.com/roots/trellis-cli/pull/524 . I however am a newbie in the realm of Golang so depend too much on third party sources and trial and error to quickly resolve this and add an update to store virtual machine data in a configuration file … though I am trying.

I hope that Dale can come up with something cool that works for all and allow for multiple sites on one macOS Lima virtual machine like a.site.com and site.com.

Thanks for the nudge. I’ve opened up my draft PR (#515) for review, we’ve been using it for a couple of weeks with no issues discovered so hopefully that bodes well.

1 Like