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,3 +1,4 @@
|
|
1
|
+
require 'addressable/idna'
|
1
2
|
|
2
3
|
module ConfigLMM
|
3
4
|
module LMM
|
@@ -9,34 +10,35 @@ module ConfigLMM
|
|
9
10
|
EMAIL_USER = 'email'
|
10
11
|
|
11
12
|
def actionDovecotDeploy(id, target, activeState, context, options)
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
13
|
+
self.withConnection(target['Location'], target) do |connection|
|
14
|
+
Linux.withConnection(connection) do |linuxConnection|
|
15
|
+
|
16
|
+
linuxConnection.ensurePackage(PACKAGE_NAME, options)
|
17
|
+
linuxConnection.ensureServiceAutoStart(SERVICE_NAME, options)
|
18
|
+
|
19
|
+
linuxConnection.createServiceUser(EMAIL_USER, EMAIL_HOME, 'Dovecot EMail', options)
|
20
|
+
|
21
|
+
uid = linuxConnection.exec("id -u #{EMAIL_USER}", false, options).strip
|
22
|
+
|
23
|
+
|
24
|
+
linuxConnection.fileReplace("#{DOVECOT_DIR}conf.d/10-mail.conf", '^#mail_uid =.*', "mail_uid = #{uid}", options)
|
25
|
+
linuxConnection.fileReplace("#{DOVECOT_DIR}conf.d/10-mail.conf", '^#mail_gid =.*', "mail_gid = #{uid}", options)
|
26
|
+
linuxConnection.fileReplace("#{DOVECOT_DIR}conf.d/10-mail.conf", '^#mail_location =.*', "mail_location = maildir:~/Mail", options)
|
27
|
+
|
28
|
+
if !target['Protocols'].to_a.empty?
|
29
|
+
linuxConnection.updateFile(DOVECOT_DIR + 'dovecot.conf', options) do |configLines|
|
30
|
+
configLines << "protocols = #{target['Protocols'].join(' ')}\n"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
linuxConnection.updateFile(DOVECOT_DIR + 'conf.d/10-mail.conf', options) do |configLines|
|
33
35
|
configLines << "mail_home = #{EMAIL_HOME}/emails/%u\n"
|
34
36
|
configLines << "first_valid_uid = #{uid}\n"
|
35
37
|
configLines << "last_valid_uid = #{uid}\n"
|
36
38
|
end
|
37
39
|
|
38
|
-
self.class.cutConfigSection(DOVECOT_DIR + 'conf.d/10-master.conf', 'service lmtp', options,
|
39
|
-
|
40
|
+
self.class.cutConfigSection(DOVECOT_DIR + 'conf.d/10-master.conf', 'service lmtp', options, linuxConnection)
|
41
|
+
linuxConnection.updateFile(DOVECOT_DIR + 'conf.d/10-master.conf', options) do |configLines|
|
40
42
|
configLines << "service lmtp {\n"
|
41
43
|
configLines << " unix_listener lmtp {\n"
|
42
44
|
configLines << " user = postfix\n"
|
@@ -46,9 +48,12 @@ module ConfigLMM
|
|
46
48
|
configLines << "}\n"
|
47
49
|
end
|
48
50
|
|
49
|
-
self.class.cutConfigSection(DOVECOT_DIR + 'conf.d/15-mailboxes.conf', 'namespace inbox', options,
|
50
|
-
|
51
|
+
self.class.cutConfigSection(DOVECOT_DIR + 'conf.d/15-mailboxes.conf', 'namespace inbox', options, linuxConnection)
|
52
|
+
linuxConnection.updateFile(DOVECOT_DIR + 'conf.d/15-mailboxes.conf', options) do |configLines|
|
51
53
|
configLines << "namespace inbox {\n"
|
54
|
+
configLines << " mailbox INBOX {\n"
|
55
|
+
configLines << " auto = subscribe\n"
|
56
|
+
configLines << " }\n"
|
52
57
|
configLines << " mailbox Drafts {\n"
|
53
58
|
configLines << " special_use = \\Drafts\n"
|
54
59
|
configLines << " auto = subscribe\n"
|
@@ -68,17 +73,14 @@ module ConfigLMM
|
|
68
73
|
configLines << "}\n"
|
69
74
|
end
|
70
75
|
|
71
|
-
|
72
|
-
self.class.sshExec!(ssh, "firewall-cmd -q --permanent --add-service='imaps'")
|
76
|
+
linuxConnection.firewallAddService('imaps', options)
|
73
77
|
|
74
|
-
|
75
|
-
self.class.sshExec!(ssh, cmd)
|
78
|
+
linuxConnection.fileReplace("#{DOVECOT_DIR}conf.d/10-auth.conf", '^!include auth-system.conf.ext', "#!include auth-system.conf.ext", options)
|
76
79
|
|
77
80
|
if target['OAuth2']
|
78
|
-
|
79
|
-
self.class.sshExec!(ssh, cmd)
|
81
|
+
linuxConnection.fileReplace("#{DOVECOT_DIR}conf.d/10-auth.conf", 'auth_mechanisms =.*', "auth_mechanisms = xoauth2 oauthbearer", options)
|
80
82
|
|
81
|
-
|
83
|
+
linuxConnection.updateFile(DOVECOT_DIR + 'conf.d/10-auth.conf', options) do |configLines|
|
82
84
|
configLines << "userdb {\n"
|
83
85
|
configLines << " driver = static\n"
|
84
86
|
configLines << " args = allow_all_users=yes\n"
|
@@ -90,7 +92,7 @@ module ConfigLMM
|
|
90
92
|
configLines << "}\n"
|
91
93
|
end
|
92
94
|
|
93
|
-
|
95
|
+
linuxConnection.updateFile(DOVECOT_DIR + 'dovecot-oauth2.conf.ext', options) do |configLines|
|
94
96
|
# Need v2.3.16+
|
95
97
|
#configLines << "openid_configuration_url = #{target['OAuth2']['OIDC']}\n"
|
96
98
|
if target['OAuth2']['TokenInfo']
|
@@ -99,18 +101,24 @@ module ConfigLMM
|
|
99
101
|
if target['OAuth2']['Introspection']
|
100
102
|
configLines << "introspection_url = #{target['OAuth2']['Introspection']}\n"
|
101
103
|
end
|
102
|
-
|
103
|
-
|
104
|
+
|
105
|
+
secretId = target['OAuth2']['SecretId']
|
106
|
+
secretId = target['SecretId'] unless secretId
|
107
|
+
clientId = context.secrets.load(secretId, 'OAUTH2_CLIENT_ID')
|
108
|
+
clientId = target['OAuth2']['ClientID'] unless clientId
|
109
|
+
clientSecret = context.secrets.load(secretId, 'OAUTH2_CLIENT_SECRET')
|
110
|
+
|
111
|
+
if clientId
|
112
|
+
configLines << "client_id = #{clientId}\n"
|
104
113
|
end
|
105
|
-
if
|
106
|
-
configLines << "client_secret = #{
|
114
|
+
if clientSecret
|
115
|
+
configLines << "client_secret = #{clientSecret}\n"
|
107
116
|
end
|
108
117
|
end
|
109
118
|
else
|
110
|
-
|
111
|
-
self.class.sshExec!(ssh, cmd)
|
119
|
+
linuxConnection.fileReplace("#{DOVECOT_DIR}conf.d/10-auth.conf", 'auth_mechanisms =.*', "auth_mechanisms = plain", options)
|
112
120
|
|
113
|
-
|
121
|
+
linuxConnection.updateFile(DOVECOT_DIR + 'conf.d/10-auth.conf', options) do |configLines|
|
114
122
|
configLines << "auth_username_format = %u\n"
|
115
123
|
configLines << "userdb {\n"
|
116
124
|
configLines << " driver = static\n"
|
@@ -121,29 +129,56 @@ module ConfigLMM
|
|
121
129
|
configLines << " args = #{DOVECOT_DIR}passwords\n"
|
122
130
|
configLines << "}\n"
|
123
131
|
end
|
124
|
-
|
125
|
-
|
126
|
-
|
132
|
+
linuxConnection.exec("touch #{DOVECOT_DIR}passwords", options)
|
133
|
+
linuxConnection.setUserGroup("#{DOVECOT_DIR}passwords", 'dovecot', 'dovecot', options)
|
134
|
+
linuxConnection.setPrivate("#{DOVECOT_DIR}passwords", options)
|
127
135
|
end
|
128
136
|
|
129
|
-
certDir =
|
130
|
-
|
137
|
+
certDir = linuxConnection.createWildecardCertificate(options)
|
138
|
+
linuxConnection.updateFile(DOVECOT_DIR + 'conf.d/10-ssl.conf', options) do |configLines|
|
131
139
|
configLines << "ssl_cert = <#{certDir}fullchain.pem\n"
|
132
140
|
configLines << "ssl_key = <#{certDir}privkey.pem\n"
|
141
|
+
if !target['Domains'].to_h.empty?
|
142
|
+
target['Domains'].each do |domain, config|
|
143
|
+
if config['CertName']
|
144
|
+
configLines << "local_name #{Addressable::IDNA.to_ascii(domain)} {\n"
|
145
|
+
configLines << " ssl_cert = </etc/letsencrypt/live/#{config['CertName']}/fullchain.pem\n"
|
146
|
+
configLines << " ssl_key = </etc/letsencrypt/live/#{config['CertName']}/privkey.pem\n"
|
147
|
+
configLines << "}\n"
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
configLines
|
133
152
|
end
|
153
|
+
|
154
|
+
linuxConnection.restartService(SERVICE_NAME, options)
|
134
155
|
end
|
135
|
-
else
|
136
|
-
# TODO
|
137
156
|
end
|
157
|
+
end
|
158
|
+
|
159
|
+
def cleanup(configs, state, context, options)
|
160
|
+
cleanupType(:Dovecot, configs, state, context, options) do |item, id, state, context, options, connection|
|
161
|
+
Linux.withConnection(connection) do |linuxConnection|
|
162
|
+
linuxConnection.stopService(SERVICE_NAME, options)
|
163
|
+
linuxConnection.firewallRemoveService('imaps', options)
|
164
|
+
linuxConnection.removePackage(PACKAGE_NAME, options)
|
138
165
|
|
139
|
-
|
166
|
+
state.item(id)['Status'] = State::STATUS_DELETED unless options[:dry]
|
167
|
+
|
168
|
+
if options[:destroy]
|
169
|
+
linuxConnection.deleteUserAndGroup(EMAIL_USER, options)
|
170
|
+
|
171
|
+
state.item(id)['Status'] = State::STATUS_DESTROYED unless options[:dry]
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
140
175
|
end
|
141
176
|
|
142
|
-
def self.cutConfigSection(file, sectionStart, options,
|
177
|
+
def self.cutConfigSection(file, sectionStart, options, linuxConnection)
|
143
178
|
localFile = options['output'] + '/' + SecureRandom.alphanumeric(10)
|
144
179
|
File.write(localFile, '')
|
145
|
-
|
146
|
-
|
180
|
+
linuxConnection.exec("touch #{file}", options)
|
181
|
+
linuxConnection.download(file, localFile, options)
|
147
182
|
fileData = File.read(localFile)
|
148
183
|
position = fileData.index(sectionStart)
|
149
184
|
if position
|
@@ -156,7 +191,7 @@ module ConfigLMM
|
|
156
191
|
fileData = fileData[0...position]
|
157
192
|
end
|
158
193
|
File.write(localFile, fileData)
|
159
|
-
|
194
|
+
linuxConnection.upload(localFile, file, options)
|
160
195
|
end
|
161
196
|
end
|
162
197
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
|
2
|
+
[Unit]
|
3
|
+
Description=ERPNext Frontend container
|
4
|
+
After=local-fs.target
|
5
|
+
|
6
|
+
[Container]
|
7
|
+
ContainerName=ERPNext-Frontend
|
8
|
+
Image=ConfigLM.moe/erpnext:v$VERSION
|
9
|
+
Exec=nginx-entrypoint.sh
|
10
|
+
EnvironmentFile=/var/lib/erpnext/.config/containers/systemd/ERPNext.env
|
11
|
+
PublishPort=127.0.0.1:18400:8080
|
12
|
+
Network=ERPNext.network
|
13
|
+
HostName=ERPNext-Frontend
|
14
|
+
UserNS=keep-id:uid=1000,gid=1000
|
15
|
+
Volume=/var/lib/erpnext/sites:/home/frappe/frappe-bench/sites
|
16
|
+
Volume=/var/lib/erpnext/logs:/home/frappe/frappe-bench/logs
|
17
|
+
LogDriver=journald
|
18
|
+
|
19
|
+
[Service]
|
20
|
+
TimeoutStartSec=16min
|
21
|
+
Restart=on-failure
|
22
|
+
|
23
|
+
[Install]
|
24
|
+
WantedBy=multi-user.target default.target
|
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
[Unit]
|
3
|
+
Description=ERPNext Queue container
|
4
|
+
After=local-fs.target
|
5
|
+
|
6
|
+
[Container]
|
7
|
+
ContainerName=ERPNext-Queue
|
8
|
+
Image=ConfigLM.moe/erpnext:v$VERSION
|
9
|
+
Exec=bench worker --queue long,default,short
|
10
|
+
EnvironmentFile=/var/lib/erpnext/.config/containers/systemd/ERPNext.env
|
11
|
+
Network=slirp4netns:allow_host_loopback=true
|
12
|
+
UserNS=keep-id:uid=1000,gid=1000
|
13
|
+
Volume=/var/lib/erpnext/sites:/home/frappe/frappe-bench/sites
|
14
|
+
Volume=/var/lib/erpnext/logs:/home/frappe/frappe-bench/logs
|
15
|
+
LogDriver=journald
|
16
|
+
|
17
|
+
[Service]
|
18
|
+
TimeoutStartSec=16min
|
19
|
+
Restart=on-failure
|
20
|
+
|
21
|
+
[Install]
|
22
|
+
WantedBy=multi-user.target default.target
|
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
[Unit]
|
3
|
+
Description=ERPNext Scheduler container
|
4
|
+
After=local-fs.target
|
5
|
+
|
6
|
+
[Container]
|
7
|
+
ContainerName=ERPNext-Scheduler
|
8
|
+
Image=ConfigLM.moe/erpnext:v$VERSION
|
9
|
+
Exec=bench schedule
|
10
|
+
EnvironmentFile=/var/lib/erpnext/.config/containers/systemd/ERPNext.env
|
11
|
+
UserNS=keep-id:uid=1000,gid=1000
|
12
|
+
Volume=/var/lib/erpnext/sites:/home/frappe/frappe-bench/sites
|
13
|
+
Volume=/var/lib/erpnext/logs:/home/frappe/frappe-bench/logs
|
14
|
+
LogDriver=journald
|
15
|
+
|
16
|
+
[Service]
|
17
|
+
TimeoutStartSec=16min
|
18
|
+
Restart=on-failure
|
19
|
+
|
20
|
+
[Install]
|
21
|
+
WantedBy=multi-user.target default.target
|
22
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
|
2
|
+
[Unit]
|
3
|
+
Description=ERPNext Websocket container
|
4
|
+
After=local-fs.target
|
5
|
+
|
6
|
+
[Container]
|
7
|
+
ContainerName=ERPNext-Websocket
|
8
|
+
Image=ConfigLM.moe/erpnext:v$VERSION
|
9
|
+
Exec=node /home/frappe/frappe-bench/apps/frappe/socketio.js
|
10
|
+
EnvironmentFile=/var/lib/erpnext/.config/containers/systemd/ERPNext.env
|
11
|
+
Network=ERPNext.network
|
12
|
+
IP=10.90.50.11
|
13
|
+
HostName=ERPNext-Websocket
|
14
|
+
UserNS=keep-id:uid=1000,gid=1000
|
15
|
+
Volume=/var/lib/erpnext/sites:/home/frappe/frappe-bench/sites
|
16
|
+
Volume=/var/lib/erpnext/logs:/home/frappe/frappe-bench/logs
|
17
|
+
LogDriver=journald
|
18
|
+
|
19
|
+
[Service]
|
20
|
+
TimeoutStartSec=16min
|
21
|
+
Restart=on-failure
|
22
|
+
|
23
|
+
[Install]
|
24
|
+
WantedBy=multi-user.target default.target
|
@@ -0,0 +1,23 @@
|
|
1
|
+
|
2
|
+
[Unit]
|
3
|
+
Description=ERPNext container
|
4
|
+
After=local-fs.target
|
5
|
+
|
6
|
+
[Container]
|
7
|
+
ContainerName=ERPNext
|
8
|
+
Image=ConfigLM.moe/erpnext:v$VERSION
|
9
|
+
EnvironmentFile=/var/lib/erpnext/.config/containers/systemd/ERPNext.env
|
10
|
+
Network=ERPNext.network
|
11
|
+
IP=10.90.50.10
|
12
|
+
HostName=ERPNext
|
13
|
+
UserNS=keep-id:uid=1000,gid=1000
|
14
|
+
Volume=/var/lib/erpnext/sites:/home/frappe/frappe-bench/sites
|
15
|
+
Volume=/var/lib/erpnext/logs:/home/frappe/frappe-bench/logs
|
16
|
+
LogDriver=journald
|
17
|
+
|
18
|
+
[Service]
|
19
|
+
TimeoutStartSec=12min
|
20
|
+
Restart=on-failure
|
21
|
+
|
22
|
+
[Install]
|
23
|
+
WantedBy=multi-user.target default.target
|
@@ -0,0 +1,204 @@
|
|
1
|
+
|
2
|
+
module ConfigLMM
|
3
|
+
module LMM
|
4
|
+
class ERPNext < Framework::Plugin
|
5
|
+
|
6
|
+
USER = 'erpnext'
|
7
|
+
HOME_DIR = '/var/lib/erpnext'
|
8
|
+
VERSION = '15'
|
9
|
+
FRAPPE_REPO = 'https://github.com/frappe/frappe_docker.git'
|
10
|
+
IMAGE_ID = 'ConfigLM.moe/erpnext:v' + VERSION
|
11
|
+
CONTAINER_NAME = 'ERPNext'
|
12
|
+
|
13
|
+
def actionERPNextBuild(id, target, activeState, context, options)
|
14
|
+
buildContainer(id, target, options)
|
15
|
+
end
|
16
|
+
|
17
|
+
def buildContainer(id, target, options)
|
18
|
+
Linux.withConnection(local) do |localLinux|
|
19
|
+
begin
|
20
|
+
localLinux.ensurePackages(['git', 'Podman'], options) unless localLinux.hasBinaries?(['git', 'podman'], options)
|
21
|
+
rescue RuntimeError => error
|
22
|
+
prompt.say(error, :color => :red)
|
23
|
+
end
|
24
|
+
frappe = File.expand_path(REPOS_CACHE + '/frappe_docker')
|
25
|
+
if !File.exist?(frappe)
|
26
|
+
localLinux.createDirs(options, File.expand_path(REPOS_CACHE))
|
27
|
+
localLinux.exec("cd #{REPOS_CACHE} && git clone --quiet #{FRAPPE_REPO}", false, options)
|
28
|
+
else
|
29
|
+
localLinux.exec("cd #{REPOS_CACHE}/frappe_docker && git pull --quiet", false, options)
|
30
|
+
end
|
31
|
+
localLinux.exec("cd #{REPOS_CACHE}/frappe_docker && git checkout . --quiet", false, options)
|
32
|
+
|
33
|
+
if !IO::Connection.cmdSuccess?("podman image exists #{IMAGE_ID}")
|
34
|
+
appsJSON = Base64.urlsafe_encode64(File.read(__dir__ + '/sites/apps.json').gsub('$VERSION', VERSION))
|
35
|
+
# if you see error like "newuidmap 5227 0 1000 1 1 100000 65536: newuidmap: write to uid_map failed: Operation not permitted"
|
36
|
+
# then for LXC you need to set idmap like:
|
37
|
+
# LXC:
|
38
|
+
# - idmap: u 0 100000 165536
|
39
|
+
# - idmap: g 0 100000 165536
|
40
|
+
localLinux.exec("cd #{REPOS_CACHE}/frappe_docker && podman build --tag=#{IMAGE_ID} --build-arg APPS_JSON_BASE64=#{appsJSON} --build-arg FRAPPE_BRANCH=version-#{VERSION} --file images/custom/Containerfile .", false, options)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def actionERPNextDeploy(id, target, activeState, context, options)
|
46
|
+
raise Framework::PluginProcessError.new('Domain field must be set!') if (!target.key?('Proxy') || target['Proxy']) && !target['Domain']
|
47
|
+
|
48
|
+
target['Database'] ||= {}
|
49
|
+
self.withConnection(target['Location'], target) do |connection|
|
50
|
+
Linux.withConnection(connection) do |linuxConnection|
|
51
|
+
|
52
|
+
dbPassword = self.configureMariaDB(target['Database'], activeState, linuxConnection, options)
|
53
|
+
|
54
|
+
Podman.ensurePresent(linuxConnection, options)
|
55
|
+
Podman.createUser(USER, HOME_DIR, 'ERPNext', linuxConnection, options)
|
56
|
+
|
57
|
+
cmd = IO::SSH.cmd(target['Location'])
|
58
|
+
local.exec("podman image save ConfigLM.moe/erpnext:v#{VERSION} | #{cmd} 'cat > #{HOME_DIR}/erpnext.tar'", false, options)
|
59
|
+
|
60
|
+
linuxConnection.withUserShell(USER) do |shell|
|
61
|
+
shell.createDirs(options, '~/sites', '~/logs')
|
62
|
+
Podman.loadImage(shell, 'erpnext.tar', options)
|
63
|
+
end
|
64
|
+
|
65
|
+
linuxConnection.exec("rm -f #{HOME_DIR}/erpnext.tar", false, options)
|
66
|
+
|
67
|
+
path = Podman.containersPath(HOME_DIR)
|
68
|
+
linuxConnection.exec(" echo 'FRAPPE_DB_PASSWORD=#{dbPassword}' > #{path}/ERPNext.env", false, options)
|
69
|
+
linuxConnection.exec("echo 'FRAPPE_SITE_NAME_HEADER=site' >> #{path}/ERPNext.env", false, options)
|
70
|
+
#linuxConnection.exec("echo 'UPSTREAM_REAL_IP_ADDRESS=127.0.0.1' >> #{path}/ERPNext.env", false, options)
|
71
|
+
#linuxConnection.exec("echo 'UPSTREAM_REAL_IP_RECURSIVE=on' >> #{path}/ERPNext.env", false, options)
|
72
|
+
linuxConnection.exec("echo 'BACKEND=10.90.50.10:8000' >> #{path}/ERPNext.env", false, options)
|
73
|
+
linuxConnection.exec("echo 'SOCKETIO=10.90.50.11:9000' >> #{path}/ERPNext.env", false, options)
|
74
|
+
|
75
|
+
linuxConnection.exec("chown #{USER}:#{USER} #{path}/ERPNext.env", false, options)
|
76
|
+
linuxConnection.exec("chmod 600 #{path}/ERPNext.env", false, options)
|
77
|
+
|
78
|
+
linuxConnection.upload(__dir__ + '/sites/apps.txt', HOME_DIR + '/sites/', options)
|
79
|
+
linuxConnection.upload(__dir__ + '/sites/common_site_config.json', HOME_DIR + '/sites/', options)
|
80
|
+
|
81
|
+
if target['Database'] && target['Database']['HostName']
|
82
|
+
linuxConnection.exec("sed -i 's|\"10.0.2.2\"|\"#{target['Database']['HostName']}\"|' #{HOME_DIR}/sites/common_site_config.json", false, options)
|
83
|
+
end
|
84
|
+
|
85
|
+
if target['Valkey']
|
86
|
+
linuxConnection.exec("sed -i 's|10.0.2.2:6379|#{target['Valkey']}|' #{HOME_DIR}/sites/common_site_config.json", false, options)
|
87
|
+
end
|
88
|
+
|
89
|
+
if target['ValkeySecretId']
|
90
|
+
valkeyPassword = context.secrets.load(target['ValkeySecretId'], 'VALKEY_PASSWORD')
|
91
|
+
linuxConnection.exec("sed -i 's|\"use_rq_auth\": false|\"use_rq_auth\": true|' #{HOME_DIR}/sites/common_site_config.json", false, options)
|
92
|
+
linuxConnection.exec("sed -i 's|$VALKEY_PASSWORD|#{valkeyPassword}|' #{HOME_DIR}/sites/common_site_config.json", false, { **options, hide: true })
|
93
|
+
end
|
94
|
+
|
95
|
+
linuxConnection.exec("chown -R #{USER}:#{USER} " + HOME_DIR + '/sites', false, options)
|
96
|
+
|
97
|
+
linuxConnection.upload(__dir__ + '/ERPNext.network', path, options)
|
98
|
+
linuxConnection.upload(__dir__ + '/ERPNext.container', path, options)
|
99
|
+
linuxConnection.upload(__dir__ + '/ERPNext-Queue.container', path, options)
|
100
|
+
linuxConnection.upload(__dir__ + '/ERPNext-Scheduler.container', path, options)
|
101
|
+
linuxConnection.upload(__dir__ + '/ERPNext-Websocket.container', path, options)
|
102
|
+
linuxConnection.upload(__dir__ + '/ERPNext-Frontend.container', path, options)
|
103
|
+
linuxConnection.exec("sed -i 's|$VERSION|#{VERSION}|' #{path}/ERPNext.container", false, options)
|
104
|
+
linuxConnection.exec("sed -i 's|$VERSION|#{VERSION}|' #{path}/ERPNext-Queue.container", false, options)
|
105
|
+
linuxConnection.exec("sed -i 's|$VERSION|#{VERSION}|' #{path}/ERPNext-Scheduler.container", false, options)
|
106
|
+
linuxConnection.exec("sed -i 's|$VERSION|#{VERSION}|' #{path}/ERPNext-Websocket.container", false, options)
|
107
|
+
linuxConnection.exec("sed -i 's|$VERSION|#{VERSION}|' #{path}/ERPNext-Frontend.container", false, options)
|
108
|
+
|
109
|
+
if !target.key?('Proxy') || target['Proxy']
|
110
|
+
Nginx.withConnection(linuxConnection) do |nginxConnection|
|
111
|
+
nginxConnection.provisionProxy('http://127.0.0.1:18400', 'ERPNext', target, activeState, context, options)
|
112
|
+
end
|
113
|
+
elsif target.key?('Proxy') && target['Proxy'] == false
|
114
|
+
linuxConnection.exec("sed -i 's|PublishPort=127.0.0.1:18400:|PublishPort=0.0.0.0:18400:|' #{path}/ERPNext-Frontend.container", false, options)
|
115
|
+
linuxConnection.firewallAddPort('18400/tcp', options)
|
116
|
+
end
|
117
|
+
|
118
|
+
linuxConnection.reloadUserServices(USER, options)
|
119
|
+
linuxConnection.restartUserService(USER, 'ERPNext-network', options)
|
120
|
+
linuxConnection.restartUserService(USER, 'ERPNext', options)
|
121
|
+
|
122
|
+
MariaDB.withConnection(target['Database'], linuxConnection) do |connectionDB|
|
123
|
+
if !connectionDB.tableExist?(USER, 'tabUser', { **options, 'dry': false })
|
124
|
+
linuxConnection.withUserShell(USER) do |shellConnection|
|
125
|
+
Podman.withConnection(shellConnection, Podman.container(CONTAINER_NAME, shellConnection, options)) do |podmanConnection|
|
126
|
+
adminPassword = SecureRandom.alphanumeric(20)
|
127
|
+
dbAdminPassword = connectionDB.createAdmin(options)
|
128
|
+
linuxConnection.exec("rm -rf " + HOME_DIR + '/sites/erpnext', false, options)
|
129
|
+
#podmanConnection.exec("bench new-site --no-setup-db --db-name erpnext --db-user erpnext --admin-password #{adminPassword} --install-app erpnext --set-default site", false, { **options, hide: true })
|
130
|
+
connectionDB.dropDB(USER, options)
|
131
|
+
podmanConnection.exec("bench new-site --db-root-username admin --db-root-password #{dbAdminPassword} --db-name erpnext --admin-password #{adminPassword} --install-app erpnext --set-default site", false, { **options, hide: true })
|
132
|
+
podmanConnection.exec("bench --site site install-app hrms", false, options)
|
133
|
+
prompt.say("Administrator password: #{adminPassword}", :color => :magenta)
|
134
|
+
connectionDB.dropAdmin(options)
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
linuxConnection.restartUserService(USER, 'ERPNext-Queue', options)
|
141
|
+
linuxConnection.restartUserService(USER, 'ERPNext-Scheduler', options)
|
142
|
+
linuxConnection.restartUserService(USER, 'ERPNext-Websocket', options)
|
143
|
+
linuxConnection.restartUserService(USER, 'ERPNext-Frontend', options)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
def configureMariaDB(settings, activeState, linuxConnection, options)
|
149
|
+
password = SecureRandom.alphanumeric(20)
|
150
|
+
MariaDB.withConnection(settings, linuxConnection) do |mariaConnection|
|
151
|
+
mariaConnection.createUserAndDB(USER, password, nil, options)
|
152
|
+
end
|
153
|
+
password
|
154
|
+
end
|
155
|
+
|
156
|
+
def cleanup(configs, state, context, options)
|
157
|
+
cleanupType(:ERPNext, configs, state, context, options) do |item, id, state, context, options, connection|
|
158
|
+
Linux.withConnection(connection) do |linuxConnection|
|
159
|
+
if item['Config']['Proxy'].nil? || item['Config']['Proxy']
|
160
|
+
Nginx.withConnection(linuxConnection) do |nginxConnection|
|
161
|
+
nginxConnection.cleanupConfig('ERPNext', context, options)
|
162
|
+
nginxConnection.reload(options)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
linuxConnection.firewallRemovePort('18400/tcp', options)
|
166
|
+
|
167
|
+
linuxConnection.stopUserService(USER, 'ERPNext-Frontend', options)
|
168
|
+
linuxConnection.stopUserService(USER, 'ERPNext', options)
|
169
|
+
linuxConnection.stopUserService(USER, 'ERPNext-Websocket', options)
|
170
|
+
linuxConnection.stopUserService(USER, 'ERPNext-Scheduler', options)
|
171
|
+
linuxConnection.stopUserService(USER, 'ERPNext-Queue', options)
|
172
|
+
linuxConnection.stopUserService(USER, 'ERPNext-network', options)
|
173
|
+
|
174
|
+
path = Podman.containersPath(HOME_DIR)
|
175
|
+
linuxConnection.rm(path + 'ERPNext.network', options[:dry])
|
176
|
+
linuxConnection.rm(path + 'ERPNext.container', options[:dry])
|
177
|
+
linuxConnection.rm(path + 'ERPNext-Queue.container', options[:dry])
|
178
|
+
linuxConnection.rm(path + 'ERPNext-Scheduler.container', options[:dry])
|
179
|
+
linuxConnection.rm(path + 'ERPNext-Websocket.container', options[:dry])
|
180
|
+
linuxConnection.rm(path + 'ERPNext-Frontend.container', options[:dry])
|
181
|
+
|
182
|
+
linuxConnection.exec("podman rmi #{IMAGE_ID}", true, options)
|
183
|
+
|
184
|
+
state.item(id)['Status'] = State::STATUS_DELETED unless options[:dry]
|
185
|
+
|
186
|
+
if options[:destroy]
|
187
|
+
item['Config']['Database'] ||= {}
|
188
|
+
MariaDB.withConnection(item['Config']['Database'], linuxConnection) do |connectionDB|
|
189
|
+
connectionDB.dropDB(USER, options)
|
190
|
+
end
|
191
|
+
linuxConnection.deleteUserAndGroup(USER, options)
|
192
|
+
linuxConnection.rm(HOME_DIR, options[:dry])
|
193
|
+
|
194
|
+
state.item(id)['Status'] = State::STATUS_DESTROYED unless options[:dry]
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
end
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
{
|
2
|
+
"db_host": "10.0.2.2",
|
3
|
+
"db_port": 3306,
|
4
|
+
"redis_cache": "redis://default:$VALKEY_PASSWORD@10.0.2.2:6379",
|
5
|
+
"redis_queue": "redis://default:$VALKEY_PASSWORD@10.0.2.2:6379",
|
6
|
+
"redis_socketio": "redis://default:$VALKEY_PASSWORD@10.0.2.2:6379",
|
7
|
+
"use_rq_auth": false,
|
8
|
+
"rq_password": "$VALKEY_PASSWORD",
|
9
|
+
"rq_username": "default",
|
10
|
+
"socketio_port": 9000
|
11
|
+
}
|
@@ -1,10 +1,11 @@
|
|
1
1
|
|
2
2
|
[Unit]
|
3
3
|
Description=GitLab container
|
4
|
-
After=local-fs.target
|
4
|
+
After=local-fs.target firewalld.service
|
5
5
|
|
6
6
|
[Container]
|
7
|
-
|
7
|
+
ContainerName=GitLab
|
8
|
+
Image=docker.io/gitlab/gitlab-ce:latest
|
8
9
|
PublishPort=127.0.0.1:18100:80
|
9
10
|
PublishPort=0.0.0.0:22:22
|
10
11
|
Volume=/var/lib/gitlab/config:/etc/gitlab
|
@@ -12,6 +13,12 @@ Volume=/var/lib/gitlab/logs:/var/log/gitlab
|
|
12
13
|
Volume=/var/lib/gitlab/data:/var/opt/gitlab
|
13
14
|
Volume=/var/lib/gitlab/backups:/var/opt/gitlab/backups
|
14
15
|
ShmSize=256M
|
16
|
+
LogDriver=journald
|
17
|
+
AutoUpdate=registry
|
18
|
+
|
19
|
+
[Service]
|
20
|
+
TimeoutStartSec=20min
|
21
|
+
Restart=on-failure
|
15
22
|
|
16
23
|
[Install]
|
17
24
|
WantedBy=multi-user.target default.target
|