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
@@ -10,7 +10,6 @@ module ConfigLMM
|
|
10
10
|
def actionArchiSteamFarmDeploy(id, target, activeState, context, options)
|
11
11
|
if !target['Location'] || target['Location'] == '@me'
|
12
12
|
deployNginxConfig(id, target, activeState, context, options)
|
13
|
-
activeState['Location'] = '@me'
|
14
13
|
end
|
15
14
|
end
|
16
15
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
[Unit]
|
3
|
+
Description=Authentik Proxy Outpost container
|
4
|
+
After=local-fs.target
|
5
|
+
|
6
|
+
[Container]
|
7
|
+
ContainerName=Authentik-ProxyOutpost
|
8
|
+
Image=ghcr.io/goauthentik/proxy:2025.2
|
9
|
+
EnvironmentFile=/var/lib/authentik/.config/containers/systemd/ProxyOutpost.env
|
10
|
+
Network=slirp4netns:allow_host_loopback=true
|
11
|
+
PublishPort=127.0.0.1:19010:9000
|
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
|
@@ -4,7 +4,8 @@ Description=Authentik Server container
|
|
4
4
|
After=local-fs.target
|
5
5
|
|
6
6
|
[Container]
|
7
|
-
|
7
|
+
ContainerName=Authentik-Server
|
8
|
+
Image=ghcr.io/goauthentik/server:2025.2
|
8
9
|
Exec=server
|
9
10
|
EnvironmentFile=/var/lib/authentik/.config/containers/systemd/Authentik.env
|
10
11
|
Network=slirp4netns:allow_host_loopback=true
|
@@ -13,6 +14,11 @@ PublishPort=127.0.0.1:19300:9300
|
|
13
14
|
UserNS=keep-id:uid=1000,gid=1000
|
14
15
|
Volume=/var/lib/authentik/media:/media
|
15
16
|
Volume=/var/lib/authentik/templates:/templates
|
17
|
+
LogDriver=journald
|
18
|
+
AutoUpdate=registry
|
19
|
+
|
20
|
+
[Service]
|
21
|
+
Restart=on-failure
|
16
22
|
|
17
23
|
[Install]
|
18
24
|
WantedBy=multi-user.target default.target
|
@@ -4,7 +4,8 @@ Description=Authentik Worker container
|
|
4
4
|
After=local-fs.target
|
5
5
|
|
6
6
|
[Container]
|
7
|
-
|
7
|
+
ContainerName=Authentik-Worker
|
8
|
+
Image=ghcr.io/goauthentik/server:2025.2
|
8
9
|
Exec=worker
|
9
10
|
EnvironmentFile=/var/lib/authentik/.config/containers/systemd/Authentik.env
|
10
11
|
Network=slirp4netns:allow_host_loopback=true
|
@@ -12,6 +13,11 @@ UserNS=keep-id:uid=1000,gid=1000
|
|
12
13
|
Volume=/var/lib/authentik/media:/media
|
13
14
|
Volume=/var/lib/authentik/templates:/templates
|
14
15
|
Volume=/var/lib/authentik/certs:/certs
|
16
|
+
LogDriver=journald
|
17
|
+
AutoUpdate=registry
|
18
|
+
|
19
|
+
[Service]
|
20
|
+
Restart=on-failure
|
15
21
|
|
16
22
|
[Install]
|
17
23
|
WantedBy=multi-user.target default.target
|
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
# Upstream where your authentik server is hosted.
|
3
|
-
upstream
|
4
|
-
server
|
3
|
+
upstream <%= config['Name'] %> {
|
4
|
+
server <%= config['Server'] %>:19000;
|
5
5
|
|
6
6
|
# Improve performance by keeping some connections alive.
|
7
7
|
keepalive 10;
|
@@ -20,16 +20,28 @@ server {
|
|
20
20
|
listen [::]:443 ssl http2;
|
21
21
|
<% end %>
|
22
22
|
|
23
|
+
include config-lmm/gateway-errors.conf;
|
24
|
+
include config-lmm/security.conf;
|
23
25
|
include config-lmm/ssl.conf;
|
24
26
|
|
25
27
|
server_name <%= config['Domain'] %>;
|
26
28
|
|
27
|
-
|
28
|
-
|
29
|
+
<% if config['CertName'] %>
|
30
|
+
ssl_certificate "/etc/letsencrypt/live/<%= config['CertName'] %>/fullchain.pem";
|
31
|
+
ssl_certificate_key "/etc/letsencrypt/live/<%= config['CertName'] %>/privkey.pem";
|
32
|
+
ssl_trusted_certificate "/etc/letsencrypt/live/<%= config['CertName'] %>/chain.pem";
|
33
|
+
<% end %>
|
29
34
|
|
30
|
-
# Proxy site
|
31
35
|
location / {
|
32
|
-
proxy_pass http
|
36
|
+
proxy_pass http://<%= config['Name'] %>;
|
33
37
|
include config-lmm/proxy.conf;
|
34
38
|
}
|
39
|
+
|
40
|
+
<% if config['Outposts'].to_a.include?('Proxy') %>
|
41
|
+
location /outpost.goauthentik.io {
|
42
|
+
proxy_pass http://<%= config['Server'] %>:19010/outpost.goauthentik.io;
|
43
|
+
set $ProxyForwardedHost $http_x_authentik_host;
|
44
|
+
include config-lmm/proxy.conf;
|
45
|
+
}
|
46
|
+
<% end %>
|
35
47
|
}
|
@@ -1,70 +1,257 @@
|
|
1
1
|
|
2
|
+
require 'json'
|
3
|
+
|
2
4
|
module ConfigLMM
|
3
5
|
module LMM
|
4
|
-
class Authentik < Framework::
|
6
|
+
class Authentik < Framework::Plugin
|
5
7
|
|
6
8
|
USER = 'authentik'
|
7
9
|
HOME_DIR = '/var/lib/authentik'
|
8
|
-
HOST_IP = '10.0.2.2'
|
9
10
|
|
10
11
|
def actionAuthentikBuild(id, target, state, context, options)
|
11
|
-
|
12
|
+
Nginx.withConnection(local) do |nginxConnection|
|
13
|
+
nginxConnection.writeConfig(__dir__, 'Authentik', target, state, context, options)
|
14
|
+
end
|
12
15
|
end
|
13
16
|
|
14
17
|
def actionAuthentikDeploy(id, target, activeState, context, options)
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
ssh.scp.upload!(__dir__ + '/Authentik-Worker.container', path)
|
39
|
-
self.class.sshExec!(ssh, "systemctl --user --machine=#{USER}@ daemon-reload")
|
40
|
-
self.class.sshExec!(ssh, "systemctl --user --machine=#{USER}@ start Authentik-Server")
|
41
|
-
self.class.sshExec!(ssh, "systemctl --user --machine=#{USER}@ start Authentik-Worker")
|
42
|
-
|
43
|
-
Framework::LinuxApp.ensureServiceAutoStartOverSSH(NGINX_PACKAGE, ssh)
|
44
|
-
self.writeNginxConfig(__dir__, 'Authentik', id, target, state, context, options)
|
45
|
-
self.deployNginxConfig(id, target, activeState, context, options)
|
46
|
-
Framework::LinuxApp.startServiceOverSSH(NGINX_PACKAGE, ssh)
|
18
|
+
|
19
|
+
if target['Location'].start_with?('http')
|
20
|
+
apiURL = target['Location']
|
21
|
+
configureAuthentik(apiURL, id, target, activeState, context, options)
|
22
|
+
else
|
23
|
+
deployServerAndReverseProxy(id, target, activeState, context, options)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def deployServerAndReverseProxy(id, target, activeState, context, options)
|
28
|
+
|
29
|
+
self.withConnection(target['Location'], target) do |connection|
|
30
|
+
Linux.withConnection(connection) do |linuxConnection|
|
31
|
+
target['Database'] ||= {}
|
32
|
+
target['Deploy'] = true unless target.key?('Deploy')
|
33
|
+
|
34
|
+
if target['Deploy']
|
35
|
+
if !target.key?('Proxy') || target['Proxy'] == false
|
36
|
+
self.deployServer(linuxConnection, target, activeState, context, options)
|
37
|
+
self.deployProxyOutpost(target, linuxConnection, options)
|
38
|
+
end
|
39
|
+
|
40
|
+
self.deployReverseProxy(id, linuxConnection, target, activeState, context, options)
|
47
41
|
end
|
48
|
-
|
49
|
-
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
apiURL = "https://#{target['Domain']}/"
|
46
|
+
configureAuthentik(apiURL, id, target, activeState, context, options)
|
47
|
+
end
|
48
|
+
|
49
|
+
def deployServer(linuxConnection, target, activeState, context, options)
|
50
|
+
dbPassword = self.configurePostgreSQL(target['Database'], linuxConnection, options)
|
51
|
+
|
52
|
+
Podman.ensurePresent(linuxConnection, options)
|
53
|
+
Podman.createUser(USER, HOME_DIR, 'Authentik IdP and SSO', linuxConnection, options)
|
54
|
+
linuxConnection.withUserShell(USER) do |shell|
|
55
|
+
shell.createDirs(options, '~/media', '~/templates', '~/certs')
|
56
|
+
end
|
57
|
+
|
58
|
+
path = Podman.containersPath(HOME_DIR)
|
59
|
+
secretKey = context.secrets.load(target['SecretId'], 'SECRET_KEY')
|
60
|
+
if secretKey.nil?
|
61
|
+
secretKey = SecureRandom.urlsafe_base64(60)
|
62
|
+
context.secrets.store(target['SecretId'], 'SECRET_KEY', secretKey) unless options['dry']
|
63
|
+
end
|
64
|
+
linuxConnection.fileWrite("#{path}/Authentik.env", "AUTHENTIK_SECRET_KEY=#{secretKey}", { **options, hide: true })
|
65
|
+
|
66
|
+
valkeyHost = Podman.updateHost(target['Valkey'].to_h['Host'])
|
67
|
+
linuxConnection.fileAppend("#{path}/Authentik.env", "AUTHENTIK_REDIS__HOST=#{valkeyHost}", options)
|
68
|
+
if target['Valkey'].to_h['SecretId']
|
69
|
+
valkeyPassword = context.secrets.load(target['Valkey']['SecretId'], 'VALKEY_PASSWORD')
|
70
|
+
if !valkeyPassword.nil?
|
71
|
+
linuxConnection.fileAppend("#{path}/Authentik.env", "AUTHENTIK_REDIS__PASSWORD=#{valkeyPassword}", { **options, hide: true })
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
postgresHost = Podman.updateHost(target['Database'].to_h['HostName'])
|
76
|
+
linuxConnection.fileAppend("#{path}/Authentik.env", "AUTHENTIK_POSTGRESQL__HOST=#{postgresHost}", options)
|
77
|
+
linuxConnection.fileAppend("#{path}/Authentik.env", "AUTHENTIK_POSTGRESQL__PASSWORD=#{dbPassword}", { **options, hide: true })
|
78
|
+
|
79
|
+
if !target['SMTP'].to_h.empty?
|
80
|
+
host = target['SMTP']['Host']
|
81
|
+
host = Podman::HOST_IP if host.to_s.empty? || ['localhost', '127.0.0.1'].include?(host)
|
82
|
+
|
83
|
+
linuxConnection.fileAppend("#{path}/Authentik.env", "AUTHENTIK_EMAIL__HOST=#{host}", options)
|
84
|
+
|
85
|
+
if target['SMTP']['Port']
|
86
|
+
linuxConnection.fileAppend("#{path}/Authentik.env", "AUTHENTIK_EMAIL__PORT=#{target['SMTP']['Port']}", options)
|
87
|
+
end
|
88
|
+
|
89
|
+
if target['SMTP']['Username']
|
90
|
+
linuxConnection.fileAppend("#{path}/Authentik.env", "AUTHENTIK_EMAIL__USERNAME=#{target['SMTP']['Username']}", options)
|
91
|
+
end
|
92
|
+
|
93
|
+
if target['SMTP']['SecretId']
|
94
|
+
smtpPassword = context.secrets.load(target['SMTP']['SecretId'], target['SMTP']['Username'].upcase + '_PASSWORD')
|
95
|
+
linuxConnection.fileAppend("#{path}/Authentik.env", "AUTHENTIK_EMAIL__PASSWORD=#{smtpPassword}", { **options, hide: true })
|
96
|
+
end
|
97
|
+
|
98
|
+
if target['SMTP']['Port'] == 465
|
99
|
+
linuxConnection.fileAppend("#{path}/Authentik.env", "AUTHENTIK_EMAIL__USE_TLS=true", options)
|
100
|
+
end
|
101
|
+
|
102
|
+
if target['SMTP']['From']
|
103
|
+
linuxConnection.fileAppend("#{path}/Authentik.env", "AUTHENTIK_EMAIL__FROM=#{target['SMTP']['From']}", options)
|
50
104
|
end
|
51
105
|
else
|
52
|
-
#
|
106
|
+
linuxConnection.fileAppend("#{path}/Authentik.env", "AUTHENTIK_EMAIL__HOST=#{Podman::HOST_IP}", options)
|
107
|
+
end
|
108
|
+
|
109
|
+
adminPassword = context.secrets.load(target['SecretId'], 'ADMIN_PASSWORD')
|
110
|
+
if adminPassword.nil?
|
111
|
+
raise 'Missing Authentik Admin.EMail' unless target['Admin'].to_h.key?('EMail')
|
112
|
+
adminPassword = SecureRandom.urlsafe_base64(30)
|
113
|
+
if !options['dry']
|
114
|
+
context.secrets.store(target['SecretId'], 'ADMIN_PASSWORD', adminPassword)
|
115
|
+
context.secrets.print("Authentik Admin password", adminPassword)
|
116
|
+
end
|
53
117
|
end
|
118
|
+
if target['Admin'].to_h.key?('EMail')
|
119
|
+
email = target['Admin']['EMail']
|
120
|
+
linuxConnection.fileAppend("#{path}/Authentik.env", "AUTHENTIK_BOOTSTRAP_EMAIL=#{email}", options)
|
121
|
+
linuxConnection.fileAppend("#{path}/Authentik.env", "AUTHENTIK_BOOTSTRAP_PASSWORD=#{adminPassword}", { **options, hide: true })
|
122
|
+
end
|
123
|
+
|
124
|
+
adminToken = context.secrets.load(target['SecretId'], 'ADMIN_TOKEN')
|
125
|
+
if adminToken.nil?
|
126
|
+
adminToken = SecureRandom.urlsafe_base64(60)
|
127
|
+
if !options['dry']
|
128
|
+
context.secrets.store(target['SecretId'], 'ADMIN_TOKEN', adminToken) unless options['dry']
|
129
|
+
context.secrets.print("Authentik Admin token", adminToken)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
linuxConnection.fileAppend("#{path}/Authentik.env", "AUTHENTIK_BOOTSTRAP_TOKEN=#{adminToken}", { **options, hide: true })
|
133
|
+
|
134
|
+
linuxConnection.setUserGroup("#{path}/Authentik.env", USER, USER, options)
|
135
|
+
linuxConnection.setPrivate("#{path}/Authentik.env", options)
|
136
|
+
|
137
|
+
linuxConnection.upload(__dir__ + '/Authentik-Server.container', path, options)
|
138
|
+
linuxConnection.upload(__dir__ + '/Authentik-Worker.container', path, options)
|
139
|
+
|
140
|
+
if target['Proxy'] == false
|
141
|
+
linuxConnection.fileReplace("#{path}/Authentik-Server.container", 'PublishPort=127.0.0.1:19000:', 'PublishPort=0.0.0.0:19000:', options)
|
142
|
+
linuxConnection.firewallAddPort('19000/tcp', options)
|
143
|
+
end
|
144
|
+
|
145
|
+
linuxConnection.reloadUserServices(USER, options)
|
146
|
+
linuxConnection.restartUserService(USER, 'Authentik-Server', options)
|
147
|
+
linuxConnection.restartUserService(USER, 'Authentik-Worker', options)
|
54
148
|
end
|
55
149
|
|
56
|
-
def
|
57
|
-
|
150
|
+
def deployReverseProxy(id, linuxConnection, target, activeState, context, options)
|
151
|
+
if !target.key?('Proxy') || target['Proxy']
|
152
|
+
raise Framework::PluginProcessError.new('Domain field must be set!') unless target['Domain']
|
153
|
+
Nginx.withConnection(linuxConnection) do |nginxConnection|
|
154
|
+
target['Server'] = '127.0.0.1' unless target['Server']
|
155
|
+
target['ConfigName'] = target['Name']
|
156
|
+
nginxConnection.provision(__dir__, 'Authentik', target, activeState, context, options)
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
def configureAuthentik(apiURL, id, target, activeState, context, options)
|
162
|
+
if target['Groups'] || target['Providers'] || target['Applications']
|
163
|
+
prompt.say('Configuring specified settings for Authentik is not implemented! You\'ll have to configure those manually.', :color => :magenta)
|
164
|
+
end
|
165
|
+
end
|
58
166
|
|
59
|
-
|
167
|
+
def waitTilReady(baseURL, target, linuxConnection, options)
|
168
|
+
if !options['dry']
|
169
|
+
timeout = 3600 # 1h
|
170
|
+
loop do
|
171
|
+
begin
|
172
|
+
linuxConnection.exec("curl --no-progress-meter --show-error --fail #{baseURL}/", false, options)
|
173
|
+
break
|
174
|
+
rescue
|
175
|
+
timeout -= 30
|
176
|
+
end
|
177
|
+
raise "Timeout while waiting #{baseURL}/ to be ready!" if timeout <= 0
|
178
|
+
sleep(30)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
60
182
|
|
61
|
-
|
62
|
-
|
183
|
+
def viewToken(baseURL, target, tokenIdentifier, adminToken, linuxConnection, options)
|
184
|
+
url = "#{baseURL}/api/v3/core/tokens/#{tokenIdentifier}/view_key/"
|
185
|
+
result = linuxConnection.http(url, options, { 'Authorization' => 'Bearer ' + adminToken })
|
186
|
+
data = JSON.parse(result)
|
187
|
+
return nil unless data['key']
|
188
|
+
data['key']
|
63
189
|
end
|
64
190
|
|
65
|
-
def
|
191
|
+
def loadProxyOutpostToken(baseURL, target, linuxConnection, options)
|
192
|
+
return '' if options['dry']
|
193
|
+
adminToken = context.secrets.load(target['SecretId'], 'ADMIN_TOKEN')
|
194
|
+
if adminToken.nil?
|
195
|
+
prompt.say("Authentik Admin token missing! You need to set secret: #{context.secrets.getID(target['SecretId'], 'ADMIN_TOKEN')}", :color => :magenta)
|
196
|
+
raise 'Authentik Admin token missing!'
|
197
|
+
end
|
198
|
+
url = "#{baseURL}/api/v3/outposts/instances/?name__iexact=authentik+Embedded+Outpost"
|
199
|
+
result = JSON.parse(linuxConnection.http(url, options, { 'Authorization' => 'Bearer ' + adminToken }))
|
200
|
+
if result['results'].to_a.empty?
|
201
|
+
prompt.say(result, :color => :red)
|
202
|
+
raise 'Failed to get Embedded Proxy Outpost info!'
|
203
|
+
end
|
204
|
+
|
205
|
+
tokenIdentifier = result['results'][0]['token_identifier']
|
206
|
+
tokenValue = viewToken(baseURL, target, tokenIdentifier, adminToken, linuxConnection, options)
|
207
|
+
raise 'Failed to get Embedded Proxy Outpost token!' if tokenValue.nil?
|
208
|
+
context.secrets.store(target['SecretId'], 'PROXYOUTPOST_TOKEN', tokenValue)
|
209
|
+
tokenValue
|
210
|
+
end
|
211
|
+
|
212
|
+
def deployProxyOutpost(target, linuxConnection, options)
|
213
|
+
return unless target['Outposts'].to_a.include?('Proxy')
|
214
|
+
|
215
|
+
proxyOutpostToken = context.secrets.load(target['SecretId'], 'PROXYOUTPOST_TOKEN')
|
216
|
+
if proxyOutpostToken.nil?
|
217
|
+
baseURL = "http://127.0.0.1:19000"
|
218
|
+
waitTilReady(baseURL, target, linuxConnection, options)
|
219
|
+
proxyOutpostToken = loadProxyOutpostToken(baseURL, target, linuxConnection, options)
|
220
|
+
end
|
221
|
+
|
222
|
+
Podman.ensurePresent(linuxConnection, options)
|
223
|
+
path = Podman.containersPath(HOME_DIR)
|
224
|
+
linuxConnection.fileWrite("#{path}/ProxyOutpost.env", "AUTHENTIK_HOST=https://#{target['Domain'].downcase}", options)
|
225
|
+
linuxConnection.fileAppend("#{path}/ProxyOutpost.env", 'AUTHENTIK_INSECURE=false', options)
|
226
|
+
linuxConnection.fileAppend("#{path}/ProxyOutpost.env", "AUTHENTIK_TOKEN=#{proxyOutpostToken}", { **options, hide: true })
|
227
|
+
valkeyHost = Podman.updateHost(target['Valkey'].to_h['Host'])
|
228
|
+
linuxConnection.fileAppend("#{path}/ProxyOutpost.env", "AUTHENTIK_REDIS__HOST=#{valkeyHost}", options)
|
229
|
+
if target['Valkey'].to_h['SecretId']
|
230
|
+
valkeyPassword = context.secrets.load(target['Valkey']['SecretId'], 'VALKEY_PASSWORD')
|
231
|
+
if !valkeyPassword.nil?
|
232
|
+
linuxConnection.fileAppend("#{path}/ProxyOutpost.env", "AUTHENTIK_REDIS__PASSWORD=#{valkeyPassword}", { **options, hide: true })
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
linuxConnection.setUserGroup("#{path}/ProxyOutpost.env", USER, USER, options)
|
237
|
+
linuxConnection.setPrivate("#{path}/ProxyOutpost.env", options)
|
238
|
+
|
239
|
+
linuxConnection.upload(__dir__ + '/Authentik-ProxyOutpost.container', path)
|
240
|
+
|
241
|
+
if target['Proxy'] == false
|
242
|
+
linuxConnection.fileReplace("#{path}/Authentik-ProxyOutpost.container", 'PublishPort=127.0.0.1:19010:', 'PublishPort=0.0.0.0:19010:', options)
|
243
|
+
linuxConnection.firewallAddPort('19010/tcp', options)
|
244
|
+
end
|
245
|
+
|
246
|
+
linuxConnection.reloadUserServices(USER, options)
|
247
|
+
linuxConnection.restartUserService(USER, 'Authentik-ProxyOutpost', options)
|
248
|
+
end
|
249
|
+
|
250
|
+
def configurePostgreSQL(dbSettings, linuxConnection, options)
|
66
251
|
password = SecureRandom.alphanumeric(20)
|
67
|
-
PostgreSQL.
|
252
|
+
PostgreSQL.withConnection(dbSettings, linuxConnection) do |postgresConnection|
|
253
|
+
postgresConnection.createUserAndDB(USER, password, options)
|
254
|
+
end
|
68
255
|
password
|
69
256
|
end
|
70
257
|
|
@@ -0,0 +1,38 @@
|
|
1
|
+
|
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
|
+
include config-lmm/security.conf;
|
27
|
+
|
28
|
+
location / {
|
29
|
+
<% if config['Server'] %>
|
30
|
+
proxy_pass <%= config['Server'] %>;
|
31
|
+
<% else %>
|
32
|
+
proxy_pass http://127.0.0.1:18200;
|
33
|
+
<% end %>
|
34
|
+
|
35
|
+
include config-lmm/proxy.conf;
|
36
|
+
}
|
37
|
+
|
38
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
[Unit]
|
3
|
+
Description=BookStack container
|
4
|
+
After=local-fs.target
|
5
|
+
|
6
|
+
[Container]
|
7
|
+
ContainerName=BookStack
|
8
|
+
Image=ghcr.io/linuxserver/bookstack:latest
|
9
|
+
EnvironmentFile=/var/lib/bookstack/.config/containers/systemd/BookStack.env
|
10
|
+
Network=slirp4netns:allow_host_loopback=true
|
11
|
+
PublishPort=127.0.0.1:18200:80
|
12
|
+
Volume=/var/lib/bookstack/config:/config
|
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
|
+
module ConfigLMM
|
3
|
+
module LMM
|
4
|
+
class BookStack < Framework::NginxApp
|
5
|
+
|
6
|
+
USER = 'bookstack'
|
7
|
+
HOME_DIR = '/var/lib/bookstack'
|
8
|
+
HOST_IP = '10.0.2.2'
|
9
|
+
|
10
|
+
def actionBookStackDeploy(id, target, activeState, context, options)
|
11
|
+
raise Framework::PluginProcessError.new('Domain field must be set!') unless target['Domain']
|
12
|
+
|
13
|
+
target['Database'] ||= {}
|
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
|
+
dbPassword = self.configureMariaDB(target['Database'], activeState, ssh)
|
21
|
+
distroInfo = Framework::LinuxApp.currentDistroInfo(ssh)
|
22
|
+
Framework::LinuxApp.configurePodmanServiceOverSSH(USER, HOME_DIR, 'BookStack', distroInfo, ssh)
|
23
|
+
self.class.sshExec!(ssh, "su --login #{USER} --shell /bin/sh --command 'mkdir -p ~/config'")
|
24
|
+
|
25
|
+
path = Framework::LinuxApp::SYSTEMD_CONTAINERS_PATH.gsub('~', HOME_DIR)
|
26
|
+
self.class.exec(" echo 'DB_HOST=#{HOST_IP}' > #{path}/BookStack.env", ssh)
|
27
|
+
self.class.exec(" echo 'DB_DATABASE=#{USER}' >> #{path}/BookStack.env", ssh)
|
28
|
+
self.class.exec(" echo 'DB_USERNAME=#{USER}' >> #{path}/BookStack.env", ssh)
|
29
|
+
self.class.exec(" echo 'DB_PASSWORD=#{dbPassword}' >> #{path}/BookStack.env", ssh)
|
30
|
+
self.class.exec(" echo 'APP_URL=https://#{target['Domain']}' >> #{path}/BookStack.env", ssh)
|
31
|
+
|
32
|
+
if target['OIDC'] && target['OIDC']['Issuer']
|
33
|
+
|
34
|
+
secretId = target['OIDC']['SecretId']
|
35
|
+
secretId = target['SecretId'] unless secretId
|
36
|
+
clientId = context.secrets.load(secretId, 'OIDC_CLIENT_ID')
|
37
|
+
clientSecret = context.secrets.load(secretId, 'OIDC_CLIENT_SECRET')
|
38
|
+
|
39
|
+
self.class.exec(" echo 'AUTH_METHOD=oidc' >> #{path}/BookStack.env", ssh)
|
40
|
+
self.class.exec(" echo 'AUTH_AUTO_INITIATE=true' >> #{path}/BookStack.env", ssh)
|
41
|
+
self.class.exec(" echo 'OIDC_CLIENT_ID=#{clientId}' >> #{path}/BookStack.env", ssh)
|
42
|
+
self.class.exec(" echo 'OIDC_CLIENT_SECRET=#{clientSecret}' >> #{path}/BookStack.env", ssh)
|
43
|
+
self.class.exec(" echo 'OIDC_ISSUER=#{target['OIDC']['Issuer']}' >> #{path}/BookStack.env", ssh)
|
44
|
+
self.class.exec(" echo 'OIDC_ISSUER_DISCOVER=true' >> #{path}/BookStack.env", ssh)
|
45
|
+
self.class.exec(" echo 'OIDC_USER_TO_GROUPS=true' >> #{path}/BookStack.env", ssh)
|
46
|
+
end
|
47
|
+
|
48
|
+
if target['SMTP']
|
49
|
+
host = target['SMTP']['Host']
|
50
|
+
host = HOST_IP if ['localhost', '127.0.0.1'].include?(host)
|
51
|
+
self.class.exec(" echo 'MAIL_HOST=#{host}' >> #{path}/BookStack.env", ssh)
|
52
|
+
self.class.exec(" echo 'MAIL_PORT=#{target['SMTP']['Port']}' >> #{path}/BookStack.env", ssh)
|
53
|
+
self.class.exec(" echo 'MAIL_USERNAME=#{target['SMTP']['Username']}' >> #{path}/BookStack.env", ssh)
|
54
|
+
|
55
|
+
if target['SMTP']['SecretId'] && target['SMTP']['Username']
|
56
|
+
smtpPassword = context.secrets.load(target['SMTP']['SecretId'], target['SMTP']['Username'].upcase + '_PASSWORD')
|
57
|
+
self.class.exec(" echo 'MAIL_PASSWORD=#{smtpPassword}' >> #{path}/BookStack.env", ssh)
|
58
|
+
end
|
59
|
+
|
60
|
+
self.class.exec(" echo 'MAIL_FROM=#{target['SMTP']['From']}' >> #{path}/BookStack.env", ssh)
|
61
|
+
end
|
62
|
+
|
63
|
+
self.class.exec("chown #{USER}:#{USER} #{path}/BookStack.env", ssh)
|
64
|
+
self.class.exec("chmod 600 #{path}/BookStack.env", ssh)
|
65
|
+
|
66
|
+
ssh.scp.upload!(__dir__ + '/BookStack.container', path)
|
67
|
+
self.class.exec("systemctl --user --machine=#{USER}@ daemon-reload", ssh)
|
68
|
+
self.class.exec("systemctl --user --machine=#{USER}@ restart BookStack", ssh)
|
69
|
+
|
70
|
+
Framework::LinuxApp.ensurePackages([NGINX_PACKAGE], ssh)
|
71
|
+
Framework::LinuxApp.ensureServiceAutoStartOverSSH(NGINX_PACKAGE, ssh)
|
72
|
+
self.class.prepareNginxConfig(target, ssh)
|
73
|
+
self.writeNginxConfig(__dir__, 'BookStack', id, target, state, context, options)
|
74
|
+
self.deployNginxConfig(id, target, activeState, context, options)
|
75
|
+
Framework::LinuxApp.startServiceOverSSH(NGINX_PACKAGE, ssh)
|
76
|
+
end
|
77
|
+
else
|
78
|
+
# TODO
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def configureMariaDB(settings, activeState, ssh)
|
83
|
+
password = SecureRandom.alphanumeric(20)
|
84
|
+
MariaDB.createRemoteUserAndDB(settings, USER, password, ssh)
|
85
|
+
password
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
@@ -6,36 +6,26 @@ module ConfigLMM
|
|
6
6
|
SERVICE_NAME = 'cassandra'
|
7
7
|
|
8
8
|
def actionCassandraDeploy(id, target, activeState, context, options)
|
9
|
-
|
10
|
-
|
9
|
+
self.withConnection(target['Location'], target) do |connection|
|
10
|
+
Linux.withConnection(connection) do |linuxConnection|
|
11
|
+
linuxConnection.ensurePackage(PACKAGE_NAME, options)
|
12
|
+
linuxConnection.ensureServiceAutoStart(SERVICE_NAME, options)
|
11
13
|
|
12
|
-
|
13
|
-
uri = Addressable::URI.parse(target['Location'])
|
14
|
-
raise Framework::PluginProcessError.new("#{id}: Unknown Protocol: #{uri.scheme}!") if uri.scheme != 'ssh'
|
15
|
-
|
16
|
-
self.class.sshStart(uri) do |ssh|
|
17
|
-
distroInfo = Framework::LinuxApp.currentDistroInfo(ssh)
|
18
|
-
configFile = '/etc/cassandra/cassandra.yaml'
|
19
|
-
if distroInfo['Name'] == 'openSUSE Leap'
|
14
|
+
if linuxConnection.distroInfo['Name'] == 'openSUSE Leap'
|
20
15
|
configFile = '/etc/cassandra/conf/cassandra.yaml'
|
21
16
|
end
|
22
17
|
|
23
|
-
|
24
|
-
self.class.sshExec!(ssh, cmd)
|
18
|
+
linuxConnection.fileReplace(configFile, '^uuid_sstable_identifiers_enabled:.*', 'uuid_sstable_identifiers_enabled: true', options)
|
25
19
|
if target['ClusterName']
|
26
|
-
|
27
|
-
self.class.sshExec!(ssh, cmd)
|
20
|
+
linuxConnection.fileReplace(configFile, '^cluster_name:.*', "cluster_name: #{target['ClusterName']}", options)
|
28
21
|
end
|
22
|
+
|
23
|
+
linuxConnection.restartService(SERVICE_NAME, options)
|
29
24
|
end
|
30
|
-
else
|
31
|
-
# TODO
|
32
25
|
end
|
33
|
-
|
34
|
-
plugins[:Linux].startService(SERVICE_NAME, target['Location'])
|
35
26
|
end
|
36
27
|
|
37
28
|
end
|
38
29
|
|
39
30
|
end
|
40
31
|
end
|
41
|
-
|