right_link 5.9.0 → 5.9.1
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/INSTALL.rdoc +370 -0
- data/LICENSE +20 -0
- data/README.rdoc +104 -0
- data/RELEASES.rdoc +143 -0
- data/actors/instance_services.rb +14 -3
- data/actors/instance_setup.rb +13 -4
- data/lib/instance/cook/executable_sequence.rb +8 -0
- data/lib/instance/instance_state.rb +2 -2
- data/lib/instance/login_user_manager.rb +10 -1
- data/lib/repo_conf_generators/yum_conf_generators.rb +8 -7
- metadata +8 -4
data/INSTALL.rdoc
ADDED
@@ -0,0 +1,370 @@
|
|
1
|
+
= DISCLAIMER & WARNING
|
2
|
+
|
3
|
+
This guide demonstrates how to build the RightLink gem, install it into any
|
4
|
+
Ruby interpreter, and integrate it with Linux. This is an advanced procedure
|
5
|
+
that is intended for people who want to modify or contribute to the RightLink
|
6
|
+
software itself.
|
7
|
+
|
8
|
+
Due to the large number of variables between different OS distributions and
|
9
|
+
Ruby versions, RightScale cannot support RightLink when it is installed in
|
10
|
+
this fashion. If your goal is to use RightLink to deploy and manage cloud
|
11
|
+
servers, then your goals are better accomplished by one of the following
|
12
|
+
options:
|
13
|
+
|
14
|
+
== Use a RightScale-Published Machine Image
|
15
|
+
|
16
|
+
A RightImage™ is a base machine image, published by RightScale, that can be
|
17
|
+
used to launch instances in cloud infrastructures. RightImages are unique
|
18
|
+
from other cloud-based machine images because they are specifically designed
|
19
|
+
for optimum communication with the RightScale platform. RightImages are
|
20
|
+
Each of RightScale's published ServerTemplates was tested and published with
|
21
|
+
one or more RightImages.
|
22
|
+
|
23
|
+
RightImages are available for several distributions/versions of Linux and
|
24
|
+
for Windows. They are the best choice for someone who wants a known-good
|
25
|
+
starting point to build their own ServerTemplates.
|
26
|
+
|
27
|
+
Obtain a RightImage:
|
28
|
+
http://support.rightscale.com/12-Guides/RightScale_101/06-Advanced_Concepts/RightImages
|
29
|
+
|
30
|
+
== Create a RightScale-Enabled Image
|
31
|
+
|
32
|
+
RightScale provides pre-built, supported RightLink packages in several
|
33
|
+
formats (RPM, DEB, MSI) that are compatible with multiple Linux distributions
|
34
|
+
and versions.
|
35
|
+
|
36
|
+
Create a RightImage:
|
37
|
+
http://support.rightscale.com/12-Guides/RightLink/02-RightLink_5.9
|
38
|
+
|
39
|
+
== Install an Early-Access RightLink Package
|
40
|
+
|
41
|
+
For the adventurous, RightScale provides access to nightly builds of RightLink
|
42
|
+
that are produced from the master branch. These packages undergo automated
|
43
|
+
regression, but we cannot provide support for nightly builds.
|
44
|
+
|
45
|
+
As of May 2013, we produce nightlies for the following distributions and
|
46
|
+
releases:
|
47
|
+
* RHEL 6 (also compatible with CentOS 6)
|
48
|
+
* Ubuntu 12.04
|
49
|
+
|
50
|
+
And the following cloud types:
|
51
|
+
* azure
|
52
|
+
* cloudstack
|
53
|
+
* ec2
|
54
|
+
* google
|
55
|
+
* openstack
|
56
|
+
* rackspace (Rackspace Classic)
|
57
|
+
* rackspace-ng (Rackspace OpenCloud)
|
58
|
+
* softlayer
|
59
|
+
|
60
|
+
After installing the RightLink package, you can bundle an image and use
|
61
|
+
it to create your own MultiCoudImage.
|
62
|
+
|
63
|
+
Alternatively, if you install to an instance that was launched as a server
|
64
|
+
via the RightScale dashboard, you can reboot the instance to proceed with
|
65
|
+
running the boot scripts for the associated ServerTemplate.
|
66
|
+
|
67
|
+
=== Nightly RPMs
|
68
|
+
|
69
|
+
==== RedHat
|
70
|
+
|
71
|
+
For RedHat-based systems, we publish nightly builds to a yum repository.
|
72
|
+
The repository follows an EPEL-like layout and supports multiple distributions
|
73
|
+
and releases.
|
74
|
+
|
75
|
+
To install nightly RPMs, first create a yum source.
|
76
|
+
|
77
|
+
cat > /etc/yum.repos.d/RightLink-development.repo <<EOF
|
78
|
+
[rightlink]
|
79
|
+
name=RightLink
|
80
|
+
baseurl=https://rightlink-integration.s3.amazonaws.com/nightly/yum/1/el/$releasever/$basearch/
|
81
|
+
gpgcheck=0
|
82
|
+
EOF
|
83
|
+
|
84
|
+
Next install RightLink cloud support package for
|
85
|
+
the cloud type your instance is running on:
|
86
|
+
|
87
|
+
yum install -y rightlink-cloud-ec2
|
88
|
+
|
89
|
+
==== SUSE
|
90
|
+
|
91
|
+
For SUSE-based systems, we publish nightly builds to a yum repository.
|
92
|
+
The repository follows an EPEL-like layout and supports multiple distributions
|
93
|
+
and releases.
|
94
|
+
|
95
|
+
To install nightly RPMs, first create a zypper source.
|
96
|
+
|
97
|
+
zypper ar -G -f https://rightlink-integration.s3.amazonaws.com/nightly/yum/1/suse/$releasever/$basearch/
|
98
|
+
|
99
|
+
Next install RightLink cloud support package for
|
100
|
+
the cloud type your instance is running on:
|
101
|
+
|
102
|
+
zypper --non-interactive install rightlink-cloud-ec2
|
103
|
+
|
104
|
+
|
105
|
+
=== Nightly DEBs
|
106
|
+
|
107
|
+
For Debian-derived systems, we publish nightly builds to an apt repository.
|
108
|
+
The repository is automatic (supports multiple distributions and releases).
|
109
|
+
|
110
|
+
To install nightly DEBs, first create an apt source, ensuring that you specify
|
111
|
+
the right architecture and release code name. For instance, on an amd64
|
112
|
+
system that is running Ubuntu 12.04 (precise):
|
113
|
+
|
114
|
+
cat > /etc/apt/sources.list.d/rightlink.sources.list <<EOF
|
115
|
+
deb [arch=amd64] https://rightlink-integration.s3.amazonaws.com/nightly/apt precise main
|
116
|
+
deb-src [arch=amd64] https://rightlink-integration.s3.amazonaws.com/nightly/apt precise main
|
117
|
+
EOF
|
118
|
+
|
119
|
+
Next install RightLink cloud support package for the
|
120
|
+
cloud type your instance is running on:
|
121
|
+
|
122
|
+
apt-get update
|
123
|
+
apt-get install rightlink-cloud-ec2
|
124
|
+
|
125
|
+
=== Nightly MSIs
|
126
|
+
|
127
|
+
TODO - provide install instructions for nightly MSIs once we begin producing them
|
128
|
+
|
129
|
+
= PREREQUISITES
|
130
|
+
|
131
|
+
RightLink is a Ruby application that runs as a daemon. It depends on the
|
132
|
+
following system components/packages, which must be installed before you
|
133
|
+
can proceed with RightLink installation.
|
134
|
+
* Ruby >= 1.8.7 p371 or better -- older versions have GC issues!
|
135
|
+
* RubyGems >= 1.8.25
|
136
|
+
* C/C++ toolchain (needed to install various gems)
|
137
|
+
|
138
|
+
Several auxiliary packages are recommended in order to obtain full RightLink
|
139
|
+
functionality at runtime:
|
140
|
+
* git and Subversion clients (facilitates Chef recipe development)
|
141
|
+
* curl (for download of RightScript attachments)
|
142
|
+
* dig, sed and perl (used by some cloud-specific config logic)
|
143
|
+
|
144
|
+
== Supported Configurations
|
145
|
+
|
146
|
+
RightLink is regularly tested on the following Linux distributions:
|
147
|
+
* CentOS - 6.4
|
148
|
+
* RedHat Enterprise Linux (RHEL) - 6.4
|
149
|
+
* Ubuntu - 12.04
|
150
|
+
|
151
|
+
It has been known to work on the following with little or no modification:
|
152
|
+
* Debian
|
153
|
+
* RedHat Enterprise Linux
|
154
|
+
* SuSE Linux
|
155
|
+
|
156
|
+
And on the following kinds of cloud:
|
157
|
+
* Amazon Web Services (AWS)
|
158
|
+
* Rackspace Cloud Servers
|
159
|
+
* Eucalyptus
|
160
|
+
* CloudStack
|
161
|
+
|
162
|
+
Although RightLink is Windows-compatible and is regularly released for
|
163
|
+
Windows variants, installation and configuration are not yet covered in this
|
164
|
+
document. For information on the RightLink Windows MSI, see the documentation
|
165
|
+
page on our {support wiki}[http://support.rightscale.com/12-Guides/Windows_User_Guide]
|
166
|
+
|
167
|
+
== CentOS and RHEL Systems
|
168
|
+
|
169
|
+
Install the C toolchain and related libraries, plus some additional libs
|
170
|
+
required for RightLink,
|
171
|
+
|
172
|
+
yum install -y autoconf bison byacc flex gcc ncurses db4-devel glibc-devel libarchive-devel openssl-devel ncurses-devel
|
173
|
+
|
174
|
+
Older releases of CentOS (before 6.x) ship with a Ruby VM that is too old. To run RightLink, you
|
175
|
+
can build Ruby from source and install it under a different prefix such as /opt/rightscale/sandbox.
|
176
|
+
|
177
|
+
== Ubuntu Systems
|
178
|
+
|
179
|
+
Install the C toolchain and related libraries, plus some additional libs
|
180
|
+
required for RightLink.
|
181
|
+
|
182
|
+
apt-get update
|
183
|
+
# may need libreadline5 (not 6), on older systems. Ditto with libreadline5-dev
|
184
|
+
apt-get install -y libssl-dev libarchive-dev libreadline-dev autoconf flex bison
|
185
|
+
# apt-get install -y build-essential gcc g++ bison openssl libreadline6 zlib1g vim autoconf libxml2 libffi
|
186
|
+
# apt-get install -y libssl-dev libreadline-dev zlib1g-dev libyaml-dev libffi-dev libxml2-dev
|
187
|
+
# apt-get install -y git-core perl sed curl dnsutils
|
188
|
+
|
189
|
+
Newer releases of Ubuntu (11.04 and above) ship with a Ruby 1.9 VM that is too new. To run RightLink, you
|
190
|
+
can build Ruby from source and install it under a different prefix such as /opt/rightscale/sandbox.
|
191
|
+
|
192
|
+
= PRE-INSTALL CUSTOMIZATION
|
193
|
+
|
194
|
+
== Feature Control Customization
|
195
|
+
|
196
|
+
Before installing RightLink (either as a package or from sources), you can
|
197
|
+
selectively disable certain features that may not be compatible with your
|
198
|
+
deployment environment.
|
199
|
+
|
200
|
+
Feature control is accomplished by creating a special YAML file prior to
|
201
|
+
installing the package or running any RightLink init script or program
|
202
|
+
logic. The YAML file contains some boolean flags that affect the behavior
|
203
|
+
of the init scripts and the agent at runtime.
|
204
|
+
|
205
|
+
The following features can all be disabled:
|
206
|
+
* Managed login (aka Server Login Control)
|
207
|
+
* Frozen OS package repositories
|
208
|
+
* Automatic MOTD update on state transitions
|
209
|
+
|
210
|
+
To disable one or more of these features, create the following file:
|
211
|
+
|
212
|
+
/etc/rightscale.d/right_link/features.yml
|
213
|
+
|
214
|
+
And populate the file thusly, supplying true/false for each feature
|
215
|
+
as appropriate.
|
216
|
+
|
217
|
+
motd:
|
218
|
+
update: false
|
219
|
+
package_repositories:
|
220
|
+
freeze: false
|
221
|
+
managed_login:
|
222
|
+
enable: false
|
223
|
+
|
224
|
+
All features are assumed to be enabled by default unless this file exists
|
225
|
+
and the associated feature is marked as disabled. Therefore, you can omit
|
226
|
+
sections for features that should remain enabled.
|
227
|
+
|
228
|
+
= INSTALLATION
|
229
|
+
|
230
|
+
== One-Time Setup
|
231
|
+
|
232
|
+
If you are packaging RightLink, run these commands as a post-install step
|
233
|
+
for your package. If you are bundling a cloud image, run these commands
|
234
|
+
_before_ bundling.
|
235
|
+
|
236
|
+
git clone git://github.com/rightscale/right_link.git
|
237
|
+
cd right_link
|
238
|
+
bundle install
|
239
|
+
bundle exec rake gem
|
240
|
+
gem install pkg/right_link-5.9.0.gem
|
241
|
+
|
242
|
+
The RubyGems installer will create a number of executable binaries in
|
243
|
+
your RubyGems bindir. These binaries control the operation of RightLink
|
244
|
+
and allow you and your scripts to interact with the management agent.
|
245
|
+
|
246
|
+
On Unix systems, the CLI binaries are normally created in /usr/bin, but
|
247
|
+
it depends on how your Ruby interpreter was installed and packaged. You
|
248
|
+
can determine the location of your RubyGems bindir by running:
|
249
|
+
|
250
|
+
gem env
|
251
|
+
|
252
|
+
By convention, most RightLink tools begin with the prefix "rs_" e.g.
|
253
|
+
rs_tag or rs_run_recipe.
|
254
|
+
|
255
|
+
= INTEGRATING WITH THE SYSTEM
|
256
|
+
|
257
|
+
== Multi-Cloud Support
|
258
|
+
|
259
|
+
export RS_CLOUD=ec2 # or another cloud type, see below...
|
260
|
+
mkdir -p /etc/rightscale.d
|
261
|
+
echo "$RS_CLOUD" > /etc/rightscale.d/cloud
|
262
|
+
|
263
|
+
RightLink supports many virtualization engines, cloud APIs and other facets
|
264
|
+
of cloud technology. Due to lack of standardization, there is no reliable
|
265
|
+
way for RightLink to auto-detect the cloud type in which it is running.
|
266
|
+
|
267
|
+
We have taken the pragmatic approach and require the user to give RightLink a
|
268
|
+
hint about its runtime environment. RightLink must know its cloud type in
|
269
|
+
order to retrieve launch settings and runtime metadata that are crucial to
|
270
|
+
successful operation.
|
271
|
+
|
272
|
+
In the commands below, we refer to an environment variable RS_CLOUD. You
|
273
|
+
should set RS_CLOUD to the cloud type under which RightLink is running, before
|
274
|
+
running any of the commands below. RS_CLOUD is your "hint" to RightLink.
|
275
|
+
|
276
|
+
RightLink knows about the following values of RS_CLOUD:
|
277
|
+
* ec2
|
278
|
+
* rackspace
|
279
|
+
* rackspace-ng
|
280
|
+
* eucalyptus
|
281
|
+
* cloudstack
|
282
|
+
* openstack
|
283
|
+
* softlayer
|
284
|
+
|
285
|
+
== On-Boot Commands
|
286
|
+
|
287
|
+
Under Linux these are accomplished with init scripts. Under Windows, a system
|
288
|
+
service spawns the agent process and monitors its health.
|
289
|
+
|
290
|
+
CAUTION: if your instance is attached to the RightScale dashboard, running
|
291
|
+
the commands below will cause it to begin running boot scripts! This is not
|
292
|
+
harmful, but if your intent is to bundle a "pristine" image, you probably
|
293
|
+
want to put the following commands into an init script and test by bundling
|
294
|
+
and relaunching.
|
295
|
+
|
296
|
+
#The commands below use relative paths for readability
|
297
|
+
cd /opt/rightscale
|
298
|
+
|
299
|
+
# Fetch metadata from cloud and make it available in the shell environment
|
300
|
+
bin/cloud --name $RS_CLOUD --action bootstrap > /dev/null
|
301
|
+
. /var/spool/cloud/user-data.sh
|
302
|
+
|
303
|
+
=== Determine Boot State
|
304
|
+
|
305
|
+
# TODO - check_for_rightscale
|
306
|
+
|
307
|
+
# TODO - rightboot init script (detect reboot & tweak state)
|
308
|
+
|
309
|
+
# TODO - check_boot_state, update_boot_state
|
310
|
+
|
311
|
+
=== Run Fix-It Tasks
|
312
|
+
|
313
|
+
# TODO - UNDOCUMENTED - bin/system --action ssh
|
314
|
+
# TODO - UNDOCUMENTED - bin/system --action hostname
|
315
|
+
# TODO - UNDOCUMENTED - bin/system --action proxy
|
316
|
+
|
317
|
+
=== Configure RightLink Agent
|
318
|
+
|
319
|
+
bin/enroll --root-dir /var/lib/rightscale/right_link --url $RS_RN_URL --host $RS_RN_HOST --id $RS_RN_ID --token $RS_RN_AUTH
|
320
|
+
bin/deploy
|
321
|
+
|
322
|
+
=== Launch RightLink Agent
|
323
|
+
|
324
|
+
# Start the RightLink agent
|
325
|
+
bin/rnac --start instance
|
326
|
+
|
327
|
+
# Start the agent watchdog process
|
328
|
+
bin/rchk --start
|
329
|
+
|
330
|
+
At this point, your instance should be booting and sending audit entries back to the RightScale dashboard.
|
331
|
+
Navigate to this server and verify that it's booting cleanly.
|
332
|
+
|
333
|
+
== On-Shutdown Commands
|
334
|
+
|
335
|
+
When the system is terminating, you should allow RightLink to run its decommission scripts.
|
336
|
+
|
337
|
+
#The commands below use relative paths for readability
|
338
|
+
cd /opt/rightscale
|
339
|
+
|
340
|
+
bin/rnac --decommission
|
341
|
+
|
342
|
+
== Filesystem Locations
|
343
|
+
|
344
|
+
=== Linux Systems
|
345
|
+
|
346
|
+
/etc/rightscale.d | Static configuration, incl. "hints" for init scripts
|
347
|
+
/etc/rightscale.d/right_link | Static files that customize RightLink behavior
|
348
|
+
/var/spool/cloud | Cloud-provided metadata & user-data
|
349
|
+
/var/lib/rightscale/right_agent | Persistent config files generated at startup
|
350
|
+
/var/lib/rightscale/right_link | Persistent RightLink agent state
|
351
|
+
/var/run | Transient agent state, e.g. pid files
|
352
|
+
/var/cache | Cookbooks, attachments, temp files
|
353
|
+
/usr/bin | Public CLI: rs_tag, rs_debug, ...
|
354
|
+
/opt/rightscale/bin | Private CLI: rnac, rad, cook, ...
|
355
|
+
/opt/rightscale/sandbox | Private sandbox (Ruby, RubyGems, ...)
|
356
|
+
|
357
|
+
=== Windows Systems
|
358
|
+
|
359
|
+
Data files -- paths are relative to %COMMON_APPDATA%\RightScale
|
360
|
+
|
361
|
+
rightscale.d | Static "hints" for system services
|
362
|
+
spool\cloud | Cloud-provided metadata & user-data (.sh, .rb, raw formats)
|
363
|
+
RightAgent | Persistent config files generated at startup
|
364
|
+
right_link | Persistent RightLink agent state
|
365
|
+
cache | Cookbooks, attachments, temp files
|
366
|
+
|
367
|
+
Program logic -- paths are relative to %ProgramFiles(x86)%
|
368
|
+
|
369
|
+
RightScale\RightLink | Application logic & support files
|
370
|
+
RightScale\sandbox | Private sandbox (Ruby, RubyGems, ...)
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009-2012 RightScale, Inc.
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
'Software'), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
17
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
18
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
19
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
20
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
= RightLink
|
2
|
+
|
3
|
+
= DESCRIPTION
|
4
|
+
|
5
|
+
== Synopsis
|
6
|
+
|
7
|
+
RightLink automates servers configuration and monitoring. It uses RabbitMQ as
|
8
|
+
message bus and relies on Chef[2] for configuring. RightLink uses RightPopen[3]
|
9
|
+
to monitor the stdout and stderr streams of scripted processes. Servers running
|
10
|
+
the RightLink agent configures themselves on startup an register with the
|
11
|
+
mapper so that operational recipes and scripts can be run at a later time.
|
12
|
+
|
13
|
+
Refer to the wiki (https://github.com/rightscale/right_link/wikis) for up-to-date
|
14
|
+
documentation.
|
15
|
+
|
16
|
+
Use the built-in issues tracker (https://github.com/rightscale/right_link/issues)
|
17
|
+
to report issues.
|
18
|
+
|
19
|
+
Maintained by the RightScale Teal Team
|
20
|
+
|
21
|
+
== Interface
|
22
|
+
|
23
|
+
The RightLink agent exposes actors and methods used to schedule the execution
|
24
|
+
of Chef recipes and RightScripts (shell scripts) and perform other server
|
25
|
+
management operations. You can find these actors in the 'actors' subdirectory
|
26
|
+
of RightLink.
|
27
|
+
|
28
|
+
RightLink retrieves <i>executable bundles</i> containing all the information
|
29
|
+
required to run the Chef recipe or RightScript from other agents. An executable
|
30
|
+
bundle consists of a sequence of Chef recipes and/or RightScripts together with
|
31
|
+
any required data (Chef attributes, RightScript parameters, packages etc.). The
|
32
|
+
exact definition can be found in RightAgent[3].
|
33
|
+
|
34
|
+
Some of the other agent operations that RightLink relies on:
|
35
|
+
|
36
|
+
* booter actor:
|
37
|
+
* booter/declare: Set the RightLink version number
|
38
|
+
* booter/get_repositories: Retrieve the repositories bundle used to configure the server
|
39
|
+
* booter/get_boot_bundle: Retrieve the boot execution bundle
|
40
|
+
* booter/get_decommission_bundle: Retrieve the decommission execution bundle
|
41
|
+
|
42
|
+
* auditor actor:
|
43
|
+
* auditor/create_new_section: Create a new audit section
|
44
|
+
* auditor/update_status: Update the current audit summary
|
45
|
+
* auditor/append_info: Append information text to the audit
|
46
|
+
* auditor/append_error: Append error message to the audit
|
47
|
+
* auditor/append_output: Append script output to the audit
|
48
|
+
* auditor/append_raw_output: Same as above, but don't append newline character
|
49
|
+
|
50
|
+
* forwarder actor:
|
51
|
+
* forwarder/schedule_recipe: Request a Chef recipe to be scheduled on this instance
|
52
|
+
* forwarder/schedule_right_script: Request a RightScript to be scheduled on this instance
|
53
|
+
|
54
|
+
* state recorder actor:
|
55
|
+
* state_recorder/record: Record instance state transitions (e.g. <i>boot</i>-><i>operational</i>)
|
56
|
+
|
57
|
+
Upon startup the instance agent will first request the boot execution bundle
|
58
|
+
and run it. If the execution is successful it will then tell the state recorder
|
59
|
+
actor to transition to the operational state. At that point the agent is ready
|
60
|
+
to receive requests.
|
61
|
+
|
62
|
+
RightLink comes with two command line tools <i>rs_run_recipe</i> and
|
63
|
+
<i>rs_run_right_script</i> which allow triggering the execution of operational
|
64
|
+
Chef recipes or RighScript respecively from within the instance itself. These
|
65
|
+
two command line tools tell the RightLink agent to send a
|
66
|
+
<i>forwarder/schedule_recipe</i> or <i>forwarder/schedule_right_script</i>
|
67
|
+
request to the agents that provide these operations. These agents should in
|
68
|
+
turn call the <i>instance_scheduler/schedule_bundle</i> operation of the
|
69
|
+
RightLink agent with the right execution bundle.
|
70
|
+
|
71
|
+
= INSTALLATION
|
72
|
+
|
73
|
+
See INSTALL.rdoc for more information
|
74
|
+
|
75
|
+
= ADDITIONAL RESOURCES
|
76
|
+
|
77
|
+
* [1] Chef is http://wiki.opscode.com/display/chef/Home
|
78
|
+
* [2] RightPopen is http://gemcutter.org/gems/right_popen
|
79
|
+
* [3] RightAgent is http://gemcutter.org/gems/right_agent
|
80
|
+
|
81
|
+
= LICENSE
|
82
|
+
|
83
|
+
<b>RightLink</b>
|
84
|
+
|
85
|
+
Copyright:: Copyright (c) 2009-2011 RightScale, Inc.
|
86
|
+
|
87
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
88
|
+
a copy of this software and associated documentation files (the
|
89
|
+
'Software'), to deal in the Software without restriction, including
|
90
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
91
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
92
|
+
permit persons to whom the Software is furnished to do so, subject to
|
93
|
+
the following conditions:
|
94
|
+
|
95
|
+
The above copyright notice and this permission notice shall be
|
96
|
+
included in all copies or substantial portions of the Software.
|
97
|
+
|
98
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
99
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
100
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
101
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
102
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
103
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
104
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/RELEASES.rdoc
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
= 5.9.1 (RightLink 5.9 beta 2)
|
2
|
+
|
3
|
+
Released 2013-08-07.
|
4
|
+
|
5
|
+
== New Features
|
6
|
+
|
7
|
+
* Rebooting the machine with "rs_shutdown --reboot" will now use OS' facility for rebooting the
|
8
|
+
machine rather than invoking the cloud's API to reboot. This works around VM state loss when
|
9
|
+
the hypervisor/image isn't properly generating/handling ACPI restart events.
|
10
|
+
|
11
|
+
== Changes to Existing Functionality
|
12
|
+
|
13
|
+
* Add AMQP connection lifecycle callbacks to ensure that the instance recovers from from AMQP
|
14
|
+
connection failures much more rapidly.
|
15
|
+
|
16
|
+
* Assign random password to users that are created during SSH login, ensuring that the RightLink
|
17
|
+
agent can reliably lock and unlock their accounts when role evolution occurs.
|
18
|
+
|
19
|
+
== Bug Fixes
|
20
|
+
|
21
|
+
* Repository freezing under CentOS 6 uses the proper public key file name, instead of hardcoding
|
22
|
+
"/RPM-GPG-KEY-CentOS-5"
|
23
|
+
|
24
|
+
= 5.9.0 (RightLink 5.9 beta 1)
|
25
|
+
|
26
|
+
Released 2013-07-13.
|
27
|
+
|
28
|
+
== New Features
|
29
|
+
|
30
|
+
* The RS_DECOM_REASON environment variable is set during decommission script/recipe execution to indicate the reason why decommission
|
31
|
+
is running. This variable will have one of the following values: 'reboot', 'stop', 'terminate' or 'unknown'
|
32
|
+
The value will be 'reboot', 'stop' or 'terminate' when decommissioning through the RightScale dashboard or when using the
|
33
|
+
rs_shutdown command. The 'unknown' value may be seen when the rightlink service is decommissioned (not stopped) from the console or
|
34
|
+
else the instance is shutdown or rebooted without using the rs_shutdown command.
|
35
|
+
* RightLink is distributed as a modular "tree" of packages, making it easy to install just what you need
|
36
|
+
* Improved package hygiene, e.g. clean uninstall and minimal post-install filesystem tampering
|
37
|
+
* Ability to distinguish between sudo (server_login + server_superuser) and normal (server_login) users
|
38
|
+
* Cookbook contents are cached on the instance, significantly improving reconverge speed
|
39
|
+
|
40
|
+
== Changes to Existing Functionality
|
41
|
+
|
42
|
+
* Disable users' accounts if they lose login privileges, in addition to removing trust in their key
|
43
|
+
* Respect /etc/sudoers.d when configuring sudo
|
44
|
+
* Minimize sudo privileges of rightscale user
|
45
|
+
* Freeze RubyGems by editing the systemwide RubyGems config file (/etc/gemrc) rather than modifying
|
46
|
+
root's (~root/.gemrc). This helps ensure more consistent RubyGems behavior across multiple users and Ruby versions.
|
47
|
+
* Support frozen repositories for Ubuntu 12.04-12.10 (precise, quantal)
|
48
|
+
* Update sandbox Ruby to 1.8.7p371
|
49
|
+
* Remove OpenSSL from the sandbox; link against system OpenSSL to inherit OS security patches
|
50
|
+
* Remove monit from the sandbox (RightLink no longer relies on it)
|
51
|
+
* PowerShell/Chef process spawning has been improved under Windows
|
52
|
+
|
53
|
+
== Bug Fixes
|
54
|
+
|
55
|
+
* pty ownership is assigned correct to enable screen/tmux sessions as "rightscale@<host>"
|
56
|
+
* Chef "script" resource now honors the user, group and umask attributes
|
57
|
+
* Chef "right_link_tag" resource no longer crashes on "load" action
|
58
|
+
* Exit codes for rs_run_recipe and rs_run_right_script accurately reflect failure/success
|
59
|
+
* rs_run_right_script can deal with parameters that contain "="
|
60
|
+
* Network failures during cookbook/attachment download are handled gracefully
|
61
|
+
* MOTD no longer refers to obsolete files
|
62
|
+
* Output of "rs_tag --help" has been improved
|
63
|
+
* AMQP broker reconnect reliability improved for certain corner cases
|
64
|
+
* SuSE metadata query on CloudStack has been fixed
|
65
|
+
|
66
|
+
= 5.8.13 (General Availability release in conjunction with ServerTemplates v13.4)
|
67
|
+
|
68
|
+
== New Features
|
69
|
+
|
70
|
+
=== Cloud Support
|
71
|
+
|
72
|
+
== Bug Fixes
|
73
|
+
|
74
|
+
* Hardened metadata retrieval for Windows on Openstack to overcome DHCP-lease race conditions
|
75
|
+
|
76
|
+
= 5.8.12 (Limited-availability release)
|
77
|
+
|
78
|
+
== New Features
|
79
|
+
|
80
|
+
=== Cloud Support
|
81
|
+
|
82
|
+
* Rackspace Open Cloud
|
83
|
+
|
84
|
+
== Bug Fixes
|
85
|
+
|
86
|
+
* Managed login always displays MOTD, works with older versions of sudo,
|
87
|
+
* Cookbook download is more reliable in fail-and-retry scenarios
|
88
|
+
|
89
|
+
= 5.8.8 (General Availability release in conjunction with ServerTemplates v12.11 LTS)
|
90
|
+
|
91
|
+
== New Features
|
92
|
+
|
93
|
+
=== Cloud Support
|
94
|
+
|
95
|
+
* Google Compute Engine
|
96
|
+
* Windows Azure
|
97
|
+
* SoftLayer
|
98
|
+
|
99
|
+
=== Security and Compliance
|
100
|
+
|
101
|
+
* Compliance with the Linux Filesystem Hierarchy Standard (FHS) helps RightLink coexist with host-based IDS
|
102
|
+
* See INSTALL.rdoc for more information on filesystem paths
|
103
|
+
* Managed login requires users to login with to their own limited-privilege account, and to execute privileged commands using "sudo"
|
104
|
+
* Some features of RightLink can be disabled prior to package install, to facilitate custom image builds for high-security deployment
|
105
|
+
environments
|
106
|
+
* For more information, refer to http://bit.ly/IftBeq or to RightLink's INSTALL.rdoc
|
107
|
+
|
108
|
+
=== Automation
|
109
|
+
|
110
|
+
* Concurrent recipe/script execution is supported; see the --thread option of rs_run_recipe and rs_run_right_script.
|
111
|
+
* Non-error audit output can be suppressed for recipes/scripts that run very frequently; see the --policy and --audit-period
|
112
|
+
options of rs_run_recipe and rs_run_right_script
|
113
|
+
* Tag queries accept a timeout option -- both via the rs_tag command-line tool, and the ServerCollection resource
|
114
|
+
* The agent queries its own tags before running a sequence of scripts or recipes, helping to ensure that tag-based decisions
|
115
|
+
are made using fresh state. The result of the tag query is audited, to enhance transparency and facilitate debugging.
|
116
|
+
|
117
|
+
=== Chef
|
118
|
+
|
119
|
+
* Chef 0.10.10
|
120
|
+
* An rs_ohai command is available to invoke Ohai from the command line with all of the RightScale plugins and enhancements.
|
121
|
+
* RightLink features "development mode" for cookbooks, wherein the instance directly checks out cookbooks from their
|
122
|
+
associated Git/Subversion repository and converges using the contents of the repo. Users can edit recipes between runs,
|
123
|
+
and even commit and push their changes upstream after everything is working.
|
124
|
+
* Enable this for selected cookbooks by applying a tag to the server that lists comma-separated dev cookbook names
|
125
|
+
* e.g. rs_agent_dev:dev_cookbooks=cb_1,cb_2,cb_3,...
|
126
|
+
* For more information on cookbook development, refer to http://bit.ly/HHcVhs
|
127
|
+
* Most commands invoked by Ohai/Chef are logged with DEBUG severity for easier debugging of troublesome providers/recipes. To change
|
128
|
+
the RightLink log, use the rs_log_level command.
|
129
|
+
|
130
|
+
== Miscellaneous
|
131
|
+
|
132
|
+
* The rs_agent_dev:log_level tag now allows you to specify any level (not just debug). Other agent-dev tags no longer force debug log level.
|
133
|
+
The log level can be changed by other utilities, e.g. the rs_log_level command, even if it has been initially set by the tag. The chef
|
134
|
+
process will re-query it's tags prior to convergence and the rs_log_level tag will take precedence in this case.
|
135
|
+
|
136
|
+
== Bug Fixes
|
137
|
+
|
138
|
+
* The command-line tools now report a meaningful version number (currently 0.3) and will continue to do so with future RightLink releases
|
139
|
+
* Instances will strand if they fail to install any package required by boot scripts
|
140
|
+
* HTTP metadata fetching is more tolerant of server errors; its output is far less verbose
|
141
|
+
* The UI's ordering of cookbook repositories is preserved at runtime, for cookbooks that are defined in multiple repos
|
142
|
+
* Extraneous Ohai debug output has been squelched from audits and logs
|
143
|
+
* RightLink agent startup and shutdown is more reliable under Linux
|
data/actors/instance_services.rb
CHANGED
@@ -25,12 +25,13 @@ class InstanceServices
|
|
25
25
|
include RightScale::Actor
|
26
26
|
include RightScale::OperationResultHelper
|
27
27
|
|
28
|
-
expose :update_login_policy
|
28
|
+
expose :update_login_policy, :reboot
|
29
29
|
|
30
30
|
def initialize(agent_identity)
|
31
31
|
@agent_identity = agent_identity
|
32
32
|
end
|
33
33
|
|
34
|
+
# Apply a new SSH login policy to the instance.
|
34
35
|
# Always return success, used for troubleshooting
|
35
36
|
#
|
36
37
|
# == Parameters:
|
@@ -41,7 +42,7 @@ class InstanceServices
|
|
41
42
|
#
|
42
43
|
def update_login_policy(new_policy)
|
43
44
|
status = nil
|
44
|
-
|
45
|
+
|
45
46
|
RightScale::AuditProxy.create(@agent_identity, 'Updating managed login policy') do |audit|
|
46
47
|
begin
|
47
48
|
RightScale::LoginManager.instance.update_policy(new_policy, @agent_identity) do |audit_content|
|
@@ -56,9 +57,19 @@ class InstanceServices
|
|
56
57
|
audit.append_error("Error applying login policy: #{e.message}", :category => RightScale::EventCategories::CATEGORY_ERROR)
|
57
58
|
RightScale::Log.error('Failed to update managed login policy', e, :trace)
|
58
59
|
status = error_result("#{e.class.name}: #{e.message}")
|
59
|
-
end
|
60
|
+
end
|
60
61
|
end
|
61
62
|
|
62
63
|
status
|
63
64
|
end
|
65
|
+
|
66
|
+
# Reboot the instance using local (OS) facility.
|
67
|
+
#
|
68
|
+
# @return [RightScale::OperationResult] Always returns success
|
69
|
+
#
|
70
|
+
def reboot(_)
|
71
|
+
RightScale::Log.info('Initiate reboot using local (OS) facility')
|
72
|
+
RightScale::Platform.controller.reboot
|
73
|
+
success_result
|
74
|
+
end
|
64
75
|
end
|
data/actors/instance_setup.rb
CHANGED
@@ -100,18 +100,27 @@ class InstanceSetup
|
|
100
100
|
success_result(RightScale::InstanceState.value)
|
101
101
|
end
|
102
102
|
|
103
|
-
# Handle
|
103
|
+
# Handle connection status notification from broker to adjust offline mode
|
104
|
+
# or to re-enroll if all connections have failed
|
104
105
|
#
|
105
106
|
# === Parameters
|
106
|
-
# status(Symbol):: Connection status, one of :connected or :
|
107
|
+
# status(Symbol):: Connection status, one of :connected, :disconnected, or :failed
|
107
108
|
#
|
108
109
|
# === Return
|
109
110
|
# true:: Always return true
|
110
111
|
def connection_status(status)
|
111
|
-
|
112
|
+
case status
|
113
|
+
when :connected
|
114
|
+
RightScale::Sender.instance.disable_offline_mode
|
115
|
+
when :disconnected
|
112
116
|
RightScale::Sender.instance.enable_offline_mode
|
117
|
+
when :failed
|
118
|
+
RightScale::Log.error("All broker connections have failed")
|
119
|
+
RightScale::ReenrollManager.vote
|
120
|
+
RightScale::ReenrollManager.vote
|
121
|
+
RightScale::ReenrollManager.vote
|
113
122
|
else
|
114
|
-
RightScale::
|
123
|
+
RightScale::Log.error("Unrecognized broker connection status: #{status}")
|
115
124
|
end
|
116
125
|
true
|
117
126
|
end
|
@@ -50,6 +50,7 @@ module RightScale
|
|
50
50
|
# Runs in separate (runner) process.
|
51
51
|
class ExecutableSequence
|
52
52
|
include EM::Deferrable
|
53
|
+
include Chef::Mixin::PathSanity
|
53
54
|
|
54
55
|
# Min number of seconds to wait before retrying Ohai to get the hostname
|
55
56
|
OHAI_RETRY_MIN_DELAY = 20
|
@@ -160,6 +161,12 @@ module RightScale
|
|
160
161
|
download_cookbooks if @ok
|
161
162
|
update_cookbook_path if @ok
|
162
163
|
setup_powershell_providers if RightScale::Platform.windows?
|
164
|
+
|
165
|
+
# note that chef normally enforces path sanity before executing ohai in
|
166
|
+
# the client run method. we create ohai before client run and some ohai
|
167
|
+
# plugins behave badly when there is no ruby on the PATH. we need to do
|
168
|
+
# a pre-emptive path sanity here before we start ohai and chef.
|
169
|
+
enforce_path_sanity
|
163
170
|
check_ohai { |o| converge(o) } if @ok
|
164
171
|
end
|
165
172
|
true
|
@@ -761,5 +768,6 @@ module RightScale
|
|
761
768
|
ensure
|
762
769
|
ENV.replace(original_env.to_hash)
|
763
770
|
end
|
771
|
+
|
764
772
|
end
|
765
773
|
end
|
@@ -510,9 +510,9 @@ module RightScale
|
|
510
510
|
return unless RightScale::Platform.linux?
|
511
511
|
|
512
512
|
if SUCCESSFUL_STATES.include?(@value)
|
513
|
-
system('echo "RightScale installation complete. Details can be found in
|
513
|
+
system('echo "RightScale installation complete. Details can be found in system logs." | wall') rescue nil
|
514
514
|
elsif FAILED_STATES.include?(@value)
|
515
|
-
system('echo "RightScale installation failed. Please review
|
515
|
+
system('echo "RightScale installation failed. Please review system logs." | wall') rescue nil
|
516
516
|
end
|
517
517
|
|
518
518
|
return nil
|
@@ -153,6 +153,13 @@ module RightScale
|
|
153
153
|
Etc.getpwuid(uid).name
|
154
154
|
end
|
155
155
|
|
156
|
+
|
157
|
+
def random_password
|
158
|
+
letters = [('a'..'z'),('A'..'Z')].map{|i| i.to_a}.flatten
|
159
|
+
password = (0..32).map{ letters[rand(letters.length)] }.join
|
160
|
+
Shellwords.escape(password.crypt("rightscale"))
|
161
|
+
end
|
162
|
+
|
156
163
|
# Create a Unix user with the "useradd" command.
|
157
164
|
#
|
158
165
|
# === Parameters
|
@@ -177,13 +184,15 @@ module RightScale
|
|
177
184
|
dash_s = "-s #{Shellwords.escape(shell)}"
|
178
185
|
end
|
179
186
|
|
180
|
-
result = sudo("#{useradd} #{dash_s} -u #{uid} -m #{Shellwords.escape(username)}")
|
187
|
+
result = sudo("#{useradd} #{dash_s} -u #{uid} -p #{random_password} -m #{Shellwords.escape(username)}")
|
181
188
|
|
182
189
|
case result.exitstatus
|
183
190
|
when 0
|
184
191
|
home_dir = Shellwords.escape(Etc.getpwnam(username).dir)
|
185
192
|
|
186
193
|
sudo("chmod 0771 #{Shellwords.escape(home_dir)}")
|
194
|
+
# Locking account to prevent warning os SUSE(it complains on unlocking non-locked account)
|
195
|
+
modify_user(username, true, shell)
|
187
196
|
|
188
197
|
RightScale::Log.info "LoginUserManager created #{username} successfully"
|
189
198
|
else
|
@@ -31,7 +31,7 @@ module Yum
|
|
31
31
|
end
|
32
32
|
|
33
33
|
module CentOS #########################################################################
|
34
|
-
|
34
|
+
RPM_GPG_KEY_CentOS="file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-"
|
35
35
|
|
36
36
|
# The different generate classes will always generate an exception ("string") if there's anything that went wrong. If no exception, things went well.
|
37
37
|
class Base
|
@@ -111,16 +111,17 @@ module Yum
|
|
111
111
|
############## INTERNAL FUNCTIONS #######################################################
|
112
112
|
def self.abstract_generate(params)
|
113
113
|
return unless Yum::CentOS::is_this_centos?
|
114
|
-
|
115
|
-
opts.merge!(params)
|
116
|
-
raise "missing parameters to generate file!" unless opts[:repo_filename] && opts[:repo_name] && opts[:repo_subpath] &&
|
117
|
-
opts[:base_urls] && opts[:frozen_date] && opts[:enabled] && opts[:gpgkey_file]
|
114
|
+
|
118
115
|
ver = Yum::execute("lsb_release -rs").strip
|
119
116
|
arch = Yum::execute("uname -i").strip
|
120
117
|
|
121
118
|
major_ver = ver.strip.split(".").first
|
122
119
|
repo_path = "#{major_ver}/#{opts[:repo_subpath]}/#{arch}"
|
123
120
|
|
121
|
+
opts = { :enabled => true, :gpgkey_file => RPM_GPG_KEY_CentOS + major_ver, :frozen_date => "latest"}
|
122
|
+
opts.merge!(params)
|
123
|
+
raise "missing parameters to generate file!" unless opts[:repo_filename] && opts[:repo_name] && opts[:repo_subpath] &&
|
124
|
+
opts[:base_urls] && opts[:frozen_date] && opts[:enabled] && opts[:gpgkey_file]
|
124
125
|
# Old CentOS versions 5.0 and 5.1 were not versioned...so we just point to the base of the repo instead.
|
125
126
|
if !(ver =~ /5\.[01]/)
|
126
127
|
repo_path = repo_path + "/archive/" + opts[:frozen_date]
|
@@ -154,7 +155,7 @@ END
|
|
154
155
|
end # Module CentOS
|
155
156
|
|
156
157
|
module Epel #####################################################################
|
157
|
-
RPM_GPG_KEY_EPEL="file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL"
|
158
|
+
RPM_GPG_KEY_EPEL="file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-"
|
158
159
|
def self.generate(description, base_urls, frozen_date = "latest")
|
159
160
|
opts = {:repo_filename => "Epel",
|
160
161
|
:repo_name => "epel",
|
@@ -171,7 +172,7 @@ END
|
|
171
172
|
|
172
173
|
epel_version = get_enterprise_linux_version
|
173
174
|
puts "found EPEL version: #{epel_version}"
|
174
|
-
opts = { :enabled => true, :gpgkey_file => RPM_GPG_KEY_EPEL, :frozen_date => "latest"}
|
175
|
+
opts = { :enabled => true, :gpgkey_file => RPM_GPG_KEY_EPEL + epel_version.to_s, :frozen_date => "latest"}
|
175
176
|
opts.merge!(params)
|
176
177
|
raise "missing parameters to generate file!" unless opts[:repo_filename] && opts[:repo_name] &&
|
177
178
|
opts[:base_urls] && opts[:frozen_date] && opts[:enabled] && opts[:gpgkey_file]
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: right_link
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 5
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 5.9.
|
9
|
+
- 1
|
10
|
+
version: 5.9.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- RightScale
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2013-
|
18
|
+
date: 2013-08-07 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -180,6 +180,10 @@ extensions:
|
|
180
180
|
extra_rdoc_files: []
|
181
181
|
|
182
182
|
files:
|
183
|
+
- RELEASES.rdoc
|
184
|
+
- INSTALL.rdoc
|
185
|
+
- LICENSE
|
186
|
+
- README.rdoc
|
183
187
|
- init/config.yml
|
184
188
|
- init/init.rb
|
185
189
|
- actors/agent_manager.rb
|