The goal of CloudEnvy is to allow developers to easily spin up instances for development in an OpenStack cloud.
CloudEnvy is built on a few principles.
1. Bootstrapping an environment should only take 1 command. 2. Hardware is the enemy, virtualize your environments so others can play with you. 3. Never rely on tools which you can not hack.
Use setup.py to install cloudenvy and the dependencies:
python setup.py install
You must set your user options in ~/.cloudenvy. User options include a few general preferences, and your cloud credentials. Here is a minimal config:
cloudenvy: clouds: cloud01: os_username: username os_password: password os_tenant_name: tenant_name os_auth_url: http://urltokeystoneendpoint:5000/v2.0/
Much like Vagrant, each ENVy must have a corresponding configuration file in the project working directory. We call this file Envyfile. It should be located at the root of your project.
project_config: name: foo #required image_name: Ubuntu 11.10 cloudimg amd64 #required image_id: 47101ccb-2685-42c4-9a32-5aeaaf84862 # use this if there is a chance that there will be more than a single image with the same name. remote_user: ubuntu #optional - defaults to ubuntu, different distros require different fields, we optimize for ubuntu flavor_name: m1.large #optional - defaults to `m1.small` provision_scripts: - ~/Desktop/provision_scripts/foo.sh - ~/Desktop/provision_scripts/bar.sh - ~/Desktop/provision_scripts/baz.sh
Launch a bare instance
NOTE: If your Envyfile contains the
provision_scripts config option, envy up will automatically run
envy provision when your ENVy has finished booting. If you do not want to auto provision your ENVy you must pass the
--no-provision flag like so:
envy up --no-provision
NOTE: Use the
-v flag to get verbose logging output. Example:
envy -v up
To provision a script, you must set the path to one or more shell scripts (in the future these can be any type of excecutable files).
If you are attempting to debug provision scripts, you can pass in several scripts, which will be run in order, like so:
envy provision --scripts ~/Desktop/scripts/foo.sh ~/Desktop/scripts/bar.sh
NOTE: Provisioning an ENVy does not use the
OpenStack CloudConfigDrive. Instead it uploads the provision script, and runs it using Fabric. This allows you to perform operations which require ssh authentication (such as a git clone from a private repository)
Get your ENVy IP
SSH to your ENVy
SSH into your instance.
NOTE: It is highly recommended that you enable SSH Agent Forwarding. The fastest way to do this is to run:
Destroy your ENVy
Destroy your instance
Name your ENVys
If desired you can launch multiple ENVys for a single project. This is useful if you want to run an ENVy for development, and a separate ENVy for testing. Your ENVy name will always be prefaced for the project it belongs to, to do this run:
envy up -n foo #this will result in ProjectName-foo
NOTE: If you choose to do this, you will need to pass the
-n flag into all of your commands, for example if you want to ssh into the ENVy created above you would have to run:
envy ssh -n foo
You will quickly lose track of all of the ENVys for your project, so we added a command that will allow you to retrieve each ENVy name in context of your proejct. To do this run:
NOTE: This will likely change, as CloudEnvy gets smarter in how it tracks instances, for example we should probably be using server metadata to track if an instance is from CloudEnvy.
Passing in your user configuration (dotfiles)
You can pass in basic dotfiles by running:
This defaults to uploading the following files
.vimrc, .gitconfig, .gitignore, .screenrc. If you would like to pass in a custom set of dotfiles, you can specify them like so
envy dotfiles -f '.vimrc, .gitconfig'
NOTE: The custom dotfiles must be in a comma separated list, and all of them in a single set of quotes.
Simple file uploading
You can upload files to your ENVy via SFTP by running:
envy scp ~/cat-photo.jpg ~/ZOMGKITTY.jpg
Defining custom security groups
By default CloudEnvy opens ports
22, 443, 80, 8080, 5000, and 9292. These ports are generally useful for OpenStack development, but if you have other requirements, or just don't like to have empty open ports you can define them in your Envyfile
To add custom security groups you can put define them in your Envyfile following the format below:
sec_groups: [ 'icmp, -1, -1, 0.0.0.0/0', 'tcp, 22, 22, 0.0.0.0/0', 'tcp, 80, 80, 0.0.0.0/0', 'tcp, 3000, 3000, 0.0.0.0/0' ]