forj 0.0.29 → 0.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +47 -2
 - data/bin/forj +12 -9
 - data/lib/boot.rb +13 -8
 - data/lib/security.rb +5 -0
 - metadata +13 -13
 
    
        data/README.md
    CHANGED
    
    | 
         @@ -2,8 +2,53 @@ Forj cli 
     | 
|
| 
       2 
2 
     | 
    
         
             
            =====================
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
      
 5 
     | 
    
         
            +
            Installation
         
     | 
| 
       6 
6 
     | 
    
         
             
            =====================
         
     | 
| 
      
 7 
     | 
    
         
            +
            For ruby 1.9
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                sudo apt-get install ruby-dev build-essential libopenssl-ruby1.9.1 libssl-dev zlib1g-dev -y
         
     | 
| 
      
 10 
     | 
    
         
            +
                sudo gem install forj
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            For ruby 1.8
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                sudo apt-get install ruby1.8-dev ruby1.8 ri1.8 rdoc1.8 irb1.8 -y
         
     | 
| 
      
 15 
     | 
    
         
            +
                sudo apt-get install libreadline-ruby1.8 libruby1.8 libopenssl-ruby -y
         
     | 
| 
      
 16 
     | 
    
         
            +
                sudo apt-get install libxslt-dev libxml2-dev -y
         
     | 
| 
      
 17 
     | 
    
         
            +
                sudo gem install nokogiri
         
     | 
| 
      
 18 
     | 
    
         
            +
                sudo apt-get install ruby-bundler -y
         
     | 
| 
      
 19 
     | 
    
         
            +
                sudo gem install mime-types -v 1.25.1
         
     | 
| 
      
 20 
     | 
    
         
            +
                sudo gem install hpcloud
         
     | 
| 
      
 21 
     | 
    
         
            +
                sudo gem install forj
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            How to use forj cli
         
     | 
| 
      
 25 
     | 
    
         
            +
            =====================
         
     | 
| 
      
 26 
     | 
    
         
            +
            Setup forj
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                forj setup # follow the instructions
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
            Boot a forge
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                forj boot <blueprint> on <cloud_provider> as <name>
         
     | 
| 
      
 33 
     | 
    
         
            +
                e.g. forj boot redstone on hpcloud as maestro_01
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
            Optional arguments
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                -u --build #Replace the default build.sh.
         
     | 
| 
      
 38 
     | 
    
         
            +
                -d --build_config_dir # Defines the build configuration directory to load the build configuration file.
         
     | 
| 
      
 39 
     | 
    
         
            +
                -c --build_config # The build config file to load <confdir>/<BoxName>.<Config>.env.
         
     | 
| 
      
 40 
     | 
    
         
            +
                -b --branch # The build will extract from git branch name.
         
     | 
| 
      
 41 
     | 
    
         
            +
                -t --test_box # Create test-box meta from the repository path provided.
         
     | 
| 
      
 42 
     | 
    
         
            +
                -r --git_repo # The box built will use a different git repository sent out to <user_data>.
         
     | 
| 
      
 43 
     | 
    
         
            +
                -h --boothook # By default, boothook file used is build/bin/build-tools/boothook.sh.
         
     | 
| 
      
 44 
     | 
    
         
            +
                -x --box_name # Defines the name of the box or box image to build.
         
     | 
| 
      
 45 
     | 
    
         
            +
                -k --key_name # Key pair name to import.
         
     | 
| 
      
 46 
     | 
    
         
            +
                -p --key_path # Public key pair data.
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
            To ssh into a server
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
                forj ssh <name> <node>
         
     | 
| 
      
 51 
     | 
    
         
            +
                e.g. forj ssh maestro_01 [maestro, ci, util, review] # the nodes from your blueprint
         
     | 
| 
       7 
52 
     | 
    
         | 
| 
       8 
53 
     | 
    
         | 
| 
       9 
54 
     | 
    
         
             
            Contributing to Forj
         
     | 
| 
         @@ -14,4 +59,4 @@ your development today! 
     | 
|
| 
       14 
59 
     | 
    
         | 
| 
       15 
60 
     | 
    
         
             
            License
         
     | 
| 
       16 
61 
     | 
    
         
             
            =====================
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
      
 62 
     | 
    
         
            +
            Forj Cli is licensed under the Apache License, Version 2.0.  See LICENSE for full license text.
         
     | 
    
        data/bin/forj
    CHANGED
    
    | 
         @@ -74,21 +74,24 @@ class Forj < Thor 
     | 
