confctl 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +11 -0
  3. data/.gitignore +8 -0
  4. data/.overcommit.yml +6 -0
  5. data/.rubocop.yml +67 -0
  6. data/.rubocop_todo.yml +5 -0
  7. data/.ruby-version +1 -0
  8. data/CHANGELOG.md +2 -0
  9. data/Gemfile +2 -0
  10. data/LICENSE.txt +674 -0
  11. data/README.md +522 -0
  12. data/Rakefile +40 -0
  13. data/bin/confctl +4 -0
  14. data/confctl.gemspec +33 -0
  15. data/example/.gitignore +2 -0
  16. data/example/README.md +38 -0
  17. data/example/cluster/cluster.nix +7 -0
  18. data/example/cluster/module-list.nix +3 -0
  19. data/example/cluster/nixos-machine/config.nix +15 -0
  20. data/example/cluster/nixos-machine/hardware.nix +4 -0
  21. data/example/cluster/nixos-machine/module.nix +8 -0
  22. data/example/cluster/vpsadminos-container/config.nix +22 -0
  23. data/example/cluster/vpsadminos-container/module.nix +8 -0
  24. data/example/cluster/vpsadminos-machine/config.nix +22 -0
  25. data/example/cluster/vpsadminos-machine/hardware.nix +4 -0
  26. data/example/cluster/vpsadminos-machine/module.nix +8 -0
  27. data/example/cluster/vpsfreecz-vps/config.nix +25 -0
  28. data/example/cluster/vpsfreecz-vps/module.nix +8 -0
  29. data/example/configs/confctl.nix +10 -0
  30. data/example/configs/swpins.nix +28 -0
  31. data/example/data/default.nix +5 -0
  32. data/example/data/ssh-keys.nix +7 -0
  33. data/example/environments/base.nix +13 -0
  34. data/example/modules/module-list.nix +13 -0
  35. data/example/shell.nix +11 -0
  36. data/example/swpins/channels/nixos-unstable.json +35 -0
  37. data/example/swpins/channels/vpsadminos-staging.json +35 -0
  38. data/lib/confctl/cli/app.rb +551 -0
  39. data/lib/confctl/cli/attr_filters.rb +51 -0
  40. data/lib/confctl/cli/cluster.rb +1248 -0
  41. data/lib/confctl/cli/command.rb +206 -0
  42. data/lib/confctl/cli/configuration.rb +296 -0
  43. data/lib/confctl/cli/gen_data.rb +97 -0
  44. data/lib/confctl/cli/generation.rb +335 -0
  45. data/lib/confctl/cli/log_view.rb +267 -0
  46. data/lib/confctl/cli/output_formatter.rb +288 -0
  47. data/lib/confctl/cli/swpins/base.rb +40 -0
  48. data/lib/confctl/cli/swpins/channel.rb +73 -0
  49. data/lib/confctl/cli/swpins/cluster.rb +80 -0
  50. data/lib/confctl/cli/swpins/core.rb +86 -0
  51. data/lib/confctl/cli/swpins/utils.rb +55 -0
  52. data/lib/confctl/cli/swpins.rb +5 -0
  53. data/lib/confctl/cli/tag_filters.rb +30 -0
  54. data/lib/confctl/cli.rb +5 -0
  55. data/lib/confctl/conf_cache.rb +105 -0
  56. data/lib/confctl/conf_dir.rb +88 -0
  57. data/lib/confctl/erb_template.rb +37 -0
  58. data/lib/confctl/exceptions.rb +3 -0
  59. data/lib/confctl/gcroot.rb +30 -0
  60. data/lib/confctl/generation/build.rb +145 -0
  61. data/lib/confctl/generation/build_list.rb +106 -0
  62. data/lib/confctl/generation/host.rb +35 -0
  63. data/lib/confctl/generation/host_list.rb +81 -0
  64. data/lib/confctl/generation/unified.rb +117 -0
  65. data/lib/confctl/generation/unified_list.rb +63 -0
  66. data/lib/confctl/git_repo_mirror.rb +79 -0
  67. data/lib/confctl/health_checks/base.rb +66 -0
  68. data/lib/confctl/health_checks/run_command.rb +179 -0
  69. data/lib/confctl/health_checks/systemd/properties.rb +84 -0
  70. data/lib/confctl/health_checks/systemd/property_check.rb +31 -0
  71. data/lib/confctl/health_checks/systemd/property_list.rb +20 -0
  72. data/lib/confctl/health_checks.rb +5 -0
  73. data/lib/confctl/hook.rb +35 -0
  74. data/lib/confctl/line_buffer.rb +53 -0
  75. data/lib/confctl/logger.rb +151 -0
  76. data/lib/confctl/machine.rb +107 -0
  77. data/lib/confctl/machine_control.rb +172 -0
  78. data/lib/confctl/machine_list.rb +108 -0
  79. data/lib/confctl/machine_status.rb +135 -0
  80. data/lib/confctl/module_options.rb +95 -0
  81. data/lib/confctl/nix.rb +382 -0
  82. data/lib/confctl/nix_build.rb +108 -0
  83. data/lib/confctl/nix_collect_garbage.rb +64 -0
  84. data/lib/confctl/nix_copy.rb +49 -0
  85. data/lib/confctl/nix_format.rb +124 -0
  86. data/lib/confctl/nix_literal_expression.rb +15 -0
  87. data/lib/confctl/parallel_executor.rb +43 -0
  88. data/lib/confctl/pattern.rb +9 -0
  89. data/lib/confctl/settings.rb +50 -0
  90. data/lib/confctl/std_line_buffer.rb +40 -0
  91. data/lib/confctl/swpins/change_set.rb +151 -0
  92. data/lib/confctl/swpins/channel.rb +62 -0
  93. data/lib/confctl/swpins/channel_list.rb +47 -0
  94. data/lib/confctl/swpins/cluster_name.rb +94 -0
  95. data/lib/confctl/swpins/cluster_name_list.rb +15 -0
  96. data/lib/confctl/swpins/core.rb +137 -0
  97. data/lib/confctl/swpins/deployed_info.rb +23 -0
  98. data/lib/confctl/swpins/spec.rb +20 -0
  99. data/lib/confctl/swpins/specs/base.rb +184 -0
  100. data/lib/confctl/swpins/specs/directory.rb +51 -0
  101. data/lib/confctl/swpins/specs/git.rb +135 -0
  102. data/lib/confctl/swpins/specs/git_rev.rb +24 -0
  103. data/lib/confctl/swpins.rb +17 -0
  104. data/lib/confctl/system_command.rb +10 -0
  105. data/lib/confctl/user_script.rb +13 -0
  106. data/lib/confctl/user_scripts.rb +41 -0
  107. data/lib/confctl/utils/file.rb +21 -0
  108. data/lib/confctl/version.rb +3 -0
  109. data/lib/confctl.rb +43 -0
  110. data/man/man8/confctl-options.nix.8 +1334 -0
  111. data/man/man8/confctl-options.nix.8.md +1340 -0
  112. data/man/man8/confctl.8 +660 -0
  113. data/man/man8/confctl.8.md +654 -0
  114. data/nix/evaluator.nix +160 -0
  115. data/nix/lib/default.nix +83 -0
  116. data/nix/lib/machine/default.nix +74 -0
  117. data/nix/lib/machine/info.nix +5 -0
  118. data/nix/lib/swpins/eval.nix +71 -0
  119. data/nix/lib/swpins/options.nix +94 -0
  120. data/nix/machines.nix +31 -0
  121. data/nix/modules/cluster/default.nix +459 -0
  122. data/nix/modules/confctl/cli.nix +21 -0
  123. data/nix/modules/confctl/generations.nix +84 -0
  124. data/nix/modules/confctl/nix.nix +28 -0
  125. data/nix/modules/confctl/swpins.nix +55 -0
  126. data/nix/modules/module-list.nix +19 -0
  127. data/shell.nix +42 -0
  128. data/template/confctl-options.nix/main.erb +45 -0
  129. data/template/confctl-options.nix/options.erb +15 -0
  130. metadata +353 -0
