Add a second Bedrock site to Lima VM

After initializing the virtual machine with

trellis vm start

I have added a second Bedrock site called zenitcom.com. When trying to provision the local server with

trellis provision development

I get an error on the [wordpress-install : Install Dependencies with Composer] task because /srv/www/zenitcom.com/current/web directory is empty. The bedrock project is not symlinked in the virtual machine, although it is in my local filesystem.

If the Bedrock project is present before creating the virtual machine, then it works, but adding a new project with the machine already running does not seem to work.

How is this resolved? What is the correct way to add a new project to an already running virtual machine?

[EDIT] Tryed to deploy to development with allow_development_deploys: true in cli config and I get this error (“current” is not a symbolic link)

TASK [deploy : Initialize] *****************************************************
fatal: [default]: FAILED! => {"changed": false, "msg": "/srv/www/zenitcom.com/current exists but is not a symbolic link"}

I think it’s an issue with the generated Lima config not being updated properly.

What does your .trellis/lima/[site name].yml file look like? Here’s an example:

vmType: "vz"
rosetta:
  enabled: false
images:
- location: https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img
  arch: x86_64
- location: https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-arm64.img
  arch: aarch64

mounts:
- location: /Users/scott/dev/site
  mountPoint: /srv/www/example.com/current
  writable: true

mountType: "virtiofs"
ssh:
  forwardAgent: true
networks:
- vzNAT: true
containerd:
  user: false
provision:
- mode: system
  script: |
    #!/bin/bash
    echo "127.0.0.1 $(hostname)" >> /etc/hosts

You can see my one site under mounts. One issue with the Lima integration is that file isn’t the source of truth, Lima itself will generate its own under ~/.lima/[site name]/lima.yaml. So there’s some situations where trellis-cli updates its config but it’s not reflected in the other Lima one.

This isn’t a proper solution but you could manually edit that file and stop + start the VM. trellis-cli should update these configs so if it doesn’t then it’s a bug. But there’s never going to be a way to support this without at least stopping the VM.

Even Vagrant required a specific vagrant reload command. Just provisioning wouldn’t pick up new mounts.

2 Likes

trellis-cli should update these configs so if it doesn’t then it’s a bug. But there’s never going to be a way to support this without at least stopping the VM.

There’s an issue up for this in Github: you have to stop the vm, manually update the config that Lima creates, start the vm and then reprovision. trellis-cli doesn’t update it’s own config file and manually updating also doesn’t solve, even after stop/start/reprovisioning.

This has been fixed as of v1.12.1.

You still need to restart + provision but the CLI generates the proper Lima config now :tada:

3 Likes