ConfigLMM 0.3.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 +70 -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 +20 -0
- data/Plugins/Apps/Authentik/Authentik-Server.container +7 -1
- data/Plugins/Apps/Authentik/Authentik-Worker.container +7 -1
- data/Plugins/Apps/Authentik/Authentik.conf.erb +18 -6
- data/Plugins/Apps/Authentik/Authentik.lmm.rb +232 -45
- data/Plugins/Apps/BookStack/BookStack.conf.erb +38 -0
- data/Plugins/Apps/BookStack/BookStack.container +20 -0
- data/Plugins/Apps/BookStack/BookStack.lmm.rb +91 -0
- 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 +22 -0
- data/Plugins/Apps/Discourse/Discourse.conf.erb +38 -0
- data/Plugins/Apps/Discourse/Discourse.container +21 -0
- data/Plugins/Apps/Discourse/Discourse.lmm.rb +156 -0
- data/Plugins/Apps/Dovecot/Dovecot.lmm.rb +87 -52
- data/Plugins/Apps/ERPNext/ERPNext-Frontend.container +24 -0
- data/Plugins/Apps/ERPNext/ERPNext-Queue.container +22 -0
- data/Plugins/Apps/ERPNext/ERPNext-Scheduler.container +22 -0
- data/Plugins/Apps/ERPNext/ERPNext-Websocket.container +24 -0
- data/Plugins/Apps/ERPNext/ERPNext.container +23 -0
- data/Plugins/Apps/ERPNext/ERPNext.lmm.rb +204 -0
- data/Plugins/Apps/ERPNext/ERPNext.network +12 -0
- data/Plugins/Apps/ERPNext/sites/apps.json +10 -0
- data/Plugins/Apps/ERPNext/sites/apps.txt +3 -0
- data/Plugins/Apps/ERPNext/sites/common_site_config.json +11 -0
- data/Plugins/Apps/GitLab/GitLab.container +9 -2
- data/Plugins/Apps/GitLab/GitLab.lmm.rb +52 -33
- 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 +78 -0
- data/Plugins/Apps/LetsEncrypt/hooks/dovecot.sh +2 -0
- data/Plugins/Apps/LetsEncrypt/hooks/nginx.sh +2 -0
- data/Plugins/Apps/LetsEncrypt/hooks/postfix.sh +2 -0
- data/Plugins/Apps/LetsEncrypt/renew-certificates.service +7 -0
- data/Plugins/Apps/LetsEncrypt/renew-certificates.timer +12 -0
- data/Plugins/Apps/LetsEncrypt/rfc2136.ini +11 -0
- 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 +122 -0
- 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 +19 -0
- data/Plugins/Apps/Matrix/Matrix.conf.erb +47 -9
- data/Plugins/Apps/Matrix/Matrix.lmm.rb +119 -5
- data/Plugins/Apps/Matrix/Synapse.container +22 -0
- data/Plugins/Apps/Matrix/config.json +50 -0
- data/Plugins/Apps/Matrix/homeserver.yaml +70 -0
- data/Plugins/Apps/Matrix/log.config +30 -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 +155 -48
- 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 +54 -4
- data/Plugins/Apps/Nginx/conf.d/languages.conf +21 -0
- data/Plugins/Apps/Nginx/config-lmm/errors.conf +33 -22
- data/Plugins/Apps/Nginx/config-lmm/gateway-errors.conf +20 -0
- data/Plugins/Apps/Nginx/config-lmm/proxy.conf +6 -2
- data/Plugins/Apps/Nginx/main.conf.erb +7 -3
- data/Plugins/Apps/Nginx/nginx.conf +2 -2
- data/Plugins/Apps/Nginx/nginx.lmm.rb +103 -81
- data/Plugins/Apps/Nginx/proxy.conf.erb +24 -6
- data/Plugins/Apps/Odoo/Odoo.conf.erb +0 -3
- data/Plugins/Apps/Odoo/Odoo.container +7 -1
- 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 +23 -0
- data/Plugins/Apps/{GitLab/GitLab.conf.erb → OpenVidu/OpenVidu.conf.erb} +8 -3
- data/Plugins/Apps/OpenVidu/OpenVidu.container +21 -0
- data/Plugins/Apps/OpenVidu/OpenVidu.lmm.rb +94 -0
- data/Plugins/Apps/OpenVidu/OpenViduCall.conf.erb +32 -0
- data/Plugins/Apps/OpenVidu/OpenViduCall.container +20 -0
- data/Plugins/Apps/OpenVidu/ingress.yaml +10 -0
- data/Plugins/Apps/OpenVidu/livekit.yaml +13 -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 -9
- data/Plugins/Apps/Peppermint/Peppermint.container +7 -1
- 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 +249 -145
- data/Plugins/Apps/PostgreSQL/Connection.rb +97 -0
- data/Plugins/Apps/PostgreSQL/PostgreSQL.lmm.rb +204 -99
- 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 +72 -0
- data/Plugins/Apps/Roundcube/Roundcube.lmm.rb +141 -0
- 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 +59 -0
- data/Plugins/Apps/Tunnel/tunnelTCP.service +9 -0
- data/Plugins/Apps/Tunnel/tunnelTCP.socket +9 -0
- data/Plugins/Apps/Tunnel/tunnelUDP.service +9 -0
- data/Plugins/Apps/Tunnel/tunnelUDP.socket +9 -0
- 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 +64 -20
- data/Plugins/Apps/Vaultwarden/Vaultwarden.conf.erb +9 -6
- data/Plugins/Apps/Vaultwarden/Vaultwarden.container +7 -1
- data/Plugins/Apps/Vaultwarden/Vaultwarden.lmm.rb +67 -28
- data/Plugins/Apps/Wiki.js/Wiki.js.conf.erb +39 -0
- data/Plugins/Apps/Wiki.js/Wiki.js.container +20 -0
- data/Plugins/Apps/Wiki.js/Wiki.js.lmm.rb +55 -0
- 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 +40 -4
- data/Plugins/Apps/gollum/gollum.container +10 -1
- data/Plugins/Apps/gollum/gollum.lmm.rb +56 -47
- 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 +81 -0
- data/Plugins/OS/Linux/Distributions.yaml +32 -0
- data/Plugins/OS/Linux/Flavours.yaml +24 -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 +708 -174
- data/Plugins/OS/Linux/Packages.yaml +67 -3
- data/Plugins/OS/Linux/Proxmox/answer.toml.erb +30 -0
- 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 +93 -40
- 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 +10 -7
- data/Plugins/Platforms/Proxmox/Proxmox.lmm.rb +402 -0
- data/Plugins/Platforms/Proxmox/XTerm.rb +321 -0
- data/Plugins/Platforms/libvirt/libvirt.lmm.rb +41 -15
- 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 +130 -41
- data/Plugins/Services/DNS/tonic.lmm.rb +22 -12
- data/bootstrap.sh +41 -3
- data/lib/ConfigLMM/Framework/plugins/dns.rb +4 -3
- data/lib/ConfigLMM/Framework/plugins/linuxApp.rb +187 -144
- data/lib/ConfigLMM/Framework/plugins/nginxApp.rb +54 -6
- data/lib/ConfigLMM/Framework/plugins/plugin.rb +68 -140
- 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 +13 -5
- data/lib/ConfigLMM/commands/cleanup.rb +1 -0
- data/lib/ConfigLMM/commands/configsCommand.rb +38 -5
- data/lib/ConfigLMM/commands/diff.rb +33 -9
- data/lib/ConfigLMM/context.rb +22 -3
- data/lib/ConfigLMM/io/configList.rb +85 -7
- 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 +12 -3
- data/lib/ConfigLMM/version.rb +2 -1
- data/lib/ConfigLMM.rb +1 -0
- data/{Examples → scripts}/configlmmAuth.sh +7 -5
- metadata +257 -9
@@ -1,166 +1,200 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'tty-which'
|
4
|
+
|
3
5
|
module ConfigLMM
|
4
6
|
module Framework
|
5
7
|
|
6
8
|
class LinuxApp < Framework::Plugin
|
7
9
|
|
8
10
|
LINUX_FOLDER = __dir__ + '/../../../../Plugins/OS/Linux/'
|
9
|
-
SUSE_NAME = 'openSUSE Leap'
|
10
11
|
SUSE_ID = 'opensuse-leap'
|
11
12
|
PODMAN_PACKAGE = 'Podman'
|
12
13
|
SYSTEMD_CONTAINERS_PATH = '~/.config/containers/systemd/'
|
13
14
|
|
14
|
-
|
15
|
-
|
15
|
+
# DEPRECATED
|
16
|
+
def ensurePackage(name, location, binary = nil)
|
17
|
+
self.class.ensurePackage(name, location, binary)
|
16
18
|
end
|
17
19
|
|
20
|
+
# DEPRECATED
|
18
21
|
def ensurePackages(names, location)
|
19
|
-
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.ensurePackages(names, locationOrSSH)
|
23
|
-
distroInfo = nil
|
24
|
-
closure = Proc.new do |ssh|
|
25
|
-
distroInfo = self.currentDistroInfo(ssh)
|
26
|
-
reposPackages = self.mapPackages(names, distroInfo['Name'])
|
27
|
-
|
28
|
-
repos = []
|
29
|
-
pkgs = []
|
30
|
-
reposPackages.each do |pkg|
|
31
|
-
if pkg.include?('|')
|
32
|
-
repoName, pkg = pkg.split('|')
|
33
|
-
repos << repoName
|
34
|
-
pkgs << pkg
|
35
|
-
else
|
36
|
-
pkgs << pkg
|
37
|
-
end
|
38
|
-
end
|
39
|
-
repos.each do |repoName|
|
40
|
-
self.addRepo(repoName, distroInfo, ssh)
|
41
|
-
end
|
42
|
-
command = distroInfo['InstallPackage'] + ' ' + pkgs.map { |pkg| pkg.shellescape }.join(' ')
|
43
|
-
if ssh
|
44
|
-
self.sshExec!(ssh, command)
|
45
|
-
else
|
46
|
-
if `echo $EUID`.strip == '0'
|
47
|
-
`#{command} >/dev/null`
|
48
|
-
else
|
49
|
-
`sudo #{command} >/dev/null`
|
50
|
-
end
|
51
|
-
end
|
52
|
-
distroInfo
|
53
|
-
end
|
22
|
+
self.class.ensurePackages(names, location)
|
23
|
+
end
|
54
24
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
25
|
+
# DEPRECATED
|
26
|
+
def self.ensurePackage(name, locationOrConnection, binary = nil)
|
27
|
+
if binary && TTY::Which.which(binary)
|
28
|
+
return
|
29
|
+
end
|
30
|
+
self.ensurePackages([name], locationOrConnection)
|
31
|
+
end
|
60
32
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
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
|
66
39
|
end
|
67
|
-
distroInfo
|
68
40
|
end
|
69
41
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
# TODO
|
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
|
77
48
|
end
|
78
49
|
end
|
79
50
|
|
80
|
-
|
81
|
-
|
82
|
-
|
51
|
+
# DEPRECATED
|
52
|
+
def ensureServiceAutoStart(name, locationOrConnection)
|
53
|
+
self.class.ensureServiceAutoStart(name, locationOrConnection)
|
54
|
+
end
|
55
|
+
|
56
|
+
# DEPRECATED
|
57
|
+
def self.ensureServiceAutoStart(name, locationOrConnection)
|
58
|
+
name = self.convertServiceName(name, locationOrConnection)
|
59
|
+
self.execDistroCommand(name, 'AutoStartService', locationOrConnection)
|
60
|
+
end
|
61
|
+
|
62
|
+
# DEPRECATED
|
63
|
+
def self.ensureServiceAutoStartOverSSH(name, locationOrConnection)
|
64
|
+
self.ensureServiceAutoStart(name, locationOrConnection)
|
65
|
+
end
|
66
|
+
|
67
|
+
# DEPRECATED
|
68
|
+
def startService(name, locationOrConnection, dry = false)
|
69
|
+
self.class.startService(name, locationOrConnection, dry = false)
|
70
|
+
end
|
71
|
+
|
72
|
+
# DEPRECATED
|
73
|
+
def self.startService(name, locationOrConnection, dry = false)
|
74
|
+
name = self.convertServiceName(name, locationOrConnection)
|
75
|
+
self.execDistroCommand(name, 'StartService', locationOrConnection, false, dry)
|
76
|
+
end
|
77
|
+
|
78
|
+
# DEPRECATED
|
79
|
+
def self.startServiceOverSSH(name, locationOrConnection, dry = false)
|
80
|
+
name = self.convertServiceName(name, locationOrConnection)
|
81
|
+
self.startService(name, locationOrConnection, dry)
|
82
|
+
end
|
83
|
+
|
84
|
+
# DEPRECATED
|
85
|
+
def self.restartService(name, locationOrConnection, dry = false)
|
86
|
+
name = self.convertServiceName(name, locationOrConnection)
|
87
|
+
self.execDistroCommand(name, 'RestartService', locationOrConnection, false, dry)
|
88
|
+
end
|
89
|
+
|
90
|
+
# DEPRECATED
|
91
|
+
def self.reloadService(name, locationOrConnection, dry = false)
|
92
|
+
name = self.convertServiceName(name, locationOrConnection)
|
93
|
+
self.execDistroCommand(name, 'ReloadService', locationOrConnection, false, dry)
|
94
|
+
end
|
83
95
|
|
84
|
-
|
85
|
-
|
96
|
+
# DEPRECATED
|
97
|
+
def self.stopService(name, locationOrConnection, dry = false)
|
98
|
+
name = self.convertServiceName(name, locationOrConnection)
|
99
|
+
self.execDistroCommand(name, 'StopService', locationOrConnection, true, dry)
|
100
|
+
end
|
101
|
+
|
102
|
+
# DEPRECATED
|
103
|
+
def self.disableService(name, locationOrConnection, dry = false)
|
104
|
+
name = self.convertServiceName(name, locationOrConnection)
|
105
|
+
self.execDistroCommand(name, 'DisableService', locationOrConnection, true, dry)
|
106
|
+
end
|
107
|
+
|
108
|
+
# DEPRECATED
|
109
|
+
def self.reloadServiceManager(locationOrConnection, dry = false)
|
110
|
+
self.execDistroCommand(nil, 'ReloadServiceManager', locationOrConnection, false, dry)
|
111
|
+
end
|
112
|
+
|
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)
|
117
|
+
end
|
118
|
+
|
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 })
|
86
123
|
end
|
124
|
+
end
|
87
125
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
else
|
93
|
-
closure.call(locationOrSSH)
|
126
|
+
# DEPRECATED
|
127
|
+
def self.convertServiceName(name, connection)
|
128
|
+
self.doConnection(connection) do |connection|
|
129
|
+
name = LMM::LinuxConnection.new(connection).convertServiceName(name)
|
94
130
|
end
|
131
|
+
name
|
95
132
|
end
|
96
133
|
|
97
|
-
def
|
98
|
-
if
|
99
|
-
|
100
|
-
|
101
|
-
|
134
|
+
def self.doConnection(locationOrConnection, &block)
|
135
|
+
if locationOrConnection.nil? || locationOrConnection == '@me'
|
136
|
+
result = block.call(nil)
|
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)
|
102
141
|
else
|
103
|
-
|
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
|
104
149
|
end
|
150
|
+
result
|
105
151
|
end
|
106
152
|
|
107
|
-
|
108
|
-
|
109
|
-
|
153
|
+
# DEPRECATED
|
154
|
+
def self.firewallAddServiceOverSSH(serviceName, locationOrConnection)
|
155
|
+
self.firewallAddService(serviceName, locationOrConnection)
|
156
|
+
end
|
110
157
|
|
111
|
-
|
112
|
-
|
113
|
-
|
158
|
+
# DEPRECATED
|
159
|
+
def self.firewallAddPortOverSSH(portName, locationOrConnection)
|
160
|
+
self.firewallAddPort(portName, locationOrConnection)
|
161
|
+
end
|
114
162
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
else
|
120
|
-
closure.call(locationOrSSH)
|
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 })
|
121
167
|
end
|
122
168
|
end
|
123
169
|
|
124
|
-
|
125
|
-
def self.
|
126
|
-
|
127
|
-
|
128
|
-
self.sshExec!(ssh, command, true)
|
129
|
-
command = 'firewall-cmd --add-service ' + serviceName.shellescape
|
130
|
-
self.sshExec!(ssh, command, true)
|
131
|
-
end
|
132
|
-
|
133
|
-
if locationOrSSH.is_a?(String) || locationOrSSH.is_a?(Addressable::URI)
|
134
|
-
self.sshStart(locationOrSSH) do |ssh|
|
135
|
-
closure.call(ssh)
|
136
|
-
end
|
137
|
-
else
|
138
|
-
closure.call(locationOrSSH)
|
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 })
|
139
174
|
end
|
140
175
|
end
|
141
176
|
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
end
|
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 })
|
181
|
+
end
|
182
|
+
end
|
149
183
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
else
|
155
|
-
closure.call(locationOrSSH)
|
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 })
|
156
188
|
end
|
157
189
|
end
|
158
190
|
|
159
191
|
def self.mapPackages(packages, distroName)
|
160
|
-
|
192
|
+
allPackages = YAML.load_file(LINUX_FOLDER + 'Packages.yaml')
|
161
193
|
names = []
|
194
|
+
raise "Distro '#{distroName}' not implemented!" unless allPackages.key?(distroName)
|
195
|
+
distroPackages = allPackages[distroName].to_h
|
162
196
|
packages.to_a.each do |pkg|
|
163
|
-
packageName = distroPackages[
|
197
|
+
packageName = distroPackages[pkg]
|
164
198
|
if packageName
|
165
199
|
if packageName.is_a?(Array)
|
166
200
|
names += packageName
|
@@ -174,6 +208,7 @@ module ConfigLMM
|
|
174
208
|
names
|
175
209
|
end
|
176
210
|
|
211
|
+
# DEPRECATED
|
177
212
|
def self.createCertificateOverSSH(ssh)
|
178
213
|
dir = "/etc/letsencrypt/live/Wildcard/"
|
179
214
|
self.sshExec!(ssh, "mkdir -p #{dir}")
|
@@ -185,51 +220,59 @@ module ConfigLMM
|
|
185
220
|
dir
|
186
221
|
end
|
187
222
|
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
self.sshExec!(ssh, addUserCmd, true)
|
192
|
-
self.createSubuidsOverSSH(user, distroInfo, ssh)
|
193
|
-
self.sshExec!(ssh, "loginctl enable-linger #{user}")
|
194
|
-
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)
|
195
226
|
end
|
196
227
|
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
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}'")
|
208
238
|
else
|
209
|
-
|
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}'")
|
210
246
|
end
|
211
247
|
end
|
212
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
|
213
255
|
def self.createSubuidsOverSSH(user, distroInfo, ssh)
|
214
256
|
self.sshExec!(ssh, "#{distroInfo['ModifyUser']} --add-subuids 100000-165535 --add-subgids 100000-165535 #{user}")
|
215
257
|
end
|
216
258
|
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
259
|
+
# DEPRECATED
|
260
|
+
def self.distroID(connection = nil)
|
261
|
+
id = nil
|
262
|
+
self.doConnection(connection) do |connection|
|
263
|
+
id = LMM::LinuxConnection.new(connection).distroID
|
222
264
|
end
|
265
|
+
id
|
223
266
|
end
|
224
267
|
|
225
|
-
|
226
|
-
|
268
|
+
# DEPRECATED
|
269
|
+
def self.currentDistroInfo(connection)
|
270
|
+
self.distroInfo(self.distroID(connection))
|
227
271
|
end
|
228
272
|
|
273
|
+
# DEPRECATED
|
229
274
|
def self.distroInfo(distroID)
|
230
|
-
|
231
|
-
raise Framework::PluginProcessError.new("Unknown Linux Distro: #{distroID}!") unless distributions.key?(distroID)
|
232
|
-
distributions[distroID]
|
275
|
+
YAML.load_file(LINUX_FOLDER + 'Distributions.yaml')[distroID]
|
233
276
|
end
|
234
277
|
|
235
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
|
|
@@ -25,9 +28,11 @@ module ConfigLMM
|
|
25
28
|
target = target.dup
|
26
29
|
target['NginxVersion'] = 0 unless target['NginxVersion']
|
27
30
|
template = ERB.new(File.read(dir + '/' + name + '.conf.erb'))
|
31
|
+
name = target['ConfigName'] if target['ConfigName']
|
28
32
|
renderTemplate(template, target, outputFolder + '/nginx/servers-lmm/' + name + '.conf', options)
|
29
33
|
end
|
30
34
|
|
35
|
+
# DEPRECATED
|
31
36
|
def deployNginxConfig(id, target, activeState, context, options)
|
32
37
|
outputFolder = options['output'] + '/nginx/servers-lmm'
|
33
38
|
|
@@ -36,27 +41,70 @@ module ConfigLMM
|
|
36
41
|
raise Framework::PluginProcessError.new("Unknown Protocol: #{uri.scheme}!") if uri.scheme != 'ssh'
|
37
42
|
self.class.sshStart(uri) do |ssh|
|
38
43
|
self.class.uploadFolder(outputFolder, CONFIG_DIR, ssh)
|
39
|
-
|
44
|
+
if target['TLS']
|
45
|
+
Framework::LinuxApp.firewallAddServiceOverSSH('https', ssh)
|
46
|
+
else
|
47
|
+
Framework::LinuxApp.firewallAddServiceOverSSH('http', ssh)
|
48
|
+
end
|
40
49
|
end
|
41
50
|
else
|
42
51
|
copy(outputFolder, CONFIG_DIR, options['dry'])
|
43
52
|
end
|
44
53
|
end
|
45
54
|
|
46
|
-
|
47
|
-
|
55
|
+
# DEPRECATED
|
56
|
+
def cleanupNginxConfig(name, id, state, context, options, connection)
|
57
|
+
connection.rm('/etc/nginx/servers-lmm/' + name + '.conf', options['dry'])
|
48
58
|
end
|
49
59
|
|
50
|
-
|
51
|
-
|
52
|
-
|
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
|
53
66
|
else
|
54
67
|
target['NginxVersion'] = `nginx -v`.strip.split('/')[1].to_f
|
55
68
|
end
|
56
69
|
end
|
57
70
|
|
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
|
78
|
+
end
|
79
|
+
|
80
|
+
# DEPRECATED
|
81
|
+
def self.ensurePackage(connection = nil)
|
82
|
+
Framework::LinuxApp.ensurePackages([NGINX_PACKAGE], connection)
|
83
|
+
Framework::LinuxApp.ensureServiceAutoStartOverSSH(NGINX_PACKAGE, connection)
|
84
|
+
end
|
85
|
+
|
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)
|
90
|
+
self.writeNginxConfig(dir, configName, id, target, state, context, options)
|
91
|
+
self.deployNginxConfig(id, target, activeState, context, options)
|
92
|
+
Framework::LinuxApp.startServiceOverSSH(NGINX_PACKAGE, connectionOrSSH)
|
93
|
+
self.class.reload(connectionOrSSH)
|
94
|
+
end
|
95
|
+
|
96
|
+
# DEPRECATED
|
97
|
+
def deployNginxProxyConfig(server, name, id, target, activeState, state, context, options, connectionOrSSH)
|
98
|
+
target = target.dup
|
99
|
+
target['Proxy'] = server
|
100
|
+
target['Name'] = name if name
|
101
|
+
target['ConfigName'] = target['Name']
|
102
|
+
useNginxProxy(__dir__ + '/../../../../Plugins/Apps/Nginx', 'proxy', id, target, activeState, state, context, options, connectionOrSSH)
|
103
|
+
end
|
104
|
+
|
58
105
|
private
|
59
106
|
|
107
|
+
# DEPRECATED
|
60
108
|
def updateTargetConfig(target)
|
61
109
|
target['TLS'] = true if target['TLS'].nil?
|
62
110
|
|