How to Deploying Joomla Containers using Docker Composer

Docker Compose is a tool that allows you to deploy an application composed by multiple containers. For example, imagine that you want to deploy Joomla. It requires two containers, the web application (which it also runs the web server apache) and the database.

Docker11

Deploying using the docker CLI

First, let’s deploy Joomla using the Docker command line interface.

  • Run the database container. We do it first because the database is a dependency of the application.

  • Run the application container, link it to the database and map the port 80

Executing containers in the background

The previous commands allows you to run the containers and all the logs will be shown in the terminal. If you want to run the containers in the background, you need to add the parameter -d

Stopping containers

If you want to stop and delete a running container, allowing you to start another container with the same name, you just need to execute the following command. The last parameter is the container name.

NOTE: you can get the name of all running containers executing the command docker ps )

Installing Docker

You can install Docker by executing the following command:

Deploying using Docker Compose

Docker compose makes things more simple. It allows you to create a simple YAML file that will contain everything required to orchestrate both containers. Let’s run the previous example using Docker Compose.
Create a file called compose-joomla.yml with the following content:
joomla:

Installing Docker Compose

If you do not have Docker Compose installed yet, you can do it by executing the following commands:

Deploying Containers in the Cloud using Manageacloud

First, in our account, we create a server configuration, called docker_compose_joomla, using shell, for Ubuntu 14.04 and using the following content:

Running applications in the cloud

A server configuration is everything that is required to run applications in the cloud using Manageacloud.
Deploying from the web interface
There are two ways to deploy a server from the web interface:

  • By clicking “Quick Deployment” from the server configuration view
  • By clicking “Production” or “Testing” from the advanced deployment page

Deploying using the mac cli

You can also deploy from the command line interface:

Installing mac Command Line Interface

You can install mac cli by executing the following command:

Deploying using Manageacloud triggers

The mac cli and the web interface requires credentials and some other minor tweaks to run. However, if you use triggers , you will isolate all that complexity. You can deploy just by executing a POST into an URL.

  • First, create a new trigger at you account
  • Comment out the lines that contains the credentials:

  • Add the following line to the trigger

Now you can run the trigger, deploying the application, just executing a POST to an URL. Example:

Triggers and Webhooks

Triggers are bash scripts that isolates all the credentials and complexity. Triggers are specially ideal to run in Webhooks as part of the Continuous Integration or Continuous Deployment pipeline.

Deploying using macfiles

Sometimes is just not good enough to deploy single servers as you need to use infrastructure resources such as load balancers, autoscaling groups and more.
macfile is a technology agnostic framework that allows you to integrate any technology that uses bash . Access to the quickstart guide for more information.

Deploying using API

If you want to integrate the deployment of Joomla with an application, you should use the API to create the server. For example:

Deploying using Manageacloud scripts

Sometimes you need to deploy server configurations in existing servers. In this case, you can deploy using the Manageacloud script, accessible from the deployment page. For example:

When should I use Manageacloud scripts ?

You can use Manageacloud script in many different cases, for example:

  • In the Dockerfile to create the configuration of your container
  • If you create development servers using Virtual Box
  • and more

Conclusion

Docker Compose is a fantastic tool to deploy containers and microservices in the cloud. Using it along ManageaCloud offer us the flexibility required to deploy applications in the cloud, covering many different use cases and deployment scenarios.