ConfigLMM 0.4.0 → 0.5.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +34 -0
- data/CNAME +1 -0
- data/Examples/.lmm.state.yaml +159 -0
- data/Examples/ConfigLMM.mm.yaml +32 -0
- data/Examples/Implemented.mm.yaml +252 -4
- data/Examples/SmallBusiness.mm.yaml +492 -0
- data/Plugins/Apps/Answer/answer.lmm.rb +165 -0
- data/Plugins/Apps/Answer/answer@.service +40 -0
- data/Plugins/Apps/ArchiSteamFarm/ArchiSteamFarm.conf.erb +0 -3
- data/Plugins/Apps/ArchiSteamFarm/ArchiSteamFarm.lmm.rb +0 -1
- data/Plugins/Apps/Authentik/Authentik-ProxyOutpost.container +7 -1
- data/Plugins/Apps/Authentik/Authentik-Server.container +6 -1
- data/Plugins/Apps/Authentik/Authentik-Worker.container +6 -1
- data/Plugins/Apps/Authentik/Authentik.conf.erb +12 -7
- data/Plugins/Apps/Authentik/Authentik.lmm.rb +226 -61
- data/Plugins/Apps/BookStack/BookStack.conf.erb +0 -3
- data/Plugins/Apps/BookStack/BookStack.container +5 -0
- data/Plugins/Apps/BookStack/BookStack.lmm.rb +14 -3
- data/Plugins/Apps/Cassandra/Cassandra.lmm.rb +9 -19
- data/Plugins/Apps/ClickHouse/ClickHouse.container +28 -0
- data/Plugins/Apps/ClickHouse/ClickHouse.lmm.rb +113 -0
- data/Plugins/Apps/ClickHouse/Config/listen.yaml +2 -0
- data/Plugins/Apps/ClickHouse/Config/logger.yaml +8 -0
- data/Plugins/Apps/ClickHouse/Config/zookeepers.yaml +5 -0
- data/Plugins/Apps/ClickHouse/Connection.rb +96 -0
- data/Plugins/Apps/Discourse/Discourse-Sidekiq.container +5 -0
- data/Plugins/Apps/Discourse/Discourse.conf.erb +1 -4
- data/Plugins/Apps/Discourse/Discourse.container +4 -0
- data/Plugins/Apps/Discourse/Discourse.lmm.rb +116 -55
- data/Plugins/Apps/Dovecot/Dovecot.lmm.rb +74 -62
- data/Plugins/Apps/ERPNext/ERPNext-Frontend.container +6 -1
- data/Plugins/Apps/ERPNext/ERPNext-Queue.container +5 -0
- data/Plugins/Apps/ERPNext/ERPNext-Scheduler.container +5 -0
- data/Plugins/Apps/ERPNext/ERPNext-Websocket.container +6 -1
- data/Plugins/Apps/ERPNext/ERPNext.container +6 -1
- data/Plugins/Apps/ERPNext/ERPNext.lmm.rb +138 -127
- data/Plugins/Apps/GitLab/GitLab.container +6 -0
- data/Plugins/Apps/GitLab/GitLab.lmm.rb +43 -49
- data/Plugins/Apps/Homepage/Homepage.conf.erb +86 -0
- data/Plugins/Apps/Homepage/Homepage.container +19 -0
- data/Plugins/Apps/Homepage/Homepage.lmm.rb +54 -0
- data/Plugins/Apps/IPFS/IPFS.conf.erb +0 -3
- data/Plugins/Apps/IPFS/IPFS.lmm.rb +0 -1
- data/Plugins/Apps/InfluxDB/InfluxDB.conf.erb +0 -3
- data/Plugins/Apps/InfluxDB/InfluxDB.lmm.rb +0 -1
- data/Plugins/Apps/Jackett/Jackett.conf.erb +0 -3
- data/Plugins/Apps/Jackett/Jackett.lmm.rb +0 -1
- data/Plugins/Apps/Jellyfin/Jellyfin.conf.erb +0 -3
- data/Plugins/Apps/Jellyfin/Jellyfin.lmm.rb +0 -1
- data/Plugins/Apps/LetsEncrypt/LetsEncrypt.lmm.rb +49 -28
- data/Plugins/Apps/LibreTranslate/LibreTranslate.container +21 -0
- data/Plugins/Apps/LibreTranslate/LibreTranslate.lmm.rb +34 -0
- data/Plugins/Apps/Lobsters/Containerfile +81 -0
- data/Plugins/Apps/Lobsters/Lobsters-Tasks.container +26 -0
- data/Plugins/Apps/Lobsters/Lobsters.conf.erb +99 -0
- data/Plugins/Apps/Lobsters/Lobsters.container +27 -0
- data/Plugins/Apps/Lobsters/Lobsters.lmm.rb +196 -0
- data/Plugins/Apps/Lobsters/crontab +3 -0
- data/Plugins/Apps/Lobsters/database.yml +26 -0
- data/Plugins/Apps/Lobsters/entrypoint.sh +30 -0
- data/Plugins/Apps/Lobsters/generateCredentials.rb +19 -0
- data/Plugins/Apps/Lobsters/lobsters-cron.sh +25 -0
- data/Plugins/Apps/Lobsters/lobsters-daily.sh +23 -0
- data/Plugins/Apps/Lobsters/puma.rb +49 -0
- data/Plugins/Apps/MariaDB/Connection.rb +55 -0
- data/Plugins/Apps/MariaDB/MariaDB.lmm.rb +60 -53
- data/Plugins/Apps/Mastodon/Mastodon-Sidekiq.container +22 -0
- data/Plugins/Apps/Mastodon/Mastodon-Streaming.container +20 -0
- data/Plugins/Apps/Mastodon/Mastodon.conf.erb +34 -45
- data/Plugins/Apps/Mastodon/Mastodon.container +28 -0
- data/Plugins/Apps/Mastodon/Mastodon.lmm.rb +240 -5
- data/Plugins/Apps/Mastodon/configlmm.rake +30 -0
- data/Plugins/Apps/Mastodon/entrypoint.sh +16 -0
- data/Plugins/Apps/Matrix/Element.container +5 -0
- data/Plugins/Apps/Matrix/Matrix.conf.erb +2 -8
- data/Plugins/Apps/Matrix/Matrix.lmm.rb +100 -71
- data/Plugins/Apps/Matrix/Synapse.container +5 -0
- data/Plugins/Apps/Netdata/Netdata.conf.erb +0 -3
- data/Plugins/Apps/Netdata/Netdata.lmm.rb +0 -1
- data/Plugins/Apps/Nextcloud/Nextcloud.conf.erb +3 -4
- data/Plugins/Apps/Nextcloud/Nextcloud.lmm.rb +150 -68
- data/Plugins/Apps/Nextcloud/autoconfig.php +13 -0
- data/Plugins/Apps/Nextcloud/config.php +10 -1
- data/Plugins/Apps/Nextcloud/nextcloudcron.service +8 -0
- data/Plugins/Apps/Nextcloud/nextcloudcron.timer +10 -0
- data/Plugins/Apps/Nginx/Connection.rb +93 -0
- data/Plugins/Apps/Nginx/conf.d/configlmm.conf +50 -9
- data/Plugins/Apps/Nginx/conf.d/languages.conf +21 -0
- data/Plugins/Apps/Nginx/config-lmm/errors.conf +25 -20
- data/Plugins/Apps/Nginx/config-lmm/gateway-errors.conf +20 -0
- data/Plugins/Apps/Nginx/config-lmm/proxy.conf +1 -1
- data/Plugins/Apps/Nginx/main.conf.erb +7 -3
- data/Plugins/Apps/Nginx/nginx.conf +2 -2
- data/Plugins/Apps/Nginx/nginx.lmm.rb +99 -81
- data/Plugins/Apps/Nginx/proxy.conf.erb +11 -3
- data/Plugins/Apps/Odoo/Odoo.conf.erb +0 -3
- data/Plugins/Apps/Odoo/Odoo.container +5 -0
- data/Plugins/Apps/Odoo/Odoo.lmm.rb +4 -5
- data/Plugins/Apps/Ollama/Ollama.container +26 -0
- data/Plugins/Apps/Ollama/Ollama.lmm.rb +73 -0
- data/Plugins/Apps/OpenTelemetry/Config/config.yaml +704 -0
- data/Plugins/Apps/OpenTelemetry/OpenTelemetry.lmm.rb +154 -0
- data/Plugins/Apps/OpenVidu/Ingress.container +5 -0
- data/Plugins/Apps/OpenVidu/OpenVidu.conf.erb +0 -3
- data/Plugins/Apps/OpenVidu/OpenVidu.container +5 -0
- data/Plugins/Apps/OpenVidu/OpenVidu.lmm.rb +7 -3
- data/Plugins/Apps/OpenVidu/OpenViduCall.conf.erb +0 -3
- data/Plugins/Apps/OpenVidu/OpenViduCall.container +5 -0
- data/Plugins/Apps/PHP-FPM/Connection.rb +91 -0
- data/Plugins/Apps/PHP-FPM/PHP-FPM.lmm.rb +31 -4
- data/Plugins/Apps/Peppermint/Peppermint.conf.erb +2 -5
- data/Plugins/Apps/Peppermint/Peppermint.container +5 -0
- data/Plugins/Apps/Peppermint/Peppermint.lmm.rb +29 -33
- data/Plugins/Apps/Perplexica/Perplexica.container +25 -0
- data/Plugins/Apps/Perplexica/Perplexica.lmm.rb +92 -0
- data/Plugins/Apps/Perplexica/config.toml +26 -0
- data/Plugins/Apps/Podman/Connection.rb +24 -0
- data/Plugins/Apps/Podman/Podman.lmm.rb +80 -0
- data/Plugins/Apps/Podman/storage.conf +6 -0
- data/Plugins/Apps/Postfix/Postfix.lmm.rb +242 -164
- data/Plugins/Apps/PostgreSQL/Connection.rb +97 -0
- data/Plugins/Apps/PostgreSQL/PostgreSQL.lmm.rb +184 -148
- data/Plugins/Apps/Pterodactyl/Pterodactyl.conf.erb +0 -3
- data/Plugins/Apps/Pterodactyl/Pterodactyl.lmm.rb +0 -2
- data/Plugins/Apps/Pterodactyl/Wings.conf.erb +0 -3
- data/Plugins/Apps/RVM/RVM.lmm.rb +57 -0
- data/Plugins/Apps/Roundcube/Roundcube.conf.erb +0 -3
- data/Plugins/Apps/Roundcube/Roundcube.lmm.rb +15 -19
- data/Plugins/Apps/SSH/SSH.lmm.rb +9 -15
- data/Plugins/Apps/SearXNG/SearXNG.container +22 -0
- data/Plugins/Apps/SearXNG/SearXNG.lmm.rb +79 -0
- data/Plugins/Apps/SearXNG/limiter.toml +40 -0
- data/Plugins/Apps/SearXNG/settings.yml +2 -0
- data/Plugins/Apps/SigNoz/Config/alerts.yml +11 -0
- data/Plugins/Apps/SigNoz/Config/otel-collector-config.yaml +110 -0
- data/Plugins/Apps/SigNoz/Config/otel-collector-opamp-config.yaml +1 -0
- data/Plugins/Apps/SigNoz/Config/prometheus.yml +18 -0
- data/Plugins/Apps/SigNoz/SigNoz-Collector.container +23 -0
- data/Plugins/Apps/SigNoz/SigNoz-Migrator.container +17 -0
- data/Plugins/Apps/SigNoz/SigNoz.conf.erb +61 -0
- data/Plugins/Apps/SigNoz/SigNoz.container +26 -0
- data/Plugins/Apps/SigNoz/SigNoz.lmm.rb +319 -0
- data/Plugins/Apps/Solr/log4j2.xml +89 -0
- data/Plugins/Apps/Solr/solr.lmm.rb +82 -0
- data/Plugins/Apps/Sunshine/Sunshine.conf.erb +0 -3
- data/Plugins/Apps/Sunshine/Sunshine.lmm.rb +0 -1
- data/Plugins/Apps/Tunnel/tunnel.lmm.rb +33 -37
- data/Plugins/Apps/UVdesk/UVdesk.conf.erb +0 -3
- data/Plugins/Apps/Umami/Umami.container +19 -0
- data/Plugins/Apps/Umami/Umami.lmm.rb +108 -0
- data/Plugins/Apps/Valkey/Valkey.lmm.rb +54 -42
- data/Plugins/Apps/Vaultwarden/Vaultwarden.conf.erb +9 -6
- data/Plugins/Apps/Vaultwarden/Vaultwarden.container +7 -1
- data/Plugins/Apps/Vaultwarden/Vaultwarden.lmm.rb +64 -29
- data/Plugins/Apps/Wiki.js/Wiki.js.conf.erb +1 -4
- data/Plugins/Apps/Wiki.js/Wiki.js.container +5 -0
- data/Plugins/Apps/Wiki.js/Wiki.js.lmm.rb +31 -37
- data/Plugins/Apps/YaCy/YaCy.conf.erb +93 -0
- data/Plugins/Apps/YaCy/YaCy.container +21 -0
- data/Plugins/Apps/YaCy/YaCy.lmm.rb +160 -0
- data/Plugins/Apps/ZooKeeper/ZooKeeper.container +24 -0
- data/Plugins/Apps/ZooKeeper/ZooKeeper.lmm.rb +68 -0
- data/Plugins/Apps/bitmagnet/bitmagnet.conf.erb +0 -3
- data/Plugins/Apps/bitmagnet/bitmagnet.lmm.rb +0 -1
- data/Plugins/Apps/gollum/gollum.conf.erb +2 -4
- data/Plugins/Apps/gollum/gollum.container +6 -0
- data/Plugins/Apps/gollum/gollum.lmm.rb +51 -50
- data/Plugins/Apps/llama.cpp/llama.cpp.container +28 -0
- data/Plugins/Apps/llama.cpp/llama.cpp.lmm.rb +90 -0
- data/Plugins/Apps/vLLM/vLLM.container +32 -0
- data/Plugins/Apps/vLLM/vLLM.lmm.rb +89 -0
- data/Plugins/OS/General/Utils.lmm.rb +26 -0
- data/Plugins/OS/Linux/Connection.rb +472 -0
- data/Plugins/OS/Linux/Debian/preseed.cfg.erb +25 -6
- data/Plugins/OS/Linux/Flavours.yaml +13 -0
- data/Plugins/OS/Linux/Grub/grub.cfg +10 -0
- data/Plugins/OS/Linux/HTTP.rb +32 -0
- data/Plugins/OS/Linux/Linux.lmm.rb +533 -187
- data/Plugins/OS/Linux/Packages.yaml +20 -1
- data/Plugins/OS/Linux/Services.yaml +8 -0
- data/Plugins/OS/Linux/Shell.rb +70 -0
- data/Plugins/OS/Linux/Syslinux/default +8 -0
- data/Plugins/OS/Linux/WireGuard/WireGuard.lmm.rb +83 -59
- data/Plugins/OS/Linux/WireGuard/wg0.conf.erb +3 -0
- data/Plugins/OS/Linux/openSUSE/autoinst.xml.erb +29 -3
- data/Plugins/OS/Linux/systemd/systemd.lmm.rb +13 -11
- data/Plugins/OS/Routers/Aruba/ArubaInstant.lmm.rb +6 -5
- data/Plugins/Platforms/GitHub.lmm.rb +73 -28
- data/Plugins/Platforms/GoDaddy/GoDaddy.lmm.rb +9 -6
- data/Plugins/Platforms/Proxmox/Proxmox.lmm.rb +402 -0
- data/Plugins/Platforms/Proxmox/XTerm.rb +321 -0
- data/Plugins/Platforms/libvirt/libvirt.lmm.rb +38 -13
- data/Plugins/Platforms/porkbun.lmm.rb +12 -2
- data/Plugins/Platforms/porkbun_spec.rb +2 -2
- data/Plugins/Services/DNS/AmberBit.lmm.rb +1 -1
- data/Plugins/Services/DNS/ArubaItDNS.lmm.rb +1 -1
- data/Plugins/Services/DNS/NICLV.lmm.rb +1 -1
- data/Plugins/Services/DNS/PowerDNS.lmm.rb +70 -68
- data/Plugins/Services/DNS/tonic.lmm.rb +22 -12
- data/lib/ConfigLMM/Framework/plugins/dns.rb +4 -3
- data/lib/ConfigLMM/Framework/plugins/linuxApp.rb +145 -184
- data/lib/ConfigLMM/Framework/plugins/nginxApp.rb +34 -17
- data/lib/ConfigLMM/Framework/plugins/plugin.rb +53 -181
- data/lib/ConfigLMM/Framework/plugins/store.rb +4 -4
- data/lib/ConfigLMM/Framework/variables.rb +75 -0
- data/lib/ConfigLMM/Framework.rb +1 -0
- data/lib/ConfigLMM/cli.rb +12 -6
- data/lib/ConfigLMM/commands/configsCommand.rb +37 -6
- data/lib/ConfigLMM/commands/diff.rb +33 -9
- data/lib/ConfigLMM/context.rb +22 -3
- data/lib/ConfigLMM/io/configList.rb +82 -6
- data/lib/ConfigLMM/io/connection.rb +143 -0
- data/lib/ConfigLMM/io/dhcp.rb +330 -0
- data/lib/ConfigLMM/io/http.rb +78 -0
- data/lib/ConfigLMM/io/local.rb +207 -0
- data/lib/ConfigLMM/io/pxe.rb +92 -0
- data/lib/ConfigLMM/io/ssh.rb +156 -0
- data/lib/ConfigLMM/io/tftp.rb +105 -0
- data/lib/ConfigLMM/io.rb +2 -0
- data/lib/ConfigLMM/secrets/envStore.rb +39 -0
- data/lib/ConfigLMM/secrets/fileStore.rb +43 -0
- data/lib/ConfigLMM/state.rb +2 -1
- data/lib/ConfigLMM/version.rb +2 -1
- data/lib/ConfigLMM.rb +1 -0
- data/{Examples → scripts}/configlmmAuth.sh +7 -5
- metadata +205 -8
@@ -8,230 +8,183 @@ module ConfigLMM
|
|
8
8
|
class LinuxApp < Framework::Plugin
|
9
9
|
|
10
10
|
LINUX_FOLDER = __dir__ + '/../../../../Plugins/OS/Linux/'
|
11
|
-
SUSE_NAME = 'openSUSE Leap'
|
12
11
|
SUSE_ID = 'opensuse-leap'
|
13
|
-
DEBIAN_NAME = 'Debian'
|
14
|
-
PROXMOXVE_NAME = 'Proxmox VE'
|
15
12
|
PODMAN_PACKAGE = 'Podman'
|
16
13
|
SYSTEMD_CONTAINERS_PATH = '~/.config/containers/systemd/'
|
17
14
|
|
15
|
+
# DEPRECATED
|
18
16
|
def ensurePackage(name, location, binary = nil)
|
19
17
|
self.class.ensurePackage(name, location, binary)
|
20
18
|
end
|
21
19
|
|
20
|
+
# DEPRECATED
|
22
21
|
def ensurePackages(names, location)
|
23
22
|
self.class.ensurePackages(names, location)
|
24
23
|
end
|
25
24
|
|
26
|
-
|
25
|
+
# DEPRECATED
|
26
|
+
def self.ensurePackage(name, locationOrConnection, binary = nil)
|
27
27
|
if binary && TTY::Which.which(binary)
|
28
28
|
return
|
29
29
|
end
|
30
|
-
self.ensurePackages([name],
|
30
|
+
self.ensurePackages([name], locationOrConnection)
|
31
31
|
end
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
pkgs = []
|
40
|
-
reposPackages.each do |pkg|
|
41
|
-
if pkg.include?('|')
|
42
|
-
repoName, pkg = pkg.split('|')
|
43
|
-
repos << repoName
|
44
|
-
pkgs << pkg
|
45
|
-
else
|
46
|
-
pkgs << pkg
|
47
|
-
end
|
48
|
-
end
|
49
|
-
repos.each do |repoName|
|
50
|
-
self.addRepo(repoName, distroInfo, ssh)
|
51
|
-
end
|
52
|
-
command = distroInfo['InstallPackage'] + ' ' + pkgs.map { |pkg| pkg.shellescape }.join(' ')
|
53
|
-
if ssh
|
54
|
-
self.sshExec!(ssh, command)
|
55
|
-
else
|
56
|
-
if `echo $EUID`.strip == '0'
|
57
|
-
`#{command} >/dev/null`
|
58
|
-
else
|
59
|
-
`sudo #{command} >/dev/null`
|
60
|
-
end
|
61
|
-
end
|
62
|
-
distroInfo
|
33
|
+
# DEPRECATED
|
34
|
+
def self.ensurePackages(names, locationOrConnection)
|
35
|
+
self.doConnection(locationOrConnection) do |connection|
|
36
|
+
linuxConnection = LMM::LinuxConnection.new(connection)
|
37
|
+
linuxConnection.ensurePackages(names)
|
38
|
+
linuxConnection.distroInfo
|
63
39
|
end
|
64
40
|
end
|
65
41
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
reposPackages.each do |pkg|
|
73
|
-
if pkg.include?('|')
|
74
|
-
repoName, pkg = pkg.split('|')
|
75
|
-
pkgs << pkg
|
76
|
-
else
|
77
|
-
pkgs << pkg
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
command = distroInfo['RemovePackage'] + ' ' + pkgs.map { |pkg| pkg.shellescape }.join(' ')
|
82
|
-
if ssh
|
83
|
-
self.sshExec!(ssh, command, true, dry)
|
84
|
-
else
|
85
|
-
if `echo $EUID`.strip == '0'
|
86
|
-
if dry
|
87
|
-
puts "Would execute: #{command} >/dev/null"
|
88
|
-
else
|
89
|
-
`#{command} >/dev/null`
|
90
|
-
end
|
91
|
-
else
|
92
|
-
if dry
|
93
|
-
puts "Would execute: sudo #{command} >/dev/null"
|
94
|
-
else
|
95
|
-
`sudo #{command} >/dev/null`
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
distroInfo
|
42
|
+
# DEPRECATED
|
43
|
+
def self.removePackage(name, locationOrConnection, dry = false)
|
44
|
+
self.doConnection(locationOrConnection) do |connection|
|
45
|
+
linuxConnection = LMM::LinuxConnection.new(connection)
|
46
|
+
linuxConnection.removePackage(name)
|
47
|
+
linuxConnection.distroInfo
|
100
48
|
end
|
101
49
|
end
|
102
50
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
raise Framework::PluginProcessError.new("#{id}: Unknown Protocol: #{uri.scheme}!") if uri.scheme != 'ssh'
|
107
|
-
self.class.ensureServiceAutoStartOverSSH(name, uri)
|
108
|
-
else
|
109
|
-
# TODO
|
110
|
-
end
|
51
|
+
# DEPRECATED
|
52
|
+
def ensureServiceAutoStart(name, locationOrConnection)
|
53
|
+
self.class.ensureServiceAutoStart(name, locationOrConnection)
|
111
54
|
end
|
112
55
|
|
113
|
-
|
114
|
-
|
56
|
+
# DEPRECATED
|
57
|
+
def self.ensureServiceAutoStart(name, locationOrConnection)
|
58
|
+
name = self.convertServiceName(name, locationOrConnection)
|
59
|
+
self.execDistroCommand(name, 'AutoStartService', locationOrConnection)
|
115
60
|
end
|
116
61
|
|
117
|
-
#
|
118
|
-
def self.ensureServiceAutoStartOverSSH(name,
|
119
|
-
self.ensureServiceAutoStart(name,
|
62
|
+
# DEPRECATED
|
63
|
+
def self.ensureServiceAutoStartOverSSH(name, locationOrConnection)
|
64
|
+
self.ensureServiceAutoStart(name, locationOrConnection)
|
120
65
|
end
|
121
66
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
raise Framework::PluginProcessError.new("#{id}: Unknown Protocol: #{uri.scheme}!") if uri.scheme != 'ssh'
|
126
|
-
self.class.startService(name, location, dry = false)
|
127
|
-
else
|
128
|
-
# TODO
|
129
|
-
end
|
67
|
+
# DEPRECATED
|
68
|
+
def startService(name, locationOrConnection, dry = false)
|
69
|
+
self.class.startService(name, locationOrConnection, dry = false)
|
130
70
|
end
|
131
71
|
|
132
|
-
|
133
|
-
|
72
|
+
# DEPRECATED
|
73
|
+
def self.startService(name, locationOrConnection, dry = false)
|
74
|
+
name = self.convertServiceName(name, locationOrConnection)
|
75
|
+
self.execDistroCommand(name, 'StartService', locationOrConnection, false, dry)
|
134
76
|
end
|
135
77
|
|
136
|
-
#
|
137
|
-
def self.startServiceOverSSH(name,
|
138
|
-
self.
|
78
|
+
# DEPRECATED
|
79
|
+
def self.startServiceOverSSH(name, locationOrConnection, dry = false)
|
80
|
+
name = self.convertServiceName(name, locationOrConnection)
|
81
|
+
self.startService(name, locationOrConnection, dry)
|
139
82
|
end
|
140
83
|
|
141
|
-
|
142
|
-
|
84
|
+
# DEPRECATED
|
85
|
+
def self.restartService(name, locationOrConnection, dry = false)
|
86
|
+
name = self.convertServiceName(name, locationOrConnection)
|
87
|
+
self.execDistroCommand(name, 'RestartService', locationOrConnection, false, dry)
|
143
88
|
end
|
144
89
|
|
145
|
-
|
146
|
-
|
90
|
+
# DEPRECATED
|
91
|
+
def self.reloadService(name, locationOrConnection, dry = false)
|
92
|
+
name = self.convertServiceName(name, locationOrConnection)
|
93
|
+
self.execDistroCommand(name, 'ReloadService', locationOrConnection, false, dry)
|
147
94
|
end
|
148
95
|
|
149
|
-
|
150
|
-
|
96
|
+
# DEPRECATED
|
97
|
+
def self.stopService(name, locationOrConnection, dry = false)
|
98
|
+
name = self.convertServiceName(name, locationOrConnection)
|
99
|
+
self.execDistroCommand(name, 'StopService', locationOrConnection, true, dry)
|
151
100
|
end
|
152
101
|
|
153
|
-
|
154
|
-
|
102
|
+
# DEPRECATED
|
103
|
+
def self.disableService(name, locationOrConnection, dry = false)
|
104
|
+
name = self.convertServiceName(name, locationOrConnection)
|
105
|
+
self.execDistroCommand(name, 'DisableService', locationOrConnection, true, dry)
|
155
106
|
end
|
156
107
|
|
157
|
-
|
158
|
-
|
108
|
+
# DEPRECATED
|
109
|
+
def self.reloadServiceManager(locationOrConnection, dry = false)
|
110
|
+
self.execDistroCommand(nil, 'ReloadServiceManager', locationOrConnection, false, dry)
|
159
111
|
end
|
160
112
|
|
161
|
-
|
162
|
-
|
163
|
-
self.execDistroCommand(name, '
|
113
|
+
# DEPRECATED
|
114
|
+
def self.deleteUserAndGroup(name, locationOrConnection, dry = false)
|
115
|
+
self.execDistroCommand(name, 'DeleteUser', locationOrConnection, true, dry)
|
116
|
+
self.execDistroCommand(name, 'DeleteGroup', locationOrConnection, true, dry)
|
164
117
|
end
|
165
118
|
|
166
|
-
|
167
|
-
|
168
|
-
|
119
|
+
# DEPRECATED
|
120
|
+
def self.execDistroCommand(param, commandName, locationOrConnection, allowFailure = false, dry = false)
|
121
|
+
self.doConnection(locationOrConnection) do |connection|
|
122
|
+
LMM::LinuxConnection.new(connection).execDistroCommand(param, commandName, allowFailure, { 'dry': dry })
|
123
|
+
end
|
124
|
+
end
|
169
125
|
|
170
|
-
|
171
|
-
|
172
|
-
|
126
|
+
# DEPRECATED
|
127
|
+
def self.convertServiceName(name, connection)
|
128
|
+
self.doConnection(connection) do |connection|
|
129
|
+
name = LMM::LinuxConnection.new(connection).convertServiceName(name)
|
173
130
|
end
|
131
|
+
name
|
174
132
|
end
|
175
133
|
|
176
|
-
def self.
|
177
|
-
if
|
134
|
+
def self.doConnection(locationOrConnection, &block)
|
135
|
+
if locationOrConnection.nil? || locationOrConnection == '@me'
|
178
136
|
result = block.call(nil)
|
179
|
-
elsif
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
self.sshStart(locationOrSSH) do |ssh|
|
184
|
-
result = block.call(ssh)
|
185
|
-
end
|
137
|
+
elsif locationOrConnection.is_a?(String) || locationOrConnection.is_a?(Addressable::URI)
|
138
|
+
prompt = TTY::Prompt.new
|
139
|
+
logger = TTY::Logger.new
|
140
|
+
IO::Connection.tunnel(locationOrConnection, {}, {}, prompt, logger, &block)
|
186
141
|
else
|
187
|
-
|
142
|
+
if locationOrConnection.is_a?(IO::Connection)
|
143
|
+
result = block.call(locationOrConnection)
|
144
|
+
else
|
145
|
+
prompt = TTY::Prompt.new
|
146
|
+
logger = TTY::Logger.new
|
147
|
+
result = block.call(IO::Connection.new(:SSH, IO::SSH.new(prompt, logger, locationOrConnection), prompt, logger))
|
148
|
+
end
|
188
149
|
end
|
189
150
|
result
|
190
151
|
end
|
191
152
|
|
192
|
-
#
|
193
|
-
def self.firewallAddServiceOverSSH(serviceName,
|
194
|
-
self.firewallAddService(serviceName,
|
153
|
+
# DEPRECATED
|
154
|
+
def self.firewallAddServiceOverSSH(serviceName, locationOrConnection)
|
155
|
+
self.firewallAddService(serviceName, locationOrConnection)
|
195
156
|
end
|
196
157
|
|
197
|
-
#
|
198
|
-
def self.firewallAddPortOverSSH(portName,
|
199
|
-
self.firewallAddPort(portName,
|
158
|
+
# DEPRECATED
|
159
|
+
def self.firewallAddPortOverSSH(portName, locationOrConnection)
|
160
|
+
self.firewallAddPort(portName, locationOrConnection)
|
200
161
|
end
|
201
162
|
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
command = 'firewall-cmd --add-service ' + serviceName.shellescape
|
207
|
-
self.exec(command, ssh, true, dry)
|
163
|
+
# DEPRECATED
|
164
|
+
def self.firewallAddService(serviceName, locationOrConnection = nil, dry = false)
|
165
|
+
self.doConnection(locationOrConnection) do |connection|
|
166
|
+
LMM::LinuxConnection.new(connection).firewallAddService(serviceName, { 'dry': dry })
|
208
167
|
end
|
209
168
|
end
|
210
169
|
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
command = 'firewall-cmd --remove-service ' + serviceName.shellescape
|
216
|
-
self.exec(command, ssh, false, dry)
|
170
|
+
# DEPRECATED
|
171
|
+
def self.firewallRemoveService(serviceName, locationOrConnection = nil, dry = false)
|
172
|
+
self.doConnection(locationOrConnection) do |connection|
|
173
|
+
LMM::LinuxConnection.new(connection).firewallRemoveService(serviceName, { 'dry': dry })
|
217
174
|
end
|
218
175
|
end
|
219
176
|
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
command = 'firewall-cmd --add-port ' + portName.shellescape
|
225
|
-
self.exec(command, ssh, true, dry)
|
177
|
+
# DEPRECATED
|
178
|
+
def self.firewallAddPort(portName, locationOrConnection = nil, dry = false)
|
179
|
+
self.doConnection(locationOrConnection) do |connection|
|
180
|
+
LMM::LinuxConnection.new(connection).firewallAddPort(portName, { 'dry': dry })
|
226
181
|
end
|
227
182
|
end
|
228
183
|
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
command = 'firewall-cmd --remove-port ' + portName.shellescape
|
234
|
-
self.exec(command, ssh, false, dry)
|
184
|
+
# DEPRECATED
|
185
|
+
def self.firewallRemovePort(portName, locationOrConnection = nil, dry = false)
|
186
|
+
self.doConnection(locationOrConnection) do |connection|
|
187
|
+
LMM::LinuxConnection.new(connection).firewallRemovePort(portName, { 'dry': dry })
|
235
188
|
end
|
236
189
|
end
|
237
190
|
|
@@ -255,6 +208,7 @@ module ConfigLMM
|
|
255
208
|
names
|
256
209
|
end
|
257
210
|
|
211
|
+
# DEPRECATED
|
258
212
|
def self.createCertificateOverSSH(ssh)
|
259
213
|
dir = "/etc/letsencrypt/live/Wildcard/"
|
260
214
|
self.sshExec!(ssh, "mkdir -p #{dir}")
|
@@ -266,52 +220,59 @@ module ConfigLMM
|
|
266
220
|
dir
|
267
221
|
end
|
268
222
|
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
self.sshExec!(ssh, addUserCmd, true)
|
273
|
-
self.sshExec!(ssh, "chmod o-rwx #{homedir}")
|
274
|
-
self.createSubuidsOverSSH(user, distroInfo, ssh)
|
275
|
-
self.sshExec!(ssh, "loginctl enable-linger #{user}")
|
276
|
-
self.sshExec!(ssh, "su --login #{user} --shell /bin/sh --command 'mkdir -p #{SYSTEMD_CONTAINERS_PATH}'")
|
223
|
+
# DEPRECATED
|
224
|
+
def self.configurePodmanService(user, homedir, userComment, distroInfo, connection)
|
225
|
+
self.configurePodmanServiceOverSSH(user, homedir, userComment, distroInfo, connection)
|
277
226
|
end
|
278
227
|
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
end
|
228
|
+
# DEPRECATED
|
229
|
+
def self.configurePodmanServiceOverSSH(user, homedir, userComment, distroInfo, connectionOrSSH)
|
230
|
+
if connectionOrSSH.is_a?(IO::Connection)
|
231
|
+
Framework::LinuxApp.ensurePackages([PODMAN_PACKAGE], connectionOrSSH)
|
232
|
+
addUserCmd = "#{distroInfo['CreateServiceUser']} --home-dir '#{homedir}' --create-home --comment '#{userComment}' #{user}"
|
233
|
+
connectionOrSSH.exec(addUserCmd, true)
|
234
|
+
connectionOrSSH.exec("chmod o-rwx #{homedir}")
|
235
|
+
self.createSubuids(user, distroInfo, connectionOrSSH)
|
236
|
+
connectionOrSSH.exec("loginctl enable-linger #{user}")
|
237
|
+
connectionOrSSH.exec("su --login #{user} --shell /bin/sh --command 'mkdir -p #{SYSTEMD_CONTAINERS_PATH}'")
|
290
238
|
else
|
291
|
-
|
239
|
+
Framework::LinuxApp.ensurePackages([PODMAN_PACKAGE], connectionOrSSH)
|
240
|
+
addUserCmd = "#{distroInfo['CreateServiceUser']} --home-dir '#{homedir}' --create-home --comment '#{userComment}' #{user}"
|
241
|
+
self.sshExec!(connectionOrSSH, addUserCmd, true)
|
242
|
+
self.sshExec!(connectionOrSSH, "chmod o-rwx #{homedir}")
|
243
|
+
self.createSubuidsOverSSH(user, distroInfo, connectionOrSSH)
|
244
|
+
self.sshExec!(connectionOrSSH, "loginctl enable-linger #{user}")
|
245
|
+
self.sshExec!(connectionOrSSH, "su --login #{user} --shell /bin/sh --command 'mkdir -p #{SYSTEMD_CONTAINERS_PATH}'")
|
292
246
|
end
|
293
247
|
end
|
294
248
|
|
249
|
+
# DEPRECATED
|
250
|
+
def self.createSubuids(user, distroInfo, connection)
|
251
|
+
connection.exec("#{distroInfo['ModifyUser']} --add-subuids 100000-165535 --add-subgids 100000-165535 #{user}")
|
252
|
+
end
|
253
|
+
|
254
|
+
# DEPRECATED
|
295
255
|
def self.createSubuidsOverSSH(user, distroInfo, ssh)
|
296
256
|
self.sshExec!(ssh, "#{distroInfo['ModifyUser']} --add-subuids 100000-165535 --add-subgids 100000-165535 #{user}")
|
297
257
|
end
|
298
258
|
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
259
|
+
# DEPRECATED
|
260
|
+
def self.distroID(connection = nil)
|
261
|
+
id = nil
|
262
|
+
self.doConnection(connection) do |connection|
|
263
|
+
id = LMM::LinuxConnection.new(connection).distroID
|
304
264
|
end
|
265
|
+
id
|
305
266
|
end
|
306
267
|
|
307
|
-
|
308
|
-
|
268
|
+
# DEPRECATED
|
269
|
+
def self.currentDistroInfo(connection)
|
270
|
+
self.distroInfo(self.distroID(connection))
|
309
271
|
end
|
310
272
|
|
273
|
+
# DEPRECATED
|
311
274
|
def self.distroInfo(distroID)
|
312
|
-
|
313
|
-
raise Framework::PluginProcessError.new("Unknown Linux Distro: #{distroID}!") unless distributions.key?(distroID)
|
314
|
-
distributions[distroID]
|
275
|
+
YAML.load_file(LINUX_FOLDER + 'Distributions.yaml')[distroID]
|
315
276
|
end
|
316
277
|
|
317
278
|
end
|
@@ -11,12 +11,15 @@ require 'fileutils'
|
|
11
11
|
module ConfigLMM
|
12
12
|
module Framework
|
13
13
|
|
14
|
+
# DEPRECATED
|
14
15
|
class NginxApp < Framework::Plugin
|
15
16
|
|
17
|
+
# DEPRECATED
|
16
18
|
NGINX_PACKAGE = 'nginx'
|
17
19
|
CONFIG_DIR = '/etc/nginx/'
|
18
20
|
WWW_DIR = '/srv/www/'
|
19
21
|
|
22
|
+
# DEPRECATED
|
20
23
|
def writeNginxConfig(dir, name, id, target, activeState, context, options)
|
21
24
|
outputFolder = options['output']
|
22
25
|
|
@@ -29,6 +32,7 @@ module ConfigLMM
|
|
29
32
|
renderTemplate(template, target, outputFolder + '/nginx/servers-lmm/' + name + '.conf', options)
|
30
33
|
end
|
31
34
|
|
35
|
+
# DEPRECATED
|
32
36
|
def deployNginxConfig(id, target, activeState, context, options)
|
33
37
|
outputFolder = options['output'] + '/nginx/servers-lmm'
|
34
38
|
|
@@ -48,46 +52,59 @@ module ConfigLMM
|
|
48
52
|
end
|
49
53
|
end
|
50
54
|
|
51
|
-
|
52
|
-
|
55
|
+
# DEPRECATED
|
56
|
+
def cleanupNginxConfig(name, id, state, context, options, connection)
|
57
|
+
connection.rm('/etc/nginx/servers-lmm/' + name + '.conf', options['dry'])
|
53
58
|
end
|
54
59
|
|
55
|
-
|
56
|
-
|
57
|
-
|
60
|
+
# DEPRECATED
|
61
|
+
def self.prepareNginxConfig(target, connectionOrSSH = nil)
|
62
|
+
if connectionOrSSH.is_a?(IO::Connection)
|
63
|
+
target['NginxVersion'] = connectionOrSSH.exec('nginx -v').strip.split('/')[1].to_f
|
64
|
+
elsif connectionOrSSH
|
65
|
+
target['NginxVersion'] = self.sshExec!(connectionOrSSH, 'nginx -v').strip.split('/')[1].to_f
|
58
66
|
else
|
59
67
|
target['NginxVersion'] = `nginx -v`.strip.split('/')[1].to_f
|
60
68
|
end
|
61
69
|
end
|
62
70
|
|
63
|
-
|
64
|
-
|
71
|
+
# DEPRECATED
|
72
|
+
def self.reload(connection = nil, dry = false)
|
73
|
+
if connection.is_a?(IO::Connection)
|
74
|
+
connection.exec("systemctl reload nginx", false, { 'dry' => dry })
|
75
|
+
else
|
76
|
+
self.exec("systemctl reload nginx", connection, false, dry)
|
77
|
+
end
|
65
78
|
end
|
66
79
|
|
67
|
-
|
68
|
-
|
69
|
-
Framework::LinuxApp.
|
80
|
+
# DEPRECATED
|
81
|
+
def self.ensurePackage(connection = nil)
|
82
|
+
Framework::LinuxApp.ensurePackages([NGINX_PACKAGE], connection)
|
83
|
+
Framework::LinuxApp.ensureServiceAutoStartOverSSH(NGINX_PACKAGE, connection)
|
70
84
|
end
|
71
85
|
|
72
|
-
|
73
|
-
|
74
|
-
self.class.
|
86
|
+
# DEPRECATED
|
87
|
+
def useNginxProxy(dir, configName, id, target, activeState, state, context, options, connectionOrSSH)
|
88
|
+
self.class.ensurePackage(connectionOrSSH)
|
89
|
+
self.class.prepareNginxConfig(target, connectionOrSSH)
|
75
90
|
self.writeNginxConfig(dir, configName, id, target, state, context, options)
|
76
91
|
self.deployNginxConfig(id, target, activeState, context, options)
|
77
|
-
Framework::LinuxApp.startServiceOverSSH(NGINX_PACKAGE,
|
78
|
-
self.class.reload(
|
92
|
+
Framework::LinuxApp.startServiceOverSSH(NGINX_PACKAGE, connectionOrSSH)
|
93
|
+
self.class.reload(connectionOrSSH)
|
79
94
|
end
|
80
95
|
|
81
|
-
|
96
|
+
# DEPRECATED
|
97
|
+
def deployNginxProxyConfig(server, name, id, target, activeState, state, context, options, connectionOrSSH)
|
82
98
|
target = target.dup
|
83
99
|
target['Proxy'] = server
|
84
100
|
target['Name'] = name if name
|
85
101
|
target['ConfigName'] = target['Name']
|
86
|
-
useNginxProxy(__dir__ + '/../../../../Plugins/Apps/Nginx', 'proxy', id, target, activeState, state, context, options,
|
102
|
+
useNginxProxy(__dir__ + '/../../../../Plugins/Apps/Nginx', 'proxy', id, target, activeState, state, context, options, connectionOrSSH)
|
87
103
|
end
|
88
104
|
|
89
105
|
private
|
90
106
|
|
107
|
+
# DEPRECATED
|
91
108
|
def updateTargetConfig(target)
|
92
109
|
target['TLS'] = true if target['TLS'].nil?
|
93
110
|
|