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
@@ -0,0 +1,92 @@
|
|
1
|
+
|
2
|
+
module ConfigLMM
|
3
|
+
module LMM
|
4
|
+
class Perplexica < Framework::Plugin
|
5
|
+
|
6
|
+
USER = 'perplexica'
|
7
|
+
HOME_DIR = '/var/lib/perplexica'
|
8
|
+
|
9
|
+
def actionPerplexicaDeploy(id, target, activeState, context, options)
|
10
|
+
|
11
|
+
self.withConnection(target['Location'], target) do |connection|
|
12
|
+
Linux.withConnection(connection) do |linuxConnection|
|
13
|
+
Podman.ensurePresent(linuxConnection, options)
|
14
|
+
Podman.createUser(USER, HOME_DIR, 'Perplexica', linuxConnection, options)
|
15
|
+
linuxConnection.withUserShell(USER) do |shell|
|
16
|
+
shell.createDirs(options, '~/data', '~/uploads')
|
17
|
+
end
|
18
|
+
|
19
|
+
linuxConnection.upload(__dir__ + '/config.toml', HOME_DIR, options)
|
20
|
+
|
21
|
+
grokKey = target['GrokSecretId'] ? context.secrets.load(target['GrokSecretId'], 'API_KEY') : nil
|
22
|
+
linuxConnection.fileReplace("#{HOME_DIR}/config.toml", '\$GROQ_KEY', grokKey, options)
|
23
|
+
|
24
|
+
anthropicKey = target['AnthropicSecretId'] ? context.secrets.load(target['AnthropicSecretId'], 'API_KEY') : nil
|
25
|
+
linuxConnection.fileReplace("#{HOME_DIR}/config.toml", '\$ANTHROPIC_KEY', anthropicKey, options)
|
26
|
+
|
27
|
+
geminiKey = target['GeminiSecretId'] ? context.secrets.load(target['GeminiSecretId'], 'API_KEY') : nil
|
28
|
+
linuxConnection.fileReplace("#{HOME_DIR}/config.toml", '\$GEMINI_KEY', geminiKey, options)
|
29
|
+
|
30
|
+
deepseekKey = target['DeepSeekSecretId'] ? context.secrets.load(target['DeepSeekSecretId'], 'API_KEY') : nil
|
31
|
+
linuxConnection.fileReplace("#{HOME_DIR}/config.toml", '\$DEEPSEEK_KEY', deepseekKey, options)
|
32
|
+
|
33
|
+
openaiKey = nil
|
34
|
+
openaiURL = nil
|
35
|
+
openaiModel = nil
|
36
|
+
if target['OpenAI'] && !target['OpenAI'].to_h.empty?
|
37
|
+
openaiKey = target['OpenAI']['SecretId'] ? context.secrets.load(target['OpenAI']['SecretId'], 'API_KEY') : nil
|
38
|
+
openaiURL = Podman.updateURL(target['OpenAI']['URL']) unless target['OpenAI']['URL'].to_s.empty?
|
39
|
+
openaiModel = target['OpenAI']['Model']
|
40
|
+
end
|
41
|
+
linuxConnection.fileReplace("#{HOME_DIR}/config.toml", '\$OPENAI_KEY', openaiKey, options)
|
42
|
+
linuxConnection.fileReplace("#{HOME_DIR}/config.toml", '\$OPENAI_URL', openaiURL, options)
|
43
|
+
linuxConnection.fileReplace("#{HOME_DIR}/config.toml", '\$OPENAI_MODEL', openaiModel, options)
|
44
|
+
|
45
|
+
ollamaURL = nil
|
46
|
+
if target['Ollama'] && !target['Ollama'].to_h.empty?
|
47
|
+
ollamaURL = Podman.updateURL(target['Ollama']['URL'], Ollama::PORT)
|
48
|
+
end
|
49
|
+
linuxConnection.fileReplace("#{HOME_DIR}/config.toml", '\$OLLAMA_URL', ollamaURL, options)
|
50
|
+
|
51
|
+
linuxConnection.setUserGroup("#{HOME_DIR}/config.toml", USER, USER, options)
|
52
|
+
|
53
|
+
path = Podman.containersPath(HOME_DIR)
|
54
|
+
|
55
|
+
searxng = Podman.updateURL(target['SearXNG'], SearXNG::PORT)
|
56
|
+
|
57
|
+
linuxConnection.fileWrite("#{path}/Perplexica.env", "SEARXNG_API_URL=#{searxng}", options)
|
58
|
+
|
59
|
+
linuxConnection.setUserGroup("#{path}/Perplexica.env", USER, USER, options)
|
60
|
+
linuxConnection.setPrivate("#{path}/Perplexica.env", options)
|
61
|
+
|
62
|
+
linuxConnection.upload(__dir__ + '/Perplexica.container', path, options)
|
63
|
+
|
64
|
+
linuxConnection.reloadUserServices(USER, options)
|
65
|
+
linuxConnection.restartUserService(USER, 'Perplexica', options)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def cleanup(configs, state, context, options)
|
71
|
+
cleanupType(:Perplexica, configs, state, context, options) do |item, id, state, context, options, connection|
|
72
|
+
Linux.withConnection(connection) do |linuxConnection|
|
73
|
+
|
74
|
+
linuxConnection.stopUserService(USER, 'Perplexica', options)
|
75
|
+
|
76
|
+
path = Podman.containersPath(HOME_DIR)
|
77
|
+
linuxConnection.rm(path + '/Perplexica.container', options[:dry])
|
78
|
+
|
79
|
+
state.item(id)['Status'] = State::STATUS_DELETED unless options[:dry]
|
80
|
+
|
81
|
+
if options[:destroy]
|
82
|
+
linuxConnection.deleteUserAndGroup(USER, options)
|
83
|
+
state.item(id)['Status'] = State::STATUS_DESTROYED unless options[:dry]
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
[GENERAL]
|
2
|
+
SIMILARITY_MEASURE = "cosine" # "cosine" or "dot"
|
3
|
+
KEEP_ALIVE = "5m" # How long to keep Ollama models loaded into memory. (Instead of using -1 use "-1m")
|
4
|
+
|
5
|
+
[MODELS.OPENAI]
|
6
|
+
API_KEY = "$OPENAI_KEY"
|
7
|
+
|
8
|
+
[MODELS.GROQ]
|
9
|
+
API_KEY = "$GROQ_KEY"
|
10
|
+
|
11
|
+
[MODELS.ANTHROPIC]
|
12
|
+
API_KEY = "$ANTHROPIC_KEY"
|
13
|
+
|
14
|
+
[MODELS.GEMINI]
|
15
|
+
API_KEY = "$GEMINI_KEY"
|
16
|
+
|
17
|
+
[MODELS.CUSTOM_OPENAI]
|
18
|
+
API_KEY = "$OPENAI_KEY"
|
19
|
+
API_URL = "$OPENAI_URL"
|
20
|
+
MODEL_NAME = "$OPENAI_MODEL"
|
21
|
+
|
22
|
+
[MODELS.OLLAMA]
|
23
|
+
API_URL = "$OLLAMA_URL" # Ollama API URL
|
24
|
+
|
25
|
+
[MODELS.DEEPSEEK]
|
26
|
+
API_KEY = "$DEEPSEEK_KEY"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
|
2
|
+
module ConfigLMM
|
3
|
+
module LMM
|
4
|
+
class PodmanConnection
|
5
|
+
|
6
|
+
attr_reader :connection
|
7
|
+
|
8
|
+
def initialize(connection, container)
|
9
|
+
@connection = connection
|
10
|
+
@container = container
|
11
|
+
end
|
12
|
+
|
13
|
+
def exec(command, allowFailure = false, options = {})
|
14
|
+
workdir = ''
|
15
|
+
if options[:workdir]
|
16
|
+
workdir = "--workdir #{options[:workdir].shellescape}"
|
17
|
+
end
|
18
|
+
cmd = "podman exec #{workdir} #{@container['Id'].shellescape} sh -c '#{LinuxShell.escapeSingleQuotes(command)}'"
|
19
|
+
@connection.exec(cmd, allowFailure, options)
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
require_relative 'Connection'
|
2
|
+
|
3
|
+
require 'uri'
|
4
|
+
|
5
|
+
module ConfigLMM
|
6
|
+
module LMM
|
7
|
+
class Podman < Framework::Plugin
|
8
|
+
|
9
|
+
PACKAGE_NAME = 'Podman'
|
10
|
+
SYSTEM_CONTAINERS_PATH = '/etc/containers/systemd'
|
11
|
+
USER_CONTAINERS_PATH = '~/.config/containers/systemd'
|
12
|
+
HOST_IP = '10.0.2.2'
|
13
|
+
|
14
|
+
def self.ensurePresent(linuxConnection, options = {})
|
15
|
+
linuxConnection.ensurePackage(PACKAGE_NAME, options)
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.container(name, connection, options = {})
|
19
|
+
result = connection.exec("podman ps --format json --filter name='^#{name}$'", false, { **options, dry: false }).strip
|
20
|
+
containers = JSON.parse(result)
|
21
|
+
raise "Failed to find container #{name}!" if containers.empty?
|
22
|
+
containers.first
|
23
|
+
rescue JSON::ParserError => error
|
24
|
+
return { 'Id' => name } if options['dry']
|
25
|
+
raise error
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.withConnection(connection, container)
|
29
|
+
yield(PodmanConnection.new(connection, container))
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.run(imageId, name, cmd, linuxConnection, options)
|
33
|
+
linuxConnection.exec("podman run --name #{name} --replace --rm -it #{imageId} #{cmd}")
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.createUser(user, homedir, userComment, linuxConnection, options)
|
37
|
+
linuxConnection.createServiceUser(user, homedir, userComment, options)
|
38
|
+
linuxConnection.createSubuids(user, options)
|
39
|
+
linuxConnection.enableLinger(user, options)
|
40
|
+
linuxConnection.withUserShell(user) do |shell|
|
41
|
+
shell.createDirs(options, USER_CONTAINERS_PATH)
|
42
|
+
end
|
43
|
+
# This is a workaround for performance issue with Podman --userns keep-id
|
44
|
+
# See https://github.com/containers/podman/issues/16541
|
45
|
+
linuxConnection.upload(__dir__ + '/storage.conf', homedir + '/.config/containers/', options)
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.loadImage(userShell, imageFile, options = {})
|
49
|
+
cmd = "podman image load --input '#{imageFile.shellescape}'"
|
50
|
+
userShell.exec(cmd, false, options)
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.removeImage(userShell, imageFile, options = {})
|
54
|
+
cmd = "podman image rm --ignore '#{imageFile.shellescape}'"
|
55
|
+
userShell.exec(cmd, false, options)
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.containersPath(homeDir = nil)
|
59
|
+
if homeDir.nil?
|
60
|
+
SYSTEM_CONTAINERS_PATH
|
61
|
+
else
|
62
|
+
USER_CONTAINERS_PATH.gsub('~', homeDir)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.updateHost(host)
|
67
|
+
host = HOST_IP if host.to_s.empty? || ['localhost', '127.0.0.1', '::1'].include?(host)
|
68
|
+
host
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.updateURL(url, defaultPort = nil)
|
72
|
+
uri = URI.parse(url.to_s)
|
73
|
+
uri.scheme = 'http' unless uri.scheme
|
74
|
+
uri.port = defaultPort if !uri.port && defaultPort
|
75
|
+
uri.host = self.updateHost(uri.host)
|
76
|
+
uri.to_s
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|