Skip to content

Creating a wordpress development environment with Subutai

Junior Lima edited this page Dec 3, 2017 · 8 revisions

1. Setting up a wordpress environment on the Hub

  1. Logged in on the hub.
  2. Click "Environments".
  3. Click on "Create Environment". Click the checkbox in one peer from my Favorites.I find the "Next" button on the top right and click it.
  4. I'll start with an ubuntu16 image. I click it twice to have one in each Peer. Name it.
  5. Success! Click "Build" and wait for the magic to happen.
  6. After environment is healthy, I SSH into it through the Tray.

2. Setting up Wordpress Environment

  1. apt update && apt upgrade

  2. Reading documentation on wp-cli: https://wp-cli.org/ Requirements: WP >= 3.7, PHP >= 5.3.29

  3. apt install wordpress php php-cli mysql-server -y . no passwords for MySQL. (later @fsilva suggested I should have apache/nginx, mysql and php-fpm on distinct containers. As this environment is meant only to develop and test our blog, I'll leave that for later. In production, that may be a good idea).

  4. apt install curl -y

  5. Following docs: chmod +x wp-cli.phar && mv wp-cli.phar /usr/local/bin/wp

  6. Downloaded tab completion from here and sourced it: https://raw.githubusercontent.com/wp-cli/wp-cli/master/utils/wp-completion.bash

  7. Install my text editor of choice: apt install nano -y

  8. Edit /etc/apache2/sites-available/wordpress.conf:

     Alias /blog /usr/share/wordpress
     <Directory /usr/share/wordpress>
         Options FollowSymLinks
         AllowOverride Limit Options FileInfo
         DirectoryIndex index.php
         Order allow,deny
         Allow from all
     </Directory>
     <Directory /usr/share/wordpress/wp-content>
         Options FollowSymLinks
         Order allow,deny
         Allow from all
     </Directory>
    
  9. service apache2 reload

  10. sudo gzip -d /usr/share/doc/wordpress/examples/setup-mysql.gz

  11. sudo bash /usr/share/doc/wordpress/examples/setup-mysql -n wp_subutai subutai-blog.stage-hub.net

  12. PHP didn't work. Of course, it's not enabled on apache. sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql

  13. http://subutai-blog.stage-hub.net/blog redirects to install script

  14. Successful install!

3. Configuring git repository

Studying this: https://wpbeaches.com/set-git-workflow-local-devlopment-webserver/

See also: http://www.designcollective.io/blogs/manage-wordpress-with-git

References