[A JuJu Adventure] Baby Steps into WordPress Charm

For a while now, I have being toying with the idea to move away from a WordPress.com hosted site for this blog. The main reason: I am not really happy to have to pay for every single simple stuff.. add an additional URL to the site, take aways advertising, edit a CSS… it really stops me from playing :)

What had prevented me from doing this in the past was that I haven’t really got much experience setting up WordPress or MySQL. What I really needed was a save (and free) sandbox to try changes to my site, until I was happy with it, and then easily deploy it live… Can you say Juju?

With Juju you can do all your playing locally using LXC, save all the changes into a Charm and then just deploy them into a public cloud. Perfect!

 

The first thing I did was to set-up an Amazon AWS account and configure my juju environment to deploy to the public cloud. My rationale here was: if I can’t get vanilla WordPress in a live public site, then there is little point continuing with the experiment.

This was actually pretty easy, I just followed the Getting Started guide. The only stumbling block was that I was using my travel laptop at the time that didn’t have my launchpad ssh keys. You need to create ssh keys to use Juju, but apparently you also need to publish them into your launchpad account. Once this was done, I had a public WordPress instance in just 5 commands.

Next step: destroy the environment and stop paying :) Now I needed to bring up my cheap sandbox.

Again this is pretty easy to setup, just follow the Getting Started guide. I hit another road block once my deployment instances seemed not be doing much, “juju status -e local” showed them in pending state and the logs did not display any activity…A bit of Googling later , I found that Jorge Castro had hit the same problem and found the solution in Ask Ubuntu.

With my WordPress local instance now fully up and running, now I needed to upload my own content. To do this, I just needed to upload the wordpress importer plugin. Fairly trivial to get gone by hand, thanks to the very useful “juju scp” and “juju ssh” commands, but how to do it via a Charm. I wanted to make sure that the next time a deploy wordpress, it would have already this plugin install. Crudly this is what I did:

  • Using the charm-tools I got the wordpress charm loc ally (charm get wordpress)
  • I then edited the install file under hooks/ to include:
    apt-get -y install wordpress pwgen wget unzip
    wget http://downloads.wordpress.org/plugin/wordpress-importer.0.6.zip
    sudo unzip wordpress-importer.0.6 -d /usr/share/wordpress/wp-content/plugins/
  • redeploy using locally stored charm. juju deploy –repository=~/charms local:precise/wordpress -e local

Guess what, it worked. I did get some warnings (WARNING Charm ‘.mrconfig’ has an error) that I am yet to iron out, but when the wordpress instance came up the new plugin was there:

That is all for today, and before I go, one last useful hint courtesy of James Page: Add “default: {name of your env}” if you have multiple environments┬á but you normally always use one. Save me having to type “-e local” all the time.

12 Responses to [A JuJu Adventure] Baby Steps into WordPress Charm

  1. Pingback: Ubuntu developers: Victor Tuson Palau: [A JuJu Adventure] Baby Steps into WordPress Charm | Linux-Support.com

  2. The new wordpress charm should rock even more for you, I’ll keep you posted on it’s progress.

  3. Brandon says:

    NICE Victor, its good to see new faces pick up Juju. Drop by anytime on IRC if you wish for some tips/tricks as myself and marcoceppi currently work on the WordPress and Drupal charms fairly heavily.

    But looks like your off to a great start so far.

    • Victor Palau says:

      I need to read a bit more about it, but my idea is to create a subordinate charm to wordpress that would install the plugins I care about and theming and so on, but not sure if that is the right way to go about it. At the moment, I am just working out how to setup some of the plugins

      • Brandon says:

        Yup, your exactly correct. The subordinate would be the ideal way to house your own plugins and themes etc that would layer “ontop” of the WordPress charm.

        Although in the meantime while your still just getting the feel for things you can add plugins and such to the wordpress charm its self and just run “juju charm-update wordpress” and it will push your latest changes to the local wordpress charm fork upto the node(s) running wordpress and then fire the charm-update hook so that it can put the new files you’ve added into place or anything else you might need it to do.

        Like you said the sub is the ideal place for that but while getting a feel for things that way works too!

        Cheers!!

  4. Pingback: [A JuJu Adventure] Splitting my charm out « Victor Palau's Blog

  5. Pingback: Ubuntu developers: Victor Tuson Palau: [A JuJu Adventure] Splitting my charm out | Linux-Support.com

  6. Pingback: Ubuntu Weekly Newsletter Issue 267 | Ubuntu Linux FAQs

  7. Pingback: [A JuJu Adventure] Splitting my charm out | All Top Gadget

  8. Pingback: [A Juju adventure] Linking up with Android « Victor Palau's Blog

  9. Pingback: [A Juju Adventure] Charming Lamp! « Victor Palau's Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: