Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provisioning Remote Server w/ Remote SQL DB ‘true’ Issues #563

Closed
3 tasks done
RiFi2k opened this issue Apr 12, 2016 · 2 comments
Closed
3 tasks done

Provisioning Remote Server w/ Remote SQL DB ‘true’ Issues #563

RiFi2k opened this issue Apr 12, 2016 · 2 comments

Comments

@RiFi2k
Copy link
Contributor

RiFi2k commented Apr 12, 2016

  • This is a bug report
  • This request isn't a duplicate of an existing issue
  • I've read the docs and followed them (if applicable)

Bug report

Please provide steps to reproduce, including full log output:

Provisioning a remote server with newest master branch of Trellis with the variable for remote sql set to true.
mysql_remote_database: true
I have tried it with it set to true from first provision (so no mariadb ever installed) and also provisioning first so mariadb gets installed then switching afterwards.

Either way Trellis will always fail when trying to connect to the remote db and will act like it can't find a local database even though db_host is set to an IP address.

Fails with the error "Access denied for root@localhost(using password YES)"

I also tried SSHing into the server and running 'wp db' commands after verifying that the .env file 100% had the REMOTE DB settings loaded in it. Every time it still wants to connect root@localhost

After trying a few things I decided to ssh into the server and install the package
mysql-client, which I don't think ended up helping.
(This is with no mariadb role run ever)

Then I edited /etc/mysql/my.cnf file and changed the variable 'bind-address' from the local ip 127.0.0.1 to my remote IP, then everything worked as expected.

So it seems the Ansible roles are running through the mysql socket which is set to localhost exclusively. Once I changed the bind address like I said I am able to run commands on the remote DB all day.

Please describe your local environment:

Ansible version: 2.0.0.2 and also tried 2.0.1.0

OS: Running the Trellis playbook from an Ubuntu 14.04 instance provisioned on Google Cloud Platform

DB Server: Google Cloud SQL

Note: I have successfully completed this exact provisioning numerous times using the same env variables.

Where did the bug happen? Development or remote servers?

Remote server, Ubuntu 14.04 Google Cloud Compute Instance

Please provide a repository or your wordpress_sites config (if possible):

  example.com:
    site_hosts:
      - staging.example.com
    local_path: ../example.com
    repo: git@bitbucket.org:example-sites/example.com.git
    branch: master
    db_create: false
    multisite:
      enabled: false
    ssl:
      enabled: true
      provider: letsencrypt
    cache:
      enabled: false
    env:
      disable_wp_cron: true
      db_host: 104.xxx.xxx.xxx
      db_user: example_staging
      db_name: example_staging
      db_prefix: ex_


  example.com:
    env:
      db_password: 'epic_db_password'
      # Generate your keys here: https://api.wordpress.org/secret-key/1.1/salt/
      pretend my salts are here

Is there a related Discourse thread or were any utilized (please link them)?

https://discourse.roots.io/t/provisioning-remote-server-w-remote-sql-db-true-issues/

Other relevant information:

Like I said as soon as I changed the socket IP it started working perfectly

@swalkinshaw
Copy link
Member

@RiFi2k got a PR up here: #573

swalkinshaw added a commit that referenced this issue Apr 23, 2016
Previously you had to manually toggle the remote database option via
`mysql_remote_database` (which also didn't fully work).

Now Trellis automatically detects if the sites are using a remote
`db_host` or not (aka not `localhost`) and handles things accordingly.

This also installs the mysql-client now regardless.
@RiFi2k
Copy link
Contributor Author

RiFi2k commented Apr 26, 2016

Awesome addition right here. Got really busy but got a chance to test this branch out today in development and it worked out perfectly. Just may want to add in docs that you need to have the remote database already created in the proper format, example_com_development

As long as you have the database available to connect to on the remote server it will install WP for you on that database.

Thanks for the fix!

@RiFi2k RiFi2k closed this as completed Apr 26, 2016
swalkinshaw added a commit that referenced this issue Apr 30, 2016
Previously you had to manually toggle the remote database option via
`mysql_remote_database` (which also didn't fully work).

Now Trellis automatically detects if the sites are using a remote
`db_host` or not (aka not `localhost`) and handles things accordingly.

This also installs the mysql-client now regardless.
swalkinshaw added a commit that referenced this issue Apr 30, 2016
jawngee added a commit to jawngee/trellis that referenced this issue May 22, 2016
* commit 'f1c4fb72009906244f512e82bb02c2f9435dbed0': (52 commits)
  Add Nginx variable to set fastcgi_buffer_size (roots#586)
  Require Ansible 2.0.2 and remove deploy_helper
  Pass cli options to user role's admin_user ping test
  Add connection-related cli options to ping command
  Wrap my.cnf password in quotes
  Update to WP-CLI v0.23.1
  Fix roots#563 - Improve remote databases
  Update salts link to roots.io version
  Fix roots#569 Only skip subdomains for non-www domains
  Define development default for Let's Encrypt variable
  Enable Let's Encrypt to transition http sites to https
  Add 'reason' to attr extracted for pretty-print
  Adding dbus to essentials
  Pass vault cli args to remote-user ping task
  Tidy up sudoer password definitions and comments
  👮 Fix ssmtp role tags
  0.9.7
  Fix ansible.cfg and Ansible plugins for moved Vagrantfile
  Enable color output for Vagrant shell provisioner windows.sh
  Tidy up output.py by moving some methods to utils
  ...

# Conflicts:
#	roles/deploy/defaults/main.yml
primozcigler added a commit to proteusthemes/pt-ops that referenced this issue Jun 4, 2016
* trellis-tmp:
  Require Ansible 2.0.2
  Add Nginx variable to set fastcgi_buffer_size (roots#586)
  Require Ansible 2.0.2 and remove deploy_helper
  Pass cli options to user role's admin_user ping test
  Add connection-related cli options to ping command
  Wrap my.cnf password in quotes
  Update to WP-CLI v0.23.1
  Fix roots#563 - Improve remote databases
  Enable color output for Vagrant shell provisioner windows.sh

# Conflicts:
#	Vagrantfile
#	group_vars/all/database.yml
#	roles/mariadb/defaults/main.yml
primozcigler added a commit to proteusthemes/pt-ops that referenced this issue Jun 4, 2016
* merge-0.9.7:
  Newline fix.
  Require Ansible 2.0.2
  Add Nginx variable to set fastcgi_buffer_size (roots#586)
  Require Ansible 2.0.2 and remove deploy_helper
  Pass cli options to user role's admin_user ping test
  Add connection-related cli options to ping command
  Wrap my.cnf password in quotes
  Update to WP-CLI v0.23.1
  Fix roots#563 - Improve remote databases
  Enable color output for Vagrant shell provisioner windows.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants