config_o_mat 0.1.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 (71) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.rspec +1 -0
  4. data/.ruby-gemset +1 -0
  5. data/.ruby-version +1 -0
  6. data/Gemfile +26 -0
  7. data/Gemfile.lock +56 -0
  8. data/LICENSE +202 -0
  9. data/NOTICE +2 -0
  10. data/README.md +15 -0
  11. data/Rakefile +35 -0
  12. data/bin/config_o_mat-configurator +49 -0
  13. data/bin/config_o_mat-meta_configurator +49 -0
  14. data/config_o_mat.gemspec +49 -0
  15. data/design/configurator_lifecycle_test.dot +91 -0
  16. data/design/original_design.md +45 -0
  17. data/lib/config_o_mat/configurator/cond/first_run.rb +29 -0
  18. data/lib/config_o_mat/configurator/cond/next_state.rb +29 -0
  19. data/lib/config_o_mat/configurator/cond/profiles_to_apply.rb +29 -0
  20. data/lib/config_o_mat/configurator/cond/retries_left.rb +37 -0
  21. data/lib/config_o_mat/configurator/cond/services_to_reload.rb +29 -0
  22. data/lib/config_o_mat/configurator/cond.rb +17 -0
  23. data/lib/config_o_mat/configurator/memory.rb +93 -0
  24. data/lib/config_o_mat/configurator/op/apply_all_profiles.rb +35 -0
  25. data/lib/config_o_mat/configurator/op/commit_staged_profile.rb +35 -0
  26. data/lib/config_o_mat/configurator/op/compile_templates.rb +41 -0
  27. data/lib/config_o_mat/configurator/op/connect_to_appconfig.rb +35 -0
  28. data/lib/config_o_mat/configurator/op/generate_all_templates.rb +66 -0
  29. data/lib/config_o_mat/configurator/op/next_tick.rb +48 -0
  30. data/lib/config_o_mat/configurator/op/notify_systemd_start.rb +29 -0
  31. data/lib/config_o_mat/configurator/op/parse_cli.rb +93 -0
  32. data/lib/config_o_mat/configurator/op/refresh_all_profiles.rb +63 -0
  33. data/lib/config_o_mat/configurator/op/refresh_profile.rb +65 -0
  34. data/lib/config_o_mat/configurator/op/reload_one_service.rb +73 -0
  35. data/lib/config_o_mat/configurator/op/stage_one_profile.rb +33 -0
  36. data/lib/config_o_mat/configurator/op/wait_retry.rb +41 -0
  37. data/lib/config_o_mat/configurator/op.rb +17 -0
  38. data/lib/config_o_mat/configurator.rb +122 -0
  39. data/lib/config_o_mat/flip_flopper/cond/service_status.rb +29 -0
  40. data/lib/config_o_mat/flip_flopper/cond.rb +17 -0
  41. data/lib/config_o_mat/flip_flopper/memory.rb +51 -0
  42. data/lib/config_o_mat/flip_flopper/op/check_service_status.rb +72 -0
  43. data/lib/config_o_mat/flip_flopper/op/determine_running_instance.rb +56 -0
  44. data/lib/config_o_mat/flip_flopper/op/report_failure.rb +36 -0
  45. data/lib/config_o_mat/flip_flopper/op/start_activating_instance.rb +34 -0
  46. data/lib/config_o_mat/flip_flopper/op/stop_activating_instance.rb +34 -0
  47. data/lib/config_o_mat/flip_flopper/op/stop_initial_instance.rb +34 -0
  48. data/lib/config_o_mat/flip_flopper/op.rb +17 -0
  49. data/lib/config_o_mat/flip_flopper.rb +46 -0
  50. data/lib/config_o_mat/meta_configurator/memory.rb +73 -0
  51. data/lib/config_o_mat/meta_configurator/op/generate_systemd_config.rb +80 -0
  52. data/lib/config_o_mat/meta_configurator/op/parse_meta_cli.rb +103 -0
  53. data/lib/config_o_mat/meta_configurator/op.rb +17 -0
  54. data/lib/config_o_mat/meta_configurator.rb +44 -0
  55. data/lib/config_o_mat/shared/cond/early_exit.rb +29 -0
  56. data/lib/config_o_mat/shared/cond.rb +17 -0
  57. data/lib/config_o_mat/shared/op/load_meta_config.rb +188 -0
  58. data/lib/config_o_mat/shared/op.rb +17 -0
  59. data/lib/config_o_mat/shared/systemd_interface.rb +93 -0
  60. data/lib/config_o_mat/shared/types.rb +248 -0
  61. data/lib/config_o_mat/version.rb +19 -0
  62. data/lib/version.rb +19 -0
  63. data/systemd/teak-configurator-restart-service@.path +27 -0
  64. data/systemd/teak-configurator-restart-service@.service +21 -0
  65. data/systemd/teak-configurator-start-service@.path +27 -0
  66. data/systemd/teak-configurator-start-service@.service +21 -0
  67. data/systemd/teak-configurator-stop-service@.path +27 -0
  68. data/systemd/teak-configurator-stop-service@.service +21 -0
  69. data/systemd/teak-configurator.service +68 -0
  70. data/systemd/teak-metaconfigurator.service +57 -0
  71. metadata +213 -0