|
| 
       74 
74 
     | 
    
         | 
| 
       75 
75 
     | 
    
         
             
              desc 'boot', 'boot a Maestro box and instruct it to provision the blueprint'
         
     | 
| 
       76 
76 
     | 
    
         | 
| 
       77 
     | 
    
         
            -
              method_option :build,            :aliases => '- 
     | 
| 
       78 
     | 
    
         
            -
              method_option :build_config_dir, :aliases => '- 
     | 
| 
       79 
     | 
    
         
            -
              method_option :build_config,     :aliases => '- 
     | 
| 
       80 
     | 
    
         
            -
              method_option :branch,           :aliases => '- 
     | 
| 
       81 
     | 
    
         
            -
              method_option :test_box,         :aliases => '- 
     | 
| 
       82 
     | 
    
         
            -
              method_option :git_repo,         :aliases => '- 
     | 
| 
       83 
     | 
    
         
            -
              method_option :boothook,         :aliases => '- 
     | 
| 
       84 
     | 
    
         
            -
              method_option :box_name,         :aliases => '- 
     | 
| 
      
 77 
     | 
    
         
            +
              method_option :build,            :aliases => '-u',   :desc => 'Replace the default build.sh'
         
     | 
| 
      
 78 
     | 
    
         
            +
              method_option :build_config_dir, :aliases => '-d',   :desc => 'Defines the build configuration directory to load the build configuration file. You can set FORJ_BLD_CONF_DIR. By default, it will look in your current directory.'
         
     | 
| 
      
 79 
     | 
    
         
            +
              method_option :build_config,     :aliases => '-c',   :desc => 'The build config file to load <confdir>/<BoxName>.<Config>.env. By default, uses "master" as Config.'
         
     | 
| 
      
 80 
     | 
    
         
            +
              method_option :branch,           :aliases => '-b',   :desc => 'The build will extract from git branch name. It sets the configuration build <config> to the branch name <branch>.'
         
     | 
| 
      
 81 
     | 
    
         
            +
              method_option :test_box,         :aliases => '-t',   :desc => 'Create test-box meta from the repository path provided.'
         
     | 
| 
      
 82 
     | 
    
         
            +
              method_option :git_repo,         :aliases => '-r',   :desc => 'The box built will use a different git repository sent out to <user_data>. This repository needs to be read only. No keys are sent.'
         
     | 
| 
      
 83 
     | 
    
         
            +
              method_option :boothook,         :aliases => '-h',   :desc => 'By default, boothook file used is build/bin/build-tools/boothook.sh. Use this option to set another one.'
         
     | 
| 
      
 84 
     | 
    
         
            +
              method_option :box_name,         :aliases => '-x',   :desc => 'Defines the name of the box or box image to build.'
         
     | 
| 
      
 85 
     | 
    
         
            +
              method_option :key_name,         :aliases => '-k',   :desc => 'Import a key pair.'
         
     | 
| 
      
 86 
     | 
    
         
            +
              method_option :key_path,         :aliases => '-p',   :desc => 'Public key data'
         
     | 
| 
       85 
87 
     | 
    
         | 
| 
       86 
88 
     | 
    
         
             
              def boot(blueprint, on, cloud_provider, as, name, test = false)
         
     | 
| 
       87 
89 
     | 
    
         
             
                  Boot.boot(blueprint, cloud_provider, name,
         
     | 
| 
       88 
90 
     | 
    
         
             
                            options[:build], options[:build_config_dir],
         
     | 
| 
       89 
91 
     | 
    
         
             
                            options[:build_config], options[:branch],
         
     | 
| 
       90 
92 
     | 
    
         
             
                            options[:git_repo], options[:boothook],
         
     | 
| 
       91 
     | 
    
         
            -
                            options[:box_name],  
     | 
| 
      
 93 
     | 
    
         
            +
                            options[:box_name], options[:key_name],
         
     | 
| 
      
 94 
     | 
    
         
            +
                            options[:key_path], test)
         
     | 
| 
       92 
95 
     | 
    
         
             
              end
         
     | 
| 
       93 
96 
     | 
    
         | 
| 
       94 
97 
     | 
    
         
             
              desc 'down', 'delete the Maestro box and all systems installed by the blueprint'
         
     | 
    
        data/lib/boot.rb
    CHANGED
    
    | 
         @@ -36,9 +36,10 @@ include Helpers 
     | 
|
| 
       36 
