I’m having problems running vagrant up on a fresh trellis install, and could do with some advice on how to fix. The error reads:
TASK [common : Validate Ubuntu version] ****************************************
System info:
Ansible 2.7.12; Vagrant 2.2.5; Darwin
Trellis version (per changelog): "Officially support Ubuntu 20.04"
---------------------------------------------------
The conditional check 'ansible_distribution_version is version('18.04', '<')'
failed. The error was: Version comparison: 'ansible_distribution_version' is
undefined
The error appears to have been in '/Users/designlobby/Sites/+trellis/mysite.co.uk/trellis/roles/common/tasks/main.yml': line 67, column 3, but
may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Validate Ubuntu version
^ here
fatal: [default]: FAILED! => {}
TASK [composer : Install configured globally-required packages.] ***************
System info:
Ansible 2.7.12; Vagrant 2.2.5; Darwin
Trellis 1.5.0: August 5th, 2020
---------------------------------------------------
non-zero return code
Changed current directory to /root/.composer
Do not run Composer as root/super user! See https://getcomposer.org/root for
details
[RuntimeException]
No composer.json present in the current directory, this may be the cause of
the following exception.
[InvalidArgumentException]
Package hirak/prestissimo at version @stable has a PHP requirement
incompatible with your PHP version, PHP extensions and Composer version
require [--dev] [--dry-run] [--prefer-source] [--prefer-dist] [--fixed]
[--no-suggest] [--no-progress] [--no-update] [--no-install] [--no-scripts]
[--update-no-dev] [-w|--update-with-dependencies] [-W|--update-with-all-
dependencies] [--with-dependencies] [--with-all-dependencies] [--ignore-
platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--prefer-stable]
[--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a
|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix
APCU-AUTOLOADER-PREFIX] [--] [<packages>]...
failed: [default] (item={u'name': u'hirak/prestissimo'}) => {"changed": true, "cmd": ["/usr/local/bin/composer", "global", "require", "hirak/prestissimo:@stable", "--no-progress", "--no-interaction"], "delta": "0:00:00.250289", "end": "2020-11-11 17:25:24.630598", "item": {"name": "hirak/prestissimo"}, "rc": 1, "start": "2020-11-11 17:25:24.380309", "stderr_lines": ["Changed current directory to /root/.composer", "Do not run Composer as root/super user! See https://getcomposer.org/root for details", "", " ", " [RuntimeException] ", " No composer.json present in the current directory, this may be the cause of the following exception. ", " ", "", " ", " [InvalidArgumentException] ", " Package hirak/prestissimo at version @stable has a PHP requirement incompatible with your PHP version, PHP extensions and Composer version ", " ", "", "require [--dev] [--dry-run] [--prefer-source] [--prefer-dist] [--fixed] [--no-suggest] [--no-progress] [--no-update] [--no-install] [--no-scripts] [--update-no-dev] [-w|--update-with-dependencies] [-W|--update-with-all-dependencies] [--with-dependencies] [--with-all-dependencies] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--] [<packages>]..."], "stdout": "", "stdout_lines": []}
But I’m not sure how to remove Prestissimo! I tried commenting out in trellis/group_vars/main.yml, but I get a new error:
TASK [composer : include_tasks] ************************************************
System info:
Ansible 2.7.12; Vagrant 2.2.5; Darwin
Trellis 1.5.0: August 5th, 2020
---------------------------------------------------
The conditional check 'composer_global_packages | length > 0' failed. The
error was: Unexpected templating type error occurred on ({% if
composer_global_packages | length > 0 %} True {% else %} False {% endif %}):
object of type 'NoneType' has no len()
The error appears to have been in '/Users/designlobby/Sites/+trellis/mysite
.co.uk/trellis/vendor/roles/composer/tasks/main.yml': line 62, column 3, but
may be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- include_tasks: global-require.yml
^ here
I have just found another thread to follow which will hopefully lead to something!
I’m afraid I don’t know anything about ansible playbooks etc. I have some notes saved on how to get trellis up and running from the first time I managed to get everything working. I only use trellis for local development.
Currently I’m trying to fix this on a trellis 1.5.0 test environment, just so I can get something working before moving to client development sites working.
Where/when would I run composer global remove hirak/prestissimo ? I have tried from my trellis directory after ssh’ing into the server, and from my local trellis directory. Both times I got the error message:
[RuntimeException]
Could not read ./composer.json
file_get_contents(./composer.json): failed to open stream: No such file or directory
I can confirm there is no composer file in my trellis directory.
The Trellis directory (the ansible stuff) doesn’t have to be on the Trellis web server at all.
It has to be on some workstation/ansible runner that uses ansible to connect to the Trellis web server and issue SSH commands to provision it.
The error message shows up for composer v2, and no prestissimo installed.
This means that your Trellis playbook that you are using for provisioning the Trellis web server still tries to do something with composer global commands.
As you wrote about two different Trellis directories, one on your workstation and one on the actual Trellis web server (where it doesn’t need to be and where it shouldn’t actually be), I guess you are applying an outdated Trellis playbook.
Sorry for any confusion, I only have trellis running on my local computer. I still deploy sites manually via SFTP, (only the ‘site’ directory). The ‘trellis’ directory doesn’t touch the production server.
So, I don’t think I’m doing any of the playbook stuff. I’m only trying to get my local Trellis server working. I’m trying to start a clean install, so I don’t mind which trellis version I use as long as something works.
I’ve been trying to follow instructions from the other post on a trellis 1.5.0 install but so far nothing seems to work.
Yes Vagrant. I don’t mind updating Bedrock if necessary, if it’s pretty straight forward.
I only use one Trellis install per site - Scared of having a lot of sites on one Trellis install and then something going wrong! So individual installations for each local site.
Can confirm this is working, both locally and in production, as long as everything is rebuilt - ie running vagrant destroy and vagrant up again was required to force the local server to run composer < 2.0. I also had to do a clean install on my staging server, rather than only updating files whose dates had changed (this is just because I still use SFTP).
I haven’t tested trellis 1.7.0 again yet, but will do shortly.