diff options
-rw-r--r-- | DEVNOTES (renamed from cli/DEVNOTES) | 36 | ||||
-rw-r--r-- | Gemfile (renamed from cli/Gemfile) | 0 | ||||
-rw-r--r-- | Gemfile.lock (renamed from cli/Gemfile.lock) | 0 | ||||
-rw-r--r-- | README.md | 133 | ||||
-rw-r--r-- | Rakefile (renamed from cli/Rakefile) | 0 | ||||
-rwxr-xr-x | bin/leap (renamed from cli/bin/leap) | 0 | ||||
-rw-r--r-- | cli/README.md | 132 | ||||
-rw-r--r-- | leap_cli.gemspec (renamed from cli/leap_cli.gemspec) | 0 | ||||
-rw-r--r-- | leap_cli.rdoc (renamed from cli/leap_cli.rdoc) | 0 | ||||
-rw-r--r-- | lib/leap_cli.rb (renamed from cli/lib/leap_cli.rb) | 0 | ||||
-rw-r--r-- | lib/leap_cli/commands/README (renamed from cli/lib/leap_cli/commands/README) | 0 | ||||
-rw-r--r-- | lib/leap_cli/commands/compile.rb (renamed from cli/lib/leap_cli/commands/compile.rb) | 0 | ||||
-rw-r--r-- | lib/leap_cli/commands/deploy.rb (renamed from cli/lib/leap_cli/commands/deploy.rb) | 0 | ||||
-rw-r--r-- | lib/leap_cli/commands/init.rb (renamed from cli/lib/leap_cli/commands/init.rb) | 0 | ||||
-rw-r--r-- | lib/leap_cli/commands/list.rb (renamed from cli/lib/leap_cli/commands/list.rb) | 0 | ||||
-rw-r--r-- | lib/leap_cli/commands/pre.rb (renamed from cli/lib/leap_cli/commands/pre.rb) | 0 | ||||
-rw-r--r-- | lib/leap_cli/config.rb (renamed from cli/lib/leap_cli/config.rb) | 0 | ||||
-rw-r--r-- | lib/leap_cli/config_list.rb (renamed from cli/lib/leap_cli/config_list.rb) | 0 | ||||
-rw-r--r-- | lib/leap_cli/config_manager.rb (renamed from cli/lib/leap_cli/config_manager.rb) | 0 | ||||
-rw-r--r-- | lib/leap_cli/init.rb (renamed from cli/lib/leap_cli/init.rb) | 0 | ||||
-rw-r--r-- | lib/leap_cli/log.rb (renamed from cli/lib/leap_cli/log.rb) | 0 | ||||
-rw-r--r-- | lib/leap_cli/path.rb (renamed from cli/lib/leap_cli/path.rb) | 0 | ||||
-rw-r--r-- | lib/leap_cli/version.rb (renamed from cli/lib/leap_cli/version.rb) | 0 | ||||
-rw-r--r-- | test/default_test.rb (renamed from cli/test/default_test.rb) | 0 | ||||
-rw-r--r-- | test/provider/common.json (renamed from cli/test/provider/common.json) | 0 | ||||
-rw-r--r-- | test/provider/files/ca/ca.crt (renamed from cli/test/provider/files/ca/ca.crt) | 0 | ||||
-rw-r--r-- | test/provider/files/ca/ca.key (renamed from cli/test/provider/files/ca/ca.key) | 0 | ||||
-rw-r--r-- | test/provider/files/public-definitions/provider.json.erb (renamed from cli/test/provider/files/public-definitions/provider.json.erb) | 0 | ||||
-rw-r--r-- | test/provider/files/vpn1/vpn1.rewire.co.crt (renamed from cli/test/provider/files/vpn1/vpn1.rewire.co.crt) | 0 | ||||
-rw-r--r-- | test/provider/files/vpn1/vpn1.rewire.co.key (renamed from cli/test/provider/files/vpn1/vpn1.rewire.co.key) | 0 | ||||
-rw-r--r-- | test/provider/hiera/couch1.rewire.yaml (renamed from cli/test/provider/hiera/couch1.rewire.yaml) | 0 | ||||
-rw-r--r-- | test/provider/hiera/couch2.rewire.yaml (renamed from cli/test/provider/hiera/couch2.rewire.yaml) | 0 | ||||
-rw-r--r-- | test/provider/hiera/ns1.rewire.yaml (renamed from cli/test/provider/hiera/ns1.rewire.yaml) | 0 | ||||
-rw-r--r-- | test/provider/hiera/ns2.rewire.yaml (renamed from cli/test/provider/hiera/ns2.rewire.yaml) | 0 | ||||
-rw-r--r-- | test/provider/hiera/vpn1.rewire.yaml (renamed from cli/test/provider/hiera/vpn1.rewire.yaml) | 0 | ||||
-rw-r--r-- | test/provider/hiera/web1.rewire.yaml (renamed from cli/test/provider/hiera/web1.rewire.yaml) | 0 | ||||
-rw-r--r-- | test/provider/nodes/couch1.json (renamed from cli/test/provider/nodes/couch1.json) | 0 | ||||
-rw-r--r-- | test/provider/nodes/couch2.json (renamed from cli/test/provider/nodes/couch2.json) | 0 | ||||
-rw-r--r-- | test/provider/nodes/ns1.json (renamed from cli/test/provider/nodes/ns1.json) | 0 | ||||
-rw-r--r-- | test/provider/nodes/ns2.json (renamed from cli/test/provider/nodes/ns2.json) | 0 | ||||
-rw-r--r-- | test/provider/nodes/vpn1.json (renamed from cli/test/provider/nodes/vpn1.json) | 0 | ||||
-rw-r--r-- | test/provider/nodes/web1.json (renamed from cli/test/provider/nodes/web1.json) | 0 | ||||
-rw-r--r-- | test/provider/provider.json (renamed from cli/test/provider/provider.json) | 0 | ||||
-rw-r--r-- | test/provider/services/couchdb.json (renamed from cli/test/provider/services/couchdb.json) | 0 | ||||
-rw-r--r-- | test/provider/services/dns.json (renamed from cli/test/provider/services/dns.json) | 0 | ||||
-rw-r--r-- | test/provider/services/openvpn.json (renamed from cli/test/provider/services/openvpn.json) | 0 | ||||
-rw-r--r-- | test/provider/services/webapp.json (renamed from cli/test/provider/services/webapp.json) | 0 | ||||
-rw-r--r-- | test/provider/tags/production.json (renamed from cli/test/provider/tags/production.json) | 0 | ||||
-rw-r--r-- | test/test_helper.rb (renamed from cli/test/test_helper.rb) | 0 |
49 files changed, 136 insertions, 165 deletions
@@ -8,14 +8,12 @@ templates for nodes and services stored in leap_platform commands: - leap add-service # menu of services, adding copies the template - leap add-node # you pick a service, then it copies template + leap add-service # menu of services, copies from the template + leap add-node # you pick a service among those enabled, then it copies template deploy --------------------- -not yet working - leap bootstrap leap dryrun leap deploy @@ -23,27 +21,9 @@ not yet working key management ------------------------- -not yet working - leap add-ssh-keypair leap add-x509-keypair -hiera logic ------------------------- - -leap_platform should be able insert ruby logic in the generation of hiera .yml files. for example, so say that a webapp node should get a list of all the couchdb nodes its config. - -this code might look like this - - node['couchdb_ips'] = @nodes[:services => :couchdb].map(&:ip_address) - -or - - node['couchdb_ips'] = @services[:couchdb].nodes.map(&:ip_address) - -maybe see http://blog.bigbinary.com/2008/10/17/under-the-hood-how-named-scope-works.html - - json validation ------------------------ @@ -54,8 +34,9 @@ http://www.kuwata-lab.com/kwalify/ruby/users-guide.html useful liberaries ================================ -user interaction +notes to myself +user interaction readline highline terminal-tables @@ -63,34 +44,25 @@ user interaction http://stackoverflow.com/questions/9577718/what-ruby-libraries-should-i-use-for-building-a-console-based-application testing - aruba -- test for cli help - gem-man -- install man pages with gems ronn -- write man pages in markdown push examples - https://github.com/net-ssh/net-ssh - https://github.com/seattlerb/rake-remote_task http://docs.seattlerb.org/rake-remote_task/ https://github.com/seattlerb/rake-remote_task/blob/master/lib/rake/remote_task.rb - https://github.com/davidwinter/sooty push puppet with rake/remote_task https://github.com/davidwinter/sooty/blob/master/lib/sooty.rb - calling rsync from ruby https://github.com/RichGuk/rrsync/blob/master/rrsync.rb http://rubyforge.org/projects/six-rsync/ - https://github.com/automateit/automateit - http://www.jedi.be/blog/2009/11/17/shell-scripting-dsl-in-ruby/ - parallel shell https://github.com/delano/rye https://github.com/adamwiggins/rush diff --git a/cli/Gemfile.lock b/Gemfile.lock index 60ce6f8..60ce6f8 100644 --- a/cli/Gemfile.lock +++ b/Gemfile.lock @@ -1 +1,132 @@ -more to come. +About LEAP command line interface +================================= + +This gem installs an executable 'leap' that allows you to manage servers using the leap platform. + +Installation +================================= + +To install the gem: + + gem install leap_cli + +To run from a clone of the git repo, see "Development", below. + +Usage +================================= + +This tool is incomplete, so most commands don't yet work. + +Run `leap help` for a usage instructions. + +Here is an example usage: + + leap init provider + cd provider + edit configuration files (see below) + leap compile + +Directories and Files +================================= + +The general structure of leap project looks like this: + + my_leap_project/ # the 'root' directory + leap_platform/ # a clone of the leap_platform puppet recipes + provider/ # your provider-specific configurations + +The "leap" command should be run from within the "provider" directory. + +You can name these directories whatever you like. The leap command will walk up the directory tree until it finds a directory that looks like a 'root' directory. + +Within the "provider" directory: + + nodes/ # one configuration file per node (i.e. server) + services/ # nodes inherit from these files if specified in node config. + tags/ # nodes inherit from these files if specified in node config. + files/ # text and binary files needed for services and nodes, including keypairs + users/ # crypto key material for sysadmins + common.yaml # all nodes inherit these options + provider.yaml # global service provider definition + +Configuration Files +================================= + +All configuration files are in JSON format. For example + + { + "key1": "value1", + "key2": "value2" + } + +Keys should match /[a-z0-9_]/ + +Unlike traditional JSON, comments are allowed. If the first non-whitespace character is '#' the line is treated as a comment. + + # this is a comment + { + # this is a comment + "key": "value" # this is an error + } + +Options in the configuration files might be nested. For example: + + { + "openvpn": { + "ip_address": "1.1.1.1" + } + } + +When compiled into hiera and made available in puppet, this becomes a Hash object with flattened keys: + + {"openvpn.ip_address" => "1.1.1.1"} + +Node Configuration +================================= + +The name of the file will be the hostname of the node. + +An example configuration "nodes/dns-europe.json" + + { + "services": "dns", + "tags": ["production", "europe"], + "ip_address": "1.1.1.1" + } + +This node will have hostname "dns-europe" and it will inherit from the following files (in this order): + + common.json + services/dns.json + tags/europe.json + tags/production.json + +Development +================================= + +prerequisites: + +* rubygems (``apt-get install rubygems``) +* bundler (``gem install bundler``) + +Install command line ``leap``: + + git clone git://leap.se/leap_cli # clone leap cli code + cd leap_cli + bundle # install required gems + ln -s `pwd`/bin/leap ~/bin # link executable somewhere in your bin path + +You can experiment using the example provider in the test directory + + cd test/provider + leap + +Alternately, you can create your own provider for testing: + + mkdir ~/dev/example.org + cd ~/dev/example.org + git clone git://leap.se/leap_platform + leap init provider + cd provider + leap + diff --git a/cli/README.md b/cli/README.md deleted file mode 100644 index fccd6d1..0000000 --- a/cli/README.md +++ /dev/null @@ -1,132 +0,0 @@ -About LEAP command line interface -================================= - -This gem installs an executable 'leap' that allows you to manage servers using the leap platform. - -Installation -================================= - -To install the gem: - - gem install leap_cli - -To run from a clone of the git repo, see "Development", below. - -Usage -================================= - -This tool is incomplete, so most commands don't yet work. - -Run `leap help` for a usage instructions. - -Here is an example usage: - - leap init provider - cd provider - edit configuration files (see below) - leap compile - -Directories and Files -================================= - -The general structure of leap project looks like this: - - my_leap_project/ # the 'root' directory - leap_platform/ # a clone of the leap_platform puppet recipes - provider/ # your provider-specific configurations - -The "leap" command should be run from within the "provider" directory. - -You can name these directories whatever you like. The leap command will walk up the directory tree until it finds a directory that looks like a 'root' directory. - -Within the "provider" directory: - - nodes/ # one configuration file per node (i.e. server) - services/ # nodes inherit from these files if specified in node config. - tags/ # nodes inherit from these files if specified in node config. - files/ # text and binary files needed for services and nodes, including keypairs - users/ # crypto key material for sysadmins - common.yaml # all nodes inherit these options - provider.yaml # global service provider definition - -Configuration Files -================================= - -All configuration files are in JSON format. For example - - { - "key1": "value1", - "key2": "value2" - } - -Keys should match /[a-z0-9_]/ - -Unlike traditional JSON, comments are allowed. If the first non-whitespace character is '#' the line is treated as a comment. - - # this is a comment - { - # this is a comment - "key": "value" # this is an error - } - -Options in the configuration files might be nested. For example: - - { - "openvpn": { - "ip_address": "1.1.1.1" - } - } - -When compiled into hiera and made available in puppet, this becomes a Hash object with flattened keys: - - {"openvpn.ip_address" => "1.1.1.1"} - -Node Configuration -================================= - -The name of the file will be the hostname of the node. - -An example configuration "nodes/dns-europe.json" - - { - "services": "dns", - "tags": ["production", "europe"], - "ip_address": "1.1.1.1" - } - -This node will have hostname "dns-europe" and it will inherit from the following files (in this order): - - common.json - services/dns.json - tags/europe.json - tags/production.json - -Development -================================= - -prerequisites: - -* rubygems (``apt-get install rubygems``) -* bundler (``gem install bundler``) - -Install command line ``leap``: - - git clone git://leap.se/leap_cli # clone leap cli code - cd leap_cli - bundle # install required gems - ln -s `pwd`/bin/leap ~/bin # link executable somewhere in your bin path - -You can experiment using the example provider in the test directory - - cd test/provider - leap - -Alternately, you can create your own provider for testing: - - mkdir ~/dev/example.org - cd ~/dev/example.org - git clone git://leap.se/leap_platform - leap init provider - cd provider - leap - diff --git a/cli/leap_cli.gemspec b/leap_cli.gemspec index 208355d..208355d 100644 --- a/cli/leap_cli.gemspec +++ b/leap_cli.gemspec diff --git a/cli/leap_cli.rdoc b/leap_cli.rdoc index 31d5deb..31d5deb 100644 --- a/cli/leap_cli.rdoc +++ b/leap_cli.rdoc diff --git a/cli/lib/leap_cli.rb b/lib/leap_cli.rb index b935e35..b935e35 100644 --- a/cli/lib/leap_cli.rb +++ b/lib/leap_cli.rb diff --git a/cli/lib/leap_cli/commands/README b/lib/leap_cli/commands/README index 00fcd84..00fcd84 100644 --- a/cli/lib/leap_cli/commands/README +++ b/lib/leap_cli/commands/README diff --git a/cli/lib/leap_cli/commands/compile.rb b/lib/leap_cli/commands/compile.rb index 6b38de5..6b38de5 100644 --- a/cli/lib/leap_cli/commands/compile.rb +++ b/lib/leap_cli/commands/compile.rb diff --git a/cli/lib/leap_cli/commands/deploy.rb b/lib/leap_cli/commands/deploy.rb index 3694a38..3694a38 100644 --- a/cli/lib/leap_cli/commands/deploy.rb +++ b/lib/leap_cli/commands/deploy.rb diff --git a/cli/lib/leap_cli/commands/init.rb b/lib/leap_cli/commands/init.rb index 75cc876..75cc876 100644 --- a/cli/lib/leap_cli/commands/init.rb +++ b/lib/leap_cli/commands/init.rb diff --git a/cli/lib/leap_cli/commands/list.rb b/lib/leap_cli/commands/list.rb index a186049..a186049 100644 --- a/cli/lib/leap_cli/commands/list.rb +++ b/lib/leap_cli/commands/list.rb diff --git a/cli/lib/leap_cli/commands/pre.rb b/lib/leap_cli/commands/pre.rb index ae58fc8..ae58fc8 100644 --- a/cli/lib/leap_cli/commands/pre.rb +++ b/lib/leap_cli/commands/pre.rb diff --git a/cli/lib/leap_cli/config.rb b/lib/leap_cli/config.rb index 44e66be..44e66be 100644 --- a/cli/lib/leap_cli/config.rb +++ b/lib/leap_cli/config.rb diff --git a/cli/lib/leap_cli/config_list.rb b/lib/leap_cli/config_list.rb index c8ff23b..c8ff23b 100644 --- a/cli/lib/leap_cli/config_list.rb +++ b/lib/leap_cli/config_list.rb diff --git a/cli/lib/leap_cli/config_manager.rb b/lib/leap_cli/config_manager.rb index d383cc1..d383cc1 100644 --- a/cli/lib/leap_cli/config_manager.rb +++ b/lib/leap_cli/config_manager.rb diff --git a/cli/lib/leap_cli/init.rb b/lib/leap_cli/init.rb index bebede7..bebede7 100644 --- a/cli/lib/leap_cli/init.rb +++ b/lib/leap_cli/init.rb diff --git a/cli/lib/leap_cli/log.rb b/lib/leap_cli/log.rb index f51ca1e..f51ca1e 100644 --- a/cli/lib/leap_cli/log.rb +++ b/lib/leap_cli/log.rb diff --git a/cli/lib/leap_cli/path.rb b/lib/leap_cli/path.rb index 5dc8fe8..5dc8fe8 100644 --- a/cli/lib/leap_cli/path.rb +++ b/lib/leap_cli/path.rb diff --git a/cli/lib/leap_cli/version.rb b/lib/leap_cli/version.rb index c272647..c272647 100644 --- a/cli/lib/leap_cli/version.rb +++ b/lib/leap_cli/version.rb diff --git a/cli/test/default_test.rb b/test/default_test.rb index c363bbb..c363bbb 100644 --- a/cli/test/default_test.rb +++ b/test/default_test.rb diff --git a/cli/test/provider/common.json b/test/provider/common.json index ead9d68..ead9d68 100644 --- a/cli/test/provider/common.json +++ b/test/provider/common.json diff --git a/cli/test/provider/files/ca/ca.crt b/test/provider/files/ca/ca.crt index ed12e15..ed12e15 100644 --- a/cli/test/provider/files/ca/ca.crt +++ b/test/provider/files/ca/ca.crt diff --git a/cli/test/provider/files/ca/ca.key b/test/provider/files/ca/ca.key index 9721c35..9721c35 100644 --- a/cli/test/provider/files/ca/ca.key +++ b/test/provider/files/ca/ca.key diff --git a/cli/test/provider/files/public-definitions/provider.json.erb b/test/provider/files/public-definitions/provider.json.erb index e69de29..e69de29 100644 --- a/cli/test/provider/files/public-definitions/provider.json.erb +++ b/test/provider/files/public-definitions/provider.json.erb diff --git a/cli/test/provider/files/vpn1/vpn1.rewire.co.crt b/test/provider/files/vpn1/vpn1.rewire.co.crt index d2c9734..d2c9734 100644 --- a/cli/test/provider/files/vpn1/vpn1.rewire.co.crt +++ b/test/provider/files/vpn1/vpn1.rewire.co.crt diff --git a/cli/test/provider/files/vpn1/vpn1.rewire.co.key b/test/provider/files/vpn1/vpn1.rewire.co.key index 3fdf38a..3fdf38a 100644 --- a/cli/test/provider/files/vpn1/vpn1.rewire.co.key +++ b/test/provider/files/vpn1/vpn1.rewire.co.key diff --git a/cli/test/provider/hiera/couch1.rewire.yaml b/test/provider/hiera/couch1.rewire.yaml index 2c731ce..2c731ce 100644 --- a/cli/test/provider/hiera/couch1.rewire.yaml +++ b/test/provider/hiera/couch1.rewire.yaml diff --git a/cli/test/provider/hiera/couch2.rewire.yaml b/test/provider/hiera/couch2.rewire.yaml index a835c79..a835c79 100644 --- a/cli/test/provider/hiera/couch2.rewire.yaml +++ b/test/provider/hiera/couch2.rewire.yaml diff --git a/cli/test/provider/hiera/ns1.rewire.yaml b/test/provider/hiera/ns1.rewire.yaml index 264dd52..264dd52 100644 --- a/cli/test/provider/hiera/ns1.rewire.yaml +++ b/test/provider/hiera/ns1.rewire.yaml diff --git a/cli/test/provider/hiera/ns2.rewire.yaml b/test/provider/hiera/ns2.rewire.yaml index 2885424..2885424 100644 --- a/cli/test/provider/hiera/ns2.rewire.yaml +++ b/test/provider/hiera/ns2.rewire.yaml diff --git a/cli/test/provider/hiera/vpn1.rewire.yaml b/test/provider/hiera/vpn1.rewire.yaml index 158bb1b..158bb1b 100644 --- a/cli/test/provider/hiera/vpn1.rewire.yaml +++ b/test/provider/hiera/vpn1.rewire.yaml diff --git a/cli/test/provider/hiera/web1.rewire.yaml b/test/provider/hiera/web1.rewire.yaml index 6fc76d9..6fc76d9 100644 --- a/cli/test/provider/hiera/web1.rewire.yaml +++ b/test/provider/hiera/web1.rewire.yaml diff --git a/cli/test/provider/nodes/couch1.json b/test/provider/nodes/couch1.json index fe5d7e5..fe5d7e5 100644 --- a/cli/test/provider/nodes/couch1.json +++ b/test/provider/nodes/couch1.json diff --git a/cli/test/provider/nodes/couch2.json b/test/provider/nodes/couch2.json index 1fe2977..1fe2977 100644 --- a/cli/test/provider/nodes/couch2.json +++ b/test/provider/nodes/couch2.json diff --git a/cli/test/provider/nodes/ns1.json b/test/provider/nodes/ns1.json index 6323d10..6323d10 100644 --- a/cli/test/provider/nodes/ns1.json +++ b/test/provider/nodes/ns1.json diff --git a/cli/test/provider/nodes/ns2.json b/test/provider/nodes/ns2.json index eeba9df..eeba9df 100644 --- a/cli/test/provider/nodes/ns2.json +++ b/test/provider/nodes/ns2.json diff --git a/cli/test/provider/nodes/vpn1.json b/test/provider/nodes/vpn1.json index 10859ac..10859ac 100644 --- a/cli/test/provider/nodes/vpn1.json +++ b/test/provider/nodes/vpn1.json diff --git a/cli/test/provider/nodes/web1.json b/test/provider/nodes/web1.json index 894fb6e..894fb6e 100644 --- a/cli/test/provider/nodes/web1.json +++ b/test/provider/nodes/web1.json diff --git a/cli/test/provider/provider.json b/test/provider/provider.json index 58b6728..58b6728 100644 --- a/cli/test/provider/provider.json +++ b/test/provider/provider.json diff --git a/cli/test/provider/services/couchdb.json b/test/provider/services/couchdb.json index 7c13c8d..7c13c8d 100644 --- a/cli/test/provider/services/couchdb.json +++ b/test/provider/services/couchdb.json diff --git a/cli/test/provider/services/dns.json b/test/provider/services/dns.json index 3fea381..3fea381 100644 --- a/cli/test/provider/services/dns.json +++ b/test/provider/services/dns.json diff --git a/cli/test/provider/services/openvpn.json b/test/provider/services/openvpn.json index ffaa313..ffaa313 100644 --- a/cli/test/provider/services/openvpn.json +++ b/test/provider/services/openvpn.json diff --git a/cli/test/provider/services/webapp.json b/test/provider/services/webapp.json index 1513d6f..1513d6f 100644 --- a/cli/test/provider/services/webapp.json +++ b/test/provider/services/webapp.json diff --git a/cli/test/provider/tags/production.json b/test/provider/tags/production.json index b35c065..b35c065 100644 --- a/cli/test/provider/tags/production.json +++ b/test/provider/tags/production.json diff --git a/cli/test/test_helper.rb b/test/test_helper.rb index 2e33705..2e33705 100644 --- a/cli/test/test_helper.rb +++ b/test/test_helper.rb |