36 
     | 
    
         
             
            #
         
     | 
| 
       37 
37 
     | 
    
         
             
            module Boot
         
     | 
| 
       38 
38 
     | 
    
         
             
              def boot(blueprint, cloud_provider, name,
         
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
      
 39 
     | 
    
         
            +
                  build, build_config_dir, build_config,
         
     | 
| 
      
 40 
     | 
    
         
            +
                  branch, git_repo, boothook, box_name,
         
     | 
| 
      
 41 
     | 
    
         
            +
                  key_name, key_path,
         
     | 
| 
      
 42 
     | 
    
         
            +
                  test = false)
         
     | 
| 
       42 
43 
     | 
    
         
             
                begin
         
     | 
| 
       43 
44 
     | 
    
         
             
                  initial_msg = 'booting %s on %s' % [blueprint , cloud_provider]
         
     | 
| 
       44 
45 
     | 
    
         | 
| 
         @@ -60,6 +61,10 @@ module Boot 
     | 
|
| 
       60 
61 
     | 
    
         | 
| 
       61 
62 
     | 
    
         
             
                  security_group = SecurityGroup.create_security_group(blueprint)
         
     | 
| 
       62 
63 
     | 
    
         | 
| 
      
 64 
     | 
    
         
            +
                  key_name = 'nova' unless key_name
         
     | 
| 
      
 65 
     | 
    
         
            +
                  key_path = '~/.ssh/nova' unless key_path
         
     | 
| 
      
 66 
     | 
    
         
            +
                  SecurityGroup.upload_existing_key(key_name, key_path)
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
       63 
68 
     | 
    
         
             
                  ports = definitions['redstone']['ports']
         
     | 
| 
       64 
69 
     | 
    
         | 
| 
       65 
70 
     | 
    
         
             
                  ports.each do|port|
         
     | 
| 
         @@ -68,8 +73,8 @@ module Boot 
     | 
|
| 
       68 
73 
     | 
    
         | 
| 
       69 
74 
     | 
    
         
             
                  ENV['FORJ_HPC_NETID'] = network.id
         
     | 
| 
       70 
75 
     | 
    
         
             
                  ENV['FORJ_SECURITY_GROUP'] = security_group.name
         
     | 
| 
       71 
     | 
    
         
            -
                   
     | 
| 
       72 
     | 
    
         
            -
                   
     | 
| 
      
 76 
     | 
    
         
            +
                  ENV['FORJ_KEYPAIR'] = key_name
         
     | 
| 
      
 77 
     | 
    
         
            +
                  ENV['FORJ_HPC_NOVA_KEYPUB'] = key_name
         
     | 
| 
       73 
78 
     | 
    
         | 
| 
       74 
79 
     | 
    
         
             
                  # run build.sh to boot maestro
         
     | 
| 
       75 
80 
     | 
    
         
             
                  current_dir = Dir.pwd
         
     | 
| 
         @@ -98,9 +103,9 @@ module Boot 
     | 
|
| 
       98 
103 
     | 
    
         | 
| 
       99 
104 
     | 
    
         
             
                  if test
         
     | 
| 
       100 
105 
     | 
    
         
             
                    puts 'test flag is on, deleting objects'
         
     | 
| 
       101 
     | 
    
         
            -
             
     | 
| 
       102 
     | 
    
         
            -
             
     | 
| 
       103 
     | 
    
         
            -
             
     | 
| 
      
 106 
     | 
    
         
            +
                    Network.delete_router_interface(subnet.id, router)
         
     | 
| 
      
 107 
     | 
    
         
            +
                    Network.delete_subnet(subnet.id)
         
     | 
| 
      
 108 
     | 
    
         
            +
                    Network.delete_network(network.name)
         
     | 
| 
       104 
109 
     | 
    
         
             
                  end
         
     | 
| 
       105 
110 
     | 
    
         | 
| 
       106 
111 
     | 
    
         
             
                rescue SystemExit, Interrupt
         
     | 
    
        data/lib/security.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: forj
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.30
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
         @@ -13,7 +13,7 @@ date: 2014-06-12 00:00:00.000000000 Z 
     | 
|
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: thor
         
     | 
| 
       16 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 16 
     | 
    
         
            +
              requirement: &14971980 !ruby/object:Gem::Requirement
         
     | 
| 
       17 
17 
     | 
    
         
             
                none: false
         
     | 
| 
       18 
18 
     | 
    
         
             
                requirements:
         
     | 
