Deploy fails to development environment at step "deploy : Initialize"

Currently trying to set up the development environment with trellis / bedrock and running into this issue which I hadn’t seen in a previous setup. I deleted the vagrant VM and started from scratch to ensure that everything would provision as expected when I started encountering this issue:

fatal: [domain.test]: FAILED! => {“changed”: false, “msg”: “/srv/www/domain.test/current exists but is not a symbolic link”}

When I SSH into the box via trellis ssh development domain.test and go to /srv/www/domain.test I see that the current folder contains the contents of the /web directory. There is notably no releases folder.

I’ve tried deleting the box and reprovisioning many times, but no luck. I haven’t changed any of the default roles.

Here’s my wordpress_sites.yml

    - canonical: domain.test
    local_path: ../site
    admin_email: admin@www.domain.test
    branch: master
    repo_subtree_path: "<redacted>/site"
      enabled: false
      enabled: false
      provider: self-signed
      enabled: false
      db_user: wp_user
      db_host: <redacted>
      db_ssl: true

Any insight into what might be going on?

This part isn’t a surprise since development VMs used a synced folder and not deploys. So you should never see releases/ on the VM.

Can you share most of the log output? What task is failing?

Thanks for the quick response! Totally makes sense on the development front as I see that the changes I make on site are immediately reflected over.

Here’s the rest of the output:

$ trellis deploy development
Running command => ansible-playbook deploy.yml -e env=development site=domain.test

PLAY [Ensure necessary variables are defined] **********************************

TASK [Ensure environment is defined] *******************************************
skipping: [localhost]

PLAY [Test Connection] *********************************************************

TASK [connection : Require manual definition of remote-user] *******************
skipping: [domain.test]

TASK [connection : Check whether Ansible can connect as vagrant] ***************
ok: [domain.test -> localhost]

TASK [connection : Warn about change in host keys] *****************************
skipping: [domain.test]

TASK [connection : Set remote user for each host] ******************************
skipping: [domain.test]

TASK [connection : Announce which user was selected] ***************************
skipping: [domain.test]

TASK [connection : Load become password] ***************************************
skipping: [domain.test]

PLAY [Deploy WP site] **********************************************************

TASK [Gathering Facts] *********************************************************
ok: [domain.test]

TASK [Ensure site is valid] ****************************************************
skipping: [domain.test]

TASK [Ensure repo is valid] ****************************************************
skipping: [domain.test]

TASK [deploy : Check if deploy_before scripts exist] ***************************

TASK [deploy : include_tasks] **************************************************

TASK [deploy : Check if deploy_initialize_before scripts exist] ****************

TASK [deploy : include_tasks] **************************************************

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

PLAY RECAP *********************************************************************
localhost                  : ok=0    changed=0    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0
domain.test             : ok=2    changed=0    unreachable=0    failed=1    skipped=11   rescued=0    ignored=0

exit status 2

It’s failing at the Initalize set of tasks in deploy where it attempts to use deploy_helper

- name: Initialize
    current_path: "{{ project_current_path }}"
    path: "{{ project_root }}"
    state: present

Well there’s the problem. As I said above deploys aren’t used in development. Though there’s nothing preventing it but as you’ve encountered it can cause issues.

In development all you do is provision once (or whenever you make changes to Trellis files, not site/bedrock/themes ones). Any changes you make within your site folder will be synced automatically thanks to Vagrant.

Easiest way to fix it is to re-create the VM and don’t deploy :slight_smile:


Ahh, of course! New to the roots ecosystem, but it’s been an amazing adventure. Thanks for all of the help, feels good to finally get to the bottom of it after many hours of struggle… It’s always something simple :laughing:

Appreciate the support and excited to have joined the community.

1 Like

:thinking: Would it improve the developer experience if a confirmation or warning is shown when using development environment with trellis deploy?

1 Like

Yeah probably! I briefly considered just not allowing development at all but it’s still valid for anyone using remote/cloud dev environments?

So either:

  1. add a warning which can be disabled via a flag/config option
  2. make people explicitly pass a flag to deploy to dev (plus config option)

I’ll think more about it


Prevent deploys to development by default by swalkinshaw · Pull Request #336 · roots/trellis-cli · GitHub will be included in the next release.

Let me know if you have any feedback on the error message.