Roots Discourse

Changing www_root stops provision at installing Composer dependencies

Hello,

I’m having issues setting a custom www_root location when spinning up a test Vagrant VM.

Stuck at TASK [wordpress-install : Install Dependencies with Composer]

System info:

  • Ansible 2.7.5; Vagrant 2.2.4; Linux
  • Trellis 1.0.3

Things I’ve done

  • Fresh installation from Github -> Trellis / Bedrock
  • Adjusted www_root inside all/main.yml along with default wordpress_sites.yml credentials
  • Adjusted vagrant.rb inside trellis/lib/vagrant.rb to reflect new www_root in get_remote_path
  • Vagrant provision

Values adjusted for www_root , spun up server successfully with /srv/www (default) with no issues. I then re-provisioned with /srv/test and received the error below.

Errors Received

Composer could not find a composer.json file in /srv/test/testsrvrootchange.test/current To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section failed: [default] (item=testsrvrootchange.test) => {"changed": false, "item": {"key": "testsrvrootchange.test", "value": {"admin_email": "email@email.com", "cache": {"enabled": false}, "local_path": "../site", "multisite": {"enabled": false}, "site_hosts": [{"canonical": "testsrvrootchange.test", "redirects": ["www.testsrvrootchange.test"]}], "ssl": {"enabled": false, "provider": "self-signed"}}}, "stdout": "Composer could not find a composer.json file in /srv/test/testsrvrootchange.test/current\nTo initialize a project, please create a composer.json file as described in the https://getcomposer.org/ \"Getting Started\" section\n", "stdout_lines": ["Composer could not find a composer.json file in /srv/test/testsrvrootchange.test/current", "To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ \"Getting Started\" section"]}


Results of failed provision

In the VM , the directory structure /srv/test/testsrvrootchange.test/current/ is created but only contains a populated .env file and a web directory. The web directory is empty and the provision essentially errors at this point because it stops the provision at dependency installation with composer.

Inside dev.yml references the proper composer role and inside /trellis/roles/wordpress-install/tasks/main.yml

 composer:
   no_dev: no
   optimize_autoloader: no
   working_dir: "{{ www_root }}/{{ item.key }}/{{ item.value.current_path | default('current') }}/"
 become: no
 with_dict: "{{ wordpress_sites }}"`

This appears to be correct and correctly referencing www_root (defined in .yml and statically defined in vagrant.rb).


Is there something I’m doing wrong to receive the message? I figured adjusting even the vagrant.rb configuration would allow www_root swaps (I believe this used to be contained inside Vagrantfile directly?).

Or is there something else that needs to be adjusted as well to get it to work?