mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-22 09:50:37 +00:00
Bootstrap Debian images for virtualized environments
![]() * #347 - Fix for debconf validator pointing to wrong file. * reported in https://github.com/andsens/bootstrap-vz/issues/347 flake8: commands succeeded congratulations :) * # development commit * trying to fix the packages install with a forced apt-update prior to installing packages. should fix any issues prior to * # dev commit * Trying to parse the commands with a chrotted log_check_call * # dev commit * "TypeError: sequence item 2: expected string, list found" , trying to fix this * # dev commit - changed the way local packages get installed This commit changes the way local deb packages get installed. * rationale: a local deb package mostly includes a deb to configure apt, e.g.: Puppet apt package. Therefore, after a local dep pkg install , apt should update itself to be able to install packages that come with the repo's configured from the local deb package. This assumes you install LOCAL packages (deb files) first (as a rule of thumb) and AFTER the REMOTE packages (you include other packages by name) * reverted command plugin tasks code * # Dev commit - puppet module update Goal is to install a puppet 4 agent on the bootstrapped image * limitations: Only for debian Jessie, installs only puppet4 * # Feature improvement - Puppet module * a new way to install and configure puppet on a debian jessie * only tested on debian jessie, for now it only installs the PC1 agent package. * future endeavors include all mentioned todo's: * TODO: plugin must be able to install on any debian release * TODO: plugin must be able to offer choice of distro package or apt.puppetlabs.com package * TODO: plugin must be able to select release version package (vanilla or PC1) * TODO: plugin must be able to set up a puppet SERVER , puppetDB optional * TODO: plugin have proper linting * TODO: write test cases * # Derp commit * added project files in GitIgnore * # Dev commit * added release detection and installs appropriate package. * # derp commit * removed unnecessary class parameter. * # derp dev commit * add predecessor to ensure repo package gets installed BEFORE the agent. * # derp fixes commit * i must use info.manifest.release * a little bit refactoring * # derp commit * fixed correct predecessor * # feature & derp dev commit * added feature to install puppet modules with the plugin * # Version upgrade commit New puppet plugin module update * Plugin can select proper debian release package to install * Plugin can install modules directly from forge.puppetlabs.com * Updated documentation with working example * Limitations TL;DR: agent software only, PC1 package only, Absolute pathing, wheezy/jessie only, assumes production environment for modules. * Several ugly derp bugs squashed. * * PR fix commit * Modified puppet readme file as recommended * added small description in changelog https://github.com/andsens/bootstrap-vz/pull/365#discussion_r101378921 https://github.com/andsens/bootstrap-vz/pull/365#discussion_r101379039 * # PR fix commit * Cleaned debugging leftovers https://github.com/andsens/bootstrap-vz/pull/365#discussion_r101379293 * # PR fix commit * Removed todo's from code, creating issues on the project issue tracker. https://github.com/andsens/bootstrap-vz/pull/365#discussion_r101381742 * # PR fix commit * Moved EnableAgent task to the bottom as requested https://github.com/andsens/bootstrap-vz/pull/365#discussion_r101382775 * # PR fix commit * Removed gitignore file, I have absolutely no idea how that got there. * # PR fix commit * Fixed several TOX issues, it's all green now * #MR-365 - dev commit * first try at installing agent with sources/key injection * New tasks in puppet module: AddPuppetlabsPC1SourcesList; InstallPuppetlabsPC1ReleaseKey * it does NOT do any checks. it assumes the url is correct. * #MR-365 - derp commit * removed some unused code in tasks * #365 - tox fix commit * fixed several tox warnings * #365 - tox fix commit * missed one line... * #365 - tox fix commit * Noticed the nature of the tox warnings of 'undefined name', fixed. * # 365 - Task order fix commit * Some tasks had some invalid predecessors defined, removed. * when running a test manifest, it fails due to 'NO_PUBKEY 7F438280EF8D349F', trying a hacky way to address this * #365 - Puppet module update - install with source-key combo * It now properly installs puppet agent package with sources/keys instead of package * Tox is green * Delete .project * Delete .pydevproject * #365 - Puppet module update General puppet module update. * Fixed several issues discussed in the pull request. * Tox is all green * General puppet module update. * This update allows for the installation of the puppetlabs.com agent VERSION 4 from the official apt.puppetlabs.com repo * Allows for the installation of puppet modules. Useful for masterless setups. * Puppet modules you declare in your bootstrap-vz manifest are installed with the --force flag. Limitations and gotcha's: * Only works for Debian Wheezy & Jessie. * The Puppetlabs.com agents are only released for i386 and amd64 architectures. * If you require the puppet 3.x agent, you should not use this module but add "puppet-agent" into the packages list * You need to add your own puppet.conf file to fit your needs, this can be easily included in the assets directive. * Assets path is absolute. * General puppet module update. * This update allows for the installation of the puppetlabs.com agent VERSION 4 from the official apt.puppetlabs.com repo * Allows for the installation of puppet modules. Useful for masterless setups. * Puppet modules you declare in your bootstrap-vz manifest are installed with the --force flag. Limitations and gotcha's: * Only works for Debian Wheezy & Jessie. * The Puppetlabs.com agents are only released for i386 and amd64 architectures. * If you require the puppet 3.x agent, you should not use this module but add "puppet-agent" into the packages list * You need to add your own puppet.conf file to fit your needs, this can be easily included in the assets directive. * Assets path is absolute. * #365 - Changed the way trusted keys are fetched. * @andsens is right, keyrings are better added by injecting them into the image, removing the need to install package 'ca-certificates' * * Added new feature: puppet module version can now be included in the manifest. * modified manifest-schema to reflect proper module installation * Updated documentation. * Example manifest added to demonstrate changes * @andsens is right, keyrings are better added by injecting them into the image, removing the need to install package 'ca-certificates' * Fix several requests * Example manifest moved to a more suitable location, documentation changed as well. * A bit more efficient programming. * reverted file_copy to it's proper state |
||
---|---|---|
bootstrapvz | ||
docs | ||
manifests | ||
tests | ||
.gitignore | ||
.travis.yml | ||
bootstrap-vz | ||
bootstrap-vz-remote | ||
bootstrap-vz-server | ||
CHANGELOG.rst | ||
CONTRIBUTING.rst | ||
LICENSE | ||
MANIFEST.in | ||
README.rst | ||
setup.py | ||
tox.ini |
bootstrap-vz ============ bootstrap-vz is a bootstrapping framework for Debian that creates ready-to-boot images able to run on a number of cloud providers and virtual machines. bootstrap-vz runs without any user intervention and generates images for the following virtualization platforms: - `Amazon AWS EC2 <bootstrapvz/providers/ec2>`__ (supports both HVM and PVM; S3 and EBS backed; `used for official Debian images <https://wiki.debian.org/Cloud/AmazonEC2Image/Jessie>`__; `Quick start <#amazon-ec2-ebs-backed-ami>`__) - `Docker <bootstrapvz/providers/docker>`__ (`Quick start <#docker>`__) - `Google Compute Engine <bootstrapvz/providers/gce>`__ (`used by Google for official Debian images <https://wiki.debian.org/Cloud/GoogleComputeEngineImage>`__) - `KVM <bootstrapvz/providers/kvm>`__ (Kernel-based Virtual Machine) - `Microsoft Azure <bootstrapvz/providers/azure>`__ - `Oracle Compute Cloud Service <bootstrapvz/providers/oracle>`__ (`used for official Debian images <https://wiki.debian.org/Cloud/OracleComputeImage>`__) - `Oracle VirtualBox <bootstrapvz/providers/virtualbox>`__ (`with Vagrant support <#virtualbox-vagrant>`__) Its aim is to provide a reproducible bootstrapping process using `manifests <manifests>`__ as well as supporting a high degree of customizability through plugins. Documentation ------------- The documentation for bootstrap-vz is available at `bootstrap-vz.readthedocs.org <http://bootstrap-vz.readthedocs.org/en/master>`__. There, you can discover `what the dependencies <#dependencies>`__ for a specific cloud provider are, `see a list of available plugins <bootstrapvz/plugins>`__ and learn `how you create a manifest <manifests>`__. Note to developers: The shared documentation links on github and readthedocs are transformed in `a rather peculiar and nifty way`__. __ https://github.com/andsens/bootstrap-vz/blob/master/docs/transform_github_links.py Installation ------------ bootstrap-vz has a master branch into which stable feature branches are merged. After checking out the branch of your choice you can install the python dependencies by running ``python setup.py install``. However, depending on what kind of image you'd like to bootstrap, there are other debian package dependencies as well, at the very least you will need ``debootstrap``. `The documentation <http://bootstrap-vz.readthedocs.org/en/master>`__ explains this in more detail. Note that bootstrap-vz will tell you which tools it requires when they aren't present (the different packages are mentioned in the error message), so you can simply run bootstrap-vz once to get a list of the packages, install them, and then re-run. Quick start ----------- Here are a few quickstart tutorials for the most common images. If you plan on partitioning your volume, you will need the ``parted`` package and ``kpartx``: .. code-block:: sh root@host:~# apt-get install parted kpartx Note that you can always abort a bootstrapping process by pressing ``Ctrl+C``, bootstrap-vz will then initiate a cleanup/rollback process, where volumes are detached/deleted and temporary files removed, pressing ``Ctrl+C`` a second time shortcuts that procedure, halts the cleanup and quits the process. Docker ~~~~~~ .. code-block:: sh user@host:~$ sudo -i # become root root@host:~# git clone https://github.com/andsens/bootstrap-vz.git # Clone the repo root@host:~# apt-get install debootstrap python-pip docker.io # Install dependencies from aptitude root@host:~# pip install termcolor jsonschema fysom docopt pyyaml pyrfc3339 # Install python dependencies root@host:~# bootstrap-vz/bootstrap-vz bootstrap-vz/manifests/examples/docker/jessie-minimized.yml The resulting image should be no larger than 82 MB (81.95 MB to be exact). The manifest ``jessie-minimized.yml`` uses the `minimize\_size <bootstrapvz/plugins/minimize_size>`__ plugin to reduce the image size considerably. Rather than installing docker from the debian main repo it is recommended to install `the latest docker version <https://docs.docker.com/engine/installation/debian/#debian-jessie-80-64-bit>`__. VirtualBox Vagrant ~~~~~~~~~~~~~~~~~~ .. code-block:: sh user@host:~$ sudo -i # become root root@host:~# git clone https://github.com/andsens/bootstrap-vz.git # Clone the repo root@host:~# apt-get install qemu-utils debootstrap python-pip # Install dependencies from aptitude root@host:~# pip install termcolor jsonschema fysom docopt pyyaml # Install python dependencies root@host:~# modprobe nbd max_part=16 root@host:~# bootstrap-vz/bootstrap-vz bootstrap-vz/manifests/examples/virtualbox/jessie-vagrant.yml (The `modprobe nbd max_part=16` part enables the network block device driver to support up to 16 partitions on a device) If you want to use the `minimize\_size <bootstrapvz/plugins/minimize_size>`__ plugin, you will have to install the ``zerofree`` package and `VMWare Workstation`__ as well. __ https://my.vmware.com/web/vmware/info/slug/desktop_end_user_computing/vmware_workstation/10_0 Amazon EC2 EBS backed AMI ~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: sh user@host:~$ sudo -i # become root root@host:~# git clone https://github.com/andsens/bootstrap-vz.git # Clone the repo root@host:~# apt-get install debootstrap python-pip # Install dependencies from aptitude root@host:~# pip install termcolor jsonschema fysom docopt pyyaml boto3 # Install python dependencies root@host:~# bootstrap-vz/bootstrap-vz bootstrap-vz/manifests/official/ec2/ebs-jessie-amd64-hvm.yml To bootstrap S3 backed AMIs, bootstrap-vz will also need the ``euca2ools`` package. However, version 3.2.0 is required meaning you must install it directly from the eucalyptus repository like this: .. code-block:: sh apt-get install --no-install-recommends python-dev libxml2-dev libxslt-dev gcc zlib1g-dev pip install git+git://github.com/eucalyptus/euca2ools.git@v3.2.0 Cleanup ------- bootstrap-vz tries very hard to clean up after itself both if a run was successful but also if it failed. This ensures that you are not left with volumes still attached to the host which are useless. If an error occurred you can simply correct the problem that caused it and rerun everything, there will be no leftovers from the previous run (as always there are of course rare/unlikely exceptions to that rule). The error messages should always give you a strong hint at what is wrong, if that is not the case please consider `opening an issue`__ and attach both the error message and your manifest (preferably as a gist or similar). __ https://github.com/andsens/bootstrap-vz/issues Dependencies ------------ bootstrap-vz has a number of dependencies depending on the target platform and `the selected plugins <bootstrapvz/plugins>`__. At a bare minimum the following python libraries are needed: * `termcolor <https://pypi.python.org/pypi/termcolor>`__ * `fysom <https://pypi.python.org/pypi/fysom>`__ * `jsonschema <https://pypi.python.org/pypi/jsonschema>`__ * `docopt <https://pypi.python.org/pypi/docopt>`__ * `pyyaml <https://pypi.python.org/pypi/pyyaml>`__ To bootstrap Debian itself `debootstrap`__ is needed as well. __ https://packages.debian.org/wheezy/debootstrap Any other requirements are dependent upon the manifest configuration and are detailed in the corresponding sections of the documentation. Before the bootstrapping process begins however, bootstrap-vz will warn you if a requirement has not been met. Developers ---------- The API documentation, development guidelines and an explanation of bootstrap-vz internals can be found at `bootstrap-vz.readthedocs.org`__. __ http://bootstrap-vz.readthedocs.org/en/master/developers Contributing ------------ Contribution guidelines are described in the documentation under `Contributing <CONTRIBUTING.rst>`__. There's also a topic regarding `the coding style <CONTRIBUTING.rst#coding-style>`__. Before bootstrap-vz ------------------- bootstrap-vz was coded from scratch in python once the bash script architecture that was used in the `build-debian-cloud <https://github.com/andsens/build-debian-cloud>`__ bootstrapper reached its limits. The project has since grown well beyond its original goal, but has kept the focus on Debian images.