Database error on deploy

I’m attempting a multi-site, sub-directory deploy to production and am getting a database error:

$ ./deploy.sh production example.com

TASK [deploy : WordPress Installed?] *******************************************
System info:
  Ansible 2.0.2.0; Darwin
  Trellis 0.9.8: August 14th, 2016
---------------------------------------------------
    WordPress database error Table 'example_com_production.wp_blogs' doesn't exist for query SELECT * FROM wp_blogs
    WHERE domain = 'example.com' AND path = '/' made by
    include('phar:///usr/bin/wp/php/boot-phar.php'),
    include('phar:///usr/bin/wp/php/wp-cli.php'), WP_CLI\Runner->start,
    WP_CLI\Runner->load_wordpress, require('phar:///usr/bin/wp/php/wp-settings-
    cli.php'), require('wp-includes/ms-settings.php'), get_site_by_path

My wordpress_sites.yml file:

wordpress_sites:
  example.com:
    site_hosts:
      - canonical: example.com
        redirects:
          - www.example.com
    local_path: ../site # path targeting local Bedrock site directory (relative to Ansible root)
    repo: git@bitbucket.org:example/site.git # replace with your Git repo URL
    admin_email: info@example.com
    branch: master
    multisite:
      enabled: true
      subdomains: false
    ssl:
      enabled: true
      provider: letsencrypt
    cache:
      enabled: false
    env:
      domain_current_site: example.com
      wp_home: https://example.com
      wp_siteurl: https://example.com/wp

and in bedrock config/application.php

/* Multisite */
define('WP_ALLOW_MULTISITE', true);
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false); // Set to false if using subdirectories
define('DOMAIN_CURRENT_SITE', env('DOMAIN_CURRENT_SITE'));
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

If that’s your first deploy then you’ll need to actually install WordPress because provisioning/deploying doesn’t install it.

@cfx It is my first deploy. I’ve successfully used Trellis to install a single-site instance. When I did that I provisioned, then deployed, then went through the install process via the browser. Here I couldn’t do that as there was a db connection error.

I just redid the provision and deployment steps and get the same result. I can connect to the db using sequel pro and see the database has been created (example_com_production), but there are no tables.

Anyone have any ideas?

I recommend either installing WP using WP-CLI on your remote, or copying your local db and running search-replace.

1 Like

I did a db-migrate from the local version and loaded that onto production using sequel pro - did the trick. I tried this last night as well but for some reason it didn’t work and I figured I had bigger issues. Anyway, thanks for the input @cfx.

This looks the same as this known issue: https://github.com/roots/trellis/issues/554