Containers

GoLang: Go modules for package management during a multi-stage Docker build

My previous article on multi-stage builds to create  Docker images for Go laid the foundation for using an intermediate image as the builder your Go binary.  However, this example was intentionally simplistic and did not address package and dependency management. Since the release of Go 1.11, the standard tooling has natively supported the concept of GoLang: Go modules for package management during a multi-stage Docker build

GoLang: Using multi-stage builds to create clean Docker images

The Go programming language is a natural fit for containers because it can compile down to a single statically-linked binary.  And if you place that single executable on top of scratch, a distroless image, or a small image like alpine, your final image has a minimal footprint which is great for consumption and reuse. But the GoLang: Using multi-stage builds to create clean Docker images

Docker: Placing limits on cpu usage in containers

Containers themselves are light, but by default a container has access to all the CPU resources the Docker host kernel scheduler will allow. Internally Docker uses cgroups to limit CPU resources, and this is exposed as the flag “–cpus” when bringing up a docker container: sudo docker run -it –cpus=1.0 alpine:latest /bin/sh This will limit Docker: Placing limits on cpu usage in containers

Docker: Placing limits on container memory using cgroups

Containers themselves are light, but by default a container has access to all the memory resources of the Docker host. Internally Docker uses cgroups to limit memory resources, and in its simplest form is exposed as the  flags “-m” and “–memory-swap” when bringing up a docker container. sudo docker run -it -m 8m –memory-swap 8m Docker: Placing limits on container memory using cgroups

Docker: Use overlay2 with an xfs backing filesystem to limit rootfs size

If you are using the overlay2 storage driver, you can place limits on the rootfs within a container but only if using an xfs backing filesystem (not ext4). As a quick test of your Docker install, check your Docker storage driver and backing filesystem, then attempt to spin up a small alpine image with a Docker: Use overlay2 with an xfs backing filesystem to limit rootfs size

Zabbix: Using Docker Compose to install and upgrade Zabbix

Zabbix distributes Docker images for each component.  Not only does this mean you can quickly standup the monitoring solution, but upgrades also become a simple matter of trading up images. In this article, I will show how to stand up and then upgrade a zabbix installation using docker-compose.

Docker: Installing Docker CE on Ubuntu bionic 18.04

Update Dec 2021: I have written an updated article for installing Docker on focal 20.04 Docker is a container platform that streamlines software delivery and provides isolation, scalability, and efficiency with less overhead than OS level virtualization. These instructions are taken directly from the official Docker for Ubuntu page, but I wanted to reiterate those Docker: Installing Docker CE on Ubuntu bionic 18.04

CloudFoundry: CLI error, unexpected end of JSON input

If you receive this error upon trying to run commands from the CloudFoundry CLI: “Error read/writing config: unexpected end of JSON input” This is most likely due to an error in the “$HOME/.cf/config.json” file.  Make sure the user has full ownership: ls -l ~/.cf/config.json chown $USER:$USER ~/.cf/config.json chmod 755 ~/.cf/config.json And if that does not CloudFoundry: CLI error, unexpected end of JSON input

CloudFoundry: Installing a BOSH Director on AWS

BOSH is a project that unifies release, deployment, and lifecycle management of cloud based software.  It also serves as the underlying infrastructure for deploying the CloudFoundry PaaS. In this article, I will lead you through deploying the BOSH Director to Amazon EC2 which is the first step in deploying both CloudFoundry CFAR as well as CFCR CloudFoundry: Installing a BOSH Director on AWS

Kubernetes: running Minikube locally on Ubuntu using VirtualBox

Updated article to latest Minikube, Feb 2019 Minikube is a tool that runs a Kubernetes stack inside a single VM being run by a local virtualization engine such as VirtualBox.  This makes it ideal for local development and experimentation. In this article we’ll be going through installation and validation of a Minikube installation on Ubuntu Kubernetes: running Minikube locally on Ubuntu using VirtualBox

Docker: Using docker-compose and networking to link a Spring Boot app to an external service dependency

In earlier versions of Docker,  links were used to connect two containers by enabling network access as well as sharing environment variables.  This approach is being deprecated in favor of a shared network between the services.  And instead of environment propagation, environment values will need to be explicitly added to each service that requires them. Docker: Using docker-compose and networking to link a Spring Boot app to an external service dependency

