ConfigLMM 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +70 -0
- data/CNAME +1 -0
- data/Examples/.lmm.state.yaml +159 -0
- data/Examples/ConfigLMM.mm.yaml +32 -0
- data/Examples/Implemented.mm.yaml +252 -4
- data/Examples/SmallBusiness.mm.yaml +492 -0
- data/Plugins/Apps/Answer/answer.lmm.rb +165 -0
- data/Plugins/Apps/Answer/answer@.service +40 -0
- data/Plugins/Apps/ArchiSteamFarm/ArchiSteamFarm.conf.erb +0 -3
- data/Plugins/Apps/ArchiSteamFarm/ArchiSteamFarm.lmm.rb +0 -1
- data/Plugins/Apps/Authentik/Authentik-ProxyOutpost.container +20 -0
- data/Plugins/Apps/Authentik/Authentik-Server.container +7 -1
- data/Plugins/Apps/Authentik/Authentik-Worker.container +7 -1
- data/Plugins/Apps/Authentik/Authentik.conf.erb +18 -6
- data/Plugins/Apps/Authentik/Authentik.lmm.rb +232 -45
- data/Plugins/Apps/BookStack/BookStack.conf.erb +38 -0
- data/Plugins/Apps/BookStack/BookStack.container +20 -0
- data/Plugins/Apps/BookStack/BookStack.lmm.rb +91 -0
- data/Plugins/Apps/Cassandra/Cassandra.lmm.rb +9 -19
- data/Plugins/Apps/ClickHouse/ClickHouse.container +28 -0
- data/Plugins/Apps/ClickHouse/ClickHouse.lmm.rb +113 -0
- data/Plugins/Apps/ClickHouse/Config/listen.yaml +2 -0
- data/Plugins/Apps/ClickHouse/Config/logger.yaml +8 -0
- data/Plugins/Apps/ClickHouse/Config/zookeepers.yaml +5 -0
- data/Plugins/Apps/ClickHouse/Connection.rb +96 -0
- data/Plugins/Apps/Discourse/Discourse-Sidekiq.container +22 -0
- data/Plugins/Apps/Discourse/Discourse.conf.erb +38 -0
- data/Plugins/Apps/Discourse/Discourse.container +21 -0
- data/Plugins/Apps/Discourse/Discourse.lmm.rb +156 -0
- data/Plugins/Apps/Dovecot/Dovecot.lmm.rb +87 -52
- data/Plugins/Apps/ERPNext/ERPNext-Frontend.container +24 -0
- data/Plugins/Apps/ERPNext/ERPNext-Queue.container +22 -0
- data/Plugins/Apps/ERPNext/ERPNext-Scheduler.container +22 -0
- data/Plugins/Apps/ERPNext/ERPNext-Websocket.container +24 -0
- data/Plugins/Apps/ERPNext/ERPNext.container +23 -0
- data/Plugins/Apps/ERPNext/ERPNext.lmm.rb +204 -0
- data/Plugins/Apps/ERPNext/ERPNext.network +12 -0
- data/Plugins/Apps/ERPNext/sites/apps.json +10 -0
- data/Plugins/Apps/ERPNext/sites/apps.txt +3 -0
- data/Plugins/Apps/ERPNext/sites/common_site_config.json +11 -0
- data/Plugins/Apps/GitLab/GitLab.container +9 -2
- data/Plugins/Apps/GitLab/GitLab.lmm.rb +52 -33
- data/Plugins/Apps/Homepage/Homepage.conf.erb +86 -0
- data/Plugins/Apps/Homepage/Homepage.container +19 -0
- data/Plugins/Apps/Homepage/Homepage.lmm.rb +54 -0
- data/Plugins/Apps/IPFS/IPFS.conf.erb +0 -3
- data/Plugins/Apps/IPFS/IPFS.lmm.rb +0 -1
- data/Plugins/Apps/InfluxDB/InfluxDB.conf.erb +0 -3
- data/Plugins/Apps/InfluxDB/InfluxDB.lmm.rb +0 -1
- data/Plugins/Apps/Jackett/Jackett.conf.erb +0 -3
- data/Plugins/Apps/Jackett/Jackett.lmm.rb +0 -1
- data/Plugins/Apps/Jellyfin/Jellyfin.conf.erb +0 -3
- data/Plugins/Apps/Jellyfin/Jellyfin.lmm.rb +0 -1
- data/Plugins/Apps/LetsEncrypt/LetsEncrypt.lmm.rb +78 -0
- data/Plugins/Apps/LetsEncrypt/hooks/dovecot.sh +2 -0
- data/Plugins/Apps/LetsEncrypt/hooks/nginx.sh +2 -0
- data/Plugins/Apps/LetsEncrypt/hooks/postfix.sh +2 -0
- data/Plugins/Apps/LetsEncrypt/renew-certificates.service +7 -0
- data/Plugins/Apps/LetsEncrypt/renew-certificates.timer +12 -0
- data/Plugins/Apps/LetsEncrypt/rfc2136.ini +11 -0
- data/Plugins/Apps/LibreTranslate/LibreTranslate.container +21 -0
- data/Plugins/Apps/LibreTranslate/LibreTranslate.lmm.rb +34 -0
- data/Plugins/Apps/Lobsters/Containerfile +81 -0
- data/Plugins/Apps/Lobsters/Lobsters-Tasks.container +26 -0
- data/Plugins/Apps/Lobsters/Lobsters.conf.erb +99 -0
- data/Plugins/Apps/Lobsters/Lobsters.container +27 -0
- data/Plugins/Apps/Lobsters/Lobsters.lmm.rb +196 -0
- data/Plugins/Apps/Lobsters/crontab +3 -0
- data/Plugins/Apps/Lobsters/database.yml +26 -0
- data/Plugins/Apps/Lobsters/entrypoint.sh +30 -0
- data/Plugins/Apps/Lobsters/generateCredentials.rb +19 -0
- data/Plugins/Apps/Lobsters/lobsters-cron.sh +25 -0
- data/Plugins/Apps/Lobsters/lobsters-daily.sh +23 -0
- data/Plugins/Apps/Lobsters/puma.rb +49 -0
- data/Plugins/Apps/MariaDB/Connection.rb +55 -0
- data/Plugins/Apps/MariaDB/MariaDB.lmm.rb +122 -0
- data/Plugins/Apps/Mastodon/Mastodon-Sidekiq.container +22 -0
- data/Plugins/Apps/Mastodon/Mastodon-Streaming.container +20 -0
- data/Plugins/Apps/Mastodon/Mastodon.conf.erb +34 -45
- data/Plugins/Apps/Mastodon/Mastodon.container +28 -0
- data/Plugins/Apps/Mastodon/Mastodon.lmm.rb +240 -5
- data/Plugins/Apps/Mastodon/configlmm.rake +30 -0
- data/Plugins/Apps/Mastodon/entrypoint.sh +16 -0
- data/Plugins/Apps/Matrix/Element.container +19 -0
- data/Plugins/Apps/Matrix/Matrix.conf.erb +47 -9
- data/Plugins/Apps/Matrix/Matrix.lmm.rb +119 -5
- data/Plugins/Apps/Matrix/Synapse.container +22 -0
- data/Plugins/Apps/Matrix/config.json +50 -0
- data/Plugins/Apps/Matrix/homeserver.yaml +70 -0
- data/Plugins/Apps/Matrix/log.config +30 -0
- data/Plugins/Apps/Netdata/Netdata.conf.erb +0 -3
- data/Plugins/Apps/Netdata/Netdata.lmm.rb +0 -1
- data/Plugins/Apps/Nextcloud/Nextcloud.conf.erb +3 -4
- data/Plugins/Apps/Nextcloud/Nextcloud.lmm.rb +155 -48
- data/Plugins/Apps/Nextcloud/autoconfig.php +13 -0
- data/Plugins/Apps/Nextcloud/config.php +10 -1
- data/Plugins/Apps/Nextcloud/nextcloudcron.service +8 -0
- data/Plugins/Apps/Nextcloud/nextcloudcron.timer +10 -0
- data/Plugins/Apps/Nginx/Connection.rb +93 -0
- data/Plugins/Apps/Nginx/conf.d/configlmm.conf +54 -4
- data/Plugins/Apps/Nginx/conf.d/languages.conf +21 -0
- data/Plugins/Apps/Nginx/config-lmm/errors.conf +33 -22
- data/Plugins/Apps/Nginx/config-lmm/gateway-errors.conf +20 -0
- data/Plugins/Apps/Nginx/config-lmm/proxy.conf +6 -2
- data/Plugins/Apps/Nginx/main.conf.erb +7 -3
- data/Plugins/Apps/Nginx/nginx.conf +2 -2
- data/Plugins/Apps/Nginx/nginx.lmm.rb +103 -81
- data/Plugins/Apps/Nginx/proxy.conf.erb +24 -6
- data/Plugins/Apps/Odoo/Odoo.conf.erb +0 -3
- data/Plugins/Apps/Odoo/Odoo.container +7 -1
- data/Plugins/Apps/Odoo/Odoo.lmm.rb +4 -5
- data/Plugins/Apps/Ollama/Ollama.container +26 -0
- data/Plugins/Apps/Ollama/Ollama.lmm.rb +73 -0
- data/Plugins/Apps/OpenTelemetry/Config/config.yaml +704 -0
- data/Plugins/Apps/OpenTelemetry/OpenTelemetry.lmm.rb +154 -0
- data/Plugins/Apps/OpenVidu/Ingress.container +23 -0
- data/Plugins/Apps/{GitLab/GitLab.conf.erb → OpenVidu/OpenVidu.conf.erb} +8 -3
- data/Plugins/Apps/OpenVidu/OpenVidu.container +21 -0
- data/Plugins/Apps/OpenVidu/OpenVidu.lmm.rb +94 -0
- data/Plugins/Apps/OpenVidu/OpenViduCall.conf.erb +32 -0
- data/Plugins/Apps/OpenVidu/OpenViduCall.container +20 -0
- data/Plugins/Apps/OpenVidu/ingress.yaml +10 -0
- data/Plugins/Apps/OpenVidu/livekit.yaml +13 -0
- data/Plugins/Apps/PHP-FPM/Connection.rb +91 -0
- data/Plugins/Apps/PHP-FPM/PHP-FPM.lmm.rb +31 -4
- data/Plugins/Apps/Peppermint/Peppermint.conf.erb +2 -9
- data/Plugins/Apps/Peppermint/Peppermint.container +7 -1
- data/Plugins/Apps/Peppermint/Peppermint.lmm.rb +29 -33
- data/Plugins/Apps/Perplexica/Perplexica.container +25 -0
- data/Plugins/Apps/Perplexica/Perplexica.lmm.rb +92 -0
- data/Plugins/Apps/Perplexica/config.toml +26 -0
- data/Plugins/Apps/Podman/Connection.rb +24 -0
- data/Plugins/Apps/Podman/Podman.lmm.rb +80 -0
- data/Plugins/Apps/Podman/storage.conf +6 -0
- data/Plugins/Apps/Postfix/Postfix.lmm.rb +249 -145
- data/Plugins/Apps/PostgreSQL/Connection.rb +97 -0
- data/Plugins/Apps/PostgreSQL/PostgreSQL.lmm.rb +204 -99
- data/Plugins/Apps/Pterodactyl/Pterodactyl.conf.erb +0 -3
- data/Plugins/Apps/Pterodactyl/Pterodactyl.lmm.rb +0 -2
- data/Plugins/Apps/Pterodactyl/Wings.conf.erb +0 -3
- data/Plugins/Apps/RVM/RVM.lmm.rb +57 -0
- data/Plugins/Apps/Roundcube/Roundcube.conf.erb +72 -0
- data/Plugins/Apps/Roundcube/Roundcube.lmm.rb +141 -0
- data/Plugins/Apps/SSH/SSH.lmm.rb +9 -15
- data/Plugins/Apps/SearXNG/SearXNG.container +22 -0
- data/Plugins/Apps/SearXNG/SearXNG.lmm.rb +79 -0
- data/Plugins/Apps/SearXNG/limiter.toml +40 -0
- data/Plugins/Apps/SearXNG/settings.yml +2 -0
- data/Plugins/Apps/SigNoz/Config/alerts.yml +11 -0
- data/Plugins/Apps/SigNoz/Config/otel-collector-config.yaml +110 -0
- data/Plugins/Apps/SigNoz/Config/otel-collector-opamp-config.yaml +1 -0
- data/Plugins/Apps/SigNoz/Config/prometheus.yml +18 -0
- data/Plugins/Apps/SigNoz/SigNoz-Collector.container +23 -0
- data/Plugins/Apps/SigNoz/SigNoz-Migrator.container +17 -0
- data/Plugins/Apps/SigNoz/SigNoz.conf.erb +61 -0
- data/Plugins/Apps/SigNoz/SigNoz.container +26 -0
- data/Plugins/Apps/SigNoz/SigNoz.lmm.rb +319 -0
- data/Plugins/Apps/Solr/log4j2.xml +89 -0
- data/Plugins/Apps/Solr/solr.lmm.rb +82 -0
- data/Plugins/Apps/Sunshine/Sunshine.conf.erb +0 -3
- data/Plugins/Apps/Sunshine/Sunshine.lmm.rb +0 -1
- data/Plugins/Apps/Tunnel/tunnel.lmm.rb +59 -0
- data/Plugins/Apps/Tunnel/tunnelTCP.service +9 -0
- data/Plugins/Apps/Tunnel/tunnelTCP.socket +9 -0
- data/Plugins/Apps/Tunnel/tunnelUDP.service +9 -0
- data/Plugins/Apps/Tunnel/tunnelUDP.socket +9 -0
- data/Plugins/Apps/UVdesk/UVdesk.conf.erb +0 -3
- data/Plugins/Apps/Umami/Umami.container +19 -0
- data/Plugins/Apps/Umami/Umami.lmm.rb +108 -0
- data/Plugins/Apps/Valkey/Valkey.lmm.rb +64 -20
- data/Plugins/Apps/Vaultwarden/Vaultwarden.conf.erb +9 -6
- data/Plugins/Apps/Vaultwarden/Vaultwarden.container +7 -1
- data/Plugins/Apps/Vaultwarden/Vaultwarden.lmm.rb +67 -28
- data/Plugins/Apps/Wiki.js/Wiki.js.conf.erb +39 -0
- data/Plugins/Apps/Wiki.js/Wiki.js.container +20 -0
- data/Plugins/Apps/Wiki.js/Wiki.js.lmm.rb +55 -0
- data/Plugins/Apps/YaCy/YaCy.conf.erb +93 -0
- data/Plugins/Apps/YaCy/YaCy.container +21 -0
- data/Plugins/Apps/YaCy/YaCy.lmm.rb +160 -0
- data/Plugins/Apps/ZooKeeper/ZooKeeper.container +24 -0
- data/Plugins/Apps/ZooKeeper/ZooKeeper.lmm.rb +68 -0
- data/Plugins/Apps/bitmagnet/bitmagnet.conf.erb +0 -3
- data/Plugins/Apps/bitmagnet/bitmagnet.lmm.rb +0 -1
- data/Plugins/Apps/gollum/gollum.conf.erb +40 -4
- data/Plugins/Apps/gollum/gollum.container +10 -1
- data/Plugins/Apps/gollum/gollum.lmm.rb +56 -47
- data/Plugins/Apps/llama.cpp/llama.cpp.container +28 -0
- data/Plugins/Apps/llama.cpp/llama.cpp.lmm.rb +90 -0
- data/Plugins/Apps/vLLM/vLLM.container +32 -0
- data/Plugins/Apps/vLLM/vLLM.lmm.rb +89 -0
- data/Plugins/OS/General/Utils.lmm.rb +26 -0
- data/Plugins/OS/Linux/Connection.rb +472 -0
- data/Plugins/OS/Linux/Debian/preseed.cfg.erb +81 -0
- data/Plugins/OS/Linux/Distributions.yaml +32 -0
- data/Plugins/OS/Linux/Flavours.yaml +24 -0
- data/Plugins/OS/Linux/Grub/grub.cfg +10 -0
- data/Plugins/OS/Linux/HTTP.rb +32 -0
- data/Plugins/OS/Linux/Linux.lmm.rb +708 -174
- data/Plugins/OS/Linux/Packages.yaml +67 -3
- data/Plugins/OS/Linux/Proxmox/answer.toml.erb +30 -0
- data/Plugins/OS/Linux/Services.yaml +8 -0
- data/Plugins/OS/Linux/Shell.rb +70 -0
- data/Plugins/OS/Linux/Syslinux/default +8 -0
- data/Plugins/OS/Linux/WireGuard/WireGuard.lmm.rb +93 -40
- data/Plugins/OS/Linux/WireGuard/wg0.conf.erb +3 -0
- data/Plugins/OS/Linux/openSUSE/autoinst.xml.erb +29 -3
- data/Plugins/OS/Linux/systemd/systemd.lmm.rb +13 -11
- data/Plugins/OS/Routers/Aruba/ArubaInstant.lmm.rb +6 -5
- data/Plugins/Platforms/GitHub.lmm.rb +73 -28
- data/Plugins/Platforms/GoDaddy/GoDaddy.lmm.rb +10 -7
- data/Plugins/Platforms/Proxmox/Proxmox.lmm.rb +402 -0
- data/Plugins/Platforms/Proxmox/XTerm.rb +321 -0
- data/Plugins/Platforms/libvirt/libvirt.lmm.rb +41 -15
- data/Plugins/Platforms/porkbun.lmm.rb +12 -2
- data/Plugins/Platforms/porkbun_spec.rb +2 -2
- data/Plugins/Services/DNS/AmberBit.lmm.rb +1 -1
- data/Plugins/Services/DNS/ArubaItDNS.lmm.rb +1 -1
- data/Plugins/Services/DNS/NICLV.lmm.rb +1 -1
- data/Plugins/Services/DNS/PowerDNS.lmm.rb +130 -41
- data/Plugins/Services/DNS/tonic.lmm.rb +22 -12
- data/bootstrap.sh +41 -3
- data/lib/ConfigLMM/Framework/plugins/dns.rb +4 -3
- data/lib/ConfigLMM/Framework/plugins/linuxApp.rb +187 -144
- data/lib/ConfigLMM/Framework/plugins/nginxApp.rb +54 -6
- data/lib/ConfigLMM/Framework/plugins/plugin.rb +68 -140
- data/lib/ConfigLMM/Framework/plugins/store.rb +4 -4
- data/lib/ConfigLMM/Framework/variables.rb +75 -0
- data/lib/ConfigLMM/Framework.rb +1 -0
- data/lib/ConfigLMM/cli.rb +13 -5
- data/lib/ConfigLMM/commands/cleanup.rb +1 -0
- data/lib/ConfigLMM/commands/configsCommand.rb +38 -5
- data/lib/ConfigLMM/commands/diff.rb +33 -9
- data/lib/ConfigLMM/context.rb +22 -3
- data/lib/ConfigLMM/io/configList.rb +85 -7
- data/lib/ConfigLMM/io/connection.rb +143 -0
- data/lib/ConfigLMM/io/dhcp.rb +330 -0
- data/lib/ConfigLMM/io/http.rb +78 -0
- data/lib/ConfigLMM/io/local.rb +207 -0
- data/lib/ConfigLMM/io/pxe.rb +92 -0
- data/lib/ConfigLMM/io/ssh.rb +156 -0
- data/lib/ConfigLMM/io/tftp.rb +105 -0
- data/lib/ConfigLMM/io.rb +2 -0
- data/lib/ConfigLMM/secrets/envStore.rb +39 -0
- data/lib/ConfigLMM/secrets/fileStore.rb +43 -0
- data/lib/ConfigLMM/state.rb +12 -3
- data/lib/ConfigLMM/version.rb +2 -1
- data/lib/ConfigLMM.rb +1 -0
- data/{Examples → scripts}/configlmmAuth.sh +7 -5
- metadata +257 -9
@@ -1,12 +1,53 @@
|
|
1
1
|
|
2
2
|
server {
|
3
|
+
|
4
|
+
<% if !config['TLS'] %>
|
5
|
+
listen <%= config['Port'] %>;
|
6
|
+
listen [::]:<%= config['Port'] %>;
|
7
|
+
<% else %>
|
8
|
+
<% if config['NginxVersion'] >= 1.25 %>
|
9
|
+
listen <%= config['Port'] %> ssl;
|
10
|
+
listen [::]:<%= config['Port'] %> ssl;
|
11
|
+
http2 on;
|
12
|
+
http3 on;
|
13
|
+
quic_retry on;
|
14
|
+
add_header Alt-Svc 'h3=":<%= config['Port'] %>"; ma=86400';
|
15
|
+
<% else %>
|
16
|
+
listen <%= config['Port'] %> ssl http2;
|
17
|
+
listen [::]:<%= config['Port'] %> ssl http2;
|
18
|
+
<% end %>
|
19
|
+
|
20
|
+
include config-lmm/ssl.conf;
|
21
|
+
<% end %>
|
22
|
+
|
23
|
+
server_name <%= config['Domain'] %>;
|
24
|
+
|
25
|
+
include config-lmm/errors.conf;
|
26
|
+
|
27
|
+
location / {
|
28
|
+
proxy_pass http://127.0.0.1:18300;
|
29
|
+
include config-lmm/proxy.conf;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
server {
|
34
|
+
|
3
35
|
<% if !config['TLS'] %>
|
4
36
|
listen <%= config['Port'] %>;
|
5
37
|
listen [::]:<%= config['Port'] %>;
|
6
38
|
<% else %>
|
7
|
-
|
8
|
-
|
9
|
-
|
39
|
+
<% if config['NginxVersion'] >= 1.25 %>
|
40
|
+
listen <%= config['Port'] %> ssl;
|
41
|
+
listen [::]:<%= config['Port'] %> ssl;
|
42
|
+
http2 on;
|
43
|
+
http3 on;
|
44
|
+
quic_retry on;
|
45
|
+
add_header Alt-Svc 'h3=":<%= config['Port'] %>"; ma=86400';
|
46
|
+
<% else %>
|
47
|
+
listen <%= config['Port'] %> ssl http2;
|
48
|
+
listen [::]:<%= config['Port'] %> ssl http2;
|
49
|
+
<% end %>
|
50
|
+
|
10
51
|
include config-lmm/ssl.conf;
|
11
52
|
<% end %>
|
12
53
|
|
@@ -14,20 +55,17 @@ server {
|
|
14
55
|
#listen 8448 ssl http2 default_server;
|
15
56
|
#listen [::]:8448 ssl http2 default_server;
|
16
57
|
|
17
|
-
server_name <%= config['
|
18
|
-
|
19
|
-
access_log /var/log/nginx/matrix.access.log;
|
20
|
-
error_log /var/log/nginx/matrix.error.log;
|
58
|
+
server_name <%= config['SynapseDomain'] %>;
|
21
59
|
|
22
|
-
include config-lmm/private.conf;
|
23
60
|
include config-lmm/errors.conf;
|
24
61
|
|
25
62
|
location ~ ^(/_matrix|/_synapse/client) {
|
26
63
|
# note: do not add a path (even a single /) after the port in `proxy_pass`,
|
27
64
|
# otherwise nginx will canonicalise the URI and cause signature verification
|
28
65
|
# errors.
|
29
|
-
proxy_pass http://
|
66
|
+
proxy_pass http://127.0.0.1:8008;
|
30
67
|
include config-lmm/proxy.conf;
|
68
|
+
proxy_intercept_errors off;
|
31
69
|
|
32
70
|
# Nginx by default only allows file uploads up to 1M in size
|
33
71
|
# Increase client_max_body_size to match max_upload_size defined in homeserver.yaml
|
@@ -1,10 +1,15 @@
|
|
1
1
|
|
2
2
|
module ConfigLMM
|
3
3
|
module LMM
|
4
|
-
class Matrix < Framework::
|
4
|
+
class Matrix < Framework::Plugin
|
5
|
+
|
6
|
+
USER = 'matrix'
|
7
|
+
HOME_DIR = '/var/lib/matrix'
|
5
8
|
|
6
9
|
def actionMatrixBuild(id, target, state, context, options)
|
7
|
-
|
10
|
+
Nginx.withConnection(local) do |nginxConnection|
|
11
|
+
nginxConnection.writeConfig(__dir__, 'Matrix', target, state, context, options)
|
12
|
+
end
|
8
13
|
end
|
9
14
|
|
10
15
|
def actionMatrixDiff(id, target, activeState, context, options)
|
@@ -12,10 +17,119 @@ module ConfigLMM
|
|
12
17
|
end
|
13
18
|
|
14
19
|
def actionMatrixDeploy(id, target, activeState, context, options)
|
15
|
-
|
16
|
-
|
17
|
-
|
20
|
+
raise Framework::PluginProcessError.new('Domain field must be set!') unless target['Domain']
|
21
|
+
raise Framework::PluginProcessError.new('ServerName field must be set!') unless target['ServerName']
|
22
|
+
|
23
|
+
target['Database'] ||= {}
|
24
|
+
|
25
|
+
self.withConnection(target['Location'], target) do |connection|
|
26
|
+
Linux.withConnection(connection) do |linuxConnection|
|
27
|
+
target['Database'] ||= {}
|
28
|
+
dbPassword = self.configurePostgreSQL(target['Database'], linuxConnection, options)
|
29
|
+
|
30
|
+
Podman.ensurePresent(linuxConnection, options)
|
31
|
+
Podman.createUser(USER, HOME_DIR, 'Matrix', linuxConnection, options)
|
32
|
+
linuxConnection.withUserShell(USER) do |shell|
|
33
|
+
shell.createDirs(options, '~/data')
|
34
|
+
end
|
35
|
+
|
36
|
+
path = Podman.containersPath(HOME_DIR)
|
37
|
+
linuxConnection.ensureFile("#{path}/Matrix.env", options)
|
38
|
+
|
39
|
+
linuxConnection.setUserGroup("#{path}/Matrix.env", USER, USER, options)
|
40
|
+
linuxConnection.setPrivate("#{path}/Matrix.env", options)
|
41
|
+
|
42
|
+
homeserver = YAML.load_file(__dir__ + '/homeserver.yaml')
|
43
|
+
configureHomeserver(homeserver, dbPassword, target)
|
44
|
+
homeserverFile = options['output'] + '/homeserver.yaml'
|
45
|
+
File.write(homeserverFile, homeserver.to_yaml)
|
46
|
+
|
47
|
+
linuxConnection.upload(homeserverFile, HOME_DIR + '/data/', options)
|
48
|
+
|
49
|
+
linuxConnection.upload(__dir__ + '/log.config', HOME_DIR + '/data/', options)
|
50
|
+
linuxConnection.upload(__dir__ + '/config.json', HOME_DIR + '/', options)
|
51
|
+
linuxConnection.setUserGroup("#{HOME_DIR}/data", USER, USER, options)
|
52
|
+
|
53
|
+
linuxConnection.fileReplace("#{HOME_DIR}/config.json", '\$SYNAPSE_DOMAIN', target['SynapseDomain'], options)
|
54
|
+
linuxConnection.fileReplace("#{HOME_DIR}/config.json", '\$SERVER_NAME', target['ServerName'], options)
|
55
|
+
|
56
|
+
linuxConnection.upload(__dir__ + '/Synapse.container', path, options)
|
57
|
+
linuxConnection.upload(__dir__ + '/Element.container', path, options)
|
58
|
+
|
59
|
+
linuxConnection.reloadUserServices(USER, options)
|
60
|
+
linuxConnection.restartUserService(USER, 'Synapse', options)
|
61
|
+
linuxConnection.restartUserService(USER, 'Element', options)
|
62
|
+
|
63
|
+
Nginx.withConnection(linuxConnection) do |nginxConnection|
|
64
|
+
nginxConnection.provision(__dir__, 'Matrix', target, activeState, context, options)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def configureHomeserver(homeserver, dbPassword, target)
|
71
|
+
homeserver['server_name'] = target['ServerName']
|
72
|
+
homeserver['public_baseurl'] = "https://#{target['SynapseDomain'].downcase}/"
|
73
|
+
|
74
|
+
homeserver['database']['args']['password'] = dbPassword
|
75
|
+
|
76
|
+
homeserver['registration_shared_secret'] = SecureRandom.urlsafe_base64(45)
|
77
|
+
homeserver['macaroon_secret_key'] = SecureRandom.urlsafe_base64(45)
|
78
|
+
homeserver['form_secret'] = SecureRandom.urlsafe_base64(45)
|
79
|
+
|
80
|
+
if target['SMTP']
|
81
|
+
host = target['SMTP']['Host']
|
82
|
+
host = Podman::HOST_IP if host.to_s.empty? || ['localhost', '127.0.0.1'].include?(host)
|
83
|
+
|
84
|
+
homeserver['email']['smtp_host'] = host
|
85
|
+
if target['SMTP']['Port']
|
86
|
+
homeserver['email']['smtp_port'] = target['SMTP']['Port']
|
87
|
+
end
|
88
|
+
if target['SMTP']['Username']
|
89
|
+
homeserver['email']['smtp_user'] = target['SMTP']['Username']
|
90
|
+
smtpPassword = nil
|
91
|
+
if target['SMTP']['SecretId']
|
92
|
+
smtpPassword = context.secrets.load(target['SMTP']['SecretId'], target['SMTP']['Username'].upcase + '_PASSWORD')
|
93
|
+
end
|
94
|
+
homeserver['email']['smtp_pass'] = smtpPassword if smtpPassword
|
95
|
+
end
|
96
|
+
|
97
|
+
homeserver['email']['notif_from'] = target['SMTP']['From']
|
98
|
+
|
99
|
+
if target['SMTP']['Port'] == 465
|
100
|
+
homeserver['email']['force_tls'] = true
|
101
|
+
end
|
102
|
+
else
|
103
|
+
homeserver.delete('email')
|
104
|
+
end
|
105
|
+
|
106
|
+
if target['OIDC']
|
107
|
+
raise Framework::PluginProcessError.new('OIDC.SecretId must be set!') if target['OIDC']['SecretId'].to_s.empty?
|
108
|
+
|
109
|
+
homeserver['oidc_providers'][0]['issuer'] = target['OIDC']['Issuer']
|
110
|
+
|
111
|
+
clientId = context.secrets.load(target['OIDC']['SecretId'], 'MATRIX_CLIENT_ID')
|
112
|
+
clientSecret = context.secrets.load(target['OIDC']['SecretId'], 'MATRIX_CLIENT_SECRET')
|
113
|
+
|
114
|
+
if !clientId || !clientSecret
|
115
|
+
prompt.say("Secrets #{context.secrets.getID(target['OIDC']['SecretId'], 'MATRIX_CLIENT_ID')} and #{context.secrets.getID(target['OIDC']['SecretId'], 'MATRIX_CLIENT_SECRET')} must be set!", :color => :magenta)
|
116
|
+
raise 'Required secrets are missing!'
|
117
|
+
end
|
118
|
+
|
119
|
+
homeserver['oidc_providers'][0]['client_id'] = clientId
|
120
|
+
homeserver['oidc_providers'][0]['client_secret'] = clientSecret
|
121
|
+
homeserver['password_config']['enabled'] = false
|
122
|
+
else
|
123
|
+
homeserver.delete('oidc_providers')
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
def configurePostgreSQL(dbSettings, linuxConnection, options)
|
128
|
+
password = SecureRandom.alphanumeric(20)
|
129
|
+
PostgreSQL.withConnection(dbSettings, linuxConnection) do |postgresConnection|
|
130
|
+
postgresConnection.createUserAndDB(USER, password, options)
|
18
131
|
end
|
132
|
+
password
|
19
133
|
end
|
20
134
|
|
21
135
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
[Unit]
|
4
|
+
Description=Matrix (Synapse) container
|
5
|
+
After=local-fs.target
|
6
|
+
|
7
|
+
[Container]
|
8
|
+
ContainerName=Synapse
|
9
|
+
Image=docker.io/matrixdotorg/synapse:latest
|
10
|
+
EnvironmentFile=/var/lib/matrix/.config/containers/systemd/Matrix.env
|
11
|
+
Network=slirp4netns:allow_host_loopback=true
|
12
|
+
PublishPort=127.0.0.1:8008:8008
|
13
|
+
UserNS=keep-id:uid=991,gid=991
|
14
|
+
Volume=/var/lib/matrix/data:/data
|
15
|
+
LogDriver=journald
|
16
|
+
AutoUpdate=registry
|
17
|
+
|
18
|
+
[Service]
|
19
|
+
Restart=on-failure
|
20
|
+
|
21
|
+
[Install]
|
22
|
+
WantedBy=multi-user.target default.target
|
@@ -0,0 +1,50 @@
|
|
1
|
+
{
|
2
|
+
"default_server_config": {
|
3
|
+
"m.homeserver": {
|
4
|
+
"base_url": "https://$SYNAPSE_DOMAIN",
|
5
|
+
"server_name": "$SERVER_NAME"
|
6
|
+
},
|
7
|
+
"m.identity_server": {
|
8
|
+
"base_url": "https://matrix.org"
|
9
|
+
}
|
10
|
+
},
|
11
|
+
"disable_custom_urls": false,
|
12
|
+
"disable_guests": false,
|
13
|
+
"disable_login_language_selector": false,
|
14
|
+
"disable_3pid_login": false,
|
15
|
+
"brand": "Element",
|
16
|
+
"integrations_ui_url": "https://scalar.vector.im/",
|
17
|
+
"integrations_rest_url": "https://scalar.vector.im/api",
|
18
|
+
"integrations_widgets_urls": [
|
19
|
+
"https://scalar.vector.im/_matrix/integrations/v1",
|
20
|
+
"https://scalar.vector.im/api",
|
21
|
+
"https://scalar-staging.vector.im/_matrix/integrations/v1",
|
22
|
+
"https://scalar-staging.vector.im/api",
|
23
|
+
"https://scalar-staging.riot.im/scalar/api"
|
24
|
+
],
|
25
|
+
"default_widget_height": 280,
|
26
|
+
"default_country_code": "GB",
|
27
|
+
"show_labs_settings": false,
|
28
|
+
"features": {},
|
29
|
+
"default_federate": true,
|
30
|
+
"default_theme": "light",
|
31
|
+
"room_directory": {
|
32
|
+
"servers": ["matrix.org"]
|
33
|
+
},
|
34
|
+
"enable_presence_by_hs_url": {
|
35
|
+
"https://matrix.org": false,
|
36
|
+
"https://matrix-client.matrix.org": false
|
37
|
+
},
|
38
|
+
"setting_defaults": {
|
39
|
+
"breadcrumbs": true
|
40
|
+
},
|
41
|
+
"jitsi": {
|
42
|
+
"preferred_domain": "meet.element.io"
|
43
|
+
},
|
44
|
+
"element_call": {
|
45
|
+
"url": "https://call.element.io",
|
46
|
+
"participant_limit": 8,
|
47
|
+
"brand": "Element Call"
|
48
|
+
},
|
49
|
+
"map_style_url": "https://api.maptiler.com/maps/streets/style.json?key=fU3vlMsMn4Jb6dnEIFsx"
|
50
|
+
}
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# Configuration file for Synapse.
|
2
|
+
#
|
3
|
+
# This is a YAML file: see [1] for a quick introduction. Note in particular
|
4
|
+
# that *indentation is important*: all the elements of a list or dictionary
|
5
|
+
# should have the same indentation.
|
6
|
+
#
|
7
|
+
# [1] https://docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html
|
8
|
+
#
|
9
|
+
# For more information on how to configure Synapse, including a complete accounting of
|
10
|
+
# each option, go to docs/usage/configuration/config_documentation.md or
|
11
|
+
# https://element-hq.github.io/synapse/latest/usage/configuration/config_documentation.html
|
12
|
+
server_name: $SERVER_NAME
|
13
|
+
public_baseurl: https://$SYNAPSE_DOMAIN/
|
14
|
+
pid_file: /data/homeserver.pid
|
15
|
+
listeners:
|
16
|
+
- port: 8008
|
17
|
+
tls: false
|
18
|
+
type: http
|
19
|
+
x_forwarded: true
|
20
|
+
resources:
|
21
|
+
- names: [client, federation]
|
22
|
+
compress: false
|
23
|
+
|
24
|
+
database:
|
25
|
+
name: psycopg2
|
26
|
+
allow_unsafe_locale: true
|
27
|
+
args:
|
28
|
+
user: matrix
|
29
|
+
password: $DB_PASSWORD
|
30
|
+
dbname: matrix
|
31
|
+
host: 10.0.2.2
|
32
|
+
|
33
|
+
email:
|
34
|
+
smtp_host: 10.0.2.2
|
35
|
+
smtp_port: 25
|
36
|
+
smtp_user:
|
37
|
+
smtp_pass:
|
38
|
+
force_tls: false
|
39
|
+
notif_from:
|
40
|
+
|
41
|
+
password_config:
|
42
|
+
enabled: true
|
43
|
+
|
44
|
+
oidc_providers:
|
45
|
+
- idp_id: OIDC
|
46
|
+
idp_name: OIDC
|
47
|
+
discover: true
|
48
|
+
issuer: $OIDC_ISSUER
|
49
|
+
client_id: $CLIENT_ID
|
50
|
+
client_secret: $CLIENT_SECRET
|
51
|
+
scopes:
|
52
|
+
- "openid"
|
53
|
+
- "profile"
|
54
|
+
- "email"
|
55
|
+
user_mapping_provider:
|
56
|
+
config:
|
57
|
+
localpart_template: "{{ user.preferred_username }}"
|
58
|
+
display_name_template: "{{ user.name|capitalize }}"
|
59
|
+
|
60
|
+
log_config: "/data/log.config"
|
61
|
+
media_store_path: /data/media_store
|
62
|
+
registration_shared_secret: $SECRET1
|
63
|
+
report_stats: false
|
64
|
+
macaroon_secret_key: $SECRET2
|
65
|
+
form_secret: $SECRET3
|
66
|
+
report_stats: false
|
67
|
+
signing_key_path: "/data/signing.key"
|
68
|
+
trusted_key_servers:
|
69
|
+
- server_name: "matrix.org"
|
70
|
+
suppress_key_server_warning: true
|
@@ -0,0 +1,30 @@
|
|
1
|
+
version: 1
|
2
|
+
|
3
|
+
formatters:
|
4
|
+
precise:
|
5
|
+
|
6
|
+
format: '%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s - %(message)s'
|
7
|
+
|
8
|
+
handlers:
|
9
|
+
|
10
|
+
console:
|
11
|
+
class: logging.StreamHandler
|
12
|
+
formatter: precise
|
13
|
+
|
14
|
+
loggers:
|
15
|
+
# This is just here so we can leave `loggers` in the config regardless of whether
|
16
|
+
# we configure other loggers below (avoid empty yaml dict error).
|
17
|
+
_placeholder:
|
18
|
+
level: "INFO"
|
19
|
+
|
20
|
+
synapse.storage.SQL:
|
21
|
+
# beware: increasing this to DEBUG will make synapse log sensitive
|
22
|
+
# information such as access tokens.
|
23
|
+
level: INFO
|
24
|
+
|
25
|
+
root:
|
26
|
+
level: INFO
|
27
|
+
handlers: [console]
|
28
|
+
|
29
|
+
|
30
|
+
disable_existing_loggers: false
|
@@ -31,10 +31,7 @@ server
|
|
31
31
|
|
32
32
|
server_name <%= config['Domain'] %>;
|
33
33
|
|
34
|
-
|
35
|
-
error_log /var/log/nginx/nextcloud.error.log;
|
36
|
-
|
37
|
-
root /usr/share/webapps/nextcloud;
|
34
|
+
root <%= config['Root'] %>;
|
38
35
|
|
39
36
|
include config-lmm/private.conf;
|
40
37
|
include config-lmm/errors.conf;
|
@@ -142,6 +139,8 @@ server
|
|
142
139
|
fastcgi_request_buffering off;
|
143
140
|
|
144
141
|
fastcgi_max_temp_file_size 0;
|
142
|
+
|
143
|
+
fastcgi_hide_header X-Powered-By;
|
145
144
|
}
|
146
145
|
|
147
146
|
# Rule borrowed from `.htaccess`
|