| 
       19 
19 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -21,10 +21,10 @@ dependencies: 
     | 
|
| 
       21 
21 
     | 
    
         
             
                    version: 0.16.0
         
     | 
| 
       22 
22 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       23 
23 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       24 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 24 
     | 
    
         
            +
              version_requirements: *14971980
         
     | 
| 
       25 
25 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       26 
26 
     | 
    
         
             
              name: nokogiri
         
     | 
| 
       27 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 27 
     | 
    
         
            +
              requirement: &14971040 !ruby/object:Gem::Requirement
         
     | 
| 
       28 
28 
     | 
    
         
             
                none: false
         
     | 
| 
       29 
29 
     | 
    
         
             
                requirements:
         
     | 
| 
       30 
30 
     | 
    
         
             
                - - ~>
         
     | 
| 
         @@ -32,10 +32,10 @@ dependencies: 
     | 
|
| 
       32 
32 
     | 
    
         
             
                    version: 1.5.11
         
     | 
| 
       33 
33 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       34 
34 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       35 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 35 
     | 
    
         
            +
              version_requirements: *14971040
         
     | 
| 
       36 
36 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       37 
37 
     | 
    
         
             
              name: fog
         
     | 
| 
       38 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 38 
     | 
    
         
            +
              requirement: &14969800 !ruby/object:Gem::Requirement
         
     | 
| 
       39 
39 
     | 
    
         
             
                none: false
         
     | 
| 
       40 
40 
     | 
    
         
             
                requirements:
         
     | 
| 
       41 
41 
     | 
    
         
             
                - - ~>
         
     | 
| 
         @@ -43,10 +43,10 @@ dependencies: 
     | 
|
| 
       43 
43 
     | 
    
         
             
                    version: 1.19.0
         
     | 
| 
       44 
44 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       45 
45 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       46 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 46 
     | 
    
         
            +
              version_requirements: *14969800
         
     | 
| 
       47 
47 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       48 
48 
     | 
    
         
             
              name: hpcloud
         
     | 
| 
       49 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 49 
     | 
    
         
            +
              requirement: &14966500 !ruby/object:Gem::Requirement
         
     | 
| 
       50 
50 
     | 
    
         
             
                none: false
         
     | 
| 
       51 
51 
     | 
    
         
             
                requirements:
         
     | 
| 
       52 
52 
     | 
    
         
             
                - - ~>
         
     | 
| 
         @@ -54,10 +54,10 @@ dependencies: 
     | 
|
| 
       54 
54 
     | 
    
         
             
                    version: 2.0.8
         
     | 
| 
       55 
55 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       56 
56 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       57 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 57 
     | 
    
         
            +
              version_requirements: *14966500
         
     | 
| 
       58 
58 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       59 
59 
     | 
    
         
             
              name: git
         
     | 
| 
       60 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 60 
     | 
    
         
            +
              requirement: &14965860 !ruby/object:Gem::Requirement
         
     | 
| 
       61 
61 
     | 
    
         
             
                none: false
         
     | 
| 
       62 
62 
     | 
    
         
             
                requirements:
         
     | 
| 
       63 
63 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -65,10 +65,10 @@ dependencies: 
     | 
|
| 
       65 
65 
     | 
    
         
             
                    version: 1.2.7
         
     | 
| 
       66 
66 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       67 
67 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       68 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 68 
     | 
    
         
            +
              version_requirements: *14965860
         
     | 
| 
       69 
69 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       70 
70 
     | 
    
         
             
              name: rbx-require-relative
         
     | 
| 
       71 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 71 
     | 
    
         
            +
              requirement: &14965120 !ruby/object:Gem::Requirement
         
     | 
| 
       72 
72 
     | 
    
         
             
                none: false
         
     | 
| 
       73 
73 
     | 
    
         
             
                requirements:
         
     | 
| 
       74 
74 
     | 
    
         
             
                - - ~>
         
     | 
| 
         @@ -76,7 +76,7 @@ dependencies: 
     | 
|
| 
       76 
76 
     | 
    
         
             
                    version: 0.0.7
         
     | 
| 
       77 
77 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       78 
78 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       79 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 79 
     | 
    
         
            +
              version_requirements: *14965120
         
     | 
| 
       80 
80 
     | 
    
         
             
            description: forj command line
         
     | 
| 
       81 
81 
     | 
    
         
             
            email:
         
     | 
| 
       82 
82 
     | 
    
         
             
            - forj@forj.io
         
     |