Docker: Running a Spring Boot based app using docker-compose

Docker Compose gives us the ability to define services,  ports, volumes, and networks in a single file.  This  file provides a convenient and unified view into what would otherwise be a long list of docker commands. In this article, you will run the Spring Boot based spring-music app in a Docker container using docker-compose.

Docker: Using docker-compose to link a MongoDB server and client

Docker Compose gives us the ability to define and orchestrate multiple containers in order to construct a service.  In this article, we will use Docker Compose to create a MongoDB server and then another container that is used exclusively as a MongoDB client. While it is entirely possible to manually create these containers, links, and Docker: Using docker-compose to link a MongoDB server and client

Docker: Base image when deploying a GoLang binary in a container

Update Oct 2020: multi-stage builds now provide a standard way to leverage a fat build image, while allowing your published image to remain small.  This article is still useful for comparing base image sizes. GoLang applications are a great architectural fit for a Docker container because of their single binary executable. But you need to Docker: Base image when deploying a GoLang binary in a container

CloudFoundry: Extracting Java multiline exception stack traces from Logback and Log4j2 using Logstash

Cloud Foundry deployed Java applications can send log events to stdout/stderr and then a bound syslog drain can send this to a logging solution like ELK for ingestion. One area that has always been tricky when dealing with logging is multi-line Java stack traces.  By default, because each line in the stack trace has a CloudFoundry: Extracting Java multiline exception stack traces from Logback and Log4j2 using Logstash

CloudFoundry: Deploy Cloud Foundry locally using BOSH Lite on Ubuntu

Update Jan 2019: Now using CredHub instead of ‘–vars-store’ (which will be deprecated in CF 3) Even if you are developing a service or application that will ultimately be deployed to a private Cloud Foundry instance, having a local CF instance for development work is still an ideal development workflow. There is a local CF CloudFoundry: Deploy Cloud Foundry locally using BOSH Lite on Ubuntu

CloudFoundry: Beyond the maintenance page, delivering a response during service unavailability

For most Cloud Foundry applications and services, you can avoid downtime for maintenance with a combination of following best practices for 12 factor app development and taking advantage of Cloud Foundry’s scaling and flexible routing to implement Blue-Green deployment. But there will still be times where an application, service, or shared backend component does not CloudFoundry: Beyond the maintenance page, delivering a response during service unavailability

CloudFoundry: Using Blue-Green deloyment and route mapping for continuous deployment

One of the goals of Continuous Deployment (CD) is an automated deployment and patching process.  And as your  organization becomes more efficient at deployment and velocity increases, you want to ensure that availability is maintained while keeping risk to a minimum. Cloud Foundry supports route mapping that allows you to stand up a new live CloudFoundry: Using Blue-Green deloyment and route mapping for continuous deployment

CloudFoundry: Enabling Java JMX/RMI access for remote containers

Enabling the use of real-time JVM monitoring tools like jconsole and VisualVM can be extremely beneficial when troubleshooting issues.  These tools work by enabling a JMX/RMI communication channel to the JVM. These are typically thought of as local development tools, but they can also be used on remote CF containers running Java.  In this article, CloudFoundry: Enabling Java JMX/RMI access for remote containers

CloudFoundry: Java thread and heap dump analysis on remote containers

Java thread and heap dumps are valuable tools for troubleshooting local development,  but they can also be used on remote CF containers running a JVM.  In this article, we’ll go through various method of gathering this data from a Cloud Foundry container and then tools for analyzing this data. Now matter how uniform your environments, CloudFoundry: Java thread and heap dump analysis on remote containers

CloudFoundry: Monitoring the spring-music webapp, Part 5

Cloud Foundry is an opinionated Platform-as-a-Service that allows you to manage applications at scale. This article is part of a series that explores different facets of a Cloud Foundry deployment using the spring-music project as an example. This article is Part 5 of  a series on Cloud Foundry concepts: Deploying the spring-music webapp, Part 1 Persisting spring-music data CloudFoundry: Monitoring the spring-music webapp, Part 5

CloudFoundry: Logging for the spring-music webapp, Part 4