@@ -0,0 +1,27 @@
1
+ # Copyright 2021 Teak.io, Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ # By enabling this unit for a service, we ensure that after the service starts systemd
16
+ # listens for touches on the configurator's stop file, and will run teak-configurator-stop-service@%i.service
17
+ # when the file is touched.
18
+ #
19
+ # This allows the configurator to stop systemd services without privileged access.
20
+ [Unit]
21
+ Description=Touch a file to stop %i.service
22
+
23
+ [Path]
24
+ PathModified=/run/teak-configurator/%i.stop
25
+
26
+ [Install]
27
+ WantedBy=%i.service
@@ -0,0 +1,21 @@
1
+ # Copyright 2021 Teak.io, Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ [Unit]
16
+ Description=Stop %i.service
17
+
18
+ [Service]
19
+ Type=oneshot
20
+ ExecStart=/usr/bin/systemctl stop %i.service
21
+ RemainAfterExit=no
@@ -0,0 +1,68 @@
1
+ # Copyright 2021 Teak.io, Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ [Unit]
16
+ Description=Teak Configurator
17
+ Requires=teak-metaconfigurator.service network.target
18
+ After=teak-metaconfigurator.service network.target
19
+
20
+ [Service]
21
+ Slice=teak-services.slice
22
+ ReadOnlyPaths=/
23
+ ProtectSystem=strict
24
+ RuntimeDirectory=teak-configurator
25
+ # We use files in our runtime directory to both indicate to systemd that services should
26
+ # be restarted and to provide "credential" data to systemd services. If systemd nukes that
27
+ # directory it will see changes to the files we touch to restart services, and so restart the
28
+ # services. When the services restart, they will try to load their "credential" data, which will
29
+ # also be absent. This takes down all the services.
30
+ #
31
+ # I would prefer that things continue operating even if the configurator dies -- we can find other
32
+ # mechanisms to mark a server as unhealthy if it can no longer get new config data.
33
+ RuntimeDirectoryPreserve=yes
34
+ RuntimeDirectoryMode=0700
35
+ LogsDirectory=teak-configurator
36
+ ConfigurationDirectory=teak-configurator
37
+ WorkingDirectory=/opt/teak-configurator
38
+
39
+ NoNewPrivileges=yes
40
+ PrivateTmp=yes
41
+ PrivateUsers=yes
42
+ ProtectClock=yes
43
+ PrivateDevices=yes
44
+ ProtectKernelTunables=yes
45
+ ProtectKernelModules=yes
46
+ ProtectControlGroups=yes
47
+ RestrictSUIDSGID=yes
48
+ RestrictRealtime=yes
49
+ LockPersonality=yes
50
+ RemoveIPC=yes
51
+ UMask=0033
52
+
53
+ SystemCallArchitectures=native
54
+ SystemCallFilter=~@clock @cpu-emulation @debug @module @mount @obsolete @raw-io @reboot @resources @swap
55
+
56
+ CapabilityBoundingSet=
57
+ RestrictAddressFamilies=~AF_NETLINK AF_PACKET
58
+ RestrictNamespaces=yes
59
+
60
+ WatchdogSec=60
61
+
62
+ NotifyAccess=main
63
+ Type=notify
64
+ ExecStart=bundle2.7 exec /opt/teak-configurator/bin/config_o_mat-configurator
65
+ Restart=always
66
+
67
+ [Install]
68
+ WantedBy=multi-user.target
@@ -0,0 +1,57 @@
1
+ # Copyright 2021 Teak.io, Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ [Unit]
16
+ Description=Teak Meta Configurator (Configures systemd for the configurator)
17
+
18
+ [Service]
19
+ ReadOnlyPaths=/
20
+
21
+ # We persist systemd dropins and other config, so make sure that's writeable
22
+ ReadWritePaths=/run/systemd/system
23
+ ProtectSystem=full
24
+ RuntimeDirectory=teak-configurator
25
+ LogsDirectory=teak-configurator
26
+ ConfigurationDirectory=teak-configurator
27
+ WorkingDirectory=/opt/teak-configurator
28
+
29
+ NoNewPrivileges=yes
30
+ PrivateTmp=yes
31
+ PrivateUsers=yes
32
+ ProtectClock=yes
33
+ PrivateDevices=yes
34
+ PrivateNetwork=yes
35
+ ProtectKernelTunables=yes
36
+ ProtectKernelModules=yes
37
+ ProtectControlGroups=yes
38
+ RestrictSUIDSGID=yes
39
+ RestrictRealtime=yes
40
+ LockPersonality=yes
41
+ RemoveIPC=yes
42
+ UMask=0033
43
+
44
+ SystemCallArchitectures=native
45
+ SystemCallFilter=~@clock @cpu-emulation @debug @module @mount @obsolete @raw-io @reboot @resources @swap
46
+
47
+ CapabilityBoundingSet=
48
+ RestrictAddressFamilies=AF_UNIX
49
+ RestrictNamespaces=yes
50
+
51
+ User=root
52
+ Type=oneshot
53
+ ExecStart=bundle2.7 exec /opt/teak-configurator/bin/config_o_mat-meta_configurator
54
+ RemainAfterExit=yes
55
+
56
+ [Install]
57
+ WantedBy=multi-user.target
metadata ADDED
@@ -0,0 +1,213 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: config_o_mat
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Alex Scarborough
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-01-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: aws-sdk-appconfig
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.18'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.18'
27
+ - !ruby/object:Gem::Dependency
28
+ name: logsformyfamily
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.2'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: lifecycle_vm
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.1.1
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.1.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: ruby-dbus
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.16.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.16.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: sd_notify
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.1.1
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.1.1
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.21.2
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.21.2
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '3.10'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '3.10'
111
+ description:
112
+ email:
113
+ - alex@teak.io
114
+ executables:
115
+ - config_o_mat-configurator
116
+ - config_o_mat-meta_configurator
117
+ extensions: []
118
+ extra_rdoc_files: []
119
+ files:
120
+ - ".gitignore"
121
+ - ".rspec"
122
+ - ".ruby-gemset"
123
+ - ".ruby-version"
124
+ - Gemfile
125
+ - Gemfile.lock
126
+ - LICENSE
127
+ - NOTICE
128
+ - README.md
129
+ - Rakefile
130
+ - bin/config_o_mat-configurator
131
+ - bin/config_o_mat-meta_configurator
132
+ - config_o_mat.gemspec
133
+ - design/configurator_lifecycle_test.dot
134
+ - design/original_design.md
135
+ - lib/config_o_mat/configurator.rb
136
+ - lib/config_o_mat/configurator/cond.rb
137
+ - lib/config_o_mat/configurator/cond/first_run.rb
138
+ - lib/config_o_mat/configurator/cond/next_state.rb
139
+ - lib/config_o_mat/configurator/cond/profiles_to_apply.rb
140
+ - lib/config_o_mat/configurator/cond/retries_left.rb
141
+ - lib/config_o_mat/configurator/cond/services_to_reload.rb
142
+ - lib/config_o_mat/configurator/memory.rb
143
+ - lib/config_o_mat/configurator/op.rb
144
+ - lib/config_o_mat/configurator/op/apply_all_profiles.rb
145
+ - lib/config_o_mat/configurator/op/commit_staged_profile.rb
146
+ - lib/config_o_mat/configurator/op/compile_templates.rb
147
+ - lib/config_o_mat/configurator/op/connect_to_appconfig.rb
148
+ - lib/config_o_mat/configurator/op/generate_all_templates.rb
149
+ - lib/config_o_mat/configurator/op/next_tick.rb
150
+ - lib/config_o_mat/configurator/op/notify_systemd_start.rb
151
+ - lib/config_o_mat/configurator/op/parse_cli.rb
152
+ - lib/config_o_mat/configurator/op/refresh_all_profiles.rb
153
+ - lib/config_o_mat/configurator/op/refresh_profile.rb
154
+ - lib/config_o_mat/configurator/op/reload_one_service.rb
155
+ - lib/config_o_mat/configurator/op/stage_one_profile.rb
156
+ - lib/config_o_mat/configurator/op/wait_retry.rb
157
+ - lib/config_o_mat/flip_flopper.rb
158
+ - lib/config_o_mat/flip_flopper/cond.rb
159
+ - lib/config_o_mat/flip_flopper/cond/service_status.rb
160
+ - lib/config_o_mat/flip_flopper/memory.rb
161
+ - lib/config_o_mat/flip_flopper/op.rb
162
+ - lib/config_o_mat/flip_flopper/op/check_service_status.rb
163
+ - lib/config_o_mat/flip_flopper/op/determine_running_instance.rb
164
+ - lib/config_o_mat/flip_flopper/op/report_failure.rb
165
+ - lib/config_o_mat/flip_flopper/op/start_activating_instance.rb
166
+ - lib/config_o_mat/flip_flopper/op/stop_activating_instance.rb
167
+ - lib/config_o_mat/flip_flopper/op/stop_initial_instance.rb
168
+ - lib/config_o_mat/meta_configurator.rb
169
+ - lib/config_o_mat/meta_configurator/memory.rb
170
+ - lib/config_o_mat/meta_configurator/op.rb
171
+ - lib/config_o_mat/meta_configurator/op/generate_systemd_config.rb
172
+ - lib/config_o_mat/meta_configurator/op/parse_meta_cli.rb
173
+ - lib/config_o_mat/shared/cond.rb
174
+ - lib/config_o_mat/shared/cond/early_exit.rb
175
+ - lib/config_o_mat/shared/op.rb
176
+ - lib/config_o_mat/shared/op/load_meta_config.rb
177
+ - lib/config_o_mat/shared/systemd_interface.rb
178
+ - lib/config_o_mat/shared/types.rb
179
+ - lib/config_o_mat/version.rb
180
+ - lib/version.rb
181
+ - systemd/teak-configurator-restart-service@.path
182
+ - systemd/teak-configurator-restart-service@.service
183
+ - systemd/teak-configurator-start-service@.path
184
+ - systemd/teak-configurator-start-service@.service
185
+ - systemd/teak-configurator-stop-service@.path
186
+ - systemd/teak-configurator-stop-service@.service
187
+ - systemd/teak-configurator.service
188
+ - systemd/teak-metaconfigurator.service
189
+ homepage: https://github.com/GoCarrot/configurator
190
+ licenses: []
191
+ metadata:
192
+ homepage_uri: https://github.com/GoCarrot/configurator
193
+ source_code_uri: https://github.com/GoCarrot/configurator
194
+ post_install_message:
195
+ rdoc_options: []
196
+ require_paths:
197
+ - lib
198
+ required_ruby_version: !ruby/object:Gem::Requirement
199
+ requirements:
200
+ - - ">="
201
+ - !ruby/object:Gem::Version
202
+ version: 2.7.0
203
+ required_rubygems_version: !ruby/object:Gem::Requirement
204
+ requirements:
205
+ - - ">="
206
+ - !ruby/object:Gem::Version
207
+ version: '0'
208
+ requirements: []
209
+ rubygems_version: 3.1.6
210
+ signing_key:
211
+ specification_version: 4
212
+ summary: ConfigOMat applies AWS AppConfig to Systemd services.
213
+ test_files: []