deploy multiple wordpress sites with juju
This may seem like an obvious question, but can you deploy multiple (distinct) wordpress sites with their own databases etc? But using a single deployment? So not dedicated vm's for each sites services. And would the optimized tuning work in this scenario?
ie. we are currently using cpanel/centos to host multiple sites (standalone html sites and php/mysql wordpress sites) which uses virtual hosts.
So does the juju wordpress charm take into account setting up virtual hosts? or in the case of nginx "server blocks"?
Also using the wordpress charm can modify it to deploy standalone html sites (that don't require databases) along side it?
Solution 1:
You've got a few questions mixed in here, so I'll try to address each in turn, starting with the last one as it's the easiest to answer.
Can the charm deploy standalone html sites along side WordPress?
Yes, you can! This is functionality that currently exists within the structure of the charm, but you'll need to keep your "files" (WordPress themes, plugins, and static files) all in a repository. The charm exposes a configuration option wp-content
, while a little deceiving, this option allows you to point to any Git, BZR, Mercurial, or SVN repository. In the root of the repo is where you'd place all additional files you want at the root of your WordPress install. For instance if you want to add a plugin "foo" and a static file named "client-login.html" you would structure your repository like so:
.
├── client-login.html
└── wp-content
└── plugins
└── foo
Then, you would use juju set wordpress wp-client=<url-to-repo>
. You can learn more about this in the WordPress charm documentation under "wp-content". You can find and example of this on Githubtwo example repositories.
Take note that this won't be a separate website but static content within the WordPress site. If you're looking to host different websites, on different domains, within the context of the Juju Charm you'll need to create a new charm that would handle those scenarios
As for your second question,
Can we deploy multiple WordPress sites to the same machine?
This is a feature I wanted to add from the start but wasn't quite possible at the time. Now Juju has advanced far enough that this is possible and I'm working on making this possible. The workflow involves using Juju's Subordinate charms to allow you to deploy a base WordPress install with:
juju deploy wordpress-mu
Then, you would deploy a subordinate charm, wordpress-site
, on top of this base. From there the charm would configure it with it's own wp-content, configuration, and apache/nginx configuration, but it would share the same core base. So the configuration options like domain
, wp-content
, and debug
would be moved to this separate charm. In the end you could deploy multiple wordpress-site charms, each unique, on to the single wordpress-mu
deployment and still scale wordpress-mu (which would in turn scale all other WordPress site deployments). An example of the commands follow:
juju deploy wordpress-mu
juju deploy mysql
juju deploy wordpress-site personal-blog
juju deploy wordpress-site professional-blog
juju deploy wordpress-site client-x
juju add-relation personal-blog wordpress-mu
juju add-relation professional-blog wordpress-mu
juju add-relation client-x wordpress-mu
juju add-relation personal-blog mysql
juju add-relation professional-blog mysql
juju add-relation client-x mysql
At the end of the day you still only have one server for WordPress but you've deployed three unique instances of WordPress to that server which you can control independently with Juju.