ConfigLMM 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +34 -0
- data/CNAME +1 -0
- data/Examples/.lmm.state.yaml +159 -0
- data/Examples/ConfigLMM.mm.yaml +32 -0
- data/Examples/Implemented.mm.yaml +252 -4
- data/Examples/SmallBusiness.mm.yaml +492 -0
- data/Plugins/Apps/Answer/answer.lmm.rb +165 -0
- data/Plugins/Apps/Answer/answer@.service +40 -0
- data/Plugins/Apps/ArchiSteamFarm/ArchiSteamFarm.conf.erb +0 -3
- data/Plugins/Apps/ArchiSteamFarm/ArchiSteamFarm.lmm.rb +0 -1
- data/Plugins/Apps/Authentik/Authentik-ProxyOutpost.container +7 -1
- data/Plugins/Apps/Authentik/Authentik-Server.container +6 -1
- data/Plugins/Apps/Authentik/Authentik-Worker.container +6 -1
- data/Plugins/Apps/Authentik/Authentik.conf.erb +12 -7
- data/Plugins/Apps/Authentik/Authentik.lmm.rb +226 -61
- data/Plugins/Apps/BookStack/BookStack.conf.erb +0 -3
- data/Plugins/Apps/BookStack/BookStack.container +5 -0
- data/Plugins/Apps/BookStack/BookStack.lmm.rb +14 -3
- data/Plugins/Apps/Cassandra/Cassandra.lmm.rb +9 -19
- data/Plugins/Apps/ClickHouse/ClickHouse.container +28 -0
- data/Plugins/Apps/ClickHouse/ClickHouse.lmm.rb +113 -0
- data/Plugins/Apps/ClickHouse/Config/listen.yaml +2 -0
- data/Plugins/Apps/ClickHouse/Config/logger.yaml +8 -0
- data/Plugins/Apps/ClickHouse/Config/zookeepers.yaml +5 -0
- data/Plugins/Apps/ClickHouse/Connection.rb +96 -0
- data/Plugins/Apps/Discourse/Discourse-Sidekiq.container +5 -0
- data/Plugins/Apps/Discourse/Discourse.conf.erb +1 -4
- data/Plugins/Apps/Discourse/Discourse.container +4 -0
- data/Plugins/Apps/Discourse/Discourse.lmm.rb +116 -55
- data/Plugins/Apps/Dovecot/Dovecot.lmm.rb +74 -62
- data/Plugins/Apps/ERPNext/ERPNext-Frontend.container +6 -1
- data/Plugins/Apps/ERPNext/ERPNext-Queue.container +5 -0
- data/Plugins/Apps/ERPNext/ERPNext-Scheduler.container +5 -0
- data/Plugins/Apps/ERPNext/ERPNext-Websocket.container +6 -1
- data/Plugins/Apps/ERPNext/ERPNext.container +6 -1
- data/Plugins/Apps/ERPNext/ERPNext.lmm.rb +138 -127
- data/Plugins/Apps/GitLab/GitLab.container +6 -0
- data/Plugins/Apps/GitLab/GitLab.lmm.rb +43 -49
- data/Plugins/Apps/Homepage/Homepage.conf.erb +86 -0
- data/Plugins/Apps/Homepage/Homepage.container +19 -0
- data/Plugins/Apps/Homepage/Homepage.lmm.rb +54 -0
- data/Plugins/Apps/IPFS/IPFS.conf.erb +0 -3
- data/Plugins/Apps/IPFS/IPFS.lmm.rb +0 -1
- data/Plugins/Apps/InfluxDB/InfluxDB.conf.erb +0 -3
- data/Plugins/Apps/InfluxDB/InfluxDB.lmm.rb +0 -1
- data/Plugins/Apps/Jackett/Jackett.conf.erb +0 -3
- data/Plugins/Apps/Jackett/Jackett.lmm.rb +0 -1
- data/Plugins/Apps/Jellyfin/Jellyfin.conf.erb +0 -3
- data/Plugins/Apps/Jellyfin/Jellyfin.lmm.rb +0 -1
- data/Plugins/Apps/LetsEncrypt/LetsEncrypt.lmm.rb +49 -28
- data/Plugins/Apps/LibreTranslate/LibreTranslate.container +21 -0
- data/Plugins/Apps/LibreTranslate/LibreTranslate.lmm.rb +34 -0
- data/Plugins/Apps/Lobsters/Containerfile +81 -0
- data/Plugins/Apps/Lobsters/Lobsters-Tasks.container +26 -0
- data/Plugins/Apps/Lobsters/Lobsters.conf.erb +99 -0
- data/Plugins/Apps/Lobsters/Lobsters.container +27 -0
- data/Plugins/Apps/Lobsters/Lobsters.lmm.rb +196 -0
- data/Plugins/Apps/Lobsters/crontab +3 -0
- data/Plugins/Apps/Lobsters/database.yml +26 -0
- data/Plugins/Apps/Lobsters/entrypoint.sh +30 -0
- data/Plugins/Apps/Lobsters/generateCredentials.rb +19 -0
- data/Plugins/Apps/Lobsters/lobsters-cron.sh +25 -0
- data/Plugins/Apps/Lobsters/lobsters-daily.sh +23 -0
- data/Plugins/Apps/Lobsters/puma.rb +49 -0
- data/Plugins/Apps/MariaDB/Connection.rb +55 -0
- data/Plugins/Apps/MariaDB/MariaDB.lmm.rb +60 -53
- data/Plugins/Apps/Mastodon/Mastodon-Sidekiq.container +22 -0
- data/Plugins/Apps/Mastodon/Mastodon-Streaming.container +20 -0
- data/Plugins/Apps/Mastodon/Mastodon.conf.erb +34 -45
- data/Plugins/Apps/Mastodon/Mastodon.container +28 -0
- data/Plugins/Apps/Mastodon/Mastodon.lmm.rb +240 -5
- data/Plugins/Apps/Mastodon/configlmm.rake +30 -0
- data/Plugins/Apps/Mastodon/entrypoint.sh +16 -0
- data/Plugins/Apps/Matrix/Element.container +5 -0
- data/Plugins/Apps/Matrix/Matrix.conf.erb +2 -8
- data/Plugins/Apps/Matrix/Matrix.lmm.rb +100 -71
- data/Plugins/Apps/Matrix/Synapse.container +5 -0
- data/Plugins/Apps/Netdata/Netdata.conf.erb +0 -3
- data/Plugins/Apps/Netdata/Netdata.lmm.rb +0 -1
- data/Plugins/Apps/Nextcloud/Nextcloud.conf.erb +3 -4
- data/Plugins/Apps/Nextcloud/Nextcloud.lmm.rb +150 -68
- data/Plugins/Apps/Nextcloud/autoconfig.php +13 -0
- data/Plugins/Apps/Nextcloud/config.php +10 -1
- data/Plugins/Apps/Nextcloud/nextcloudcron.service +8 -0
- data/Plugins/Apps/Nextcloud/nextcloudcron.timer +10 -0
- data/Plugins/Apps/Nginx/Connection.rb +93 -0
- data/Plugins/Apps/Nginx/conf.d/configlmm.conf +50 -9
- data/Plugins/Apps/Nginx/conf.d/languages.conf +21 -0
- data/Plugins/Apps/Nginx/config-lmm/errors.conf +25 -20
- data/Plugins/Apps/Nginx/config-lmm/gateway-errors.conf +20 -0
- data/Plugins/Apps/Nginx/config-lmm/proxy.conf +1 -1
- data/Plugins/Apps/Nginx/main.conf.erb +7 -3
- data/Plugins/Apps/Nginx/nginx.conf +2 -2
- data/Plugins/Apps/Nginx/nginx.lmm.rb +99 -81
- data/Plugins/Apps/Nginx/proxy.conf.erb +11 -3
- data/Plugins/Apps/Odoo/Odoo.conf.erb +0 -3
- data/Plugins/Apps/Odoo/Odoo.container +5 -0
- data/Plugins/Apps/Odoo/Odoo.lmm.rb +4 -5
- data/Plugins/Apps/Ollama/Ollama.container +26 -0
- data/Plugins/Apps/Ollama/Ollama.lmm.rb +73 -0
- data/Plugins/Apps/OpenTelemetry/Config/config.yaml +704 -0
- data/Plugins/Apps/OpenTelemetry/OpenTelemetry.lmm.rb +154 -0
- data/Plugins/Apps/OpenVidu/Ingress.container +5 -0
- data/Plugins/Apps/OpenVidu/OpenVidu.conf.erb +0 -3
- data/Plugins/Apps/OpenVidu/OpenVidu.container +5 -0
- data/Plugins/Apps/OpenVidu/OpenVidu.lmm.rb +7 -3
- data/Plugins/Apps/OpenVidu/OpenViduCall.conf.erb +0 -3
- data/Plugins/Apps/OpenVidu/OpenViduCall.container +5 -0
- data/Plugins/Apps/PHP-FPM/Connection.rb +91 -0
- data/Plugins/Apps/PHP-FPM/PHP-FPM.lmm.rb +31 -4
- data/Plugins/Apps/Peppermint/Peppermint.conf.erb +2 -5
- data/Plugins/Apps/Peppermint/Peppermint.container +5 -0
- data/Plugins/Apps/Peppermint/Peppermint.lmm.rb +29 -33
- data/Plugins/Apps/Perplexica/Perplexica.container +25 -0
- data/Plugins/Apps/Perplexica/Perplexica.lmm.rb +92 -0
- data/Plugins/Apps/Perplexica/config.toml +26 -0
- data/Plugins/Apps/Podman/Connection.rb +24 -0
- data/Plugins/Apps/Podman/Podman.lmm.rb +80 -0
- data/Plugins/Apps/Podman/storage.conf +6 -0
- data/Plugins/Apps/Postfix/Postfix.lmm.rb +242 -164
- data/Plugins/Apps/PostgreSQL/Connection.rb +97 -0
- data/Plugins/Apps/PostgreSQL/PostgreSQL.lmm.rb +184 -148
- data/Plugins/Apps/Pterodactyl/Pterodactyl.conf.erb +0 -3
- data/Plugins/Apps/Pterodactyl/Pterodactyl.lmm.rb +0 -2
- data/Plugins/Apps/Pterodactyl/Wings.conf.erb +0 -3
- data/Plugins/Apps/RVM/RVM.lmm.rb +57 -0
- data/Plugins/Apps/Roundcube/Roundcube.conf.erb +0 -3
- data/Plugins/Apps/Roundcube/Roundcube.lmm.rb +15 -19
- data/Plugins/Apps/SSH/SSH.lmm.rb +9 -15
- data/Plugins/Apps/SearXNG/SearXNG.container +22 -0
- data/Plugins/Apps/SearXNG/SearXNG.lmm.rb +79 -0
- data/Plugins/Apps/SearXNG/limiter.toml +40 -0
- data/Plugins/Apps/SearXNG/settings.yml +2 -0
- data/Plugins/Apps/SigNoz/Config/alerts.yml +11 -0
- data/Plugins/Apps/SigNoz/Config/otel-collector-config.yaml +110 -0
- data/Plugins/Apps/SigNoz/Config/otel-collector-opamp-config.yaml +1 -0
- data/Plugins/Apps/SigNoz/Config/prometheus.yml +18 -0
- data/Plugins/Apps/SigNoz/SigNoz-Collector.container +23 -0
- data/Plugins/Apps/SigNoz/SigNoz-Migrator.container +17 -0
- data/Plugins/Apps/SigNoz/SigNoz.conf.erb +61 -0
- data/Plugins/Apps/SigNoz/SigNoz.container +26 -0
- data/Plugins/Apps/SigNoz/SigNoz.lmm.rb +319 -0
- data/Plugins/Apps/Solr/log4j2.xml +89 -0
- data/Plugins/Apps/Solr/solr.lmm.rb +82 -0
- data/Plugins/Apps/Sunshine/Sunshine.conf.erb +0 -3
- data/Plugins/Apps/Sunshine/Sunshine.lmm.rb +0 -1
- data/Plugins/Apps/Tunnel/tunnel.lmm.rb +33 -37
- data/Plugins/Apps/UVdesk/UVdesk.conf.erb +0 -3
- data/Plugins/Apps/Umami/Umami.container +19 -0
- data/Plugins/Apps/Umami/Umami.lmm.rb +108 -0
- data/Plugins/Apps/Valkey/Valkey.lmm.rb +54 -42
- data/Plugins/Apps/Vaultwarden/Vaultwarden.conf.erb +9 -6
- data/Plugins/Apps/Vaultwarden/Vaultwarden.container +7 -1
- data/Plugins/Apps/Vaultwarden/Vaultwarden.lmm.rb +64 -29
- data/Plugins/Apps/Wiki.js/Wiki.js.conf.erb +1 -4
- data/Plugins/Apps/Wiki.js/Wiki.js.container +5 -0
- data/Plugins/Apps/Wiki.js/Wiki.js.lmm.rb +31 -37
- data/Plugins/Apps/YaCy/YaCy.conf.erb +93 -0
- data/Plugins/Apps/YaCy/YaCy.container +21 -0
- data/Plugins/Apps/YaCy/YaCy.lmm.rb +160 -0
- data/Plugins/Apps/ZooKeeper/ZooKeeper.container +24 -0
- data/Plugins/Apps/ZooKeeper/ZooKeeper.lmm.rb +68 -0
- data/Plugins/Apps/bitmagnet/bitmagnet.conf.erb +0 -3
- data/Plugins/Apps/bitmagnet/bitmagnet.lmm.rb +0 -1
- data/Plugins/Apps/gollum/gollum.conf.erb +2 -4
- data/Plugins/Apps/gollum/gollum.container +6 -0
- data/Plugins/Apps/gollum/gollum.lmm.rb +51 -50
- data/Plugins/Apps/llama.cpp/llama.cpp.container +28 -0
- data/Plugins/Apps/llama.cpp/llama.cpp.lmm.rb +90 -0
- data/Plugins/Apps/vLLM/vLLM.container +32 -0
- data/Plugins/Apps/vLLM/vLLM.lmm.rb +89 -0
- data/Plugins/OS/General/Utils.lmm.rb +26 -0
- data/Plugins/OS/Linux/Connection.rb +472 -0
- data/Plugins/OS/Linux/Debian/preseed.cfg.erb +25 -6
- data/Plugins/OS/Linux/Flavours.yaml +13 -0
- data/Plugins/OS/Linux/Grub/grub.cfg +10 -0
- data/Plugins/OS/Linux/HTTP.rb +32 -0
- data/Plugins/OS/Linux/Linux.lmm.rb +533 -187
- data/Plugins/OS/Linux/Packages.yaml +20 -1
- data/Plugins/OS/Linux/Services.yaml +8 -0
- data/Plugins/OS/Linux/Shell.rb +70 -0
- data/Plugins/OS/Linux/Syslinux/default +8 -0
- data/Plugins/OS/Linux/WireGuard/WireGuard.lmm.rb +83 -59
- data/Plugins/OS/Linux/WireGuard/wg0.conf.erb +3 -0
- data/Plugins/OS/Linux/openSUSE/autoinst.xml.erb +29 -3
- data/Plugins/OS/Linux/systemd/systemd.lmm.rb +13 -11
- data/Plugins/OS/Routers/Aruba/ArubaInstant.lmm.rb +6 -5
- data/Plugins/Platforms/GitHub.lmm.rb +73 -28
- data/Plugins/Platforms/GoDaddy/GoDaddy.lmm.rb +9 -6
- data/Plugins/Platforms/Proxmox/Proxmox.lmm.rb +402 -0
- data/Plugins/Platforms/Proxmox/XTerm.rb +321 -0
- data/Plugins/Platforms/libvirt/libvirt.lmm.rb +38 -13
- data/Plugins/Platforms/porkbun.lmm.rb +12 -2
- data/Plugins/Platforms/porkbun_spec.rb +2 -2
- data/Plugins/Services/DNS/AmberBit.lmm.rb +1 -1
- data/Plugins/Services/DNS/ArubaItDNS.lmm.rb +1 -1
- data/Plugins/Services/DNS/NICLV.lmm.rb +1 -1
- data/Plugins/Services/DNS/PowerDNS.lmm.rb +70 -68
- data/Plugins/Services/DNS/tonic.lmm.rb +22 -12
- data/lib/ConfigLMM/Framework/plugins/dns.rb +4 -3
- data/lib/ConfigLMM/Framework/plugins/linuxApp.rb +145 -184
- data/lib/ConfigLMM/Framework/plugins/nginxApp.rb +34 -17
- data/lib/ConfigLMM/Framework/plugins/plugin.rb +53 -181
- data/lib/ConfigLMM/Framework/plugins/store.rb +4 -4
- data/lib/ConfigLMM/Framework/variables.rb +75 -0
- data/lib/ConfigLMM/Framework.rb +1 -0
- data/lib/ConfigLMM/cli.rb +12 -6
- data/lib/ConfigLMM/commands/configsCommand.rb +37 -6
- data/lib/ConfigLMM/commands/diff.rb +33 -9
- data/lib/ConfigLMM/context.rb +22 -3
- data/lib/ConfigLMM/io/configList.rb +82 -6
- data/lib/ConfigLMM/io/connection.rb +143 -0
- data/lib/ConfigLMM/io/dhcp.rb +330 -0
- data/lib/ConfigLMM/io/http.rb +78 -0
- data/lib/ConfigLMM/io/local.rb +207 -0
- data/lib/ConfigLMM/io/pxe.rb +92 -0
- data/lib/ConfigLMM/io/ssh.rb +156 -0
- data/lib/ConfigLMM/io/tftp.rb +105 -0
- data/lib/ConfigLMM/io.rb +2 -0
- data/lib/ConfigLMM/secrets/envStore.rb +39 -0
- data/lib/ConfigLMM/secrets/fileStore.rb +43 -0
- data/lib/ConfigLMM/state.rb +2 -1
- data/lib/ConfigLMM/version.rb +2 -1
- data/lib/ConfigLMM.rb +1 -0
- data/{Examples → scripts}/configlmmAuth.sh +7 -5
- metadata +205 -8
@@ -0,0 +1,54 @@
|
|
1
|
+
|
2
|
+
module ConfigLMM
|
3
|
+
module LMM
|
4
|
+
class Homepage < Framework::Plugin
|
5
|
+
|
6
|
+
NAME = 'Homepage'
|
7
|
+
USER = 'homepage'
|
8
|
+
HOME_DIR = '/var/lib/homepage'
|
9
|
+
|
10
|
+
def actionHomepageBuild(id, target, activeState, context, options)
|
11
|
+
Nginx.withConnection(local) do |nginxConnection|
|
12
|
+
nginxConnection.writeConfig(__dir__, NAME, target, state, context, options)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def actionHomepageDeploy(id, target, activeState, context, options)
|
17
|
+
self.withConnection(target['Location'], target) do |connection|
|
18
|
+
Linux.withConnection(connection) do |linuxConnection|
|
19
|
+
if !target.key?('Proxy') || target['Proxy'] != 'only'
|
20
|
+
Podman.ensurePresent(linuxConnection, options)
|
21
|
+
Podman.createUser(USER, HOME_DIR, 'Homepage', linuxConnection, options)
|
22
|
+
linuxConnection.withUserShell(USER) do |shell|
|
23
|
+
shell.createDirs(options, '~/config')
|
24
|
+
end
|
25
|
+
|
26
|
+
configPath = './Homepage'
|
27
|
+
configPath = target['ConfigPath'] if target['ConfigPath']
|
28
|
+
Dir[configPath + '/*'].each do |file|
|
29
|
+
linuxConnection.upload(file, HOME_DIR + '/config/', options)
|
30
|
+
end
|
31
|
+
|
32
|
+
path = Podman.containersPath(HOME_DIR)
|
33
|
+
linuxConnection.upload(__dir__ + '/Homepage.container', path, options)
|
34
|
+
if target.key?('Proxy') && target['Proxy'] == false
|
35
|
+
linuxConnection.exec("sed -i 's|PublishPort=127.0.0.1:13400:|PublishPort=0.0.0.0:13400:|' #{path}/Homepage.container", false, options)
|
36
|
+
linuxConnection.firewallAddPort('13400/tcp', options)
|
37
|
+
end
|
38
|
+
|
39
|
+
linuxConnection.reloadUserServices(USER, options)
|
40
|
+
linuxConnection.restartUserService(USER, 'Homepage', options)
|
41
|
+
end
|
42
|
+
if !target.key?('Proxy') || !!target['Proxy']
|
43
|
+
Nginx.withConnection(linuxConnection) do |nginxConnection|
|
44
|
+
target['ConfigName'] = target['Name']
|
45
|
+
nginxConnection.provision(__dir__, NAME, target, activeState, context, options)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -7,48 +7,69 @@ module ConfigLMM
|
|
7
7
|
CONFIG_DIR = '/etc/letsencrypt/'
|
8
8
|
|
9
9
|
def actionLetsEncryptDeploy(id, target, activeState, context, options)
|
10
|
-
self.
|
10
|
+
self.withConnection(target['Location'], target) do |connection|
|
11
|
+
Linux.withConnection(connection) do |linuxConnection|
|
12
|
+
linuxConnection.ensurePackage(PACKAGE_NAME, options)
|
11
13
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
self.class.sshStart(uri) do |ssh|
|
17
|
-
ssh.scp.upload!(__dir__ + '/rfc2136.ini', CONFIG_DIR)
|
18
|
-
ssh.scp.upload!(__dir__ + '/renew-certificates.service', '/etc/systemd/system/')
|
19
|
-
ssh.scp.upload!(__dir__ + '/renew-certificates.timer', '/etc/systemd/system/')
|
20
|
-
self.class.exec("mkdir -p #{CONFIG_DIR}renewal-hooks/deploy", ssh)
|
14
|
+
linuxConnection.upload(__dir__ + '/rfc2136.ini', CONFIG_DIR, options)
|
15
|
+
linuxConnection.upload(__dir__ + '/renew-certificates.service', '/etc/systemd/system/', options)
|
16
|
+
linuxConnection.upload(__dir__ + '/renew-certificates.timer', '/etc/systemd/system/', options)
|
17
|
+
linuxConnection.createDirs(options, CONFIG_DIR + "renewal-hooks/deploy")
|
21
18
|
target['Hooks'].to_a.each do |hook|
|
22
|
-
|
19
|
+
linuxConnection.upload(__dir__ + '/hooks/' + hook + '.sh', "#{CONFIG_DIR}renewal-hooks/deploy/", options)
|
23
20
|
end
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
21
|
+
linuxConnection.exec("chmod +x #{CONFIG_DIR}renewal-hooks/deploy/*.sh", false, options)
|
22
|
+
linuxConnection.fileReplace(CONFIG_DIR + 'rfc2136.ini', '\$IP', target['DNS']['IP'] , options)
|
23
|
+
|
24
|
+
secretId, secretName = target['DNS']['SecretId'].to_s.split('.')
|
25
|
+
key = nil
|
26
|
+
key = context.secrets.load(secretId, secretName) if secretId && secretName
|
27
|
+
key = context.secrets.load('LETSENCRYPT', 'DNS_SECRET') if key.nil?
|
28
|
+
raise Framework::PluginProcessError.new('LetsEncrypt missing RFC2136 TSIG key! Specify DNS.SecretId or LETSENCRYPT_DNS_SECRET env variable') unless key
|
29
|
+
|
30
|
+
linuxConnection.fileReplace(CONFIG_DIR + 'rfc2136.ini', '\$SECRET', key, options)
|
31
|
+
linuxConnection.setPrivate(CONFIG_DIR + 'rfc2136.ini', options)
|
28
32
|
if target['Domain']
|
29
|
-
createCertificate('Wildcard', target['Domain'], target,
|
33
|
+
createCertificate('Wildcard', target['Domain'], target, linuxConnection, options)
|
30
34
|
end
|
31
|
-
target['Certificates'].to_h.each do |name,
|
32
|
-
createCertificate(name,
|
35
|
+
target['Certificates'].to_h.each do |name, domains|
|
36
|
+
createCertificate(name, domains, target, linuxConnection, options)
|
33
37
|
end
|
34
38
|
|
35
|
-
|
36
|
-
|
37
|
-
|
39
|
+
linuxConnection.reloadServiceManager(options)
|
40
|
+
linuxConnection.ensureServiceAutoStart('renew-certificates.timer', options)
|
41
|
+
linuxConnection.startService('renew-certificates.timer', options)
|
42
|
+
|
43
|
+
target['Hooks'].to_a.each do |hook|
|
44
|
+
linuxConnection.exec("#{CONFIG_DIR}renewal-hooks/deploy/#{hook}.sh", false, options)
|
45
|
+
end
|
38
46
|
end
|
39
|
-
else
|
40
|
-
# TODO
|
41
47
|
end
|
42
48
|
end
|
43
49
|
|
44
|
-
def createCertificate(name,
|
45
|
-
|
46
|
-
|
47
|
-
|
50
|
+
def createCertificate(name, domains, target, connection, options)
|
51
|
+
return if connection.fileLink?("#{CONFIG_DIR}live/#{name}/fullchain.pem", options)
|
52
|
+
connection.exec("rm -rf #{CONFIG_DIR}live/#{name}", false, options)
|
53
|
+
|
54
|
+
domainList = []
|
55
|
+
domains = [domains] unless domains.is_a?(Array)
|
56
|
+
domains.each do |domain|
|
57
|
+
domainList << '--domains "' + Addressable::IDNA.to_ascii(domain) + '"'
|
58
|
+
if addBaseDomain?(domain, domains)
|
59
|
+
domainList << '--domains "' + Addressable::IDNA.to_ascii(domain[2..-1]) + '"'
|
60
|
+
end
|
48
61
|
end
|
49
62
|
extra = ''
|
50
63
|
extra = '--dns-rfc2136-propagation-seconds ' + target['DNS']['Propagation'].to_s if target['DNS']['Propagation']
|
51
|
-
|
64
|
+
|
65
|
+
connection.exec("certbot certonly --dns-rfc2136 --dns-rfc2136-credentials=#{CONFIG_DIR}rfc2136.ini #{extra} --non-interactive --agree-tos --email #{target['EMail']} --cert-name '#{name}' #{domainList.join(' ')}", false, options)
|
66
|
+
end
|
67
|
+
|
68
|
+
def addBaseDomain?(domain, domains)
|
69
|
+
return false unless domain.start_with?('*.')
|
70
|
+
match = '*.' + domain[2..-1].split('.')[1..].join('.')
|
71
|
+
return false if match == '*.' || domains.any? { |d| d.casecmp?(match) }
|
72
|
+
true
|
52
73
|
end
|
53
74
|
|
54
75
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
[Unit]
|
3
|
+
Description=LibreTranslate container
|
4
|
+
After=local-fs.target
|
5
|
+
|
6
|
+
[Container]
|
7
|
+
ContainerName=LibreTranslate
|
8
|
+
Image=docker.io/libretranslate/libretranslate:latest
|
9
|
+
Exec=--host 0.0.0.0 $ARGS
|
10
|
+
PublishPort=127.0.0.1:15100:5000
|
11
|
+
UserNS=keep-id:uid=1032,gid=1032
|
12
|
+
Volume=/var/lib/libretranslate/.local:/home/libretranslate/.local
|
13
|
+
LogDriver=journald
|
14
|
+
AutoUpdate=registry
|
15
|
+
|
16
|
+
[Service]
|
17
|
+
TimeoutStartSec=32min
|
18
|
+
Restart=on-failure
|
19
|
+
|
20
|
+
[Install]
|
21
|
+
WantedBy=multi-user.target default.target
|
@@ -0,0 +1,34 @@
|
|
1
|
+
|
2
|
+
module ConfigLMM
|
3
|
+
module LMM
|
4
|
+
class LibreTranslate < Framework::Plugin
|
5
|
+
|
6
|
+
USER = 'libretranslate'
|
7
|
+
HOME_DIR = '/var/lib/libretranslate'
|
8
|
+
|
9
|
+
def actionLibreTranslateDeploy(id, target, activeState, context, options)
|
10
|
+
|
11
|
+
self.withConnection(target['Location'], target) do |connection|
|
12
|
+
Linux.withConnection(connection) do |linuxConnection|
|
13
|
+
Podman.ensurePresent(linuxConnection, options)
|
14
|
+
Podman.createUser(USER, HOME_DIR, 'LibreTranslate', linuxConnection, options)
|
15
|
+
|
16
|
+
path = Podman.containersPath(HOME_DIR)
|
17
|
+
|
18
|
+
linuxConnection.upload(__dir__ + '/LibreTranslate.container', path, options)
|
19
|
+
|
20
|
+
args = ['--metrics']
|
21
|
+
linuxConnection.fileReplace("#{path}/LibreTranslate.container", '\$ARGS', args.join(' '), options)
|
22
|
+
if target['Listen']
|
23
|
+
linuxConnection.fileReplace("#{path}/LibreTranslate.container", '127.0.0.1', target['Listen'], options)
|
24
|
+
end
|
25
|
+
|
26
|
+
linuxConnection.reloadUserServices(USER, options)
|
27
|
+
linuxConnection.restartUserService(USER, 'LibreTranslate', options)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# Use an official Ruby image as a base
|
2
|
+
ARG RUBY_VERSION
|
3
|
+
FROM ruby:${RUBY_VERSION} AS base
|
4
|
+
|
5
|
+
# Install base packages
|
6
|
+
RUN apt-get update -qq && \
|
7
|
+
apt-get install --no-install-recommends -y curl libjemalloc2 libvips sqlite3 mariadb-client sendmail vim && \
|
8
|
+
rm -rf /var/lib/apt/lists /var/cache/apt/archives
|
9
|
+
|
10
|
+
# Latest releases available at https://github.com/aptible/supercronic/releases
|
11
|
+
ENV SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0.2.33/supercronic-linux-amd64 \
|
12
|
+
SUPERCRONIC_SHA1SUM=71b0d58cc53f6bd72cf2f293e09e294b79c666d8 \
|
13
|
+
SUPERCRONIC=supercronic-linux-amd64
|
14
|
+
|
15
|
+
RUN curl -fsSLO "$SUPERCRONIC_URL" \
|
16
|
+
&& echo "${SUPERCRONIC_SHA1SUM} ${SUPERCRONIC}" | sha1sum -c - \
|
17
|
+
&& chmod +x "$SUPERCRONIC" \
|
18
|
+
&& mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" \
|
19
|
+
&& ln -s "/usr/local/bin/${SUPERCRONIC}" /usr/local/bin/supercronic
|
20
|
+
|
21
|
+
ENV BUNDLE_DEPLOYMENT="1" BUNDLE_PATH="/usr/local/bundle" BUNDLE_WITHOUT="development"
|
22
|
+
|
23
|
+
# Throw-away build stage to reduce size of final image
|
24
|
+
FROM base AS build
|
25
|
+
|
26
|
+
# Install packages needed to build gems
|
27
|
+
RUN apt-get update -qq && \
|
28
|
+
apt-get install --no-install-recommends -y build-essential git libyaml-dev pkg-config && \
|
29
|
+
rm -rf /var/lib/apt/lists /var/cache/apt/archives
|
30
|
+
|
31
|
+
# Set working directory
|
32
|
+
WORKDIR /lobsters
|
33
|
+
|
34
|
+
COPY . .
|
35
|
+
|
36
|
+
# Install application gems
|
37
|
+
RUN bundle install && \
|
38
|
+
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git
|
39
|
+
|
40
|
+
RUN mkdir -p /srv/lobste.rs/log && \
|
41
|
+
ln -sf /lobsters /srv/lobste.rs/http
|
42
|
+
|
43
|
+
# Temporary generate secrets
|
44
|
+
RUN RAILS_ENV=production ./bin/rails credentials:edit
|
45
|
+
|
46
|
+
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
|
47
|
+
RUN SECRET_KEY_BASE_DUMMY=1 RAILS_ENV=production ./bin/rails assets:precompile
|
48
|
+
|
49
|
+
# Remove secrets
|
50
|
+
RUN rm -rf ./config/credentials.yml.enc ./config/master.key ./config/database.yml ./tmp/* /srv/lobste.rs/log/*
|
51
|
+
|
52
|
+
# Final stage for app image
|
53
|
+
FROM base
|
54
|
+
|
55
|
+
WORKDIR /lobsters
|
56
|
+
|
57
|
+
# Copy built artifacts: gems, application
|
58
|
+
COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
|
59
|
+
COPY --from=build /lobsters /lobsters
|
60
|
+
COPY --from=build /srv/lobste.rs /srv/lobste.rs
|
61
|
+
|
62
|
+
COPY crontab /etc/
|
63
|
+
|
64
|
+
RUN ln -sf /config/master.key /lobsters/config/master.key && \
|
65
|
+
ln -sf /config/credentials.yml.enc /lobsters/config/credentials.yml.enc && \
|
66
|
+
ln -sf /config/database.yml /lobsters/config/database.yml
|
67
|
+
|
68
|
+
RUN mv /lobsters/public /lobsters/public_source && ln -sf /srv/lobsters/public /lobsters/public
|
69
|
+
|
70
|
+
# Run and own only the runtime files as a non-root user for security
|
71
|
+
RUN groupadd --system --gid 1000 lobsters && \
|
72
|
+
useradd lobsters --uid 1000 --gid 1000 --create-home --shell /bin/bash && \
|
73
|
+
chown -R lobsters:lobsters /lobsters/tmp /srv/lobste.rs/log
|
74
|
+
|
75
|
+
ENV LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libjemalloc.so.2"
|
76
|
+
|
77
|
+
# Expose port for Rails server
|
78
|
+
EXPOSE 9292
|
79
|
+
|
80
|
+
ENTRYPOINT ["/lobsters/entrypoint.sh"]
|
81
|
+
CMD ["server"]
|
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
[Unit]
|
3
|
+
Description=Lobsters tasks container
|
4
|
+
After=local-fs.target
|
5
|
+
|
6
|
+
[Container]
|
7
|
+
ContainerName=LobstersTasks
|
8
|
+
Image=ConfigLM.moe/lobsters:master
|
9
|
+
EnvironmentFile=/var/lib/lobsters/.config/containers/systemd/Lobsters.env
|
10
|
+
Network=slirp4netns:allow_host_loopback=true
|
11
|
+
UserNS=keep-id:uid=1000,gid=1000
|
12
|
+
Exec=cron
|
13
|
+
Volume=/var/lib/lobsters/config:/config
|
14
|
+
Volume=/var/lib/lobsters/logs:/srv/lobste.rs/log
|
15
|
+
Volume=/var/lib/lobsters/cache:/srv/lobste.rs/cache
|
16
|
+
Volume=/var/lib/lobsters/storage:/srv/lobste.rs/storage
|
17
|
+
Volume=/var/lib/lobsters/queue:/srv/lobste.rs/queue
|
18
|
+
Volume=/var/lib/lobsters/tmp:/lobsters/tmp
|
19
|
+
Volume=/srv/lobsters:/srv/lobsters
|
20
|
+
LogDriver=journald
|
21
|
+
|
22
|
+
[Service]
|
23
|
+
Restart=on-failure
|
24
|
+
|
25
|
+
[Install]
|
26
|
+
WantedBy=multi-user.target default.target
|
@@ -0,0 +1,99 @@
|
|
1
|
+
|
2
|
+
upstream lobsters {
|
3
|
+
<% if config['Server'] %>
|
4
|
+
server <%= config['Server'] %>;
|
5
|
+
<% else %>
|
6
|
+
server 127.0.0.1:19292;
|
7
|
+
<% end %>
|
8
|
+
}
|
9
|
+
|
10
|
+
server {
|
11
|
+
|
12
|
+
<% if config['NginxVersion'] >= 1.25 %>
|
13
|
+
<% if !config['TLS'] %>
|
14
|
+
listen <%= config['Port'] %>;
|
15
|
+
listen [::]:<%= config['Port'] %>;
|
16
|
+
<% else %>
|
17
|
+
listen <%= config['Port'] %> ssl;
|
18
|
+
listen [::]:<%= config['Port'] %> ssl;
|
19
|
+
|
20
|
+
include config-lmm/ssl.conf;
|
21
|
+
<% end %>
|
22
|
+
http2 on;
|
23
|
+
http3 on;
|
24
|
+
quic_retry on;
|
25
|
+
add_header Alt-Svc 'h3=":443"; ma=86400';
|
26
|
+
<% else %>
|
27
|
+
<% if !config['TLS'] %>
|
28
|
+
listen <%= config['Port'] %>;
|
29
|
+
listen [::]:<%= config['Port'] %>;
|
30
|
+
<% else %>
|
31
|
+
listen <%= config['Port'] %> ssl http2;
|
32
|
+
listen [::]:<%= config['Port'] %> ssl http2;
|
33
|
+
|
34
|
+
include config-lmm/ssl.conf;
|
35
|
+
<% end %>
|
36
|
+
<% end %>
|
37
|
+
|
38
|
+
server_name <%= config['Domain'] %>;
|
39
|
+
|
40
|
+
root /srv/lobsters/public;
|
41
|
+
|
42
|
+
include config-lmm/errors.conf;
|
43
|
+
|
44
|
+
# max upload size for avatars (the only upload the site takes now)
|
45
|
+
client_max_body_size 2M;
|
46
|
+
|
47
|
+
location @lobsters {
|
48
|
+
proxy_pass http://lobsters;
|
49
|
+
|
50
|
+
include config-lmm/proxy.conf;
|
51
|
+
}
|
52
|
+
|
53
|
+
location ~ ^/assets/ {
|
54
|
+
gzip_static on;
|
55
|
+
expires max;
|
56
|
+
add_header Cache-Control public;
|
57
|
+
break;
|
58
|
+
}
|
59
|
+
|
60
|
+
location ~ ^/avatars/ {
|
61
|
+
expires max;
|
62
|
+
add_header Cache-Control public;
|
63
|
+
try_files $uri @lobsters;
|
64
|
+
break;
|
65
|
+
}
|
66
|
+
|
67
|
+
# file-based full-page caching, bypass if user has cookies
|
68
|
+
set $use_file_cache "";
|
69
|
+
|
70
|
+
if ($cookie_lobster_trap = "") {
|
71
|
+
set $use_file_cache "${use_file_cache}S"; # S = no session cookie
|
72
|
+
}
|
73
|
+
if ($cookie_tag_filters = "") {
|
74
|
+
set $use_file_cache "${use_file_cache}F"; # F = no filter cookie
|
75
|
+
}
|
76
|
+
if (-f $document_root/cache$uri/index.html) {
|
77
|
+
set $use_file_cache "${use_file_cache}I"; # I = index file cached
|
78
|
+
}
|
79
|
+
if ($use_file_cache = "SFI") {
|
80
|
+
rewrite (.*) /cache/$1/index.html break;
|
81
|
+
}
|
82
|
+
if (-f $document_root/cache$uri.html) {
|
83
|
+
set $use_file_cache "${use_file_cache}H"; # H = HTML file cached
|
84
|
+
}
|
85
|
+
if ($use_file_cache = "SFH") {
|
86
|
+
rewrite (.*) /cache/$1.html break;
|
87
|
+
}
|
88
|
+
if (-f $document_root/cache$uri) {
|
89
|
+
set $use_file_cache "${use_file_cache}O"; # O = other non-extentioned file cached
|
90
|
+
}
|
91
|
+
if ($use_file_cache = "SFO") {
|
92
|
+
rewrite (.*) /cache/$1 break;
|
93
|
+
}
|
94
|
+
|
95
|
+
location / {
|
96
|
+
try_files $uri @lobsters;
|
97
|
+
}
|
98
|
+
|
99
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
[Unit]
|
3
|
+
Description=Lobsters container
|
4
|
+
After=local-fs.target
|
5
|
+
|
6
|
+
[Container]
|
7
|
+
ContainerName=Lobsters
|
8
|
+
Image=ConfigLM.moe/lobsters:master
|
9
|
+
EnvironmentFile=/var/lib/lobsters/.config/containers/systemd/Lobsters.env
|
10
|
+
Network=slirp4netns:allow_host_loopback=true
|
11
|
+
UserNS=keep-id:uid=1000,gid=1000
|
12
|
+
PublishPort=127.0.0.1:19292:9292
|
13
|
+
Volume=/var/lib/lobsters/config:/config
|
14
|
+
Volume=/var/lib/lobsters/logs:/srv/lobste.rs/log
|
15
|
+
Volume=/var/lib/lobsters/cache:/srv/lobste.rs/cache
|
16
|
+
Volume=/var/lib/lobsters/storage:/srv/lobste.rs/storage
|
17
|
+
Volume=/var/lib/lobsters/queue:/srv/lobste.rs/queue
|
18
|
+
Volume=/var/lib/lobsters/tmp:/lobsters/tmp
|
19
|
+
Volume=/srv/lobsters:/srv/lobsters
|
20
|
+
LogDriver=journald
|
21
|
+
|
22
|
+
[Service]
|
23
|
+
TimeoutStartSec=6min
|
24
|
+
Restart=on-failure
|
25
|
+
|
26
|
+
[Install]
|
27
|
+
WantedBy=multi-user.target default.target
|