dev-lxc 2.6.1 → 2.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +17 -17
- data/CHANGELOG.md +317 -313
- data/Gemfile +4 -4
- data/LICENSE +201 -201
- data/README.md +287 -279
- data/Rakefile +1 -1
- data/bin/dev-lxc +9 -9
- data/dev-lxc.gemspec +26 -26
- data/docs/adhoc_clusters.md +22 -22
- data/docs/base_containers.md +44 -44
- data/docs/configuration.md +203 -203
- data/docs/dev-lxc_version_2.md +10 -10
- data/docs/manage_multiple_clusters.md +30 -30
- data/docs/usage.md +187 -187
- data/lib/dev-lxc/cli.rb +434 -434
- data/lib/dev-lxc/cluster.rb +1211 -1211
- data/lib/dev-lxc/container.rb +123 -123
- data/lib/dev-lxc/server.rb +197 -197
- data/lib/dev-lxc/version.rb +3 -3
- data/lib/dev-lxc.rb +118 -118
- metadata +2 -2
data/docs/usage.md
CHANGED
@@ -1,187 +1,187 @@
|
|
1
|
-
## Usage
|
2
|
-
|
3
|
-
### Show Calculated Configuration
|
4
|
-
|
5
|
-
Mostly for debugging purposes you have the ability to print the calculated cluster configuration.
|
6
|
-
|
7
|
-
```
|
8
|
-
dev-lxc show-config
|
9
|
-
```
|
10
|
-
|
11
|
-
### Cluster status
|
12
|
-
|
13
|
-
Run the following command to see the status of the cluster.
|
14
|
-
|
15
|
-
```
|
16
|
-
dev-lxc status
|
17
|
-
```
|
18
|
-
|
19
|
-
This is an example of the output.
|
20
|
-
|
21
|
-
```
|
22
|
-
chef.lxc NOT_CREATED
|
23
|
-
|
24
|
-
analytics.lxc NOT_CREATED
|
25
|
-
|
26
|
-
supermarket.lxc NOT_CREATED
|
27
|
-
|
28
|
-
node-1.lxc NOT_CREATED
|
29
|
-
```
|
30
|
-
|
31
|
-
### Specifying a Subset of Servers
|
32
|
-
|
33
|
-
Many dev-lxc subcommands can act on a subset of the cluster's servers by specifying a regular expression that matches the desired server names.
|
34
|
-
|
35
|
-
For example, the following command will show the status of the Chef Server.
|
36
|
-
|
37
|
-
```
|
38
|
-
dev-lxc status chef
|
39
|
-
```
|
40
|
-
|
41
|
-
### cluster-view, tks, tls commands
|
42
|
-
|
43
|
-
The dev-lxc-platform comes with some commands that create and manage helpful
|
44
|
-
tmux/byobu sessions to more easily see the state of a cluster.
|
45
|
-
|
46
|
-
Running the `cluster-view` command in the same directory as a `dev-lxc.yml` file
|
47
|
-
creates a tmux/byobu session with the same name as the cluster's directory.
|
48
|
-
|
49
|
-
`cluster-view` can also be run with the parent directory of a `dev-lxc.yml` file
|
50
|
-
as the first argument and `cluster-view` will change to that directory before
|
51
|
-
creating the tmux/byobu session.
|
52
|
-
|
53
|
-
The session's first window is named "cluster".
|
54
|
-
|
55
|
-
The left side is for running dev-lxc commands.
|
56
|
-
|
57
|
-
The right side updates every 0.5 seconds with the cluster's status provided by `dev-lxc status`.
|
58
|
-
|
59
|
-
The session's second window is named "shell". It opens in the same directory as the
|
60
|
-
cluster's `dev-lxc.yml` file.
|
61
|
-
|
62
|
-
The `tls` and `tks` commands are really aliases.
|
63
|
-
|
64
|
-
`tls` is an alias for `tmux list-sessions` and is used to see what tmux/byobu sessions
|
65
|
-
are running.
|
66
|
-
|
67
|
-
`tks` is an alias for `tmux kill-session -t` and is used to kill tmux/byobu sessions.
|
68
|
-
When specifying the session to be killed you only need as many characters of the session
|
69
|
-
name that are required to make the name unique among the list of running sessions.
|
70
|
-
|
71
|
-
I recommend switching to a different running tmux/byobu session before killing the current
|
72
|
-
tmux/byobu session. Otherwise you will need to reattach to the remaining tmux/byobu session.
|
73
|
-
Use the keyboard shortcuts Alt-Up/Down to easily switch between tmux/byobu sessions.
|
74
|
-
|
75
|
-
### Start cluster
|
76
|
-
|
77
|
-
Starting the cluster the first time takes awhile since it has a lot to download and build.
|
78
|
-
|
79
|
-
```
|
80
|
-
dev-lxc up
|
81
|
-
```
|
82
|
-
|
83
|
-
A test org, users, knife.rb and keys are automatically created in
|
84
|
-
the bootstrap backend server in `/root/chef-repo/.chef` for testing purposes.
|
85
|
-
|
86
|
-
The `knife-opc` plugin is installed in the embedded ruby environment of the
|
87
|
-
Private Chef and Enterprise Chef server to facilitate the creation of the test
|
88
|
-
org and user.
|
89
|
-
|
90
|
-
Note: You also have the option of running the `prepare-product-cache` subcommand which downloads required product packages to the cache.
|
91
|
-
This can be helpful when you don't want to start building the cluster yet but you want the package cache ready when you build the cluster later.
|
92
|
-
|
93
|
-
```
|
94
|
-
dev-lxc prepare-product-cache
|
95
|
-
```
|
96
|
-
|
97
|
-
### Print Chef Automate Credentials
|
98
|
-
|
99
|
-
If the cluster has a Chef Automate server you can use the `print-automate-credentials` subcommand to see what the login credentials.
|
100
|
-
|
101
|
-
```
|
102
|
-
dev-lxc print-automate-credentials
|
103
|
-
```
|
104
|
-
|
105
|
-
### Create chef-repo
|
106
|
-
|
107
|
-
Create a local chef-repo with appropriate knife.rb and pem files.
|
108
|
-
|
109
|
-
Use the `-p` option to also get pivotal.pem and pivotal.rb files.
|
110
|
-
|
111
|
-
Use the `-f` option to overwrite existing knife.rb and pivotal.rb files.
|
112
|
-
|
113
|
-
```
|
114
|
-
dev-lxc chef-repo
|
115
|
-
```
|
116
|
-
|
117
|
-
Now you can easily use knife to access the cluster.
|
118
|
-
|
119
|
-
```
|
120
|
-
cd chef-repo
|
121
|
-
knife client list
|
122
|
-
```
|
123
|
-
|
124
|
-
### Stop and start the cluster
|
125
|
-
|
126
|
-
```
|
127
|
-
dev-lxc halt
|
128
|
-
dev-lxc up
|
129
|
-
```
|
130
|
-
|
131
|
-
### Run arbitrary commands in each server
|
132
|
-
|
133
|
-
```
|
134
|
-
dev-lxc run-command chef 'uptime'
|
135
|
-
```
|
136
|
-
|
137
|
-
### Attach the terminal to a server
|
138
|
-
|
139
|
-
Attach the terminal to a server in the cluster that matches the REGEX pattern given.
|
140
|
-
|
141
|
-
```
|
142
|
-
dev-lxc attach chef
|
143
|
-
```
|
144
|
-
|
145
|
-
### Create a snapshot of the servers
|
146
|
-
|
147
|
-
Save the changes in the servers to snapshots with a comment.
|
148
|
-
|
149
|
-
```
|
150
|
-
dev-lxc halt
|
151
|
-
dev-lxc snapshot -c 'this is a snapshot comment'
|
152
|
-
```
|
153
|
-
|
154
|
-
### List snapshots
|
155
|
-
|
156
|
-
```
|
157
|
-
dev-lxc snapshot -l
|
158
|
-
```
|
159
|
-
|
160
|
-
### Restore snapshots
|
161
|
-
|
162
|
-
Restore snapshots by name.
|
163
|
-
|
164
|
-
Leave out the snapshot name or specify `LAST` to restore the most recent snapshot.
|
165
|
-
|
166
|
-
```
|
167
|
-
dev-lxc snapshot -r
|
168
|
-
dev-lxc up
|
169
|
-
```
|
170
|
-
|
171
|
-
### Destroy snapshots
|
172
|
-
|
173
|
-
Destroy snapshots by name or destroy all snapshots by specifying `ALL`.
|
174
|
-
|
175
|
-
Leave out the snapshot name or specify `LAST` to destroy the most recent snapshots.
|
176
|
-
|
177
|
-
```
|
178
|
-
dev-lxc snapshot -d
|
179
|
-
```
|
180
|
-
|
181
|
-
### Destroy cluster
|
182
|
-
|
183
|
-
Use the following command to destroy the cluster's servers.
|
184
|
-
|
185
|
-
```
|
186
|
-
dev-lxc destroy
|
187
|
-
```
|
1
|
+
## Usage
|
2
|
+
|
3
|
+
### Show Calculated Configuration
|
4
|
+
|
5
|
+
Mostly for debugging purposes you have the ability to print the calculated cluster configuration.
|
6
|
+
|
7
|
+
```
|
8
|
+
dev-lxc show-config
|
9
|
+
```
|
10
|
+
|
11
|
+
### Cluster status
|
12
|
+
|
13
|
+
Run the following command to see the status of the cluster.
|
14
|
+
|
15
|
+
```
|
16
|
+
dev-lxc status
|
17
|
+
```
|
18
|
+
|
19
|
+
This is an example of the output.
|
20
|
+
|
21
|
+
```
|
22
|
+
chef.lxc NOT_CREATED
|
23
|
+
|
24
|
+
analytics.lxc NOT_CREATED
|
25
|
+
|
26
|
+
supermarket.lxc NOT_CREATED
|
27
|
+
|
28
|
+
node-1.lxc NOT_CREATED
|
29
|
+
```
|
30
|
+
|
31
|
+
### Specifying a Subset of Servers
|
32
|
+
|
33
|
+
Many dev-lxc subcommands can act on a subset of the cluster's servers by specifying a regular expression that matches the desired server names.
|
34
|
+
|
35
|
+
For example, the following command will show the status of the Chef Server.
|
36
|
+
|
37
|
+
```
|
38
|
+
dev-lxc status chef
|
39
|
+
```
|
40
|
+
|
41
|
+
### cluster-view, tks, tls commands
|
42
|
+
|
43
|
+
The dev-lxc-platform comes with some commands that create and manage helpful
|
44
|
+
tmux/byobu sessions to more easily see the state of a cluster.
|
45
|
+
|
46
|
+
Running the `cluster-view` command in the same directory as a `dev-lxc.yml` file
|
47
|
+
creates a tmux/byobu session with the same name as the cluster's directory.
|
48
|
+
|
49
|
+
`cluster-view` can also be run with the parent directory of a `dev-lxc.yml` file
|
50
|
+
as the first argument and `cluster-view` will change to that directory before
|
51
|
+
creating the tmux/byobu session.
|
52
|
+
|
53
|
+
The session's first window is named "cluster".
|
54
|
+
|
55
|
+
The left side is for running dev-lxc commands.
|
56
|
+
|
57
|
+
The right side updates every 0.5 seconds with the cluster's status provided by `dev-lxc status`.
|
58
|
+
|
59
|
+
The session's second window is named "shell". It opens in the same directory as the
|
60
|
+
cluster's `dev-lxc.yml` file.
|
61
|
+
|
62
|
+
The `tls` and `tks` commands are really aliases.
|
63
|
+
|
64
|
+
`tls` is an alias for `tmux list-sessions` and is used to see what tmux/byobu sessions
|
65
|
+
are running.
|
66
|
+
|
67
|
+
`tks` is an alias for `tmux kill-session -t` and is used to kill tmux/byobu sessions.
|
68
|
+
When specifying the session to be killed you only need as many characters of the session
|
69
|
+
name that are required to make the name unique among the list of running sessions.
|
70
|
+
|
71
|
+
I recommend switching to a different running tmux/byobu session before killing the current
|
72
|
+
tmux/byobu session. Otherwise you will need to reattach to the remaining tmux/byobu session.
|
73
|
+
Use the keyboard shortcuts Alt-Up/Down to easily switch between tmux/byobu sessions.
|
74
|
+
|
75
|
+
### Start cluster
|
76
|
+
|
77
|
+
Starting the cluster the first time takes awhile since it has a lot to download and build.
|
78
|
+
|
79
|
+
```
|
80
|
+
dev-lxc up
|
81
|
+
```
|
82
|
+
|
83
|
+
A test org, users, knife.rb and keys are automatically created in
|
84
|
+
the bootstrap backend server in `/root/chef-repo/.chef` for testing purposes.
|
85
|
+
|
86
|
+
The `knife-opc` plugin is installed in the embedded ruby environment of the
|
87
|
+
Private Chef and Enterprise Chef server to facilitate the creation of the test
|
88
|
+
org and user.
|
89
|
+
|
90
|
+
Note: You also have the option of running the `prepare-product-cache` subcommand which downloads required product packages to the cache.
|
91
|
+
This can be helpful when you don't want to start building the cluster yet but you want the package cache ready when you build the cluster later.
|
92
|
+
|
93
|
+
```
|
94
|
+
dev-lxc prepare-product-cache
|
95
|
+
```
|
96
|
+
|
97
|
+
### Print Chef Automate Credentials
|
98
|
+
|
99
|
+
If the cluster has a Chef Automate server you can use the `print-automate-credentials` subcommand to see what the login credentials.
|
100
|
+
|
101
|
+
```
|
102
|
+
dev-lxc print-automate-credentials
|
103
|
+
```
|
104
|
+
|
105
|
+
### Create chef-repo
|
106
|
+
|
107
|
+
Create a local chef-repo with appropriate knife.rb and pem files.
|
108
|
+
|
109
|
+
Use the `-p` option to also get pivotal.pem and pivotal.rb files.
|
110
|
+
|
111
|
+
Use the `-f` option to overwrite existing knife.rb and pivotal.rb files.
|
112
|
+
|
113
|
+
```
|
114
|
+
dev-lxc chef-repo
|
115
|
+
```
|
116
|
+
|
117
|
+
Now you can easily use knife to access the cluster.
|
118
|
+
|
119
|
+
```
|
120
|
+
cd chef-repo
|
121
|
+
knife client list
|
122
|
+
```
|
123
|
+
|
124
|
+
### Stop and start the cluster
|
125
|
+
|
126
|
+
```
|
127
|
+
dev-lxc halt
|
128
|
+
dev-lxc up
|
129
|
+
```
|
130
|
+
|
131
|
+
### Run arbitrary commands in each server
|
132
|
+
|
133
|
+
```
|
134
|
+
dev-lxc run-command chef 'uptime'
|
135
|
+
```
|
136
|
+
|
137
|
+
### Attach the terminal to a server
|
138
|
+
|
139
|
+
Attach the terminal to a server in the cluster that matches the REGEX pattern given.
|
140
|
+
|
141
|
+
```
|
142
|
+
dev-lxc attach chef
|
143
|
+
```
|
144
|
+
|
145
|
+
### Create a snapshot of the servers
|
146
|
+
|
147
|
+
Save the changes in the servers to snapshots with a comment.
|
148
|
+
|
149
|
+
```
|
150
|
+
dev-lxc halt
|
151
|
+
dev-lxc snapshot -c 'this is a snapshot comment'
|
152
|
+
```
|
153
|
+
|
154
|
+
### List snapshots
|
155
|
+
|
156
|
+
```
|
157
|
+
dev-lxc snapshot -l
|
158
|
+
```
|
159
|
+
|
160
|
+
### Restore snapshots
|
161
|
+
|
162
|
+
Restore snapshots by name.
|
163
|
+
|
164
|
+
Leave out the snapshot name or specify `LAST` to restore the most recent snapshot.
|
165
|
+
|
166
|
+
```
|
167
|
+
dev-lxc snapshot -r
|
168
|
+
dev-lxc up
|
169
|
+
```
|
170
|
+
|
171
|
+
### Destroy snapshots
|
172
|
+
|
173
|
+
Destroy snapshots by name or destroy all snapshots by specifying `ALL`.
|
174
|
+
|
175
|
+
Leave out the snapshot name or specify `LAST` to destroy the most recent snapshots.
|
176
|
+
|
177
|
+
```
|
178
|
+
dev-lxc snapshot -d
|
179
|
+
```
|
180
|
+
|
181
|
+
### Destroy cluster
|
182
|
+
|
183
|
+
Use the following command to destroy the cluster's servers.
|
184
|
+
|
185
|
+
```
|
186
|
+
dev-lxc destroy
|
187
|
+
```
|