Go: reloading configuration on the fly - responding to HUP signal

Reloading your application’s configuration while it is running is a relatively easy task in Go. The only real worry is about providing concurrent access to your configuration object; and that is easily solved with the sync package’s sync.Mutex struct. When it is embedded into a struct anonymously it provides the Lock() and Unlock() methods which will protect against concurrent access. Our sample program consists of three core parts: Configuration management Main execution loop Signal handling Our demo program will list “files” that are available (for whatever purpose) to standard output. »

Running a private Docker registry server

This quick and dirty short guide will cover setting up your own private Docker image registry server with the default configuration. Image and repository storage is via a local filesystem which is mounted as a volume. More advanced setup information is available if this guide is insufficient. Get the registry server The Docker registry server has an official image in the Docker hub: $ docker pull registry:latest If you want all previous versions then you can run: $ docker pull registry Running the registry server We will start the server using the default configuration file, but will mount the image and repository storage path as a volume. »

Using the docker-gen container with nginx as a reverse proxy: a practical example

Following on from the post using docker-gen stand alone in a docker container, we will now use the container in a more real world example. docker-gen will be used to generate configuration files for nginx to act as a reverse proxy for other docker containers serving web content. Purpose You have a set of Docker containers ready for serving web content; these could be either Apache, lighthttpd, hugo, something you have written yourself, or anything which understands HTTP and returns content. »

Running docker-gen stand alone in a Docker container

The 0.3.4 release of docker-gen now makes it easier to run docker-gen stand alone inside a Docker container. What is docker-gen docker-gen is tool which monitors Docker for events via Dockers remote API and then writes to a file according to a template. For example; we are interested in the events generated by Docker for when a container is created, deleted, started or stopped. Each event contains information relevant to the container which generated it. »