Multisite remote provision/deploy doesn't create any database tables


#1

Hi,

Setting up multisite install as per docs provisions locally fine, but when I provision and deploy to remote server it creates a database, but there are no database tables, and cannot install wordpress. Ansible runs all tasks without error.

from

trellis/group_vars/staging/wordpress_sites.yml

    multisite:
      enabled: true
      subdomains: false

site/config/application.php

define('WP_ALLOW_MULTISITE', true);
define('MULTISITE', env('MULTISITE') ?? true);
define('SUBDOMAIN_INSTALL', env('SUBDOMAIN_INSTALL') ?? false); // Set to false if using subdirectories

define('DOMAIN_CURRENT_SITE', env('DOMAIN_CURRENT_SITE'));
define('PATH_CURRENT_SITE', env('PATH_CURRENT_SITE') ?: '/');
define('SITE_ID_CURRENT_SITE', env('SITE_ID_CURRENT_SITE') ?: 1);
define('BLOG_ID_CURRENT_SITE', env('BLOG_ID_CURRENT_SITE') ?: 1);

Manually importing the local wordpress tables into the remote db fixes things however.


#2

Given Trellis creates DB tables in development, it can be surprising that …

Trellis does not automatically install WordPress on remote servers. It’s normal and expected to see the WordPress install screen the first time you deploy. It’s up to you to either import an existing database or install a fresh site. – deploy docs

Deploying is a process you will repeat many times as your site evolves and updates over time, whereas importing or creating DB tables will typically only happen once, after your initial deploy. So, the deploy doesn’t automatically create/import tables.

If you notice a great place to make another mention of this in the docs, feel free to submit a PR.


Site Can't Be Reached on Digital Ocean
#3

Thats right, and after provisioning/first-deploying a non-multisite Roots install, hitting any page will direct you to the “Install wordpress” screen. With multisite, as it is, it just shows a database connection error, and no option to install/setup WordPress.

Here is a screenshot of the page that appears instead.

Cheers


#4

Running into this same issue on first deploy.

Only way I’m seeing to solve this is to ssh in and run wp core multisite-install, manually typing in the variables from my .env, then after the install deleting the new lines from wp-config since they are redundant to what will be in application.php.

Is that the recommended workflow or is there a better way to get the site installed on first deploy?


#5

getting same error…
Usually you have to install wordpress without multisite and then convert it?