Roots Error #2 – Mailhog, connection failure

Yet another error while using Roots’ Trellis, Bedrock and Sage during vagrant up on a brand new site, development locally on MacOS Sierra 10.12.6

 

My experience with Roots is that every time I use it I get a new error. Even if I didn’t change anything.

 

The Problem

Today the error began when I create a new site and ran vagrant up for the first time. This was the error:

Then I thought that since the error was reporting an issue with Vagrant Plugins I should uninstall and reinstall Vagrant and re-run vagrant up. I did this and it resolved that error. But then I got a new one:

TASK [mailhog : Download MailHog and mhsendmail binaries.] ********************* System info: Ansible 2.4.0.0; Vagrant 2.0.0; Darwin Trellis at “Vagrant: Use DHCP by default” ————————————————— Connection failure: (‘The read operation timed out’,) failed: [default] (item={u’url’: u’https://github.com/mailhog/MailHog/releases/download/v0.2.1/MailHog_linux_amd64′, u’dest’: u’/opt/mailhog/mailhog’}) => {“changed”: false, “dest”: “/opt/mailhog/mailhog”, “failed”: true, “item”: {“dest”: “/opt/mailhog/mailhog”, “url”: “https://github.com/mailhog/MailHog/releases/download/v0.2.1/MailHog_linux_amd64”}, “state”: “absent”, “url”: “https://github.com/mailhog/MailHog/releases/download/v0.2.1/MailHog_linux_amd64”} ————————————————— changed: [default] => (item={u’url’: u’https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64′, u’dest’: u’/opt/mailhog/mhsendmail’})

 

So I vagrant destroy and then vagrant up again. Same error.

I visit the URL it’s complaining it cannot access: https://github.com/mailhog/MailHog/releases/download/v0.2.1/MailHog_linux_amd64', u'dest': u'/opt/mailhog/mailhog and I am able to access it and download the file without issue.

So I rerun vagrant up and it suggests that everything is fine. I know this is incorrect because, from what I can tell, there is a bug with the script that is provided by Roots to give a false positive literally every time I rerun the script and it’s suppose to only rerun the commands that failed, or must be rerun again to initialize the VirtualBox (among other things).

Because I’m only using Roots for the second time I have no idea where to even begin to debug their script. So that’s not a realistic option.

So I, since I’ve learned how unpredictable this script can be I bank on that and run vagrant destroy and then vagrant up again. Wow! I was right. I get an entirely different error this time:

TASK [wordpress-setup : Generate self-signed certificates] *********************
System info:
Ansible 2.4.0.0; Vagrant 2.0.0; Darwin
Trellis at “Vagrant: Use DHCP by default”
—————————————————
{{ site_hosts_canonical | union(site_hosts_redirects) }}: {{
item.value.site_hosts | selectattr(‘redirects’, ‘defined’) |
sum(attribute=’redirects’, start=[]) | list }}: Unexpected templating type
error occurred on ({{ item.value.site_hosts | selectattr(‘redirects’,
‘defined’) | sum(attribute=’redirects’, start=[]) | list }}): can only
concatenate list (not “NoneType”) to list
fatal: [default]: FAILED! => {“failed”: true}

 

This time I get ok=88 whereas last time it was like ok=46. I literally only did what I wrote above. Yet somehow I get a different error.

This time, however, I think I know what’s going on with this error. You see, Trellis offer a really great feature which is environmental variables for WordPress. You can read more about that on the official docs – which I’m too lazy to link to right now. And I know that in /trellis/group_var/development/wordpress_sites.yml at line 10 I commented it out because I previously made the mistake of putting my staging URL at lines 6 and 8, and didn’t see a reason to have a redirect in that case. And I was right. Except that that was just the wrong file and URL. So I updated lines 6 and 8 to reflect the right URL and uncommented line 10 and also updated that with the right URL.

 

Viola. Site is finally working.

My guess about the connection error is that it was temporary. I’ve actually had this happened twice before but with other URLs. There are endless reasons that can happen, but if the server it’s downloading from goes down, temporarily blocks you because it thinks you’re spam, etc… are a few reasons.

 




By:
Spencer Hill
Categorized in: Bedrock, PHP, Programming, Roots, Sage Theme, Trellis
This post is related to: bedrock, connection error, errors, mailhog, roots, sage, trellis,

About

Since 2005 we've been offering digital and content marketing strategy and implementation. Including website development, search engine optimization and marketing, search marketing and more.

Continue Reading »

Contact

Email

us@theportlandcompany.com

Phone

503-567-9561

Follow

  • Logo for The Portland Company with a Coyote
    Thank you for using our site. x