confctl 1.0.0

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