inception-server 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,9 @@
1
1
  # Change Log for Inception Server
2
2
 
3
+ ## v0.3.0
4
+
5
+ * `inception share-ssh` makes it really easy to share access to an inception server. It displays text that can be copied & pasted to any person explaining how to setup local SSH config and a private key.
6
+
3
7
  ## v0.2.0
4
8
 
5
9
  * Settings stored in `~/.inception_server` instead of `~/.bosh_inception`
data/README.md CHANGED
@@ -4,12 +4,22 @@ Create an inception server for Bosh-related development.
4
4
 
5
5
  Includes a CLI for creating and preparing an inception server for deploying/developing a Bosh universe. The created or targeted VM is upgraded into an inception server via a Chef cookbook.
6
6
 
7
+ The CLI will explain how to share access to an inception server with others. Also with the power of tmux, make it easy for 2+ people to view the same terminal and to leave long running jobs whilst you are disconnected.
8
+
7
9
  [![Build Status](https://travis-ci.org/drnic/inception-server.png?branch=master)](https://travis-ci.org/drnic/inception-server)
8
10
  [![Code Climate](https://codeclimate.com/github/drnic/inception-server.png)](https://codeclimate.com/github/drnic/inception-server)
9
11
 
10
12
  ## Installation
11
13
 
12
- The tool is distributed as a RubyGem.
14
+ ```
15
+ git clone https://github.com/cloudfoundry-community/inception-server.git
16
+ cd inception-server
17
+ bundle
18
+ ```
19
+
20
+ *Wherever you see `inception` below, use `bundle exec bin/inception` until the rubygem is fixed.*
21
+
22
+ The tool WILL be distributed as a RubyGem, but its currently not working in this form sadly.
13
23
 
14
24
  ```
15
25
  $ gem install inception-server
@@ -83,6 +93,13 @@ $ inception deploy
83
93
  ... lots of chef output ...
84
94
  ```
85
95
 
96
+ ### SSH access
97
+
98
+ You have some options for accessing the inception server via SSH:
99
+
100
+ * `inception ssh` - opens a simple terminal to the inception server
101
+ * `inception tmux` - creates or attaches to a tmux session on the inception server
102
+ * `inception share-ssh` - displays how anyone can setup their own ssh config to connect to the inception server without requiring this project to be installed (nor requiring Ruby installed)
86
103
 
87
104
  ### Chef cookbook usage - remote VM
88
105
 
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.add_dependency "cyoi" # choose your own infrastructure
30
30
 
31
31
  # for running cookbooks on inception server
32
- spec.add_dependency "knife-solo", "~> 0.3.0.pre4"
32
+ spec.add_dependency "knife-solo", "~> 0.3.0"
33
33
 
34
34
  spec.add_development_dependency "bundler", "~> 1.3"
35
35
  spec.add_development_dependency "rake"
@@ -38,6 +38,6 @@ Gem::Specification.new do |spec|
38
38
  spec.add_development_dependency "rspec"
39
39
 
40
40
  # gems for the cookbook tests
41
- spec.add_development_dependency "test-kitchen", "~> 1.0.0.alpha.6"
41
+ spec.add_development_dependency "test-kitchen", "~> 1.0.0.beta.2"
42
42
  spec.add_development_dependency "berkshelf"
43
43
  end
@@ -61,6 +61,37 @@ module Inception
61
61
  run_ssh_command_or_open_tunnel(["-t", "tmux attach || tmux new-session"])
62
62
  end
63
63
 
64
+ desc "share-ssh", "Display the SSH config & private key that can be given to others to share access to the inception server"
65
+ def share_ssh(name=settings.inception.name)
66
+ user = settings.inception.provisioned.username
67
+ host = settings.inception.provisioned.host
68
+ private_key_path = "~/.ssh/#{name}"
69
+ private_key = settings.inception.key_pair.private_key
70
+ say <<-EOS
71
+ To access the inception server, add the following to your ~/.ssh/config
72
+
73
+ Host #{name}
74
+ User #{user}
75
+ Hostname #{host}
76
+ IdentityFile #{private_key_path}
77
+
78
+ Create a file #{private_key_path} with all the lines below:
79
+
80
+ #{private_key}
81
+
82
+ Change the private key to be read-only to you:
83
+
84
+ $ chmod 700 ~/.ssh
85
+ $ chmod 600 #{private_key_path}
86
+
87
+ You can now access the inception server running either:
88
+
89
+ $ ssh #{name}
90
+ $ ssh #{name} -t "tmux attach || tmux new-session"
91
+
92
+ EOS
93
+ end
94
+
64
95
  no_tasks do
65
96
  def configure_provider
66
97
  save_settings!
@@ -3,6 +3,8 @@ require "readwritesettings"
3
3
  module Inception::CliHelpers
4
4
  module Settings
5
5
  include FileUtils
6
+
7
+ CONFIG_DIRECTORY = ".inception_server"
6
8
 
7
9
  # The base directory for holding the manifest settings file
8
10
  # and private keys
@@ -10,7 +12,7 @@ module Inception::CliHelpers
10
12
  # Defaults to ~/.inception_server; and can be overridden with either:
11
13
  # * $SETTINGS - to a folder (supported method)
12
14
  def settings_dir
13
- @settings_dir ||= File.expand_path(ENV["SETTINGS"] || "~/.inception_server")
15
+ @settings_dir ||= local_settings || File.expand_path(ENV["SETTINGS"] || "~/#{CONFIG_DIRECTORY}")
14
16
  end
15
17
 
16
18
  def settings_ssh_dir
@@ -49,5 +51,10 @@ module Inception::CliHelpers
49
51
  settings
50
52
  end
51
53
 
54
+ def local_settings
55
+ path = File.join(Dir.pwd, CONFIG_DIRECTORY)
56
+ Dir.exists?(path) ? path : nil
57
+ end
58
+
52
59
  end
53
60
  end
@@ -1,3 +1,3 @@
1
1
  module Inception
2
- VERSION = "0.2.2"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -16,9 +16,16 @@ describe Inception do
16
16
  setting "provider.credentials.aws_secret_access_key", "aws_secret_access_key"
17
17
  setting "provider.region", "us-west-2"
18
18
  setting "inception.key_pair.name", "inception"
19
- setting "inception.key_pair.private_key", "PRIVATE"
20
- setting "inception.provisioned.host", "5.5.5.5"
21
- setting "inception.provisioned.username", "vcap"
19
+ setting "inception.key_pair.private_key", <<-EOS
20
+ -----BEGIN RSA PRIVATE KEY-----
21
+ xV67ZHvuRdoNDbFXscpF5uK4sEwbsvSJw73qtYAgUWfhXQKBgQDCQaO9Hf6UKd4PyPeLlSGE7akS
22
+ p57tEdMoXIE1BzUbQJL5UWfTsL6PDU7PJbIDWsR4CqESLcU3D/JVl7F5bQ6cgLifP3SuDh4oMLtK
23
+ ToA13XEsLnlLnyyi+i1dDv97Yz5jjULy8wsbiVpneabckol4427947OZwIvsHDF+KXHy3w==
24
+ -----END RSA PRIVATE KEY-----
25
+ EOS
26
+ setting "inception.name", "inception"
27
+ setting "inception.provisioned.host", "ec2-1-2-3-4.compute-1.amazonaws.com"
28
+ setting "inception.provisioned.username", "ubuntu"
22
29
  end
23
30
 
24
31
  describe "ssh" do
@@ -28,13 +35,13 @@ describe Inception do
28
35
  it "launches ssh session" do
29
36
  @cmd.should_receive(:exit)
30
37
  @cmd.should_receive(:system).
31
- with("ssh -i #{private_key_path} vcap@5.5.5.5")
38
+ with("ssh -i #{private_key_path} ubuntu@ec2-1-2-3-4.compute-1.amazonaws.com")
32
39
  @cmd.ssh
33
40
  end
34
41
  it "runs ssh command" do
35
42
  @cmd.should_receive(:exit)
36
43
  @cmd.should_receive(:system).
37
- with("ssh -i #{private_key_path} vcap@5.5.5.5 'some command'")
44
+ with("ssh -i #{private_key_path} ubuntu@ec2-1-2-3-4.compute-1.amazonaws.com 'some command'")
38
45
  @cmd.ssh("some command")
39
46
  end
40
47
  end
@@ -43,7 +50,7 @@ describe Inception do
43
50
  it "launches ssh session" do
44
51
  @cmd.should_receive(:exit)
45
52
  @cmd.should_receive(:system).
46
- with("ssh -i #{private_key_path} vcap@5.5.5.5 -t 'tmux attach || tmux new-session'")
53
+ with("ssh -i #{private_key_path} ubuntu@ec2-1-2-3-4.compute-1.amazonaws.com -t 'tmux attach || tmux new-session'")
47
54
  @cmd.tmux
48
55
  end
49
56
  end
@@ -61,7 +68,7 @@ describe Inception do
61
68
  @cmd.stub!(:ensure_mosh_installed).and_return(true)
62
69
  @cmd.should_receive(:exit)
63
70
  @cmd.should_receive(:system).
64
- with("mosh --ssh 'ssh -i #{@private_key_path}' vcap@5.5.5.5")
71
+ with("mosh --ssh 'ssh -i #{@private_key_path}' ubuntu@ec2-1-2-3-4.compute-1.amazonaws.com")
65
72
  @cmd.mosh
66
73
  end
67
74
  xit "should ensure that the mosh ports are opened" do
@@ -76,5 +83,71 @@ describe Inception do
76
83
  @cmd.ensure_security_group_allows_mosh
77
84
  end
78
85
  end
86
+
87
+ describe "share-ssh" do
88
+ it "should display an example .ssh/config & private key" do
89
+ @cmd.should_receive(:say).with(<<-EOS)
90
+ To access the inception server, add the following to your ~/.ssh/config
91
+
92
+ Host inception
93
+ User ubuntu
94
+ Hostname ec2-1-2-3-4.compute-1.amazonaws.com
95
+ IdentityFile ~/.ssh/inception
96
+
97
+ Create a file ~/.ssh/inception with all the lines below:
98
+
99
+ -----BEGIN RSA PRIVATE KEY-----
100
+ xV67ZHvuRdoNDbFXscpF5uK4sEwbsvSJw73qtYAgUWfhXQKBgQDCQaO9Hf6UKd4PyPeLlSGE7akS
101
+ p57tEdMoXIE1BzUbQJL5UWfTsL6PDU7PJbIDWsR4CqESLcU3D/JVl7F5bQ6cgLifP3SuDh4oMLtK
102
+ ToA13XEsLnlLnyyi+i1dDv97Yz5jjULy8wsbiVpneabckol4427947OZwIvsHDF+KXHy3w==
103
+ -----END RSA PRIVATE KEY-----
104
+
105
+
106
+ Change the private key to be read-only to you:
107
+
108
+ $ chmod 700 ~/.ssh
109
+ $ chmod 600 ~/.ssh/inception
110
+
111
+ You can now access the inception server running either:
112
+
113
+ $ ssh inception
114
+ $ ssh inception -t "tmux attach || tmux new-session"
115
+
116
+ EOS
117
+ @cmd.share_ssh
118
+ end
119
+
120
+ it "should display an example .ssh/config & private key with custom name" do
121
+ @cmd.should_receive(:say).with(<<-EOS)
122
+ To access the inception server, add the following to your ~/.ssh/config
123
+
124
+ Host company-xyz
125
+ User ubuntu
126
+ Hostname ec2-1-2-3-4.compute-1.amazonaws.com
127
+ IdentityFile ~/.ssh/company-xyz
128
+
129
+ Create a file ~/.ssh/company-xyz with all the lines below:
130
+
131
+ -----BEGIN RSA PRIVATE KEY-----
132
+ xV67ZHvuRdoNDbFXscpF5uK4sEwbsvSJw73qtYAgUWfhXQKBgQDCQaO9Hf6UKd4PyPeLlSGE7akS
133
+ p57tEdMoXIE1BzUbQJL5UWfTsL6PDU7PJbIDWsR4CqESLcU3D/JVl7F5bQ6cgLifP3SuDh4oMLtK
134
+ ToA13XEsLnlLnyyi+i1dDv97Yz5jjULy8wsbiVpneabckol4427947OZwIvsHDF+KXHy3w==
135
+ -----END RSA PRIVATE KEY-----
136
+
137
+
138
+ Change the private key to be read-only to you:
139
+
140
+ $ chmod 700 ~/.ssh
141
+ $ chmod 600 ~/.ssh/company-xyz
142
+
143
+ You can now access the inception server running either:
144
+
145
+ $ ssh company-xyz
146
+ $ ssh company-xyz -t "tmux attach || tmux new-session"
147
+
148
+ EOS
149
+ @cmd.share_ssh("company-xyz")
150
+ end
151
+ end
79
152
  end
80
153
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inception-server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-23 00:00:00.000000000 Z
12
+ date: 2013-08-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -130,7 +130,7 @@ dependencies:
130
130
  requirements:
131
131
  - - ~>
132
132
  - !ruby/object:Gem::Version
133
- version: 0.3.0.pre4
133
+ version: 0.3.0
134
134
  type: :runtime
135
135
  prerelease: false
136
136
  version_requirements: !ruby/object:Gem::Requirement
@@ -138,7 +138,7 @@ dependencies:
138
138
  requirements:
139
139
  - - ~>
140
140
  - !ruby/object:Gem::Version
141
- version: 0.3.0.pre4
141
+ version: 0.3.0
142
142
  - !ruby/object:Gem::Dependency
143
143
  name: bundler
144
144
  requirement: !ruby/object:Gem::Requirement
@@ -194,7 +194,7 @@ dependencies:
194
194
  requirements:
195
195
  - - ~>
196
196
  - !ruby/object:Gem::Version
197
- version: 1.0.0.alpha.6
197
+ version: 1.0.0.beta.2
198
198
  type: :development
199
199
  prerelease: false
200
200
  version_requirements: !ruby/object:Gem::Requirement
@@ -202,7 +202,7 @@ dependencies:
202
202
  requirements:
203
203
  - - ~>
204
204
  - !ruby/object:Gem::Version
205
- version: 1.0.0.alpha.6
205
+ version: 1.0.0.beta.2
206
206
  - !ruby/object:Gem::Dependency
207
207
  name: berkshelf
208
208
  requirement: !ruby/object:Gem::Requirement
@@ -317,7 +317,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
317
317
  version: '0'
318
318
  segments:
319
319
  - 0
320
- hash: -1534348497094153643
320
+ hash: -3963462369556113049
321
321
  required_rubygems_version: !ruby/object:Gem::Requirement
322
322
  none: false
323
323
  requirements:
@@ -326,7 +326,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
326
326
  version: '0'
327
327
  segments:
328
328
  - 0
329
- hash: -1534348497094153643
329
+ hash: -3963462369556113049
330
330
  requirements: []
331
331
  rubyforge_project:
332
332
  rubygems_version: 1.8.25