My current site config for the static site looks like this:
statictest:
site_hosts:
- canonical: static.dev
redirects:
- www.static.dev
local_path: ../statictest # path targeting local Bedrock site directory (relative to Ansible root)
site_install: false
db_create: false
admin_email: admin@static.dev
multisite:
enabled: false
ssl:
enabled: false
provider: self-signed
cache:
enabled: false
The site directory is empty except for a composer.json file with the following content:
{
"name": "thisolivier/statictest",
"type": "project",
"config": {
"preferred-install": "dist"
},
"require": {
}
}
Vagrant up runs well, all the way until the final task of wordpress-install, when I hit this error:
TASK [wordpress-install : Setup Permalink Structure] ***************************
changed: [default] => (item=superblog)
---------------------------------------------------
Error: This does not seem to be a WordPress install.
Pass --path=`path/to/wordpress` or run `wp core download`.
failed: [default] (item=statictest) => {"changed": true, "cmd": ["wp", "rewrite", "structure", "/%postname%/", "--allow-root"], "delta": "0:00:00.300259", "end": "2016-09-27 10:31:47.035436", "failed": true, "item": "statictest", "rc": 1, "start": "2016-09-27 10:31:46.735177", "stderr": "Error: This does not seem to be a WordPress install.\nPass --path=`path/to/wordpress` or run `wp core download`.", "stdout": "", "stdout_lines": [], "warnings": []}
I think this is a bug, since the play should only run when wp_install_results
are changed
(see roles/wordpress-install/tasks/main.yml line:67), however the site has clearly been skipped (see the output of Install WP below)
TASK [wordpress-install : Install WP] ******************************************
changed: [default] => (item=superblog)
skipping: [default] => (item=statictest)
changed: [default] => (item=patterncutting)
changed: [default] => (item=followerof)
When I debug the wp_install_results
variable, I can see that the Permalink Structure play is checking whether ANY site has been installed. I think it should be looking within the variable for whether the specific site has installed wordpress (that information is available). If you then run vagrant provision
, no new Install WP plays are run, so the wp_install_results is not set to changed, and the all the sites skip the Setup Permalink Structure
play. Successful execution!
A bigger issue is the number of WP specific plays are still being run, and that the site_install
and db_create
variables in no way prevent Trellis from treating the site as a wordpress instance.
So, to summarise, it’s possible to deploy a static site as part of the development deployment, just make sure:
-
site_install: false
and db_create: false
are set in your wordpress_sites file, and vault.yml is setup as normal.
- You have a valid composer.json file in the site root.
- You re-run
vagrant provision
after vagrant up
, since there seems to be a bug in TASK [wordpress-install : Setup Permalink Structure]
Edit: I’ve submitted a but report for the Permalink Structure issue. See Trellis issue #660.
Edit 2: The bug has now been fixed, as of pull 661 development deployments should work fine without needing to re-provision.