Deploy Slate to Heroku

— 

Documentaton is a big part of a project, more critical if you need to hand off the details of your API to multiple third parties that will interact with it. Here you will lean how to deploy Slate, the API documentation generator based on Middleman, on Heroku, and how to configure it to generate the static HTML files with each commit on a repository.

Table of Contents

  • Some context
  • Set up Slate locally
  • Building the documentation on Heroku
  • Serving files
  • Customizing the Middleman build configuration

Some context

One particular problem we were facing at work, was deploying documentation of our API on Heroku, without the need to host the generated files into our repository. This was leading us to a lot of manipulations and possibly errors, particularly when we wanted someone outside the dev team to write the documentation. What we were trying to achieve was to just commit the markdown page and be done with it.

Wordpress Development Environment With Docker Part III Using Your Own Wordpress Theme

— 

Welcome to the last part of the WordPress development environment with Docker. We will see how to use your own theme in the previous Docker container we created in Part II. If you followed up from the last time, you will see this is straightforward.

Table of Contents

  • Accessing the container
  • Sharing data
  • Adding your own theme
  • Side note on volumes
  • Wrapping up

Accessing the container.

Our WordPress instance is installed and running in a container, we have to ask ourselves how to access to this container to be able to read and write in the directory where the files are contained. Docker has mounted WordPress in /var/www/html, so in order to access this directory, we must tell the Compose tool, how to share a directory from the host and the container.

Something tricky about sharing data with Docker, on OSX and Windows, sharing directories is restricted. Your project must be located at least in the root of C:\Users (Windows) and /Users (OSX), otherwise it won't work.

Sharing data

To share data, it's a matter of adding the "volume" line in the Compose file and tell it which directory on the host we map with the container.
For this example, we want to mount the directory in a "wordpress" folder.

The syntax start with the host directory path, separated with a colon (:), and then the path in the container.


[...]
  volumes:
    - /my/awesome/path:/var/www/html
[...]

Wordpress development environment with Docker Part II: Using Docker Compose to install WordPress

— 

This is part II of an ongoing series about WordPress development with Docker. Part I was about installing Docker and preparing the environment. Our goal this time, is installing WordPress in a container, a database, and play a little bit with it.

Table of Contents

  • Prerequisites
  • Directory structure
  • Using docker-compose
  • Setting up WordPress
  • Setting up a database
  • Bonus part
  • Wrapping up
  • Part III : adding your own development theme

Prerequisites

A fonctionning installation of Docker (see Part I).

A command line / Terminal.

A web browser of your choosing.

Directory structure

We will use a simple directory structure, create a folder on your OS, then create an empty docker-compose.yml in it.


$ mkdir wp-docker
$ cd wp-docker/
$ touch docker-compose.yml

Using docker-compose

Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a Compose file to configure your application’s services. Then, using a single command, you create and start all the services from your configuration —Docker Compose documentation

You can also launch containers one by one by doing a docker run + parameters, but it is not really friendly (yes, this is highly subjective), and very verbose as you have to type a list of parameters the size of the Mississippi. Compose is a tool made to combine the launch of multiple containers ( = multiple run commands), with the help of a YML file. This file can take a lot of parameters, we will focus on the key ones we will need in order to accomplish a WordPress installation. As always check the Docker documentation to know more.

For illustration purpose, we will use the syntax version 1 of the Compose file.

Setting up WordPress

What we want for starter is to be able to launch WordPress on an Apache server and a database. We have to define two containers, and what image it should use when we will invoke the Compose program. Note that we can name or containers however we want, as it is just a label that will help ourselves to link the containers between them and see what is going on in the CLI.

Fire up your favorite text editor, and insert the following text. Save it into the docker-compose.yml as it is the default name that Docker will invoke. You can name it with another name, but you will have to tell the program explicitely (see Bonus section).


wordpress:
  image: wordpress
  ports:
    - 8080:80

WordPress development environment with Docker Part I: installing Docker

— 

Welcome to this (soon to be) series about WordPress development environment using Docker. We will cover the basis of how to set up Docker, how to configure it to run a WordPress instance in a container, and how to add our theme, modify it, and see instantly the result.

Part I is aimed at people who heard about Docker and containers, but never got deeper. If you already know what is it all about, and have a functioning environment, skip directly to Part II.

Table of Contents

  • Prerequisites
  • Introduction
  • Create a docker machine
  • Connect to the Docker Machine
  • Start and stop machines
  • Getting the Host IP address
  • Wrapping up
  • Part II : using Docker Compose to install WordPress

Prerequisites

Install Docker Toolbox (Windows or Mac, VirtualBox is included).
A Terminal (No worries on OSX or Linux, if you're on Windows, try Cygwin , or an equivalent like Babun).

Introduction

“Docker allows you to package an application with all of its dependencies into a standardized unit for software development. Docker containers wrap up a piece of software in a complete filesystem that contains everything it needs to run: code, runtime, system tools, system libraries – anything you can install on a server. This guarantees that it will always run the same, regardless of the environment it is running in.” — Docker documentation

There are three key components of Docker:
  • The docker program.
  • Docker subcommands (run, compose, etc..).
  • Docker images, that will run in containers.

“A container is a stripped-to-basics version of a Linux operating system. An image is software you load into a container. When you ran the command, the Engine software: checked to see if you had the hello-world software image downloaded the image from the Docker Hub (more about the hub later) loaded the image into the container and “ran” it ” — Docker documentation

Imagine you want to run a MySQL server, you then have to ask Docker to run MySQL.


$ docker run mysql
[...]

But, how is it going to know how to launch MySQL, you might say? Well, Docker has an "image hub", basically a repository with a lot of already configured images ready for you to use. So if the image doesn't exist on your system, it will "pull" it from the repository and install it before anything else. Of course you can build your own images, and even pushed them on the Docker repository, but it's a another story, for a different time.