@@ -0,0 +1,654 @@
1
+ # confctl 8 2020-11-01 master
2
+
3
+ ## NAME
4
+ `confctl` - Nix deployment management tool
5
+
6
+ ## SYNOPSIS
7
+ `confctl` [*global options*] *command* [*command options*] [*arguments...*]
8
+
9
+ ## DESCRIPTION
10
+ `confctl` is a Nix deployment configuration management tool. It can be used to
11
+ build and deploy *NixOS* and *vpsAdminOS* machines.
12
+
13
+ ## SOFTWARE PINS
14
+ Each machine managed by `confctl` uses predefined software packages
15
+ like `nixpkgs`, `vpsadminos` and possibly other components. These packages
16
+ are pinned to particular versions, e.g. specific git commits.
17
+
18
+ Software pins are defined in the Nix configuration and then prefetched using
19
+ `confctl`. Selected software pins are added to environment variable `NIX_PATH`
20
+ for `nix-build` and can also be read by `Nix` while building machines.
21
+
22
+ Software pins can be defined using channels or on specific machines.
23
+ The advantage of using channels is that changing a pin in a channel changes
24
+ also all machines that use the channel. Channels are defined in file
25
+ `configs/swpins.nix` using option `confctl.swpins.channels`. Deployments
26
+ declare software pins and channels in their respective `module.nix` files,
27
+ option `cluster.<name>.swpins.channels` is a list of channels to use and option
28
+ `cluster.<name>.swpins.pins` is an attrset of pins to extend or override pins
29
+ from channels.
30
+
31
+ Software pins declared in the Nix configuration have to be prefetched before
32
+ they can be used to build machines. See the `confctl swpins` command family
33
+ for more information.
34
+
35
+ ## PATTERNS
36
+ `confctl` commands accept patterns instead of names. These patterns work
37
+ similarly to shell patterns, see
38
+ <http://ruby-doc.org/core/File.html#method-c-fnmatch-3F> for more
39
+ information.
40
+
41
+ ## GLOBAL OPTIONS
42
+ `-c`, `--color` `always`|`never`|`auto`
43
+ Set output color mode. Defaults to `auto`, which enables colors when
44
+ the standard output is connected to a terminal.
45
+
46
+ ## COMMANDS
47
+ `confctl init`
48
+ Create a new configuration in the current directory. The current directory
49
+ is set up to be used with `confctl`.
50
+
51
+ `confctl add` *name*
52
+ Add new machine to the configuration.
53
+
54
+ `confctl rename` *old-name* *new-name*
55
+ Rename machine from the configuration.
56
+
57
+ `confctl rediscover`
58
+ Auto-discover machines within the `cluster/` directory and generate a list
59
+ of their modules in `cluster/cluster.nix`.
60
+
61
+ `confctl ls` [*options*] [*machine-pattern*]
62
+ List matching machines available for deployment.
63
+
64
+ `--show-trace`
65
+ Enable traces in Nix.
66
+
67
+ `--managed` `y`|`yes`|`n`|`no`|`a`|`all`
68
+ The configuration can contain machines which are not managed by confctl
69
+ and are there just for reference. This option determines what kind of
70
+ machines should be listed.
71
+
72
+ `-L`, `--list`
73
+ List possible attributes that can be used with options `--output`
74
+ or `--attr` and exit.
75
+
76
+ `-o`, `--output` *attributes*
77
+ Comma-separated list of attributes to output. Defaults to the value
78
+ of option `confctl.list.columns`.
79
+
80
+ `-H`, `--hide-header`
81
+ Do not print the line with column labels.
82
+
83
+ `-a`, `--attr` *attribute*`=`*value* | *attribute*`!=`*value*
84
+ Filter machines by selected attribute, which is either tested for
85
+ equality or inequality. Any attribute from configuration module
86
+ `cluster.<name>` can be tested.
87
+
88
+ `-t`, `--tag` *tag*|`^`*tag*
89
+ Filter machines that have *tag* set. If the tag begins with `^`, then
90
+ filter machines that do not have *tag* set.
91
+
92
+ `confctl build` [*options*] [*machine-pattern*]
93
+ Build matching machines. The result of a build is one generation for each
94
+ built machine. Subsequent builds either return an existing generation if there
95
+ had been no changes for a machine or a new generation is created. Built
96
+ generations can be managed using `confctl generation` command family.
97
+
98
+ `--show-trace`
99
+ Enable traces in Nix.
100
+
101
+ `-a`, `--attr` *attribute*`=`*value* | *attribute*`!=`*value*
102
+ Filter machines by selected attribute, which is either tested for
103
+ equality or inequality. Any attribute from configuration module
104
+ `cluster.<name>` can be tested.
105
+
106
+ `-t`, `--tag` *tag*|`^`*tag*
107
+ Filter machines that have *tag* set. If the tag begins with `^`, then
108
+ filter machines that do not have *tag* set.
109
+
110
+ `-y`, `--yes`
111
+ Do not ask for confirmation on standard input, assume the answer is yes.
112
+
113
+ `-j`, `--max-jobs` *number*
114
+ Maximum number of build jobs, passed to `nix-build`. See man nix-build(1).
115
+
116
+ `confctl deploy` [*options*] [*machine-pattern* [`boot`|`switch`|`test`|`dry-activate`]]
117
+ Deploy either a new or an existing build generation to matching machines.
118
+
119
+ *switch-action* is the argument to `switch-to-configuration` called on
120
+ the target machine. The default action is `switch`.
121
+
122
+ `--show-trace`
123
+ Enable traces in Nix.
124
+
125
+ `-a`, `--attr` *attribute*`=`*value* | *attribute*`!=`*value*
126
+ Filter machines by selected attribute, which is either tested for
127
+ equality or inequality. Any attribute from configuration module
128
+ `cluster.<name>` can be tested.
129
+
130
+ `-t`, `--tag` *tag*|`^`*tag*
131
+ Filter machines that have *tag* set. If the tag begins with `^`, then
132
+ filter machines that do not have *tag* set.
133
+
134
+ `-y`, `--yes`
135
+ Do not ask for confirmation on standard input, assume the answer is yes.
136
+
137
+ `-g`, `--generation` *generation*|`current`
138
+ Do not build a new generation, but deploy an existing generation.
139
+
140
+ `--outdated`
141
+ Run `confctl status` and deploy only outdated machines. `confctl` will
142
+ first build machines described by *machine-pattern* and then check
143
+ their status.
144
+
145
+ `--outdated-swpins`
146
+ Run `confctl status -g none` and deploy only machines that have outdated
147
+ software pins.
148
+
149
+ `-i`, `--interactive`
150
+ Deploy machines one by one while asking for confirmation for activation.
151
+
152
+ `--dry-activate-first`
153
+ After the new system is copied to the target machine, try to switch the
154
+ configuration using *dry-activate* action to see what would happen before
155
+ the real switch.
156
+
157
+ `--one-by-one`
158
+ Instead of copying the systems to all machines in bulk before activations,
159
+ copy and deploy machines one by one.
160
+
161
+ `--max-concurrent-copy` *n*
162
+ Use at most *n* concurrent nix-copy-closure processes to deploy closures
163
+ to the target machines. Defaults to `5`.
164
+
165
+ `--copy-only`
166
+ Do not activate the copied closures.
167
+
168
+ `--reboot`
169
+ Applicable only when *switch-action* is `boot`. Reboot the machine after the
170
+ configuration is activated.
171
+
172
+ `--wait-online` [*seconds* | `wait` | `nowait`]
173
+ Determines whether to wait for the machines to come back online
174
+ if `--reboot` is used. `confctl` will wait for `600 seconds` by default.
175
+
176
+ `-j`, `--max-jobs` *number*
177
+ Maximum number of build jobs, passed to `nix-build`. See man nix-build(1).
178
+
179
+ `--no-health-checks`
180
+ Do not run configured health checks. Health checks are run by default
181
+ when *switch-action* is `switch`, `test` or `boot` with `--reboot`.
182
+
183
+ `--keep-going`
184
+ Do not abort when health checks fail.
185
+
186
+ `confctl health-check` [*options*] [*machine-pattern*]
187
+ Run health checks on all or selected machines.
188
+
189
+ `-a`, `--attr` *attribute*`=`*value* | *attribute*`!=`*value*
190
+ Filter machines by selected attribute, which is either tested for
191
+ equality or inequality. Any attribute from configuration module
192
+ `cluster.<name>` can be tested.
193
+
194
+ `-t`, `--tag` *tag*|`^`*tag*
195
+ Filter machines that have *tag* set. If the tag begins with `^`, then
196
+ filter machines that do not have *tag* set.
197
+
198
+ `-y`, `--yes`
199
+ Do not ask for confirmation on standard input, assume the answer is yes.
200
+
201
+ `-j`, `--max-jobs` *number*
202
+ Maximum number of check jobs, defaults to `5`.
203
+
204
+ `confctl status` [*options*] [*machine-pattern*]
205
+ Probe managed machines and determine their status.
206
+
207
+ `-a`, `--attr` *attribute*`=`*value* | *attribute*`!=`*value*
208
+ Filter machines by selected attribute, which is either tested for
209
+ equality or inequality. Any attribute from configuration module
210
+ `cluster.<name>` can be tested.
211
+
212
+ `-t`, `--tag` *tag*|`^`*tag*
213
+ Filter machines that have *tag* set. If the tag begins with `^`, then
214
+ filter machines that do not have *tag* set.
215
+
216
+ `-y`, `--yes`
217
+ Do not ask for confirmation on standard input, assume the answer is yes.
218
+
219
+ `-g`, `--generation` *generation*|`current`|`none`
220
+ Check status against a selected generation instead of a new build. If set
221
+ to `none`, only the currently configured software pins are checked and not
222
+ the system version itself.
223
+
224
+ `-j`, `--max-jobs` *number*
225
+ Maximum number of build jobs, passed to `nix-build`. See man nix-build(1).
226
+
227
+ `confctl changelog` [*options*] [*machine-pattern* [*sw-pattern*]]
228
+ Show differences in deployed and configured software pins. For git software
229
+ pins, it's a git log.
230
+
231
+ By default, `confctl` assumes that the configuration contains upgraded
232
+ software pins, i.e. that the configuration is equal to or ahead of the deployed
233
+ machines. `confctl changelog` then prints a lists of changes that are missing
234
+ from the deployed machines. Too see a changelog for downgrade, use option
235
+ `-d`, `--downgrade`.
236
+
237
+ `confctl changelog` will not show changes to the deployment configuration
238
+ itself, it works only on software pins.
239
+
240
+ `-a`, `--attr` *attribute*`=`*value* | *attribute*`!=`*value*
241
+ Filter machines by selected attribute, which is either tested for
242
+ equality or inequality. Any attribute from configuration module
243
+ `cluster.<name>` can be tested.
244
+
245
+ `-t`, `--tag` *tag*|`^`*tag*
246
+ Filter machines that have *tag* set. If the tag begins with `^`, then
247
+ filter machines that do not have *tag* set.
248
+
249
+ `-y`, `--yes`
250
+ Do not ask for confirmation on standard input, assume the answer is yes.
251
+
252
+ `-g`, `--generation` *generation*|`current`
253
+ Show changelog against software pins from a selected generation instead
254
+ of the current configuration.
255
+
256
+ `-d`, `--downgrade`
257
+ Use when the configuration has older software pins than deployed machines,
258
+ e.g. when doing a downgrade. Show a list of changes that are deployed
259
+ on the machines and are missing in the configured software pins.
260
+
261
+ `-v`, `--verbose`
262
+ Show full-length changelog descriptions.
263
+
264
+ `-p`, `--patch`
265
+ Show patches.
266
+
267
+ `-j`, `--max-jobs` *number*
268
+ Maximum number of build jobs, passed to `nix-build`. See man nix-build(1).
269
+
270
+ `confctl diff` [*options*] [*machine-pattern* [*sw-pattern*]]
271
+ Show differences in deployed and configured software pins. For git software
272
+ pins, it's a git diff.
273
+
274
+ By default, `confctl` assumes that the configuration contains upgraded
275
+ software pins, i.e. that the configuration is equal to or ahead of the deployed
276
+ machines. `confctl diff` then considers changes that are missing from the
277
+ deployed machines. Too see a diff for downgrade, use option
278
+ `-d`, `--downgrade`.
279
+
280
+ `confctl diff` will not show changes to the deployment configuration
281
+ itself, it works only on software pins.
282
+
283
+ `-a`, `--attr` *attribute*`=`*value* | *attribute*`!=`*value*
284
+ Filter machines by selected attribute, which is either tested for
285
+ equality or inequality. Any attribute from configuration module
286
+ `cluster.<name>` can be tested.
287
+
288
+ `-t`, `--tag` *tag*|`^`*tag*
289
+ Filter machines that have *tag* set. If the tag begins with `^`, then
290
+ filter machines that do not have *tag* set.
291
+
292
+ `-y`, `--yes`
293
+ Do not ask for confirmation on standard input, assume the answer is yes.
294
+
295
+ `-g`, `--generation` *generation*|`current`
296
+ Show diff against software pins from a selected generation instead
297
+ of the current configuration.
298
+
299
+ `-d`, `--downgrade`
300
+ Use when the configuration has older software pins than deployed machines,
301
+ e.g. when doing a downgrade. Show a list of changes that are deployed
302
+ on the machines and are missing in the configured software pins.
303
+
304
+ `-j`, `--max-jobs` *number*
305
+ Maximum number of build jobs, passed to `nix-build`. See man nix-build(1).
306
+
307
+ `confctl test-connection` [*options*] [*machine-pattern*]
308
+ Try to open a SSH connection to the selected machines. This command can be
309
+ used to confirm SSH host keys of the selected machines.
310
+
311
+ `--managed` `y`|`yes`|`n`|`no`|`a`|`all`
312
+ The configuration can contain machines which are not managed by confctl
313
+ and are there just for reference. This option determines what kind of
314
+ machines should be selected.
315
+
316
+ `-a`, `--attr` *attribute*`=`*value* | *attribute*`!=`*value*
317
+ Filter machines by selected attribute, which is either tested for
318
+ equality or inequality. Any attribute from configuration module
319
+ `cluster.<name>` can be tested.
320
+
321
+ `-t`, `--tag` *tag*|`^`*tag*
322
+ Filter machines that have *tag* set. If the tag begins with `^`, then
323
+ filter machines that do not have *tag* set.
324
+
325
+ `-y`, `--yes`
326
+ Do not ask for confirmation on standard input, assume the answer is yes.
327
+
328
+ `confctl ssh` [*options*] [*machine-pattern* [*command* [*arguments...*]]]
329
+ Run command over SSH on the selected machines. If *machine-pattern* matches
330
+ only one machine and no *command* is provided, an interactive shell is started.
331
+
332
+ `--managed` `y`|`yes`|`n`|`no`|`a`|`all`
333
+ The configuration can contain machines which are not managed by confctl
334
+ and are there just for reference. This option determines what kind of
335
+ machines should be selected.
336
+
337
+ `-a`, `--attr` *attribute*`=`*value* | *attribute*`!=`*value*
338
+ Filter machines by selected attribute, which is either tested for
339
+ equality or inequality. Any attribute from configuration module
340
+ `cluster.<name>` can be tested.
341
+
342
+ `-t`, `--tag` *tag*|`^`*tag*
343
+ Filter machines that have *tag* set. If the tag begins with `^`, then
344
+ filter machines that do not have *tag* set.
345
+
346
+ `-y`, `--yes`
347
+ Do not ask for confirmation on standard input, assume the answer is yes.
348
+
349
+ `-p`, `--parallel`
350
+ Run the command on all machines in parallel. By default, the command is run
351
+ on machines sequentially.
352
+
353
+ `-g`, `--aggregate`
354
+ If the command has the same output and exit status on a group of one or more
355
+ machines, print it just once for the group. This option suppresses output
356
+ until the command has been run on all machines.
357
+
358
+ `-i`, `--input-string` *data*
359
+ Data passed to the executed command on standard input.
360
+
361
+ `-f`, `--input-file` *file*
362
+ Pass *file* as standard input to the executed command.
363
+
364
+ `confctl cssh` [*options*] [*machine-pattern*]
365
+ Open ClusterSSH to selected or all machines.
366
+
367
+ `--managed` `y`|`yes`|`n`|`no`|`a`|`all`
368
+ The configuration can contain machines which are not managed by confctl
369
+ and are there just for reference. This option determines what kind of
370
+ machines should be selected.
371
+
372
+ `-a`, `--attr` *attribute*`=`*value* | *attribute*`!=`*value*
373
+ Filter machines by selected attribute, which is either tested for
374
+ equality or inequality. Any attribute from configuration module
375
+ `cluster.<name>` can be tested.
376
+
377
+ `-t`, `--tag` *tag*|`^`*tag*
378
+ Filter machines that have *tag* set. If the tag begins with `^`, then
379
+ filter machines that do not have *tag* set.
380
+
381
+ `-y`, `--yes`
382
+ Do not ask for confirmation on standard input, assume the answer is yes.
383
+
384
+ `confctl generation ls` [*machine-pattern* [*generation-pattern*]|*n*`d`|`old`]
385
+ List all or selected generations. By default only local build generations
386
+ are listed.
387
+
388
+ `-a`, `--attr` *attribute*`=`*value* | *attribute*`!=`*value*
389
+ Filter machines by selected attribute, which is either tested for
390
+ equality or inequality. Any attribute from configuration module
391
+ `cluster.<name>` can be tested.
392
+
393
+ `-t`, `--tag` *tag*|`^`*tag*
394
+ Filter machines that have *tag* set. If the tag begins with `^`, then
395
+ filter machines that do not have *tag* set.
396
+
397
+ `-l`, `--local`
398
+ List build generations.
399
+
400
+ `-r`, `--remote`
401
+ List remote generations found on deployed machines.
402
+
403
+ `confctl generation rm` [*machine-pattern* [*generation-pattern*|*n*`d`|`old`]]
404
+ Remove selected generations.
405
+
406
+ *n*`d` will remove generations older than *n* days.
407
+
408
+ `old` will remove all generations except the current one, i.e. the one that
409
+ was built by `confctl build` the last.
410
+
411
+ By default, only local build generations are considered.
412
+
413
+ `-a`, `--attr` *attribute*`=`*value* | *attribute*`!=`*value*
414
+ Filter machines by selected attribute, which is either tested for
415
+ equality or inequality. Any attribute from configuration module
416
+ `cluster.<name>` can be tested.
417
+
418
+ `-t`, `--tag` *tag*|`^`*tag*
419
+ Filter machines that have *tag* set. If the tag begins with `^`, then
420
+ filter machines that do not have *tag* set.
421
+
422
+ `-y`, `--yes`
423
+ Do not ask for confirmation on standard input, assume the answer is yes.
424
+
425
+ `-l`, `--local`
426
+ Consider local build generations.
427
+
428
+ `-r`, `--remote`
429
+ Consider generations found on deployed machines.
430
+
431
+ `--[no-]gc`, `--[no-]collect-garbage`
432
+ Run `nix-collect-garbage` to delete unreachable store paths from deployed
433
+ machines where generations were removed. Enabled by default.
434
+
435
+ `--max-concurrent-gc` *n*
436
+ Run `nix-collect-garbage` at most on *n* machines at the same time.
437
+ Defaults to `5`.
438
+
439
+ `confctl generation rotate` [*options*] [*machine-pattern*]
440
+ Delete old build generations of all or selected machines. Old generations are
441
+ deleted based on rules configured in `configs/confctl.nix`.
442
+
443
+ This command deletes old build generations from `confctl`, and given machine
444
+ configuration also runs `nix-collect-garbage`.
445
+
446
+ `-a`, `--attr` *attribute*`=`*value* | *attribute*`!=`*value*
447
+ Filter machines by selected attribute, which is either tested for
448
+ equality or inequality. Any attribute from configuration module
449
+ `cluster.<name>` can be tested.
450
+
451
+ `-t`, `--tag` *tag*|`^`*tag*
452
+ Filter machines that have *tag* set. If the tag begins with `^`, then
453
+ filter machines that do not have *tag* set.
454
+
455
+ `-y`, `--yes`
456
+ Do not ask for confirmation on standard input, assume the answer is yes.
457
+
458
+ `-l`, `--local`
459
+ Consider local build generations.
460
+
461
+ `-r`, `--remote`
462
+ Consider generations found on deployed machines.
463
+
464
+ `--max-concurrent-gc` *n*
465
+ Run `nix-collect-garbage` at most on *n* machines at the same time.
466
+ Defaults to `5`.
467
+
468
+ `confctl collect-garbage` [*options*] [*machine-pattern*]
469
+ Run `nix-collect-garbage` on all or selected machines to delete unreachable
470
+ store paths.
471
+
472
+ `-a`, `--attr` *attribute*`=`*value* | *attribute*`!=`*value*
473
+ Filter machines by selected attribute, which is either tested for
474
+ equality or inequality. Any attribute from configuration module
475
+ `cluster.<name>` can be tested.
476
+
477
+ `-t`, `--tag` *tag*|`^`*tag*
478
+ Filter machines that have *tag* set. If the tag begins with `^`, then
479
+ filter machines that do not have *tag* set.
480
+
481
+ `-y`, `--yes`
482
+ Do not ask for confirmation on standard input, assume the answer is yes.
483
+
484
+ `--max-concurrent-gc` *n*
485
+ Run `nix-collect-garbage` at most on *n* machines at the same time.
486
+ Defaults to `5`.
487
+
488
+ `confctl gen-data vpsadmin all`
489
+ Generate all required data files from vpsAdmin API.
490
+
491
+ `confctl gen-data vpsadmin containers`
492
+ Generate container data files from vpsAdmin API.
493
+
494
+ `confctl gen-data vpsadmin network`
495
+ Generate network data files from vpsAdmin API.
496
+
497
+ `confctl swpins cluster ls` [*name-pattern* [*sw-pattern*]]
498
+ List cluster machines with pinned software packages.
499
+
500
+ `confctl swpins cluster set` *name-pattern* *sw-pattern* *version...*
501
+ Set selected software packages to new *version*. The value of *version* depends
502
+ on the type of the software pin, for git it is a git reference, e.g. a revision.
503
+
504
+ `--[no-]commit`
505
+ Commit changed swpins files to git. Disabled by default.
506
+
507
+ `--[no-]changelog`
508
+ Include changelog in the commit message when `--commit` is used. Enabled by
509
+ default.
510
+
511
+ `-d`, `--downgrade`
512
+ Use when the new version is older than the previously set version. Used for
513
+ generating changelog for the commit message.
514
+
515
+ `confctl swpins cluster update` [*name-pattern* [*sw-pattern*]]
516
+ Update selected or all software packages that have been configured to support
517
+ this command. The usual case for git is to pin to the current branch head.
518
+
519
+ `--[no-]commit`
520
+ Commit changed swpins files to git. Disabled by default.
521
+
522
+ `--[no-]changelog`
523
+ Include changelog in the commit message when `--commit` is used. Enabled by
524
+ default.
525
+
526
+ `-d`, `--downgrade`
527
+ Use when the new version is older than the previously set version. Used for
528
+ generating changelog for the commit message.
529
+
530
+ `confctl swpins channel ls` [*channel-pattern* [*sw-pattern*]]
531
+ List existing channels with pinned software packages.
532
+
533
+ `confctl swpins channel set` *channel-pattern* *sw-pattern* *version...*
534
+ Set selected software packages in channels to new *version*. The value
535
+ of *version* depends on the type of the software pin, for git it is a git
536
+ reference, e.g. a revision.
537
+
538
+ `--[no-]commit`
539
+ Commit changed swpins files to git. Disabled by default.
540
+
541
+ `--[no-]changelog`
542
+ Include changelog in the commit message when `--commit` is used. Enabled by
543
+ default.
544
+
545
+ `-d`, `--downgrade`
546
+ Use when the new version is older than the previously set version. Used for
547
+ generating changelog for the commit message.
548
+
549
+ `confctl swpins channel update` [*channel-pattern* [*sw-pattern*]]
550
+ Update selected or all software packages in channels that have been configured
551
+ to support this command. The usual case for git is to pin to the current
552
+ branch head.
553
+
554
+ `--[no-]commit`
555
+ Commit changed swpins files to git. Disabled by default.
556
+
557
+ `--[no-]changelog`
558
+ Include changelog in the commit message when `--commit` is used. Enabled by
559
+ default.
560
+
561
+ `-d`, `--downgrade`
562
+ Use when the new version is older than the previously set version. Used for
563
+ generating changelog for the commit message.
564
+
565
+ `confctl swpins core ls` [*sw-pattern*]
566
+ List core software packages used internally by confctl.
567
+
568
+ `confctl swpins core set` *sw-pattern* *version...*
569
+ Set selected core software package to new *version*. The value
570
+ of *version* depends on the type of the software pin, for git it is a git
571
+ reference, e.g. a revision.
572
+
573
+ `--[no-]commit`
574
+ Commit changed swpins files to git. Disabled by default.
575
+
576
+ `--[no-]changelog`
577
+ Include changelog in the commit message when `--commit` is used. Enabled by
578
+ default.
579
+
580
+ `-d`, `--downgrade`
581
+ Use when the new version is older than the previously set version. Used for
582
+ generating changelog for the commit message.
583
+
584
+ `confctl swpins core update` [*sw-pattern*]
585
+ Update selected or all core software packages that have been configured
586
+ to support this command. The usual case for git is to pin to the current
587
+ branch head.
588
+
589
+ `--[no-]commit`
590
+ Commit changed swpins files to git. Disabled by default.
591
+
592
+ `--[no-]changelog`
593
+ Include changelog in the commit message when `--commit` is used. Enabled by
594
+ default.
595
+
596
+ `-d`, `--downgrade`
597
+ Use when the new version is older than the previously set version. Used for
598
+ generating changelog for the commit message.
599
+
600
+ `confctl swpins update`
601
+ Update software pins that have been configured for updates, including pins
602
+ in all channels, all machine-specific pins and the core pins.
603
+
604
+ `--[no-]commit`
605
+ Commit changed swpins files to git. Disabled by default.
606
+
607
+ `--[no-]changelog`
608
+ Include changelog in the commit message when `--commit` is used. Enabled by
609
+ default.
610
+
611
+ `-d`, `--downgrade`
612
+ Use when the new version is older than the previously set version. Used for
613
+ generating changelog for the commit message.
614
+
615
+ `confctl swpins reconfigure`
616
+ Regenerate all confctl-managed software pin files according to the Nix
617
+ configuration.
618
+
619
+ ## USER-DEFINED COMMANDS
620
+ User-defined Ruby scripts can be placed in directory `scripts`. Each script
621
+ should create a subclass of `ConfCtl::UserScript` and call class-method `register`.
622
+ Scripts can define their own `confctl` subcommands.
623
+
624
+ ### Example user script
625
+
626
+ ```
627
+ class MyScript < ConfCtl::UserScript
628
+ register
629
+
630
+ def setup_cli(app)
631
+ app.desc 'My CLI command'
632
+ app.command 'my-command' do |c|
633
+ c.action &ConfCtl::Cli::Command.run(c, MyCommand, :run)
634
+ end
635
+ end
636
+ end
637
+
638
+ class MyCommand < ConfCtl::Cli::Command
639
+ def run
640
+ puts 'Hello world'
641
+ end
642
+ end
643
+ ```
644
+
645
+ ## SEE ALSO
646
+ confctl-options.nix(8)
647
+
648
+ ## BUGS
649
+ Report bugs to https://github.com/vpsfreecz/confctl/issues.
650
+
651
+ ## ABOUT
652
+ `confctl` was originally developed for the purposes of
653
+ [vpsFree.cz](https://vpsfree.org) and its cluster
654
+ [configuration](https://github.com/vpsfreecz/vpsfree-cz-configuration).