Redeployment or reprovision - when each is needed

Hi all,

If I update my group-vars/production/wordpress_sites.yml file, will I need to reprovision the box or will a normal deployment apply the updates?

Thinking from a holistic view, I realise I’ve had this type of question many times whilst working with Trellis.

Could the documentation be updated to include some guidance on what settings (if changed) will need a reprovision or redeployment please?

Look forward to hearing your thoughts.

4 Likes

Hi @allan.crabtree!

Were you able to find a solution to this?

You’d need to reprovision most likely. It kind of depends on the setting unfortunately so it’s easiest to just reprovision unless you really know.

I’m sure we could find a place to explain this (and re-provisioning in general) in the docs.

1 Like

I dropped tables in production and upon running the provision script again they were not recreated… any idea why and how I could force the wordpress to reinstall the database?

This thread isn’t really related… but in production Trellis never installs WP (creates tables).

You can use a WP-CLI command like https://developer.wordpress.org/cli/commands/core/install/

1 Like

Thanks for your response @swalkinshaw! I’m sorry, never intended to hijack the thread; I considered it directly related because, like the OP, I also had the need to change an env setting (wp_siteurl) in group_vars/production/wordpress_sites.yml and was trying to figure out how to re-provision the production server to reflect this change, same as OP.

I re-ran the provision & deploy playbooks like you advised above, but the wp_siteurl was not updated in the database, so I thought to myself "hey, what if I dropped tables in case there is a check in the playbook for the existence of tables to determine whether or not to run a wp core install "… but the tables weren’t re-created when re-running the Ansible playbook.

…Contrary to the docs (and popular belief) the first time I ran Trellis in production it did create WordPress tables, much like it did for @royscheeren back in 12/2016 (FWIW I am also running a multisite install):

Hence the confusion :slight_smile:

If I have time I think I’ll make a docs PR to add info about wp-cli…

1 Like

Can’t really comment on that other thread, but I can assure your Trellis does not install WP on remote servers.

The only place in Trellis that wp core install is run is in the wordpress-install role which is only used in dev.yml.

server.yml is used for remote server and it does not run that role.

Thanks for following up @swalkinshaw! You’re right, turns out (as you surmised) I did indeed initiate the creation of tables manually (unbeknownst to me) while trying to debug WP Errors*, which lead me to run the wp core multisite-install command found in this github issue… :man_shrugging: sorry for the confusion and your troubles! :pray:


*the errors in question, for posterity of future intrepid discourse searchers:

WordPress database error Table 'example.wp_blogs' doesn't exist for query SELECT  blog_id FROM wp_blogs  WHERE domain IN ( 'example.com' ) AND path IN ( '/' )  ORDER BY blog_id ASC LIMIT 1 made by include('phar:///usr/bin/wp/php/boot-phar.php'), include('phar:///usr/bin/wp/php/wp-cli.php'), WP_CLI\bootstrap, WP_CLI\Bootstrap\LaunchRunner->process, WP_CLI\Runner->start, WP_CLI\Runner->load_wordpress, require('wp-settings.php'), require('wp-includes/ms-settings.php'), ms_load_current_site_and_network, get_site_by_path, get_sites, WP_Site_Query->query, WP_Site_Query->get_sites, WP_Site_Query->get_site_ids
WordPress database error Table 'example.wp_sitemeta' doesn't exist for query SELECT meta_value FROM wp_sitemeta WHERE meta_key = 'site_name' AND site_id = 1 made by include('phar:///usr/bin/wp/php/boot-phar.php'), include('phar:///usr/bin/wp/php/wp-cli.php'), WP_CLI\bootstrap, WP_CLI\Bootstrap\LaunchRunner->process, WP_CLI\Runner->start, WP_CLI\Runner->load_wordpress, require('wp-settings.php'), require('wp-includes/ms-settings.php'), WP_Network->__construct, WP_Network->_set_site_name, get_network_option