teleport 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +3 -1
- data/lib/teleport/run.sh +49 -29
- data/lib/teleport/util.rb +12 -1
- data/lib/teleport/version.rb +1 -1
- data/spec/end_to_end_spec.rb +1 -1
- data/spec/support/ec2.rb +2 -1
- metadata +34 -26
data/README.md
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
## Welcome to Teleport
|
2
2
|
|
3
|
+
This is a fork of https://github.com/gurgeous/teleport, which is the canonical and maintained version of this gem.
|
4
|
+
|
3
5
|
Teleport is a lightweight way to set up Ubuntu machines. The name derives from the mechanism that teleport uses to setup the target machine - it copies itself onto the target machine via ssh and then runs itself there. In effect, it "teleports" to the target. This design makes it possible for teleport to bootstrap itself onto a fresh machine. There's no need to install ruby or anything else by hand.
|
4
6
|
|
5
7
|
Teleport strives to be **idempotent** - you can run it repeatedly without changing the result. In other words, as you build up your teleport config file you can generally run it over and over again without fear of breaking the target machine.
|
6
8
|
|
7
9
|
Teleport is great for managing a small number of hosted machines, either dedicated or in the cloud. Due to it's opinionated nature and limited scope you may find that it works better for you than other, more complicated tools.
|
8
10
|
|
9
|
-
At the moment Teleport supports **Ubuntu 10.04/10.10/11.04 with Ruby 1.8.7, 1.9.2, 1.9.3, or [REE](http://www.rubyenterpriseedition.com/)**.
|
11
|
+
At the moment Teleport supports **Ubuntu 10.04/10.10/11.04/11.10 with Ruby 1.8.7, 1.9.2, 1.9.3, or [REE](http://www.rubyenterpriseedition.com/)**.
|
10
12
|
|
11
13
|
## Getting Started
|
12
14
|
|
data/lib/teleport/run.sh
CHANGED
@@ -25,9 +25,17 @@ function fatal() {
|
|
25
25
|
|
26
26
|
function install_ruby() {
|
27
27
|
banner "apt-get update / upgrade..."
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
apt-get update
|
29
|
+
apt-get -y upgrade
|
30
|
+
|
31
|
+
# which version of readline to install?
|
32
|
+
local readline
|
33
|
+
if [ "${DISTRIB_RELEASE//[.]/}" -lt "1110" ] ; then
|
34
|
+
readline=libreadline5-dev
|
35
|
+
else
|
36
|
+
readline=libreadline-gplv2-dev
|
37
|
+
fi
|
38
|
+
apt-get install -y wget $readline
|
31
39
|
|
32
40
|
banner "installing Ruby $CONFIG_RUBY..."
|
33
41
|
case $CONFIG_RUBY in
|
@@ -40,20 +48,34 @@ function install_ruby() {
|
|
40
48
|
}
|
41
49
|
|
42
50
|
function install_ruby_187() {
|
43
|
-
|
51
|
+
apt-get -y install irb libopenssl-ruby libreadline-ruby rdoc ri ruby ruby-dev
|
44
52
|
|
45
53
|
wget http://production.cf.rubygems.org/rubygems/rubygems-$CONFIG_RUBYGEMS.tgz
|
46
54
|
tar xfpz rubygems-$CONFIG_RUBYGEMS.tgz
|
47
|
-
(cd rubygems-$CONFIG_RUBYGEMS ;
|
55
|
+
(cd rubygems-$CONFIG_RUBYGEMS ; ruby setup.rb)
|
48
56
|
ln -s /usr/bin/gem1.8 /usr/bin/gem
|
49
57
|
}
|
50
58
|
|
59
|
+
#
|
60
|
+
# thanks to http://threebrothers.org/brendan/blog/ruby-1-9-2-on-ubuntu-11-04/
|
61
|
+
# for suggestions
|
62
|
+
#
|
63
|
+
|
64
|
+
function install_ruby_19_requirements() {
|
65
|
+
local ffi
|
66
|
+
if [ "${DISTRIB_RELEASE//[.]/}" -lt "1110" ] ; then
|
67
|
+
ffi=libffi5
|
68
|
+
else
|
69
|
+
ffi=libffi6
|
70
|
+
fi
|
71
|
+
apt-get install -y bison build-essential checkinstall $ffi libssl-dev libyaml-dev zlib1g-dev
|
72
|
+
}
|
73
|
+
|
51
74
|
function install_ruby_192() {
|
52
75
|
local patch=p290
|
53
|
-
|
54
|
-
# see http://threebrothers.org/brendan/blog/ruby-1-9-2-on-ubuntu-11-04/
|
55
|
-
sudo apt-get install -y bison build-essential checkinstall libffi5 libssl-dev libyaml-dev zlib1g-dev
|
56
76
|
|
77
|
+
install_ruby_19_requirements
|
78
|
+
|
57
79
|
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-$patch.tar.gz
|
58
80
|
tar xvzf ruby-1.9.2-$patch.tar.gz
|
59
81
|
|
@@ -63,7 +85,7 @@ function install_ruby_192() {
|
|
63
85
|
--with-ruby-version=1.9.2 \
|
64
86
|
--disable-install-doc
|
65
87
|
make
|
66
|
-
|
88
|
+
checkinstall -D -y \
|
67
89
|
--fstrans=no \
|
68
90
|
--nodoc \
|
69
91
|
--pkgname="ruby1.9.2" \
|
@@ -71,19 +93,18 @@ function install_ruby_192() {
|
|
71
93
|
--provides="ruby"
|
72
94
|
cd ..
|
73
95
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
96
|
+
update-alternatives --install /usr/local/bin/ruby ruby /usr/local/bin/ruby1.9.2 500 \
|
97
|
+
--slave /usr/local/bin/ri ri /usr/local/bin/ri1.9.2 \
|
98
|
+
--slave /usr/local/bin/irb irb /usr/local/bin/irb1.9.2 \
|
99
|
+
--slave /usr/local/bin/gem gem /usr/local/bin/gem1.9.2 \
|
100
|
+
--slave /usr/local/bin/erb erb /usr/local/bin/erb1.9.2 \
|
101
|
+
--slave /usr/local/bin/rdoc rdoc /usr/local/bin/rdoc1.9.2
|
80
102
|
}
|
81
103
|
|
82
104
|
function install_ruby_193() {
|
83
105
|
local patch=p0
|
84
|
-
|
85
|
-
|
86
|
-
sudo apt-get install -y bison build-essential checkinstall libffi5 libssl-dev libyaml-dev zlib1g-dev
|
106
|
+
|
107
|
+
install_ruby_19_requirements
|
87
108
|
|
88
109
|
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-$patch.tar.gz
|
89
110
|
tar xvzf ruby-1.9.3-$patch.tar.gz
|
@@ -94,7 +115,7 @@ function install_ruby_193() {
|
|
94
115
|
--with-ruby-version=1.9.3 \
|
95
116
|
--disable-install-doc
|
96
117
|
make
|
97
|
-
|
118
|
+
checkinstall -D -y \
|
98
119
|
--fstrans=no \
|
99
120
|
--nodoc \
|
100
121
|
--pkgname="ruby1.9.3" \
|
@@ -102,21 +123,21 @@ function install_ruby_193() {
|
|
102
123
|
--provides="ruby"
|
103
124
|
cd ..
|
104
125
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
126
|
+
update-alternatives --install /usr/local/bin/ruby ruby /usr/local/bin/ruby1.9.3 500 \
|
127
|
+
--slave /usr/local/bin/ri ri /usr/local/bin/ri1.9.3 \
|
128
|
+
--slave /usr/local/bin/irb irb /usr/local/bin/irb1.9.3 \
|
129
|
+
--slave /usr/local/bin/gem gem /usr/local/bin/gem1.9.3 \
|
130
|
+
--slave /usr/local/bin/erb erb /usr/local/bin/erb1.9.3 \
|
131
|
+
--slave /usr/local/bin/rdoc rdoc /usr/local/bin/rdoc1.9.3
|
111
132
|
}
|
112
133
|
|
113
134
|
function install_ruby_ree() {
|
114
135
|
local ree="ruby-enterprise_1.8.7-2011.03_${ARCH}_ubuntu10.04.deb"
|
115
136
|
wget http://rubyenterpriseedition.googlecode.com/files/$ree
|
116
|
-
|
137
|
+
dpkg -i $ree
|
117
138
|
|
118
139
|
# remove all gems
|
119
|
-
gem list | cut -d" " -f1 | xargs
|
140
|
+
gem list | cut -d" " -f1 | xargs gem uninstall
|
120
141
|
}
|
121
142
|
|
122
143
|
|
@@ -132,8 +153,7 @@ fi
|
|
132
153
|
# which version?
|
133
154
|
. /etc/lsb-release
|
134
155
|
case $DISTRIB_RELEASE in
|
135
|
-
10.*
|
136
|
-
11.04 ) ;; # nop
|
156
|
+
10.* | 11.* ) ;; # nop
|
137
157
|
*)
|
138
158
|
banner "warning - Ubuntu $DISTRIB_RELEASE hasn't been tested with Teleport yet"
|
139
159
|
esac
|
data/lib/teleport/util.rb
CHANGED
@@ -2,6 +2,7 @@ require "cgi"
|
|
2
2
|
require "digest/md5"
|
3
3
|
require "etc"
|
4
4
|
require "fileutils"
|
5
|
+
require "yaml"
|
5
6
|
|
6
7
|
module Teleport
|
7
8
|
# Helper module for executing commands and printing stuff
|
@@ -273,7 +274,7 @@ module Teleport
|
|
273
274
|
|
274
275
|
# Returns true if the pkg is installed.
|
275
276
|
def package_is_installed?(pkg)
|
276
|
-
succeeds?("dpkg-query -f='${Status}' -W #{pkg} | grep 'install ok installed'
|
277
|
+
succeeds?("dpkg-query -f='${Status}' -W #{pkg} 2>&1 | grep 'install ok installed'")
|
277
278
|
end
|
278
279
|
|
279
280
|
# Install pkg if necessary.
|
@@ -302,6 +303,16 @@ module Teleport
|
|
302
303
|
false
|
303
304
|
end
|
304
305
|
|
306
|
+
# Returns the newest currently installed version of
|
307
|
+
# the named gem or false if the gem is not installed
|
308
|
+
def gem_version(name)
|
309
|
+
spec_out = `gem specification #{name} 2> /dev/null`
|
310
|
+
if !spec_out.empty?
|
311
|
+
spec = Gem::Specification.from_yaml(spec_out)
|
312
|
+
spec.version
|
313
|
+
end
|
314
|
+
end
|
315
|
+
|
305
316
|
# Returns true if the pidfile exists and that process id exists as
|
306
317
|
# well.
|
307
318
|
def process_by_pid?(pidfile)
|
data/lib/teleport/version.rb
CHANGED
data/spec/end_to_end_spec.rb
CHANGED
@@ -8,7 +8,7 @@ describe "a new ec2 instance" do
|
|
8
8
|
telfile do
|
9
9
|
<<EOF
|
10
10
|
user "gub"
|
11
|
-
ruby "1.
|
11
|
+
ruby "1.9.3"
|
12
12
|
ssh_options ["-o", "User=ubuntu", "-o", "StrictHostKeyChecking=no", "-o", "IdentityFile=#{ENV["TELEPORT_SSH_KEY"]}"]
|
13
13
|
|
14
14
|
role :master, :packages => %w(nginx), :recipes => %w(ruby.rb)
|
data/spec/support/ec2.rb
CHANGED
@@ -3,10 +3,11 @@ require "AWS"
|
|
3
3
|
# spin up a fresh ec2 instance
|
4
4
|
module Support
|
5
5
|
module Ec2
|
6
|
+
# these are all us-east-1 64-bit instance
|
6
7
|
AMI_10_04 = "1136fb78"
|
7
8
|
AMI_10_10 = "1933fe70"
|
8
9
|
AMI_11_04 = "71589518"
|
9
|
-
AMI_11_10 = "
|
10
|
+
AMI_11_10 = "21f53948"
|
10
11
|
KEYPAIR = "teleport"
|
11
12
|
GROUP = "teleport"
|
12
13
|
|
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teleport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 31
|
5
|
+
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
|
9
|
+
- 4
|
10
|
+
segments_generated: true
|
11
|
+
version: 1.0.4
|
11
12
|
platform: ruby
|
12
13
|
authors:
|
13
14
|
- Adam Doppelt
|
@@ -15,13 +16,11 @@ autorequire:
|
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date: 2011-
|
19
|
+
date: 2011-12-13 00:00:00 -08:00
|
19
20
|
default_executable:
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
22
|
-
|
23
|
-
type: :development
|
24
|
-
version_requirements: &id001 !ruby/object:Gem::Requirement
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
24
|
none: false
|
26
25
|
requirements:
|
27
26
|
- - ">="
|
@@ -29,13 +28,14 @@ dependencies:
|
|
29
28
|
hash: 3
|
30
29
|
segments:
|
31
30
|
- 0
|
31
|
+
segments_generated: true
|
32
32
|
version: "0"
|
33
|
+
name: amazon-ec2
|
33
34
|
prerelease: false
|
34
|
-
requirement: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: awesome_print
|
37
35
|
type: :development
|
38
|
-
version_requirements:
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
@@ -43,13 +43,14 @@ dependencies:
|
|
43
43
|
hash: 3
|
44
44
|
segments:
|
45
45
|
- 0
|
46
|
+
segments_generated: true
|
46
47
|
version: "0"
|
48
|
+
name: awesome_print
|
47
49
|
prerelease: false
|
48
|
-
requirement: *id002
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: rake
|
51
50
|
type: :development
|
52
|
-
version_requirements:
|
51
|
+
version_requirements: *id002
|
52
|
+
- !ruby/object:Gem::Dependency
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
53
54
|
none: false
|
54
55
|
requirements:
|
55
56
|
- - ">="
|
@@ -57,13 +58,14 @@ dependencies:
|
|
57
58
|
hash: 3
|
58
59
|
segments:
|
59
60
|
- 0
|
61
|
+
segments_generated: true
|
60
62
|
version: "0"
|
63
|
+
name: rake
|
61
64
|
prerelease: false
|
62
|
-
requirement: *id003
|
63
|
-
- !ruby/object:Gem::Dependency
|
64
|
-
name: rdoc
|
65
65
|
type: :development
|
66
|
-
version_requirements:
|
66
|
+
version_requirements: *id003
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
67
69
|
none: false
|
68
70
|
requirements:
|
69
71
|
- - ~>
|
@@ -72,13 +74,14 @@ dependencies:
|
|
72
74
|
segments:
|
73
75
|
- 3
|
74
76
|
- 9
|
77
|
+
segments_generated: true
|
75
78
|
version: "3.9"
|
79
|
+
name: rdoc
|
76
80
|
prerelease: false
|
77
|
-
requirement: *id004
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
|
-
name: rspec
|
80
81
|
type: :development
|
81
|
-
version_requirements:
|
82
|
+
version_requirements: *id004
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
82
85
|
none: false
|
83
86
|
requirements:
|
84
87
|
- - ~>
|
@@ -87,9 +90,12 @@ dependencies:
|
|
87
90
|
segments:
|
88
91
|
- 2
|
89
92
|
- 6
|
93
|
+
segments_generated: true
|
90
94
|
version: "2.6"
|
95
|
+
name: rspec
|
91
96
|
prerelease: false
|
92
|
-
|
97
|
+
type: :development
|
98
|
+
version_requirements: *id005
|
93
99
|
description: Easy Ubuntu server setup via teleportation.
|
94
100
|
email:
|
95
101
|
- amd@gurge.com
|
@@ -140,6 +146,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
140
146
|
hash: 3
|
141
147
|
segments:
|
142
148
|
- 0
|
149
|
+
segments_generated: true
|
143
150
|
version: "0"
|
144
151
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
152
|
none: false
|
@@ -149,11 +156,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
156
|
hash: 3
|
150
157
|
segments:
|
151
158
|
- 0
|
159
|
+
segments_generated: true
|
152
160
|
version: "0"
|
153
161
|
requirements: []
|
154
162
|
|
155
163
|
rubyforge_project: teleport
|
156
|
-
rubygems_version: 1.
|
164
|
+
rubygems_version: 1.3.7
|
157
165
|
signing_key:
|
158
166
|
specification_version: 3
|
159
167
|
summary: Teleport - opinionated Ubuntu server setup with Ruby.
|