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,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
|
@@ -4,6 +4,7 @@ Description=LiveKit Ingress container
|
|
4
4
|
After=local-fs.target
|
5
5
|
|
6
6
|
[Container]
|
7
|
+
ContainerName=Ingress
|
7
8
|
Image=docker.io/livekit/ingress:latest
|
8
9
|
EnvironmentFile=/var/lib/openvidu/.config/containers/systemd/OpenVidu.env
|
9
10
|
Network=slirp4netns:allow_host_loopback=true
|
@@ -12,7 +13,11 @@ PublishPort=127.0.0.1:8085:8085
|
|
12
13
|
PublishPort=127.0.0.1:7895:7895/udp
|
13
14
|
UserNS=keep-id:uid=1000,gid=1000
|
14
15
|
Volume=/var/lib/openvidu/ingress.yaml:/etc/ingress.yaml
|
16
|
+
LogDriver=journald
|
15
17
|
AutoUpdate=registry
|
16
18
|
|
19
|
+
[Service]
|
20
|
+
Restart=on-failure
|
21
|
+
|
17
22
|
[Install]
|
18
23
|
WantedBy=multi-user.target default.target
|
@@ -22,9 +22,6 @@ server {
|
|
22
22
|
ssl_trusted_certificate "/etc/letsencrypt/live/<%= config['CertName'] %>/chain.pem";
|
23
23
|
<% end %>
|
24
24
|
|
25
|
-
access_log /var/log/nginx/openvidu.access.log;
|
26
|
-
error_log /var/log/nginx/openvidu.error.log;
|
27
|
-
|
28
25
|
# Proxy site
|
29
26
|
location / {
|
30
27
|
proxy_pass http://127.0.0.1:7880;
|
@@ -4,13 +4,18 @@ Description=OpenVidu container
|
|
4
4
|
After=local-fs.target
|
5
5
|
|
6
6
|
[Container]
|
7
|
+
ContainerName=OpenVidu
|
7
8
|
Image=docker.io/openvidu/openvidu-server:main
|
8
9
|
Exec=--config /etc/livekit.yaml --bind=$BindIP
|
9
10
|
EnvironmentFile=/var/lib/openvidu/.config/containers/systemd/OpenVidu.env
|
10
11
|
Network=host
|
11
12
|
UserNS=keep-id:uid=1000,gid=1000
|
12
13
|
Volume=/var/lib/openvidu/livekit.yaml:/etc/livekit.yaml
|
14
|
+
LogDriver=journald
|
13
15
|
AutoUpdate=registry
|
14
16
|
|
17
|
+
[Service]
|
18
|
+
Restart=on-failure
|
19
|
+
|
15
20
|
[Install]
|
16
21
|
WantedBy=multi-user.target default.target
|
@@ -46,9 +46,13 @@ module ConfigLMM
|
|
46
46
|
|
47
47
|
if target['Valkey']
|
48
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
|
-
|
51
|
-
|
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
|
52
56
|
end
|
53
57
|
|
54
58
|
self.class.exec("chown #{USER}:#{USER} #{path}/OpenVidu.env #{HOME_DIR}/livekit.yaml #{HOME_DIR}/ingress.yaml", ssh)
|
@@ -22,9 +22,6 @@ server {
|
|
22
22
|
ssl_trusted_certificate "/etc/letsencrypt/live/<%= config['CallCertName'] %>/chain.pem";
|
23
23
|
<% end %>
|
24
24
|
|
25
|
-
access_log /var/log/nginx/openvidu-call.access.log;
|
26
|
-
error_log /var/log/nginx/openvidu-call.error.log;
|
27
|
-
|
28
25
|
# Proxy site
|
29
26
|
location / {
|
30
27
|
proxy_pass http://127.0.0.1:6080;
|
@@ -5,11 +5,16 @@ Description=OpenVidu Call container
|
|
5
5
|
After=local-fs.target
|
6
6
|
|
7
7
|
[Container]
|
8
|
+
ContainerName=OpenViduCall
|
8
9
|
Image=docker.io/openvidu/openvidu-call:main
|
9
10
|
EnvironmentFile=/var/lib/openvidu/.config/containers/systemd/OpenVidu.env
|
10
11
|
PublishPort=127.0.0.1:6080:6080
|
11
12
|
UserNS=keep-id:uid=1000,gid=1000
|
13
|
+
LogDriver=journald
|
12
14
|
AutoUpdate=registry
|
13
15
|
|
16
|
+
[Service]
|
17
|
+
Restart=on-failure
|
18
|
+
|
14
19
|
[Install]
|
15
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)
|
@@ -22,10 +22,6 @@ server {
|
|
22
22
|
|
23
23
|
server_name <%= config['Domain'] %>;
|
24
24
|
|
25
|
-
access_log /var/log/nginx/peppermint.access.log;
|
26
|
-
error_log /var/log/nginx/peppermint.error.log;
|
27
|
-
|
28
|
-
include config-lmm/errors.conf;
|
29
25
|
include config-lmm/security.conf;
|
30
26
|
|
31
27
|
client_max_body_size 10M;
|
@@ -39,6 +35,7 @@ server {
|
|
39
35
|
|
40
36
|
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
|
41
37
|
|
38
|
+
include config-lmm/errors.conf;
|
42
39
|
include config-lmm/proxy.conf;
|
43
40
|
proxy_redirect off;
|
44
41
|
proxy_read_timeout 5m;
|
@@ -48,7 +45,7 @@ server {
|
|
48
45
|
<% if config['Server'] %>
|
49
46
|
proxy_pass <%= config['Server'] %>;
|
50
47
|
<% else %>
|
51
|
-
proxy_pass http://127.0.0.1:15003
|
48
|
+
proxy_pass http://127.0.0.1:15003;
|
52
49
|
<% end %>
|
53
50
|
|
54
51
|
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
|
@@ -4,12 +4,17 @@ Description=Peppermint Ticket Management container
|
|
4
4
|
After=local-fs.target
|
5
5
|
|
6
6
|
[Container]
|
7
|
+
ContainerName=Peppermint
|
7
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
|
12
14
|
AutoUpdate=registry
|
13
15
|
|
16
|
+
[Service]
|
17
|
+
Restart=on-failure
|
18
|
+
|
14
19
|
[Install]
|
15
20
|
WantedBy=multi-user.target default.target
|
@@ -11,44 +11,40 @@ module ConfigLMM
|
|
11
11
|
raise Framework::PluginProcessError.new('Domain field must be set!') unless target['Domain']
|
12
12
|
|
13
13
|
target['Database'] ||= {}
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
path
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
self.class.prepareNginxConfig(target, ssh)
|
40
|
-
self.writeNginxConfig(__dir__, 'Peppermint', id, target, state, context, options)
|
41
|
-
self.deployNginxConfig(id, target, activeState, context, options)
|
42
|
-
Framework::LinuxApp.startServiceOverSSH(NGINX_PACKAGE, ssh)
|
14
|
+
self.withConnection(target['Location'], target) do |connection|
|
15
|
+
Linux.withConnection(connection) do |linuxConnection|
|
16
|
+
dbPassword = self.configurePostgreSQL(target['Database'], linuxConnection, options)
|
17
|
+
|
18
|
+
Podman.ensurePresent(linuxConnection, options)
|
19
|
+
Podman.createUser(USER, HOME_DIR, 'Peppermint Ticket Management', linuxConnection, options)
|
20
|
+
path = Podman.containersPath(HOME_DIR)
|
21
|
+
|
22
|
+
linuxConnection.fileWrite("#{path}/Peppermint.env", "DB_HOST=#{HOST_IP}", options)
|
23
|
+
linuxConnection.fileAppend("#{path}/Peppermint.env", "DB_USERNAME=#{USER}", options)
|
24
|
+
linuxConnection.fileAppend("#{path}/Peppermint.env", "DB_PASSWORD=#{dbPassword}", { **options, hide: true })
|
25
|
+
linuxConnection.fileAppend("#{path}/Peppermint.env", "SECRET=#{SecureRandom.urlsafe_base64(60)}", { **options, hide: true })
|
26
|
+
linuxConnection.fileAppend("#{path}/Peppermint.env", "API_URL=https://#{target['Domain']}/api", options)
|
27
|
+
|
28
|
+
linuxConnection.setUserGroup("#{path}/Peppermint.env", USER, USER, options)
|
29
|
+
linuxConnection.setPrivate("#{path}/Peppermint.env", options)
|
30
|
+
|
31
|
+
linuxConnection.upload(__dir__ + '/Peppermint.container', path, options)
|
32
|
+
|
33
|
+
linuxConnection.reloadUserServices(USER, options)
|
34
|
+
linuxConnection.restartUserService(USER, 'Peppermint', options)
|
35
|
+
|
36
|
+
Nginx.withConnection(linuxConnection) do |nginxConnection|
|
37
|
+
nginxConnection.provision(__dir__, 'Peppermint', target, activeState, context, options)
|
38
|
+
end
|
43
39
|
end
|
44
|
-
else
|
45
|
-
# TODO
|
46
40
|
end
|
47
41
|
end
|
48
42
|
|
49
|
-
def configurePostgreSQL(
|
43
|
+
def configurePostgreSQL(dbSettings, linuxConnection, options)
|
50
44
|
password = SecureRandom.alphanumeric(20)
|
51
|
-
PostgreSQL.
|
45
|
+
PostgreSQL.withConnection(dbSettings, linuxConnection) do |postgresConnection|
|
46
|
+
postgresConnection.createUserAndDB(USER, password, options)
|
47
|
+
end
|
52
48
|
password
|
53
49
|
end
|
54
50
|
|
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
[Unit]
|
3
|
+
Description=Perplexica container
|
4
|
+
After=local-fs.target
|
5
|
+
|
6
|
+
[Container]
|
7
|
+
ContainerName=Perplexica
|
8
|
+
Image=docker.io/itzcrazykns1337/perplexica:main
|
9
|
+
EnvironmentFile=/var/lib/perplexica/.config/containers/systemd/Perplexica.env
|
10
|
+
Network=slirp4netns:allow_host_loopback=true
|
11
|
+
PublishPort=127.0.0.1:13500:3000
|
12
|
+
UserNS=keep-id:uid=1000,gid=1000
|
13
|
+
Volume=/var/lib/perplexica/data:/home/perplexica/data
|
14
|
+
Volume=/var/lib/perplexica/uploads:/home/perplexica/uploads
|
15
|
+
Volume=/var/lib/perplexica/config.toml:/home/perplexica/config.toml
|
16
|
+
|
17
|
+
LogDriver=journald
|
18
|
+
AutoUpdate=registry
|
19
|
+
|
20
|
+
[Service]
|
21
|
+
TimeoutStartSec=6min
|
22
|
+
Restart=on-failure
|
23
|
+
|
24
|
+
[Install]
|
25
|
+
WantedBy=multi-user.target default.target
|