Coder Social home page Coder Social logo

image-builder's Introduction

Imaging Hot Sauce

Description

Modular image builder for imaging awesomeness!

Goals

  1. Make it easy to create EC2 style images (root, kernel, ramdisk like)
  2. Allow for vsing varying sources of those images (right now just a tarball of a installed / partition)
  3. Make it easy to add in custom logic on-top of those images via a modular set of python code that you can easily extend
  4. Keep it small, sane, clean and flexible

Status

  1. Needs love and tender care (it is mostly a prototype)

Default modules

  1. add_user (adds a given set of sudo users)
  2. install_rpms (installs a list of rpm packages) ...
  3. Your imagination...

Examples

$ sudo python ./build.py -s 4G

To add users make a yaml like the following:

$ cat build.yaml 

---
# Which modules should be ran (in order)
modules:
  - install-rpms
  - add_user

# Enable this if you wish to install
# any users info into the image (ie for testing).
add_users: 
   - harlowja

...

Then run:

$ sudo python ./build.py  -s 4G -o blah.tar.gz -x

Adding your own module

To add your own module create a file in the modules folder with a function of the following format:

def modify(name, root, cfg):
   # DO SOMETHING HERE

The name that is passed in will be the module name (from configuration) with the root variable being the root directory of the mounted image (useful for chroot) or other file alterations and the cfg variable will be the build configuration dictionary (useful for extracting any module configuration specifics)

Then save this file with a given name, ie xyz.py, and then to get this module to be activated add it to the modules list in the build.yaml file with the name xyz and then go ahead and build your image.

Note: If this module errors out (or other modules do the same) the image will not be successfully built so use this method to stop image building (ie by throwing exceptions).

Using your image

To upload this image, take the image-upload tool in anvil (or use the glance-client itself, either or) and provide it the url of your file, for example given a archive at /homes/harlowja/blah.tar.gz you would upload this via the following command.

$ python tools/img-uploader.py  -i file://///homes/harlowja/blah.tar.gz 
                                -g $GLANCE_URI -k $KEYSTONE_URI 
                                -u $YOUR_USER -t $YOUR_TENANT

Using the image-upload tool will go through the nitty gritty of extracting that image and connecting the pieces together to form a useable image in openstack. You can of course do the same with the glance-client (although you will have to know the special invocations to achieve the same effect as the image-upload tool performs).

Note: The image produced should also be easily useable in amazon (if someone ever gets around to trying that...).

image-builder's People

Contributors

gyehuda avatar harlowja avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.