Ads 468x60px

Friday, June 14, 2019

Streamlining Deployment With Docker Using Buddy

Docker makes it easy for developers to create and deploy applications in nicely packaged, virtualized containers. These containers can be used on any machine without any compatibility issues making it easier for you to write, run, and test your software applications.

In this post, we’ll go over some of the challenges that come with using Docker and how you can streamline your workflow using Buddy - a DevOps deployment platform - that’ll help you save time and improve your productivity.

What Is Docker?

Docker is a software development platform that enables developers to easily create, deploy, and test applications. It uses containers which package up all the necessary parts of an application, such as libraries and its dependencies, and imports everything as a single package. The resultant application will be able to run on any Linux machine, even if that machine has different customized settings than the one used to write and test the code.

Docker isn’t a virtual machine which means it doesn’t create a complete virtual operating environment. On the contrary, it lets applications run on the same Linux kernel as the one used to run those applications. This helps save host computer resources by only requiring those things to be sent that are not already running on it which boosts performance and reduces the application size.

The first thing developers do before they create an application is that they configure its environment. This typically involves tasks like the installation of database version, file server version, and packaging a version.

Here are the main challenges faced by developers when running applications:

Challenge #1: Environment management is difficult
To make any change in the environment, for instance installing a new database version or any other dependency, developers have to properly configure that change to their machine. The production server is where every change needs to happen upon release.

It isn’t easy to keep track of all these added dependencies without the help of proper tools. Additionally, developers know that as a result of environment configuration, problems can arise frequently, which makes debugging and fixing them difficult and expensive.

Challenge #2: Existing tools are slow and complex
While there are a lot of tools like virtual machines and configuration management software out there, they can take a toll on your resources. Plus, they take a lot of time to start and stop, which slows you down. Not to mention, using a configuration management tool requires a high level of technical knowledge and expertise.

How Docker addresses these challenges

Thankfully, Docker can help you circumvent these problems, effectively. The Docker containers package all the things required to run everything including the code, system tools, runtime, and system dependencies. This makes it so the resulting software or website is capable of seamlessly running in any environment.
In other words, Docker consumes a lot less resources as compared to virtual machines. It’s also faster because it can run on any server regardless of the operating system.

Deployment with Docker (Without Buddy)

If you’re developing a website, you’ll need access to the source code and the documentation to tell you exactly what you need to install on your machine and their configuration settings to ensure that the application can run on your machine locally.

By creating your applications in Docker, you don’t have to deal with the hassles of configuration. You don’t have to figure out what component you need to install on your machine, worry about the correct version of each dependency, or proper configuration of components for the application to run locally.

Let’s take a quick look at the steps you’ll be following when developing websites in Docker:
  1. Installing Docker: You’ll begin by installing Docker on your machine.
  2. Downloading Samples: Next, you’ll have to download the sample files you need, unzip them using a data compression tool, and place the files in the relevant directory.
  3. Running Docker: Now you can start running the terminal. To do this, you’ll need to navigate to the directory where you placed the extracted files and proceed to executing docker-compose up command.
  4. Good to go: Your development environment will start running, and you’ll be able to view the website at http://localhost: 8080.
You’re all set up and ready to start developing your website. All this, without having to install an HTTP server or a relevant dependency and without configuring a single component.

Working in Docker has its share of benefits. While it allows you to create your website locally, in a local development environment, it is possible to make your Docker deployment more efficient.

To do this, you need to install Docker Compose on the local server, upload new source files, and run the docker-compose up and docker-compose down commands on it.

Although this may seem simple at first, doing the same things manually several times a day can be counter-productive. When you change a repository every time you have to deliver, you have to connect to the server, upload the files on it, log in and run the docker-compose up and docker-compose down commands. It isn’t just time-intensive, but doing everything manually raises the chances of error, as well.

How to Automate Deployment With Docker Using Buddy

There is a better way to deploy your applications with Docker that’s more time-effective and allows you to automate the whole process. Using Buddy - a DevOps automation platform - that enables you to build applications faster using pipelines.

To build your apps using Buddy, you need to have a Buddy account, and a server with Docker.

Step #1: Set Up a Buddy Project

Here’s what you need to do to create a project with Buddy:

Start by adding a new project.

Next, you’ll have to select Buddy as your Git hosting solution and name your repository.
Export the repository you’ve been working on Docker to Buddy.

Step #2: Create a Buddy Pipeline

Next, we’ll start automating your everyday development workflow by creating a Buddy pipeline.

First, you need to add a pipeline. This will automatically create changes made to the repository in the local server.
Next, Buddy will upload the website for you on every change. All you have to do is add an action that’ll upload the source files of your application to the production server. Buddy lets you choose from several uploading options, including SCP, FTPS, and FTP.
Now you’ll have to create an ssh action for running docker-compose up and docker-compose down commands. To do this, you’ll have to provide the authorization data and set methods for execution in working directory.
With your Buddy pipeline all set up, you can be sure that any changes you make in the repository will be deployed to the server and become visible in your production environment, source code, and the configuration.

If you want, you can manually see how the pipeline works. Click the Run button next to the pipeline name, and open the page (server IP:8080) to check your website on live server.

Step #3: Set Up the Staging Server

You’re now ready to setup a pipeline for confirming Dev-Test equivalence. It’s highly recommended that you use the staging server for the development process. This is where you’ll test the changes before they’re released. Docker and Buddy will enable you to easily configure your server machines.

Start by adding a stage branch to your local repository. It’ll help you organize your work on a particular project. Git branches enable you to work on several dissimilar features at the same time without worrying about project dependencies or synchronizing changes during deployment.
Next, you need to add a new pipeline for the staging server. Its purpose is to do the same task as the production server, but for a different staging branch. You’ll be able to save time by creating a copy of your existing pipeline. However, you’ll have to make the following changes to it:
  • Modify the name of branch to staging.
  • Change the action required to uploading files: Modify the directory, so that it directs to the staging server. Remember to not use the same path for live application files and staging application files.
  • Modify ssh action: Make the execution path same as your upload action.
  • Modify the docker-compose up command to docker-compose run -d -p 8081:80. This way the staging application will be executed on a different port than the live application.
That’s it! You’re now up and running live and staging applications on the same server.
  • Live application on server IP:8080
  • Staging application on server IP:8081
Both may be configured differently, but no change in staging application will affect your live application. This is because both are running in different containers.


With Buddy, you’re able to automate deployment with Docker using pipelines and take the manual work out of the traditional approach. As a result, you’ll be able to save time and effectively minimize any chance for error.

What tools do you use to make app development more productive? Let us know by commenting below.

*Read my Disclosure


Post a Comment