Cloud Foundry is an opinionated Platform-as-a-Service that allows you to manage applications at scale.  This article is part of a series that explores different facets of a Cloud Foundry deployment using the spring-music project as an example. This article is Part 4 of  a series on Cloud Foundry concepts: Deploying the spring-music webapp, Part 1 Persisting spring-music data CloudFoundry: Logging for the spring-music webapp, Part 4

CloudFoundry: Exploring Cloud Foundry using the spring-music application

Cloud Foundry is an opinionated Platform-as-a-Service that allows you to manage applications at scale.  It supports multiple infrastructure platforms (EC2, VMware, OpenStack), and is able to standardize deployment, logging,  scaling, and routing in a way that is friendly to a continuous delivery pipeline. In this series of articles, we will use the spring-music web application CloudFoundry: Exploring Cloud Foundry using the spring-music application

CloudFoundry: Scaling the spring-music webapp, Part 3

Cloud Foundry is an opinionated Platform-as-a-Service that allows you to manage applications at scale.  This article is part of a series that explores different facets of a Cloud Foundry deployment using the spring-music project as an example. This article is Part 3 of  a series on Cloud Foundry concepts: Deploying the spring-music webapp, Part 1 Persisting CloudFoundry: Scaling the spring-music webapp, Part 3

CloudFoundry: Persisting spring-music data using Postgres service, Part 2

Cloud Foundry is an opinionated Platform-as-a-Service that allows you to manage applications at scale.  This article is part of a series that explores different facets of a Cloud Foundry deployment using the spring-music project as an example. This article is Part 2 of  a series on Cloud Foundry concepts: Deploying the spring-music webapp, Part 1 Persisting CloudFoundry: Persisting spring-music data using Postgres service, Part 2

CloudFoundry: PCF Dev 0.28 for local development on Ubuntu

Update Jan 2019: The latest PCF Dev 2.x releases only support Windows/Mac and not Linux.  This article describes the older v0.28 PCF Dev is a distribution of Cloud Foundry that has a minimal footprint and is designed to run locally on a developer’s machine.  Using this lightweight distribution of Cloud Foundry, a developer can debug CloudFoundry: PCF Dev 0.28 for local development on Ubuntu

CloudFoundry: Deploying the spring-music webapp, Part 1

Cloud Foundry is an opinionated Platform-as-a-Service that allows you to manage applications at scale.  It supports multiple infrastructure platforms, and is able to standardize deployment, logging,  scaling, and routing in a way friendly to a continuous delivery pipeline. This article is Part 1 of  a series on Cloud Foundry concepts: Deploying the spring-music webapp, Part 1 CloudFoundry: Deploying the spring-music webapp, Part 1

HAProxy: Zero downtime reloads with HAProxy 1.8 on Ubuntu 16.04 with Systemd

This article has been updated in October 2018 and is now tested for HAProxy 1.8.14. The reload functionality in HAProxy till now has always been “not perfect but good enough”, perhaps dropping a few connections under heavy load but within parameters everyone was willing to accept. And because of the potential impact, a reload was HAProxy: Zero downtime reloads with HAProxy 1.8 on Ubuntu 16.04 with Systemd

HAProxy: Zero downtime reloads with HAProxy 1.8 on Ubuntu 14.04

This article has been updated in October 2018 and is now tested for HAProxy 1.8.14. The reload functionality in HAProxy till now has always been “not perfect but good enough”, perhaps dropping a few connections under heavy load but within parameters everyone was willing to accept. And because of the potential impact, a reload was HAProxy: Zero downtime reloads with HAProxy 1.8 on Ubuntu 14.04

Docker: Visualizing image hierarchy and container dependency using dockviz

The Docker console commands for listing and viewing containers and images (ps, images, history, inspect) provides a wealth of information, but when you are managing hundreds of containers, a graph view of the container inventory and their dependencies can be critical for operations. Dockviz can help you visualize your containers and images by creating an PNG image Docker: Visualizing image hierarchy and container dependency using dockviz

Docker: logspout for Docker log collection

Docker log collection can be done using various methods, one method that is particularly effective is having a dedicated container whose sole purpose is to automatically sense other deployed containers and aggregate their log events. This is the architectural model of logspout, an open-source project that acts as a router for the stdout/stderr logs of other containers. If you do Docker: logspout for Docker log collection