Can't setup Trellis/Bedrock/Sage staging on a DigitalOcean Droplet

I followed the docs. This is how far I got:

  • Vagrant up running (VirtualBox, MacOS). Development WP is now reachable, gulp watch does work.
  • A bitbucket repo with vanilla sage, added to the local repo as remote, pushed: ok.
  • A DigitalOcean Droplet (Ubuntu 14.04 x64) was created (without IPv6).
  • ansible-playbook -i hosts/staging server.yml completed without errors.
  • ./deploy staging mysite finishes without error.
  • A-Record for the domain is set to the droplet

When I try to open the website in a browser I get an ERR_CONNECTION_REFUSED. What am I doing wrong?

Some stats:

  • ping of droplet IP ist ok
  • ping of site.com is ok
  • ping of subdomain.site.com is ok
  • nginx is alive (checked via manually enabling default in sites-availible)
  • acces.log states:

46.101.196.222 - - [28/Oct/2015:19:00:01 +0000] “GET /wp/wp-cron.php HTTP/1.1” 302 5 “-” “curl/7.35.0”

  • error.log in the Droplet is empty
  • At least there’s one error. When I vagrant provision

TASK: [mariadb | Set root user password] **************************************
failed: [default] => (item=default) => {“failed”: true, “item”: “default”}
msg: unable to connect to database, check login_user and login_password are correct or ~/.my.cnf has the credentials
failed: [default] => (item=127.0.0.1) => {“failed”: true, “item”: “127.0.0.1”}
msg: unable to connect to database, check login_user and login_password are correct or ~/.my.cnf has the credentials
failed: [default] => (item=::1) => {“failed”: true, “item”: “::1”}
msg: unable to connect to database, check login_user and login_password are correct or ~/.my.cnf has the credentials
failed: [default] => (item=localhost) => {“failed”: true, “item”: “localhost”}
msg: unable to connect to database, check login_user and login_password are correct or ~/.my.cnf has the credentials

Thanks for any hints.

Did you add your SSH key when you created the DO droplet?

I think so. In .ssh/authorized_keys on the droplet is my public key and I can root SSH to it without entering a password.

I’m uncreative how to debug the ERR_CONNECTION_REFUSED. Probably something in the nginx configuration is wrong, but Trellis creates it, so it must be somewhere there:
https://gist.github.com/gabrielwolf/6a47f1fa30ede68f4aac

Maybe @swalkinshaw has an idea?

http://staging.jibazee.net brings up the WP install page for me so it’s working? Not sure if you’ve done something since then.

Thanks Scott. That’s weird. I did no changes since my last post. Will check on other computers…

Cleaning Chrome’s cache did solve the refused connection problem. Now I see the install screen as well. But the DB is still not in sync with the local one. The DB error which I posted above prevents ./deploy to sync them. It is not reported during deploy. Hm. Intentionally?

  1. Maybe Trellis does security stuff and removes some connection method to MariaDB in the very first vagrant up where no error occurs?
  2. Is it possible (rational?) to have separate passwords for the DB locally and staging/production?
  3. Different thread but… Feature request for Trellis: “DB up and download from and to different staging environments” Would that be possible? When I work with clients I often have to grab actual staging content altered by the client himself/herself. With the dead simple https://www.npmjs.com/package/grunt-wordpress-deploy this was pretty easy.

I’ll say it first: https://deliciousbrains.com/wp-migrate-db-pro/

Yes you need to buy a license, but it rocks.

In my experience it makes sense to deal with the DB separately from the files. You get a lot more flexibility that way. The plugin can also sync your media , etc.

…and no, I’m not on any commission, although I probably should be. :wink:

2 Likes
  1. Honestly I’ve never seen those errors you had and we haven’t had any other reports (from latest versions at least)
  2. Yes it’s possible and that’s our default. mysql_root_password is set in each environment group vars.

This thread is about to get blurry. I started a [more general thread][1]
about the problem.

Regards, Gabriel
[1]: Roots who are you? The one solving the gordian knot? “general discussion”

I got rid of the mysterious DB error.

  1. Trellis was 2-3 weeks old
  2. I ignored errors from ansible-galaxy install -r requirements.yml that had problems downloading all rules. I tried 3-4 times until everything could be downloaded.

Eventually https://github.com/roots/trellis/pull/239 bugfixed the DB password change problem.

Now I can vagrant provision without error.

1 Like