Skip to content

Commit b0d1341

Browse files
committed
Updates the documentation to add package/deploy
1 parent f6cb942 commit b0d1341

File tree

3 files changed

+87
-32
lines changed

3 files changed

+87
-32
lines changed

README.md

Lines changed: 71 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ An opinionated LXC wrapper.
1717
- [CLI Usage](#cli-usage)
1818
- [Requirements](#requirements)
1919
- [Limitations](#limitations)
20-
- [Roadmap](#roadmap)
2120
- [Development](#development)
2221
- [API](#api)
2322
- [Functions](#functions)
@@ -26,6 +25,8 @@ An opinionated LXC wrapper.
2625
- [`start`](#start)
2726
- [`stop`](#stop)
2827
- [`ls`](#ls)
28+
- [`package`](#package)
29+
- [`deploy`](#deploy)
2930
- [Variables](#variables)
3031
- [`*lxc-default-folder*`](#lxc-default-folder)
3132
- [`*lxc-rootfs*`](#lxc-rootfs)
@@ -38,6 +39,8 @@ An opinionated LXC wrapper.
3839
- [`*ip-regex*`](#ip-regex)
3940
- [`*lxc-interfaces-file*`](#lxc-interfaces-file)
4041
- [`*default-shell*`](#default-shell)
42+
- [`*lxc-package-extension*`](#lxc-package-extension)
43+
- [`*lxc-config*`](#lxc-config)
4144
- [License](#license)
4245

4346
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
@@ -153,33 +156,44 @@ Wrapper around lxc for an opinionated workflow.
153156
154157
Commands:
155158
156-
create NAME
157-
creates a container named NAME
159+
create NAME
160+
creates a container named NAME
158161
159-
Options (must be BEFORE the command):
160-
--base=BASE
161-
clone BASE
162-
--template=TEMPLATE
163-
use the TEMPLATE lxc template
164-
--lxc-default-folder, --lxc-rootfs, --lxc-folder, --lxc-extension, --lxc-gateway, --default-dns-nameserver, --hosts-file, --lxc-interfaces-file
162+
Options (must be BEFORE the command):
163+
--base=BASE
164+
clone BASE
165+
--template=TEMPLATE
166+
use the TEMPLATE lxc template
167+
--lxc-default-folder, --lxc-rootfs, --lxc-folder, --lxc-extens
168+
ion, --lxc-gateway, --default-dns-nameserver, --hosts-file, --lxc-interfaces-file
165169
166-
start NAME
167-
starts the container named NAME
170+
start NAME
171+
starts the container named NAME
168172
169-
stop NAME
170-
stops the container named NAME
173+
stop NAME
174+
stops the container named NAME
171175
172-
ls
173-
lists the containers
176+
ls
177+
lists the containers
174178
175-
destroy NAME
176-
destroys the container named NAME
179+
destroy NAME
180+
destroys the container named NAME
177181
178-
Options (must be BEFORE the command):
179-
--lxc-folder, --lxc-host-extension, --hosts-file
182+
Options (must be BEFORE the command):
183+
--lxc-folder, --lxc-host-extension, --hosts-file
180184
181-
Options for all commands (must be BEFORE the command):
182-
--default-shell
185+
package NAME
186+
packages the container named NAME
187+
188+
Options (must be BEFORE the command):
189+
--archive-path=PATH
190+
the path of the archive
191+
192+
deploy --archive ARCHIVE NAME
193+
deploys the ARCHIVE in a container named NAME
194+
195+
Options for all commands (must be BEFORE the command):
196+
--default-shell
183197
```
184198

185199
## Requirements
@@ -200,12 +214,6 @@ Known limitations:
200214
containers **with lxc-wrapper** on one host.
201215
- Autostart management not supported yet.
202216

203-
## Roadmap
204-
205-
Ideas I want to eventually implement:
206-
207-
- `package`: to create a template from an existing container.
208-
209217
## Development
210218

211219
You need:
@@ -294,6 +302,26 @@ Stops an LXC. The argument can be a string or a symbol.
294302

295303
Returns the fancy output of the list of LXCs.
296304

305+
#### `package`
306+
307+
```lisp
308+
(defcommand package (name)
309+
"Packages an LXC"
310+
```
311+
312+
Packages an LXC into an shareable archive file.
313+
314+
#### `deploy`
315+
316+
```lisp
317+
(defcommand deploy (name args)
318+
"Deploys an archive created by lxc-wrapper"
319+
(destructuring-bind (&key archive)
320+
args
321+
```
322+
323+
Deploys an archive created by `lxc-wrapper package`.
324+
297325
### Variables
298326

299327
Variables are used throughout the code to be able to customize them
@@ -387,6 +415,22 @@ Default value: `/bin/bash`
387415

388416
The shell used by the commands.
389417

418+
#### `*lxc-package-extension*`
419+
420+
Used by: `package`
421+
422+
Default value: `.tar.gz`
423+
424+
The extension to give to archives created by `package`.
425+
426+
#### `*lxc-config*`
427+
428+
Used by: `deploy`
429+
430+
Default value: `#p"config"`
431+
432+
The name of the configuration file of the containers.
433+
390434
## License
391435

392436
MIT License.

src/cli.lisp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,16 @@ Commands:
100100
Options (must be BEFORE the command):
101101
--lxc-folder, --lxc-host-extension, --hosts-file
102102
103+
package NAME
104+
packages the container named NAME
105+
106+
Options (must be BEFORE the command):
107+
--archive-path=PATH
108+
the path of the archive
109+
110+
deploy --archive ARCHIVE NAME
111+
deploys the ARCHIVE in a container named NAME
112+
103113
Options for all commands (must be BEFORE the command):
104114
--default-shell
105115

src/lxc-wrapper.lisp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@
100100

101101
(defcommand deploy (name args)
102102
"Deploys an archive created by lxc-wrapper"
103-
(let* ((cli-name (adapt-arg name))
104-
(lxc-path (merge-pathnames (concatenate 'string cli-name "/")
105-
*lxc-default-folder*)))
106-
(destructuring-bind (&key archive)
107-
args
103+
(destructuring-bind (&key archive)
104+
args
105+
(let* ((cli-name (adapt-arg name))
106+
(lxc-path (merge-pathnames (concatenate 'string cli-name "/")
107+
*lxc-default-folder*)))
108108
(run
109109
"mkdir" "-p" lxc-path)
110110
(format t "Deploying ~A..." cli-name)
@@ -115,6 +115,7 @@
115115
(fix-lxc-config cli-name lxc-path *lxc-config*)
116116
(format t " done.~%")
117117
(init-lxc cli-name *hosts-file*))))
118+
118119
(defun adapt-arg (name)
119120
"Adapts an argument to string"
120121
(when (symbolp name)

0 commit comments

Comments
 (0)