management 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +26 -21
- data/lib/management/commands/run_script.rb +2 -2
- data/lib/management/commands/ssh_server.rb +1 -2
- data/lib/management/helper.rb +1 -1
- data/lib/management/version.rb +1 -1
- data/spec/main_spec.rb +3 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -49,9 +49,26 @@ with servers that it created, since it requires certain metadata to
|
|
49
49
|
work. And because it uses EC2 tags, it's currently kind of hard-coded
|
50
50
|
to only work on EC2.
|
51
51
|
|
52
|
-
####
|
52
|
+
#### Example
|
53
53
|
|
54
|
-
|
54
|
+
Given this fictional project tree:
|
55
|
+
|
56
|
+
$ tree my-project/
|
57
|
+
my-project/
|
58
|
+
├── management_config.yml
|
59
|
+
├── < other project files... >
|
60
|
+
└── resources
|
61
|
+
├── files
|
62
|
+
│ ├── nginx.conf
|
63
|
+
│ └── web.conf.erb
|
64
|
+
├── keys
|
65
|
+
│ ├── id_rsa_aws
|
66
|
+
│ └── id_rsa_aws.pub
|
67
|
+
└── scripts
|
68
|
+
├── bootstrap_base.sh
|
69
|
+
└── start_web_server.sh
|
70
|
+
|
71
|
+
And these contents of `management_config.yml`:
|
55
72
|
|
56
73
|
cloud:
|
57
74
|
provider: AWS
|
@@ -59,6 +76,9 @@ Put this in `management_config.yml` at the root of some project:
|
|
59
76
|
aws_secret_access_key: 456
|
60
77
|
region: New York 1
|
61
78
|
|
79
|
+
root_user: ubuntu
|
80
|
+
ssh_key_path: resources/keys/id_rsa_aws
|
81
|
+
|
62
82
|
envs:
|
63
83
|
- staging
|
64
84
|
- production
|
@@ -69,7 +89,6 @@ Put this in `management_config.yml` at the root of some project:
|
|
69
89
|
flavor_id: m1.small
|
70
90
|
key_name: my-ssh-key-name
|
71
91
|
groups: ["web"]
|
72
|
-
ssh_key_path: resources/keys/id_rsa_aws
|
73
92
|
|
74
93
|
scripts:
|
75
94
|
setup-web:
|
@@ -80,26 +99,12 @@ Put this in `management_config.yml` at the root of some project:
|
|
80
99
|
- copy: [resources/scripts/start_web_server.sh, /home/webapp/start_web_server.sh]
|
81
100
|
- run: /home/webapp/start_web_server.sh
|
82
101
|
|
83
|
-
|
84
|
-
`management_config.yml`, which it expects to be in your project's
|
85
|
-
root. Here's the relevant part of the file structure that the above
|
86
|
-
sample config assumes:
|
102
|
+
You could run:
|
87
103
|
|
88
|
-
$
|
89
|
-
|
90
|
-
├── management_config.yml
|
91
|
-
└── resources
|
92
|
-
├── files
|
93
|
-
│ ├── nginx.conf
|
94
|
-
│ └── web.conf.erb
|
95
|
-
├── keys
|
96
|
-
│ ├── id_rsa_aws
|
97
|
-
│ └── id_rsa_aws.pub
|
98
|
-
└── scripts
|
99
|
-
├── bootstrap_base.sh
|
100
|
-
└── start_web_server.sh
|
104
|
+
$ management create-server staging web
|
105
|
+
$ management run-script staging-web-1 setup-web
|
101
106
|
|
102
|
-
|
107
|
+
And you'd have a fully functional web server!
|
103
108
|
|
104
109
|
#### Details
|
105
110
|
|
@@ -15,7 +15,7 @@ module Management
|
|
15
15
|
server = get_server(server_name)
|
16
16
|
script = get_script(script_name)
|
17
17
|
|
18
|
-
server.private_key_path = config[:
|
18
|
+
server.private_key_path = config[:ssh_key_path]
|
19
19
|
|
20
20
|
missing = missing_local_files(script)
|
21
21
|
abort "The following files are missing:" + (["\n"] + missing).join("\n - ") if !missing.empty?
|
@@ -35,7 +35,7 @@ module Management
|
|
35
35
|
|
36
36
|
code = run_remote_command(server, cmd)
|
37
37
|
if code != 0
|
38
|
-
abort "Failed. Exit code: #{code}"
|
38
|
+
abort "############ Failed. Exit code: #{code}"
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
@@ -9,8 +9,7 @@ module Management
|
|
9
9
|
def run(server_name)
|
10
10
|
server = get_server(server_name)
|
11
11
|
|
12
|
-
|
13
|
-
ssh_key_path = type[:ssh_key_path]
|
12
|
+
ssh_key_path = config[:ssh_key_path]
|
14
13
|
system_verbose "chmod 0600 #{ssh_key_path}"
|
15
14
|
system_verbose "ssh -i #{ssh_key_path} #{config[:root_user]}@#{server.public_ip_address}"
|
16
15
|
end
|
data/lib/management/helper.rb
CHANGED
data/lib/management/version.rb
CHANGED
data/spec/main_spec.rb
CHANGED
@@ -17,13 +17,15 @@ envs:
|
|
17
17
|
- staging
|
18
18
|
- production
|
19
19
|
|
20
|
+
root_user: ubuntu
|
21
|
+
ssh_key_path: resources/my-ssh-key
|
22
|
+
|
20
23
|
types:
|
21
24
|
web:
|
22
25
|
image_id: ami-1234
|
23
26
|
flavor_id: m1.small
|
24
27
|
key_name: my-ssh-key-name
|
25
28
|
groups: ["web"]
|
26
|
-
ssh_key_path: resources/my-ssh-key
|
27
29
|
|
28
30
|
scripts:
|
29
31
|
testing:
|