management 1.3.1 → 1.3.2

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 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
- #### Sample Configs
52
+ #### Example
53
53
 
54
- Put this in `management_config.yml` at the root of some project:
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
- Management doesn't care where any of your files are, with the exception of
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
- $ tree my-project/
89
- my-project/
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
- 4 directories, 7 files
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[:types][server.type.to_sym][:ssh_key_path]
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
- type = config[:types][server.type.to_sym]
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
@@ -43,7 +43,7 @@ module Management
43
43
  end
44
44
 
45
45
  def system_verbose(cmd)
46
- puts "Running: #{cmd}"
46
+ puts "############ Running: #{cmd}"
47
47
  system cmd
48
48
  end
49
49
 
@@ -1,3 +1,3 @@
1
1
  module Management
2
- VERSION = "1.3.1"
2
+ VERSION = "1.3.2"
3
3
  end
@@ -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:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: management
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: