How to use Otto to deploy a Wordpress site?

206 views
Skip to first unread message

Andrew Havens

unread,
Feb 25, 2016, 8:38:34 PM2/25/16
to Otto
I hate working with WordPress. Admittedly, I don't know much about WordPress so I'm usually just hacking at it. However, Otto looks like a tool that could really help me. I couldn't find a tutorial on how to use Otto for deploying WordPress sites, but I read in a blog post that Otto provides support for WordPress. I'm wondering what my directory structure needs to look like in order to make the Otto setup and provisioning seamless. I'm currently working on trying to build a custom theme, but my local development environment is all screwed up from playing around with Docker and WordPress CLI. If you know of a tutorial that walks through setting up and deploying a new WordPress site using Otto, I would love to read it!

Thanks!
Andrew Havens

Michael Leow

unread,
Feb 26, 2016, 7:50:26 AM2/26/16
to Otto
Andrew,

Otto will auto detect a Wordpress source code (as a PHP app type) and implicitly prepare a MySQL DB (running as a Docker container) for its use.

I tried using the latest Wordpress from github and below are some notes I observed in getting Wordpress set up:

0) Compile the App via "otto compile" and start the VM using "otto dev" command

Inside the VM (after running "otto dev ssh"):

1) Seemed to be missing the php5-mysql library (is a BUG)
vagrant@precise64:/vagrant$ sudo apt-get install php5-mysql

2) Seemed to be missing a mysql-client (needed to connect and setup DB for Wordpress) (is a BUG unless Step #3 is auto)

3) Need to setup MySQL as per Wordpress instructions to create a DB and user (am assuming this step is not automated as the Docker image is the standard MySQL container image)

vagrant@precise64:/vagrant$ mysql -h mysql.service.consul -u root -p

mysql> CREATE DATABASE wordpress;
 
mysql> GRANT ALL PRIVILEGES ON wordpress.* TO "wordpress"@"%" IDENTIFIED BY "passw0rd";
  
mysql> FLUSH PRIVILEGES;

mysql> EXIT

3a) After DB is setup; you can confirm that you can connect to the DB (assuming DB is wordpress and user is wordpress)

vagrant@precise64:/vagrant$ mysql -h mysql.service.consul -u wordpress -u wordpress -p

4) Start the PHP standalone server for dev: 

vagrant@precise64:/vagrant$ php -S 0.0.0.0:3000
PHP 5.6.18-1+deb.sury.org~precise+1 Development Server started at Fri Feb 26 10:08:28 2016
Listening on http://0.0.0.0:3000
Document root is /vagrant
Press Ctrl-C to quit.

5) Go to the VM IP address on port 3000 in browser and run through the whole Wordpress setup (using the DB setup info earlier).
IP address is shown by "otto dev address" command.  Logs you will see the setup being kicked off ..

[Fri Feb 26 10:08:34 2016] 100.68.230.1:53638 [302]: /
[Fri Feb 26 10:08:39 2016] 100.68.230.1:53639 [200]: /wp-admin/setup-config.php
..

In theory, once you have done your custom theme development and want to get it packaged and deployed; you follow the common Otto commands below:

Try it out!  Report any observed bugs to github :)

# otto infra

# otto build

# otto deploy
Reply all
Reply to author
Forward
0 new messages