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
@@ -0,0 +1,154 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'uri'
|
3
|
+
require 'addressable/idna'
|
4
|
+
|
5
|
+
module ConfigLMM
|
6
|
+
module LMM
|
7
|
+
class OpenTelemetry < Framework::Plugin
|
8
|
+
|
9
|
+
PACKAGE_NAME = 'otelcol-contrib'
|
10
|
+
SERVICE_NAME = :'otelcol-contrib'
|
11
|
+
|
12
|
+
def actionOtelCollectorDeploy(id, target, activeState, context, options)
|
13
|
+
self.withConnection(target['Location'], target) do |connection|
|
14
|
+
Linux.withConnection(connection) do |linuxConnection|
|
15
|
+
linuxConnection.ensurePackage(PACKAGE_NAME, options)
|
16
|
+
linuxConnection.ensureServiceAutoStart(SERVICE_NAME, options)
|
17
|
+
|
18
|
+
linuxConnection.createDirs(options, '/var/lib/otelcol/file_storage')
|
19
|
+
linuxConnection.setUserGroup('/var/lib/otelcol/file_storage', 'otelcol-contrib', 'otelcol-contrib', options)
|
20
|
+
linuxConnection.exec("usermod -a -G systemd-journal otelcol-contrib", false, options)
|
21
|
+
|
22
|
+
config = YAML.load_file(__dir__ + '/Config/config.yaml')
|
23
|
+
configureEnvironment(config, target['Environment'])
|
24
|
+
configureServices(config, target['Services'], linuxConnection, options)
|
25
|
+
configureReceivers(config, target['Receivers'])
|
26
|
+
configureProcessors(config, target['Processors'])
|
27
|
+
configureExporters(config, target['Exporters'])
|
28
|
+
configFile = options['output'] + '/config.yaml'
|
29
|
+
File.write(configFile, config.to_yaml)
|
30
|
+
|
31
|
+
linuxConnection.upload(configFile, '/etc/otelcol-contrib/', options)
|
32
|
+
|
33
|
+
linuxConnection.restartService(SERVICE_NAME, options)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def cleanup(configs, state, context, options)
|
39
|
+
cleanupType(:OtelCollector, configs, state, context, options) do |item, id, state, context, options, connection|
|
40
|
+
Linux.withConnection(connection) do |linuxConnection|
|
41
|
+
|
42
|
+
linuxConnection.stopService(SERVICE_NAME, options)
|
43
|
+
linuxConnection.disableService(SERVICE_NAME, options)
|
44
|
+
linuxConnection.removePackage(PACKAGE_NAME, options)
|
45
|
+
|
46
|
+
state.item(id)['Status'] = State::STATUS_DELETED unless options[:dry]
|
47
|
+
|
48
|
+
if options[:destroy]
|
49
|
+
linuxConnection.rm('/etc/otelcol-contrib', options[:dry])
|
50
|
+
state.item(id)['Status'] = State::STATUS_DESTROYED unless options[:dry]
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def configureEnvironment(config, environment)
|
59
|
+
return unless environment
|
60
|
+
environmentNameAttr = config['processors']['resource']['attributes'].find { |attrs| attrs['key'] == 'deployment.environment.name' }
|
61
|
+
environmentNameAttr['value'] = environment
|
62
|
+
# This is deprecated but SigNoz still uses it
|
63
|
+
environmentNameAttr = config['processors']['resource']['attributes'].find { |attrs| attrs['key'] == 'deployment.environment' }
|
64
|
+
environmentNameAttr['value'] = environment
|
65
|
+
end
|
66
|
+
|
67
|
+
def configureServices(config, services, linuxConnection, options)
|
68
|
+
services.to_h.each do |name, settings|
|
69
|
+
if name == 'nginx'
|
70
|
+
linuxConnection.exec("usermod -a -G nginx otelcol-contrib", false, options)
|
71
|
+
receiverName = 'filelog/nginx'
|
72
|
+
config['receivers'][receiverName] = config['receiverTemplate'][receiverName]
|
73
|
+
config['service']['pipelines']['logs']['receivers'] << receiverName
|
74
|
+
elsif name == 'php'
|
75
|
+
settings['Users'].to_a.each do |user|
|
76
|
+
linuxConnection.exec("usermod -a -G #{user} otelcol-contrib", false, options)
|
77
|
+
end
|
78
|
+
receiverName = 'filelog/php'
|
79
|
+
config['receivers'][receiverName] = config['receiverTemplate'][receiverName]
|
80
|
+
config['service']['pipelines']['logs']['receivers'] << receiverName
|
81
|
+
receiverName = 'filelog/php_json'
|
82
|
+
config['receivers'][receiverName] = config['receiverTemplate'][receiverName]
|
83
|
+
config['service']['pipelines']['logs']['receivers'] << receiverName
|
84
|
+
elsif name == 'postgresql' || name == 'postgres'
|
85
|
+
linuxConnection.exec("usermod -a -G postgres otelcol-contrib", false, options)
|
86
|
+
receiverName = 'filelog/postgresql_json'
|
87
|
+
config['receivers'][receiverName] = config['receiverTemplate'][receiverName]
|
88
|
+
config['service']['pipelines']['logs']['receivers'] << receiverName
|
89
|
+
end
|
90
|
+
end
|
91
|
+
config.delete('receiverTemplate')
|
92
|
+
end
|
93
|
+
|
94
|
+
def configureReceivers(config, receivers)
|
95
|
+
return unless receivers
|
96
|
+
config['receivers'] = self.class.mergeConfig(config['receivers'], receivers)
|
97
|
+
config['receivers'].each do |name, data|
|
98
|
+
types = []
|
99
|
+
receiverType = name.split('/').first
|
100
|
+
if receiverType == 'jaeger' || receiverType == 'zipkin'
|
101
|
+
types << 'traces'
|
102
|
+
elsif receiverType == 'prometheus' || receiverType == 'hostmetrics'
|
103
|
+
types << 'metrics'
|
104
|
+
elsif receiverType == 'journald' || receiverType == 'filelog'
|
105
|
+
types << 'logs'
|
106
|
+
else
|
107
|
+
types = ['traces', 'metrics', 'logs']
|
108
|
+
end
|
109
|
+
|
110
|
+
if types.include?('traces')
|
111
|
+
config['service']['pipelines']['traces']['receivers'] << name unless config['service']['pipelines']['traces']['receivers'].include?(name)
|
112
|
+
end
|
113
|
+
if types.include?('metrics')
|
114
|
+
config['service']['pipelines']['metrics']['receivers'] << name unless config['service']['pipelines']['metrics']['receivers'].include?(name)
|
115
|
+
end
|
116
|
+
if types.include?('logs')
|
117
|
+
config['service']['pipelines']['logs']['receivers'] << name unless config['service']['pipelines']['logs']['receivers'].include?(name)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
def configureProcessors(config, processors)
|
123
|
+
return unless processors
|
124
|
+
config['processors'] = self.class.mergeConfig(config['processors'], processors)
|
125
|
+
end
|
126
|
+
|
127
|
+
def configureExporters(config, exporters)
|
128
|
+
return unless exporters
|
129
|
+
config['exporters'] = self.class.mergeConfig(config['exporters'], exporters)
|
130
|
+
config['exporters'].each do |name, data|
|
131
|
+
types = ['traces', 'metrics', 'logs']
|
132
|
+
if types.include?('traces')
|
133
|
+
config['service']['pipelines']['traces']['exporters'] << name unless config['service']['pipelines']['traces']['exporters'].include?(name)
|
134
|
+
end
|
135
|
+
if types.include?('metrics')
|
136
|
+
config['service']['pipelines']['metrics']['exporters'] << name unless config['service']['pipelines']['metrics']['exporters'].include?(name)
|
137
|
+
end
|
138
|
+
if types.include?('logs')
|
139
|
+
config['service']['pipelines']['logs']['exporters'] << name unless config['service']['pipelines']['logs']['exporters'].include?(name)
|
140
|
+
end
|
141
|
+
if data['endpoint']
|
142
|
+
data['endpoint'] = Addressable::IDNA.to_ascii(data['endpoint'])
|
143
|
+
config['exporters'][name] = data
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
def self.mergeConfig(defaultConfig, targetConfig)
|
149
|
+
return defaultConfig unless targetConfig
|
150
|
+
defaultConfig.merge(targetConfig) { |key, a_val, b_val| a_val.merge(b_val) }
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
|
2
|
+
[Unit]
|
3
|
+
Description=LiveKit Ingress container
|
4
|
+
After=local-fs.target
|
5
|
+
|
6
|
+
[Container]
|
7
|
+
ContainerName=Ingress
|
8
|
+
Image=docker.io/livekit/ingress:latest
|
9
|
+
EnvironmentFile=/var/lib/openvidu/.config/containers/systemd/OpenVidu.env
|
10
|
+
Network=slirp4netns:allow_host_loopback=true
|
11
|
+
PublishPort=127.0.0.1:1935:1935
|
12
|
+
PublishPort=127.0.0.1:8085:8085
|
13
|
+
PublishPort=127.0.0.1:7895:7895/udp
|
14
|
+
UserNS=keep-id:uid=1000,gid=1000
|
15
|
+
Volume=/var/lib/openvidu/ingress.yaml:/etc/ingress.yaml
|
16
|
+
LogDriver=journald
|
17
|
+
AutoUpdate=registry
|
18
|
+
|
19
|
+
[Service]
|
20
|
+
Restart=on-failure
|
21
|
+
|
22
|
+
[Install]
|
23
|
+
WantedBy=multi-user.target default.target
|
@@ -16,11 +16,16 @@ server {
|
|
16
16
|
|
17
17
|
server_name <%= config['Domain'] %>;
|
18
18
|
|
19
|
-
|
20
|
-
|
19
|
+
<% if config['CertName'] %>
|
20
|
+
ssl_certificate "/etc/letsencrypt/live/<%= config['CertName'] %>/fullchain.pem";
|
21
|
+
ssl_certificate_key "/etc/letsencrypt/live/<%= config['CertName'] %>/privkey.pem";
|
22
|
+
ssl_trusted_certificate "/etc/letsencrypt/live/<%= config['CertName'] %>/chain.pem";
|
23
|
+
<% end %>
|
21
24
|
|
25
|
+
# Proxy site
|
22
26
|
location / {
|
23
|
-
proxy_pass http://127.0.0.1:
|
27
|
+
proxy_pass http://127.0.0.1:7880;
|
24
28
|
include config-lmm/proxy.conf;
|
25
29
|
}
|
30
|
+
|
26
31
|
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
[Unit]
|
3
|
+
Description=OpenVidu container
|
4
|
+
After=local-fs.target
|
5
|
+
|
6
|
+
[Container]
|
7
|
+
ContainerName=OpenVidu
|
8
|
+
Image=docker.io/openvidu/openvidu-server:main
|
9
|
+
Exec=--config /etc/livekit.yaml --bind=$BindIP
|
10
|
+
EnvironmentFile=/var/lib/openvidu/.config/containers/systemd/OpenVidu.env
|
11
|
+
Network=host
|
12
|
+
UserNS=keep-id:uid=1000,gid=1000
|
13
|
+
Volume=/var/lib/openvidu/livekit.yaml:/etc/livekit.yaml
|
14
|
+
LogDriver=journald
|
15
|
+
AutoUpdate=registry
|
16
|
+
|
17
|
+
[Service]
|
18
|
+
Restart=on-failure
|
19
|
+
|
20
|
+
[Install]
|
21
|
+
WantedBy=multi-user.target default.target
|
@@ -0,0 +1,94 @@
|
|
1
|
+
|
2
|
+
module ConfigLMM
|
3
|
+
module LMM
|
4
|
+
class OpenVidu < Framework::NginxApp
|
5
|
+
|
6
|
+
USER = 'openvidu'
|
7
|
+
HOME_DIR = '/var/lib/openvidu'
|
8
|
+
HOST_IP = '10.0.2.2'
|
9
|
+
|
10
|
+
def actionOpenViduDeploy(id, target, activeState, context, options)
|
11
|
+
raise Framework::PluginProcessError.new('Domain field must be set!') unless target['Domain']
|
12
|
+
raise Framework::PluginProcessError.new('CallDomain field must be set!') unless target['CallDomain']
|
13
|
+
|
14
|
+
if target['Location'] && target['Location'] != '@me'
|
15
|
+
uri = Addressable::URI.parse(target['Location'])
|
16
|
+
raise Framework::PluginProcessError.new("#{id}: Unknown Protocol: #{uri.scheme}!") if uri.scheme != 'ssh'
|
17
|
+
|
18
|
+
self.class.sshStart(uri) do |ssh|
|
19
|
+
|
20
|
+
distroInfo = Framework::LinuxApp.currentDistroInfo(ssh)
|
21
|
+
Framework::LinuxApp.configurePodmanServiceOverSSH(USER, HOME_DIR, 'OpenVidu', distroInfo, ssh)
|
22
|
+
|
23
|
+
secretKey = SecureRandom.alphanumeric(40)
|
24
|
+
bindIp = target['BindIP']
|
25
|
+
bindIp = '127.0.0.1' unless bindIp
|
26
|
+
|
27
|
+
path = Framework::LinuxApp::SYSTEMD_CONTAINERS_PATH.gsub('~', HOME_DIR)
|
28
|
+
self.class.exec("echo 'INGRESS_CONFIG_FILE=/etc/ingress.yaml' > #{path}/OpenVidu.env", ssh)
|
29
|
+
self.class.exec("echo 'LIVEKIT_URL=wss://#{target['Domain']}' >> #{path}/OpenVidu.env", ssh)
|
30
|
+
self.class.exec("echo 'LIVEKIT_API_KEY=Main' >> #{path}/OpenVidu.env", ssh)
|
31
|
+
self.class.exec("echo 'LIVEKIT_API_SECRET=#{secretKey}' >> #{path}/OpenVidu.env", ssh)
|
32
|
+
self.class.exec("echo 'CALL_PRIVATE_ACCESS=true' >> #{path}/OpenVidu.env", ssh)
|
33
|
+
self.class.exec("echo 'CALL_USER=guest' >> #{path}/OpenVidu.env", ssh)
|
34
|
+
callSecret = SecureRandom.alphanumeric(20)
|
35
|
+
prompt.say("OpenVidu Call guest password: #{callSecret}", :color => :magenta)
|
36
|
+
self.class.exec("echo 'CALL_SECRET=#{callSecret}' >> #{path}/OpenVidu.env", ssh)
|
37
|
+
self.class.exec("echo 'CALL_ADMIN_USER=admin' >> #{path}/OpenVidu.env", ssh)
|
38
|
+
callAdminSecret = SecureRandom.alphanumeric(20)
|
39
|
+
prompt.say("OpenVidu Call admin password: #{callAdminSecret}", :color => :magenta)
|
40
|
+
self.class.exec("echo 'CALL_ADMIN_SECRET=#{callAdminSecret}' >> #{path}/OpenVidu.env", ssh)
|
41
|
+
|
42
|
+
ssh.scp.upload!(__dir__ + '/livekit.yaml', HOME_DIR)
|
43
|
+
ssh.scp.upload!(__dir__ + '/ingress.yaml', HOME_DIR)
|
44
|
+
|
45
|
+
self.class.exec("sed -i 's|$SECRET|#{secretKey}|' #{HOME_DIR}/livekit.yaml", ssh)
|
46
|
+
|
47
|
+
if target['Valkey']
|
48
|
+
self.class.exec("sed -i 's|10.0.2.2|#{target['Valkey']['Host']}|' #{HOME_DIR}/ingress.yaml", ssh) if target['Valkey']['Host']
|
49
|
+
|
50
|
+
if target['Valkey']['SecretId']
|
51
|
+
valkeyPassword = context.secrets.load(target['Valkey']['SecretId'], 'VALKEY_PASSWORD')
|
52
|
+
if valkeyPassword
|
53
|
+
self.class.exec("sed -i 's|password:|password: #{valkeyPassword}|' #{HOME_DIR}/ingress.yaml", ssh)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
self.class.exec("chown #{USER}:#{USER} #{path}/OpenVidu.env #{HOME_DIR}/livekit.yaml #{HOME_DIR}/ingress.yaml", ssh)
|
59
|
+
self.class.exec("chmod 600 #{path}/OpenVidu.env #{HOME_DIR}/livekit.yaml #{HOME_DIR}/ingress.yaml", ssh)
|
60
|
+
|
61
|
+
ssh.scp.upload!(__dir__ + '/OpenVidu.container', path)
|
62
|
+
ssh.scp.upload!(__dir__ + '/OpenViduCall.container', path)
|
63
|
+
ssh.scp.upload!(__dir__ + '/Ingress.container', path)
|
64
|
+
|
65
|
+
self.class.exec("sed -i 's|$BindIP|#{bindIp}|' #{path}/OpenVidu.container", ssh)
|
66
|
+
|
67
|
+
Framework::LinuxApp.firewallAddPortOverSSH('7881/tcp', ssh)
|
68
|
+
Framework::LinuxApp.firewallAddPortOverSSH('7900-7999/udp', ssh)
|
69
|
+
Framework::LinuxApp.firewallAddPortOverSSH('45000-55000/udp', ssh)
|
70
|
+
|
71
|
+
self.class.exec("systemctl --user --machine=#{USER}@ daemon-reload", ssh)
|
72
|
+
self.class.exec("systemctl --user --machine=#{USER}@ restart OpenVidu", ssh)
|
73
|
+
self.class.exec("systemctl --user --machine=#{USER}@ restart OpenViduCall", ssh)
|
74
|
+
self.class.exec("systemctl --user --machine=#{USER}@ restart Ingress", ssh)
|
75
|
+
|
76
|
+
Framework::LinuxApp.ensurePackages([NGINX_PACKAGE], ssh)
|
77
|
+
Framework::LinuxApp.ensureServiceAutoStartOverSSH(NGINX_PACKAGE, ssh)
|
78
|
+
self.class.prepareNginxConfig(target, ssh)
|
79
|
+
target['CallDomain'] = Addressable::IDNA.to_ascii(target['CallDomain'])
|
80
|
+
self.writeNginxConfig(__dir__, 'OpenVidu', id, target, state, context, options)
|
81
|
+
self.writeNginxConfig(__dir__, 'OpenViduCall', id, target, state, context, options)
|
82
|
+
self.deployNginxConfig(id, target, activeState, context, options)
|
83
|
+
Framework::LinuxApp.startServiceOverSSH(NGINX_PACKAGE, ssh)
|
84
|
+
|
85
|
+
end
|
86
|
+
else
|
87
|
+
# TODO
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
|
2
|
+
server {
|
3
|
+
<% if config['NginxVersion'] >= 1.25 %>
|
4
|
+
listen 443 ssl;
|
5
|
+
listen [::]:443 ssl;
|
6
|
+
http2 on;
|
7
|
+
http3 on;
|
8
|
+
quic_retry on;
|
9
|
+
add_header Alt-Svc 'h3=":443"; ma=86400';
|
10
|
+
<% else %>
|
11
|
+
listen 443 ssl http2;
|
12
|
+
listen [::]:443 ssl http2;
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
include config-lmm/ssl.conf;
|
16
|
+
|
17
|
+
server_name <%= config['CallDomain'] %>;
|
18
|
+
|
19
|
+
<% if config['CallCertName'] %>
|
20
|
+
ssl_certificate "/etc/letsencrypt/live/<%= config['CallCertName'] %>/fullchain.pem";
|
21
|
+
ssl_certificate_key "/etc/letsencrypt/live/<%= config['CallCertName'] %>/privkey.pem";
|
22
|
+
ssl_trusted_certificate "/etc/letsencrypt/live/<%= config['CallCertName'] %>/chain.pem";
|
23
|
+
<% end %>
|
24
|
+
|
25
|
+
# Proxy site
|
26
|
+
location / {
|
27
|
+
proxy_pass http://127.0.0.1:6080;
|
28
|
+
include config-lmm/proxy.conf;
|
29
|
+
}
|
30
|
+
|
31
|
+
}
|
32
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
[Unit]
|
4
|
+
Description=OpenVidu Call container
|
5
|
+
After=local-fs.target
|
6
|
+
|
7
|
+
[Container]
|
8
|
+
ContainerName=OpenViduCall
|
9
|
+
Image=docker.io/openvidu/openvidu-call:main
|
10
|
+
EnvironmentFile=/var/lib/openvidu/.config/containers/systemd/OpenVidu.env
|
11
|
+
PublishPort=127.0.0.1:6080:6080
|
12
|
+
UserNS=keep-id:uid=1000,gid=1000
|
13
|
+
LogDriver=journald
|
14
|
+
AutoUpdate=registry
|
15
|
+
|
16
|
+
[Service]
|
17
|
+
Restart=on-failure
|
18
|
+
|
19
|
+
[Install]
|
20
|
+
WantedBy=multi-user.target default.target
|
@@ -0,0 +1,91 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
module ConfigLMM
|
4
|
+
module LMM
|
5
|
+
class PHPFPMConnection
|
6
|
+
|
7
|
+
attr_reader :connection
|
8
|
+
|
9
|
+
def initialize(connection)
|
10
|
+
@connection = connection
|
11
|
+
end
|
12
|
+
|
13
|
+
def phpConfig
|
14
|
+
if @connection.distroName == Linux::SUSE_NAME
|
15
|
+
'/etc/php8/fpm/php.ini'
|
16
|
+
else
|
17
|
+
'/etc/php/php.ini'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def configFileDir
|
22
|
+
if @connection.distroName == Linux::SUSE_NAME
|
23
|
+
'/etc/php8/fpm/'
|
24
|
+
else
|
25
|
+
'/etc/php/'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def configDir
|
30
|
+
if @connection.distroName == Linux::SUSE_NAME
|
31
|
+
'/etc/php8/fpm/php-fpm.d/'
|
32
|
+
else
|
33
|
+
'/etc/php/php-fpm.d/'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def webappsDir
|
38
|
+
if @connection.distroName == Linux::SUSE_NAME
|
39
|
+
'/srv/www/htdocs/'
|
40
|
+
else
|
41
|
+
'/usr/share/webapps/'
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def enableExtension(name, options = {})
|
46
|
+
phpFile = self.phpConfig
|
47
|
+
if @connection.fileContains?(phpFile, "extension=#{name}", options)
|
48
|
+
@connection.fileReplace(phpFile, "^;extension=#{name}", "extension=#{name}", options)
|
49
|
+
else
|
50
|
+
@connection.fileReplace(phpFile, 'extension=zip', "extension=zip\\nextension=#{name}", { **options, escape: false })
|
51
|
+
#self.sshExec!(ssh, "sed -i 's|extension=zip|extension=zip\\nextension=#{name}|' #{phpFile}")
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def writeConfig(name, target, configLines)
|
56
|
+
target['PHP-FPM'] ||= {}
|
57
|
+
|
58
|
+
configLines << "[#{name}]\n"
|
59
|
+
configLines << "user = #{target['User']}\n"
|
60
|
+
configLines << "group = #{target['User']}\n"
|
61
|
+
if target['Listen']
|
62
|
+
configLines << "listen = #{target['Listen']}\n"
|
63
|
+
else
|
64
|
+
configLines << "listen = /run/php-fpm/#{name}.sock\n"
|
65
|
+
configLines << "listen.owner = #{target['User']}\n"
|
66
|
+
group = 'http'
|
67
|
+
group = 'nginx' if @connection.distroName == Linux::SUSE_NAME
|
68
|
+
configLines << "listen.group = #{group}\n"
|
69
|
+
end
|
70
|
+
configLines << "pm = dynamic\n"
|
71
|
+
configLines << "pm.max_children = 10\n"
|
72
|
+
configLines << "pm.min_spare_servers = 1\n"
|
73
|
+
configLines << "pm.max_spare_servers = 3\n"
|
74
|
+
configLines << "pm.start_servers = 2\n"
|
75
|
+
|
76
|
+
configLines << 'access.format = \'{"time_iso8601":"%{%Y-%m-%dT%H:%M:%S%z}T","time_received":"%{%Y-%m-%dT%H:%M:%S%z}t","pool":"%n","remote_addr":"%R","remote_user":"%u","method":"%m","host":"%{HTTP_HOST}e","uri":"%r","query_string":"%q","request":"%m %{REQUEST_URI}e %{SERVER_PROTOCOL}e","status":%s,"request_uri":"%{REQUEST_URI}e","server_protocol":"%{SERVER_PROTOCOL}e","body_bytes_sent":%l,"request_time":%d,"request_filename":"%f","http_x_forwarded_for":"%{HTTP_X_FORWARDED_FOR}e","http_x_real_ip":"%{HTTP_X_REAL_IP}e","http_referer":"%{HTTP_REFERER}e","http_user_agent":"%{HTTP_USER_AGENT}e","http_accept_language":"%{HTTP_ACCEPT_LANGUAGE}e","request_id":"%{HTTP_X_REQUEST_ID}e","content_type":"%{Content-Type}o","upstream_http_etag":"%{ETag}o","upstream_http_last_modified":"%{Last-Modified}o","cpu_time":%C,"memory":%M,"ppid":%P,"pid":%p}\'' + "\n"
|
77
|
+
configLines << "access.log = /var/log/php/$pool.access.json\n"
|
78
|
+
if target['PHP-FPM']['chdir']
|
79
|
+
configLines << "chdir = #{target['PHP-FPM']['chdir']}\n"
|
80
|
+
else
|
81
|
+
configLines << "chdir = #{self.webappsDir}$pool\n"
|
82
|
+
end
|
83
|
+
configLines << "php_admin_value[error_log] = /var/log/php/$pool.errors.log\n"
|
84
|
+
configLines << "php_admin_flag[log_errors] = on\n"
|
85
|
+
configLines << "php_admin_value[memory_limit] = 1G\n"
|
86
|
+
configLines << "php_admin_value[mail.log] = /var/log/php/$pool.mail.log\n"
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -1,4 +1,6 @@
|
|
1
1
|
|
2
|
+
require_relative 'Connection'
|
3
|
+
|
2
4
|
module ConfigLMM
|
3
5
|
module LMM
|
4
6
|
class PHP_FPM < Framework::LinuxApp
|
@@ -6,6 +8,17 @@ module ConfigLMM
|
|
6
8
|
PHPFPM_PACKAGE = 'PHP-FPM'
|
7
9
|
PHPFPM_SERVICE = 'php-fpm'
|
8
10
|
|
11
|
+
def self.deploy(linuxConnection, options)
|
12
|
+
linuxConnection.ensurePackage(PHP_FPM::PHPFPM_PACKAGE, options)
|
13
|
+
linuxConnection.ensureServiceAutoStart(PHP_FPM::PHPFPM_SERVICE, options)
|
14
|
+
|
15
|
+
dir = self.configFileDir(linuxConnection.distroInfo)
|
16
|
+
if !linuxConnection.filePresent?(dir + 'php-fpm.conf', { **options, 'dry': false })
|
17
|
+
linuxConnection.exec("cp #{dir}php-fpm.conf.default #{dir}php-fpm.conf", false, options)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# DEPRECATED
|
9
22
|
def self.writeConfig(name, target, distroInfo, configLines)
|
10
23
|
target['PHP-FPM'] ||= {}
|
11
24
|
|
@@ -18,15 +31,17 @@ module ConfigLMM
|
|
18
31
|
configLines << "listen = /run/php-fpm/#{name}.sock\n"
|
19
32
|
configLines << "listen.owner = #{target['User']}\n"
|
20
33
|
group = 'http'
|
21
|
-
group = 'nginx' if distroInfo['Name'] ==
|
34
|
+
group = 'nginx' if distroInfo['Name'] == Linux::SUSE_NAME
|
22
35
|
configLines << "listen.group = #{group}\n"
|
23
36
|
end
|
24
37
|
configLines << "pm = dynamic\n"
|
25
|
-
configLines << "pm.max_children =
|
38
|
+
configLines << "pm.max_children = 10\n"
|
26
39
|
configLines << "pm.min_spare_servers = 1\n"
|
27
40
|
configLines << "pm.max_spare_servers = 3\n"
|
28
41
|
configLines << "pm.start_servers = 2\n"
|
29
|
-
|
42
|
+
|
43
|
+
configLines << 'access.format = \'{"time_iso8601":"%{%Y-%m-%dT%H:%M:%S%z}T","time_received":"%{%Y-%m-%dT%H:%M:%S%z}t","pool":"%n","remote_addr":"%R","remote_user":"%u","method":"%m","host":"%{HTTP_HOST}e","uri":"%r","query_string":"%q","request":"%m %{REQUEST_URI}e %{SERVER_PROTOCOL}e","status":%s,"request_uri":"%{REQUEST_URI}e","server_protocol":"%{SERVER_PROTOCOL}e","body_bytes_sent":%l,"request_time":%d,"request_filename":"%f","http_x_forwarded_for":"%{HTTP_X_FORWARDED_FOR}e","http_x_real_ip":"%{HTTP_X_REAL_IP}e","http_referer":"%{HTTP_REFERER}e","http_user_agent":"%{HTTP_USER_AGENT}e","http_accept_language":"%{HTTP_ACCEPT_LANGUAGE}e","request_id":"%{HTTP_X_REQUEST_ID}e","content_type":"%{Content-Type}o","upstream_http_etag":"%{ETag}o","upstream_http_last_modified":"%{Last-Modified}o","cpu_time":%C,"memory":%M,"ppid":%P,"pid":%p}\'' + "\n"
|
44
|
+
configLines << "access.log = /var/log/php/$pool.access.json\n"
|
30
45
|
if target['PHP-FPM']['chdir']
|
31
46
|
configLines << "chdir = #{target['PHP-FPM']['chdir']}\n"
|
32
47
|
else
|
@@ -38,6 +53,7 @@ module ConfigLMM
|
|
38
53
|
configLines << "php_admin_value[mail.log] = /var/log/php/$pool.mail.log\n"
|
39
54
|
end
|
40
55
|
|
56
|
+
# DEPRECATED
|
41
57
|
def self.phpConfig(distroInfo)
|
42
58
|
if distroInfo['Name'] == 'openSUSE Leap'
|
43
59
|
'/etc/php8/fpm/php.ini'
|
@@ -46,19 +62,23 @@ module ConfigLMM
|
|
46
62
|
end
|
47
63
|
end
|
48
64
|
|
65
|
+
# DEPRECATED
|
49
66
|
def self.peclInstallOverSSH(name, ssh)
|
50
67
|
self.sshExec!(ssh, "printf \"\\n\" | pecl install #{name}", true)
|
51
68
|
end
|
52
69
|
|
70
|
+
# DEPRECATED
|
53
71
|
def self.enableExtensionOverSSH(name, distroInfo, ssh)
|
54
72
|
phpFile = self.phpConfig(distroInfo)
|
55
|
-
|
73
|
+
contains = IO::SSH.exec!(ssh, "grep 'extension=#{name}' #{phpFile}", true).strip.empty?
|
74
|
+
if contains
|
56
75
|
self.sshExec!(ssh, "sed -i 's|^;extension=#{name}|extension=#{name}|' #{phpFile}")
|
57
76
|
else
|
58
77
|
self.sshExec!(ssh, "sed -i 's|extension=zip|extension=zip\\nextension=#{name}|' #{phpFile}")
|
59
78
|
end
|
60
79
|
end
|
61
80
|
|
81
|
+
# DEPRECATED
|
62
82
|
def self.configFileDir(distroInfo)
|
63
83
|
if distroInfo['Name'] == 'openSUSE Leap'
|
64
84
|
'/etc/php8/fpm/'
|
@@ -67,6 +87,7 @@ module ConfigLMM
|
|
67
87
|
end
|
68
88
|
end
|
69
89
|
|
90
|
+
# DEPRECATED
|
70
91
|
def self.configDir(distroInfo)
|
71
92
|
if distroInfo['Name'] == 'openSUSE Leap'
|
72
93
|
'/etc/php8/fpm/php-fpm.d/'
|
@@ -75,6 +96,7 @@ module ConfigLMM
|
|
75
96
|
end
|
76
97
|
end
|
77
98
|
|
99
|
+
# DEPRECATED
|
78
100
|
def self.webappsDir(distroInfo)
|
79
101
|
if distroInfo['Name'] == 'openSUSE Leap'
|
80
102
|
'/srv/www/htdocs/'
|
@@ -83,6 +105,11 @@ module ConfigLMM
|
|
83
105
|
end
|
84
106
|
end
|
85
107
|
|
108
|
+
def self.withConnection(linuxConnection)
|
109
|
+
yield(PHPFPMConnection.new(linuxConnection))
|
110
|
+
end
|
111
|
+
|
112
|
+
# DEPRECATED
|
86
113
|
def self.fixConfigFileOverSSH(distroInfo, ssh)
|
87
114
|
dir = self.configFileDir(distroInfo)
|
88
115
|
if !self.remoteFilePresent?(dir + 'php-fpm.conf', ssh)
|
@@ -1,9 +1,5 @@
|
|
1
1
|
|
2
2
|
server {
|
3
|
-
listen 80;
|
4
|
-
listen [::]:80;
|
5
|
-
server_name peppermint.example.com;
|
6
|
-
add_header Strict-Transport-Security "max-age=15552000; includeSubDomains" always;
|
7
3
|
|
8
4
|
<% if !config['TLS'] %>
|
9
5
|
listen <%= config['Port'] %>;
|
@@ -26,10 +22,6 @@ server {
|
|
26
22
|
|
27
23
|
server_name <%= config['Domain'] %>;
|
28
24
|
|
29
|
-
access_log /var/log/nginx/peppermint.access.log;
|
30
|
-
error_log /var/log/nginx/peppermint.error.log;
|
31
|
-
|
32
|
-
include config-lmm/errors.conf;
|
33
25
|
include config-lmm/security.conf;
|
34
26
|
|
35
27
|
client_max_body_size 10M;
|
@@ -43,6 +35,7 @@ server {
|
|
43
35
|
|
44
36
|
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
|
45
37
|
|
38
|
+
include config-lmm/errors.conf;
|
46
39
|
include config-lmm/proxy.conf;
|
47
40
|
proxy_redirect off;
|
48
41
|
proxy_read_timeout 5m;
|
@@ -52,7 +45,7 @@ server {
|
|
52
45
|
<% if config['Server'] %>
|
53
46
|
proxy_pass <%= config['Server'] %>;
|
54
47
|
<% else %>
|
55
|
-
proxy_pass http://127.0.0.1:15003
|
48
|
+
proxy_pass http://127.0.0.1:15003;
|
56
49
|
<% end %>
|
57
50
|
|
58
51
|
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
|
@@ -4,11 +4,17 @@ Description=Peppermint Ticket Management container
|
|
4
4
|
After=local-fs.target
|
5
5
|
|
6
6
|
[Container]
|
7
|
-
|
7
|
+
ContainerName=Peppermint
|
8
|
+
Image=docker.io/pepperlabs/peppermint:latest
|
8
9
|
EnvironmentFile=/var/lib/peppermint/.config/containers/systemd/Peppermint.env
|
9
10
|
Network=slirp4netns:allow_host_loopback=true
|
10
11
|
PublishPort=127.0.0.1:13000:3000
|
11
12
|
PublishPort=127.0.0.1:15003:5003
|
13
|
+
LogDriver=journald
|
14
|
+
AutoUpdate=registry
|
15
|
+
|
16
|
+
[Service]
|
17
|
+
Restart=on-failure
|
12
18
|
|
13
19
|
[Install]
|
14
20
|
WantedBy=multi-user.target default.target
|