Skip to content

sheax0r/fig-lock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fig::Lock

Overview

Generates fig.lock files based on fig.yml files. Gets the latest versions of all images defined in a fig.yml file, rewrites them to include the specific tags of those versions, generates a fig.lock file.

Um, What?

The short answer

fig.lock is to fig.yml as Gemfile.lock is to Gemfile

The longer answer

Okay so, suppose you have a bunch of docker images. You want these images to work together to do something. You want whatever something is to be versioned because versioning is important - it helps you to figure out when a bug were introduced. It helps you roll back to a good version if something goes terribly wrong. All sorts of reasons!

Fig lets you describe your images and how they interact. But if you use latest tags in your image (or really anything other than explicit version locking that you do manually by always using specific tags for your images), it doesn't help you keep track of your versions - it just uses whatever docker images are installed locally, or fetches the specific tags from registries. This approach is fine if you're dealing with images that don't change very often. But if you're working in an environment where several images in different source repositories are under heavy development, it can be a problem to have to manually update the fig.yml file, and integration tests that auto-update might not be feasible.

This is why Fig::Lock exists. Fig::Lock lets you specify a fig.yml file containing images that use the latest tag. It generates fig.lock files by figuring out what explicit tag these "latest" tags actually map to, and then generating a fig.lock file that uses these exact images. Then you can run your integration tests using this file, check it into source control, etc. The point is that you get a file that represents all the versions of the things in your system, so you can use this to reproduce it exactly.

Installation

Add this line to your application's Gemfile:

gem 'fig-lock'

And then execute:

$ bundle

Or install it yourself as:

$ gem install fig-lock

Usage

fig-lock produces fig.lock files from fig.yml files, locking images to specific versions. eg:

fig.yml:

---
image: ubuntu
image: my.docker-registry.com/repo/myimage

resulting fig.lock:

---
image: ubuntu:14.04
image: my.docker-registry.com/repo/myimage:0.0.1

Currently, fig-lock only works properly with images that have been explicitly tagged. However, the next iteration should use hashes if tags are not available.

Install

The install command uses docker to retrieve all images defined in fig.lock. If no fig.lock file exists, one will be generated by invoking the update command.

  fig-lock install </path/to/fig.yml>

Update

The update command uses docker to retrieve the latest versions of all images defined in the fig.yml file and generates/updates a corresponding fig.lock file in the same directory as the fig.yml file, which uses specific version tags for these images.

  fig-lock update </path/to/fig.yml>

Contributing

  1. Fork it ( http://github.com//fig-lock/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

About

Generates fig.lock files from fig.yml files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages