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,93 @@
|
|
1
|
+
|
2
|
+
module ConfigLMM
|
3
|
+
module LMM
|
4
|
+
class NginxConnection
|
5
|
+
|
6
|
+
NGINX_PACKAGE = 'nginx'
|
7
|
+
CONFIG_DIR = '/etc/nginx/'
|
8
|
+
WWW_DIR = '/srv/www/'
|
9
|
+
|
10
|
+
attr_reader :connection
|
11
|
+
attr_reader :nginxVersion
|
12
|
+
|
13
|
+
def initialize(connection)
|
14
|
+
@connection = connection
|
15
|
+
end
|
16
|
+
|
17
|
+
def nginxVersion
|
18
|
+
# Allow to fail when nginx is not installed
|
19
|
+
@nginxVersion ||= connection.exec('nginx -v', true).strip.split('/')[1].to_f
|
20
|
+
end
|
21
|
+
|
22
|
+
def reload(options)
|
23
|
+
connection.reloadService(:nginx, options)
|
24
|
+
end
|
25
|
+
|
26
|
+
def writeConfig(dir, name, target, activeState, context, options)
|
27
|
+
outputFolder = options['output']
|
28
|
+
|
29
|
+
config = prepareConfig(target)
|
30
|
+
|
31
|
+
config['NginxVersion'] = nginxVersion
|
32
|
+
template = ERB.new(File.read(dir + '/' + name + '.conf.erb'))
|
33
|
+
name = config['ConfigName'] if config['ConfigName']
|
34
|
+
connection.local.renderTemplate(template, config, outputFolder + '/nginx/servers-lmm/' + name.to_s + '.conf', options)
|
35
|
+
end
|
36
|
+
|
37
|
+
def deployAllConfigs(target, activeState, context, options)
|
38
|
+
outputFolder = options['output'] + '/nginx/servers-lmm'
|
39
|
+
|
40
|
+
connection.createDirs(options, CONFIG_DIR)
|
41
|
+
connection.uploadFolder(outputFolder, CONFIG_DIR, options)
|
42
|
+
if target['TLS']
|
43
|
+
connection.firewallAddService('https', options)
|
44
|
+
else
|
45
|
+
connection.firewallAddService('http', options)
|
46
|
+
end
|
47
|
+
reload(options)
|
48
|
+
end
|
49
|
+
|
50
|
+
def cleanupConfig(name, context, options)
|
51
|
+
connection.rm('/etc/nginx/servers-lmm/' + name + '.conf', options['dry'])
|
52
|
+
end
|
53
|
+
|
54
|
+
def provision(dir, configName, target, activeState, context, options)
|
55
|
+
connection.ensurePackage(NGINX_PACKAGE, options)
|
56
|
+
connection.ensureServiceAutoStart(:nginx, options)
|
57
|
+
writeConfig(dir, configName, target, activeState, context, options)
|
58
|
+
connection.startService(:nginx, options)
|
59
|
+
deployAllConfigs(target, activeState, context, options)
|
60
|
+
reload(options)
|
61
|
+
end
|
62
|
+
|
63
|
+
def provisionProxy(server, name, target, activeState, context, options)
|
64
|
+
target = target.dup
|
65
|
+
target['Proxy'] = server
|
66
|
+
target['Name'] = name if name
|
67
|
+
target['ConfigName'] = target['Name']
|
68
|
+
provision(__dir__, 'proxy', target, activeState, context, options)
|
69
|
+
end
|
70
|
+
|
71
|
+
private
|
72
|
+
|
73
|
+
def prepareConfig(target)
|
74
|
+
config = target.dup
|
75
|
+
config['TLS'] = true if config['TLS'].nil?
|
76
|
+
|
77
|
+
if !config['Port']
|
78
|
+
config['Port'] = config['TLS'] ? 443 : 80
|
79
|
+
end
|
80
|
+
if config['Domain']
|
81
|
+
config['Domain'] = Addressable::IDNA.to_ascii(config['Domain'])
|
82
|
+
end
|
83
|
+
if config['Server'] && !config['Server'].start_with?('/') && !config['Server'].include?(':/')
|
84
|
+
config['Server'] = Addressable::IDNA.to_ascii(config['Server'])
|
85
|
+
end
|
86
|
+
if config['AuthentikDomain']
|
87
|
+
config['AuthentikDomain'] = Addressable::IDNA.to_ascii(config['AuthentikDomain'])
|
88
|
+
end
|
89
|
+
config
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -12,31 +12,72 @@ resolver 127.0.0.53;
|
|
12
12
|
# proxy_headers_hash_max_size 512;
|
13
13
|
# proxy_headers_hash_bucket_size 128;
|
14
14
|
|
15
|
+
log_format json escape=json '{'
|
16
|
+
'"time":$msec,'
|
17
|
+
'"time_iso8601":"$time_iso8601",'
|
18
|
+
'"remote_addr":"$remote_addr",'
|
19
|
+
'"remote_port":$remote_port,'
|
20
|
+
'"remote_user":"$remote_user",'
|
21
|
+
'"request":"$request",'
|
22
|
+
'"status":$status,'
|
23
|
+
'"method":"$request_method",'
|
24
|
+
'"scheme":"$scheme",'
|
25
|
+
'"host":"$http_host",'
|
26
|
+
'"uri":"$uri",'
|
27
|
+
'"request_uri":"$request_uri",'
|
28
|
+
'"query_string":"$query_string",'
|
29
|
+
'"request_filename":"$request_filename",'
|
30
|
+
'"request_length":$request_length,'
|
31
|
+
'"content_length":"$content_length",'
|
32
|
+
'"content_type":"$content_type",'
|
33
|
+
'"bytes_sent":$bytes_sent,'
|
34
|
+
'"body_bytes_sent":$body_bytes_sent,'
|
35
|
+
'"server_name":"$server_name",'
|
36
|
+
'"server_port":$server_port,'
|
37
|
+
'"server_protocol":"$server_protocol",'
|
38
|
+
'"http_referer":"$http_referer",'
|
39
|
+
'"http_user_agent":"$http_user_agent",'
|
40
|
+
'"http_accept_language":"$http_accept_language",'
|
41
|
+
'"http_x_forwarded_for":"$http_x_forwarded_for",'
|
42
|
+
'"http_x_real_ip":"$http_x_real_ip",'
|
43
|
+
'"request_time":$request_time,'
|
44
|
+
'"upstream_addr":"$upstream_addr",'
|
45
|
+
'"upstream_status":"$upstream_status",'
|
46
|
+
'"upstream_http_etag":"$upstream_http_etag",'
|
47
|
+
'"upstream_http_last_modified":"$upstream_http_last_modified",'
|
48
|
+
'"upstream_connect_time":"$upstream_connect_time",'
|
49
|
+
'"upstream_header_time":"$upstream_header_time",'
|
50
|
+
'"upstream_response_time":"$upstream_response_time",'
|
51
|
+
'"proxy_protocol_addr":"$proxy_protocol_addr",'
|
52
|
+
'"proxy_protocol_port":"$proxy_protocol_port",'
|
53
|
+
'"connection_time":$connection_time,'
|
54
|
+
'"connection_requests":$connection_requests'
|
55
|
+
'}';
|
56
|
+
|
57
|
+
access_log /var/log/nginx/access.json json;
|
15
58
|
|
16
59
|
gzip on;
|
60
|
+
gzip_static on;
|
17
61
|
gzip_vary on;
|
18
62
|
gzip_proxied any;
|
19
63
|
gzip_comp_level 6;
|
20
64
|
gzip_min_length 256;
|
21
65
|
|
22
|
-
# do not remove ETag headers
|
23
|
-
gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
|
24
|
-
|
25
66
|
gzip_types application/atom+xml text/javascript text/xml application/xml+rss application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/wasm application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;
|
26
67
|
|
27
|
-
|
28
68
|
charset utf-8;
|
29
69
|
charset_types text/css text/plain text/xml text/javascript text/vnd.wap.wml application/json application/javascript application/xml application/xml+rss application/rss+xm image/svg+xml;
|
30
70
|
proxy_intercept_errors on;
|
31
71
|
fastcgi_intercept_errors on;
|
32
72
|
|
33
|
-
map '' $
|
34
|
-
default
|
73
|
+
map '' $ProxyHost {
|
74
|
+
default $host;
|
75
|
+
~. '';
|
35
76
|
}
|
36
77
|
|
37
|
-
map
|
38
|
-
default $
|
39
|
-
~.
|
78
|
+
map '' $ProxyForwardedHost {
|
79
|
+
default $http_host;
|
80
|
+
~. '';
|
40
81
|
}
|
41
82
|
|
42
83
|
map $http_accept $errorExtension
|
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
# Here we include only those languages that are supported
|
3
|
+
# by https://github.com/ConfigLMM/HttpErrorPages/tree/configlmm/i18n
|
4
|
+
|
5
|
+
map $http_accept_language $userLanguage
|
6
|
+
{
|
7
|
+
default en_US;
|
8
|
+
~*^es-VE es_VE;
|
9
|
+
~*^es es_VE; # Fallback
|
10
|
+
~*^fr-FR fr_FR;
|
11
|
+
~*^fr fr_FR;
|
12
|
+
~*^it-IT it_IT;
|
13
|
+
~*^it it_IT;
|
14
|
+
~*^lv-LV lv_LV;
|
15
|
+
~*^lv lv_LV;
|
16
|
+
~*^pl pl_PL;
|
17
|
+
~*^pt-BR pt_BR;
|
18
|
+
~*^pt pt_BR;
|
19
|
+
~*^zh-CN zh_CN;
|
20
|
+
~*^zh zh_CN;
|
21
|
+
}
|
@@ -1,30 +1,35 @@
|
|
1
1
|
|
2
2
|
# add one directive for each http status code
|
3
|
-
error_page 301 /_errors_/HTTP301.$errorExtension;
|
3
|
+
error_page 301 /_errors_/HTTP301.$userLanguage.$errorExtension;
|
4
4
|
|
5
5
|
# Looks like enabling custom 302 can be problematic
|
6
6
|
# due to apps using multiple Set-Cookie headers
|
7
7
|
# for example this breaks BookStack
|
8
8
|
# so lets not use it by default
|
9
|
-
#error_page 302 /_errors_/HTTP302.$errorExtension;
|
10
|
-
|
11
|
-
error_page 303 /_errors_/HTTP303.$errorExtension;
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
error_page
|
16
|
-
|
17
|
-
error_page
|
18
|
-
error_page
|
19
|
-
error_page
|
20
|
-
error_page
|
21
|
-
error_page
|
22
|
-
error_page
|
23
|
-
error_page
|
24
|
-
error_page
|
25
|
-
error_page
|
26
|
-
error_page
|
27
|
-
error_page
|
9
|
+
#error_page 302 /_errors_/HTTP302.$userLanguage.$errorExtension;
|
10
|
+
|
11
|
+
error_page 303 /_errors_/HTTP303.$userLanguage.$errorExtension;
|
12
|
+
|
13
|
+
# Some applications (eg. Umami) misuse this status
|
14
|
+
# code and don't actually expect redirect...
|
15
|
+
#error_page 307 /_errors_/HTTP307.$userLanguage.$errorExtension;
|
16
|
+
|
17
|
+
error_page 308 /_errors_/HTTP308.$userLanguage.$errorExtension;
|
18
|
+
error_page 400 /_errors_/HTTP400.$userLanguage.$errorExtension;
|
19
|
+
error_page 401 /_errors_/HTTP401.$userLanguage.$errorExtension;
|
20
|
+
# error_page 402 /_errors_/HTTP402.$userLanguage.$errorExtension;
|
21
|
+
error_page 403 /_errors_/HTTP403.$userLanguage.$errorExtension;
|
22
|
+
error_page 404 /_errors_/HTTP404.$userLanguage.$errorExtension;
|
23
|
+
error_page 405 /_errors_/HTTP405.$userLanguage.$errorExtension;
|
24
|
+
error_page 497 /_errors_/HTTP497.$userLanguage.$errorExtension;
|
25
|
+
error_page 500 /_errors_/HTTP500.$userLanguage.$errorExtension;
|
26
|
+
error_page 501 /_errors_/HTTP501.$userLanguage.$errorExtension;
|
27
|
+
error_page 502 /_errors_/HTTP502.$userLanguage.$errorExtension;
|
28
|
+
error_page 503 /_errors_/HTTP503.$userLanguage.$errorExtension;
|
29
|
+
error_page 504 /_errors_/HTTP504.$userLanguage.$errorExtension;
|
30
|
+
error_page 520 /_errors_/HTTP520.$userLanguage.$errorExtension;
|
31
|
+
error_page 521 /_errors_/HTTP521.$userLanguage.$errorExtension;
|
32
|
+
error_page 533 /_errors_/HTTP533.$userLanguage.$errorExtension;
|
28
33
|
|
29
34
|
location /_errors_/ {
|
30
35
|
include config-lmm/public.conf;
|
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
error_page 497 /_errors_/HTTP497.$userLanguage.$errorExtension;
|
3
|
+
|
4
|
+
error_page 502 /_errors_/HTTP502.$userLanguage.$errorExtension;
|
5
|
+
error_page 503 /_errors_/HTTP503.$userLanguage.$errorExtension;
|
6
|
+
error_page 504 /_errors_/HTTP504.$userLanguage.$errorExtension;
|
7
|
+
|
8
|
+
error_page 520 /_errors_/HTTP520.$userLanguage.$errorExtension;
|
9
|
+
error_page 521 /_errors_/HTTP521.$userLanguage.$errorExtension;
|
10
|
+
error_page 533 /_errors_/HTTP533.$userLanguage.$errorExtension;
|
11
|
+
|
12
|
+
location /_errors_/ {
|
13
|
+
include config-lmm/public.conf;
|
14
|
+
|
15
|
+
add_header Location $upstream_http_location;
|
16
|
+
add_header Set-Cookie $upstream_http_set_cookie;
|
17
|
+
|
18
|
+
alias /srv/www/errors/;
|
19
|
+
internal;
|
20
|
+
}
|
@@ -6,7 +6,7 @@ proxy_set_header X-Real-IP $remote_addr;
|
|
6
6
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
7
7
|
proxy_set_header X-Forwarded-Proto $scheme;
|
8
8
|
proxy_set_header X-Forwarded-Protocol $scheme;
|
9
|
-
proxy_set_header X-Forwarded-Host $
|
9
|
+
proxy_set_header X-Forwarded-Host $ProxyForwardedHost;
|
10
10
|
|
11
11
|
proxy_set_header Upgrade $http_upgrade;
|
12
12
|
proxy_set_header Connection $connectionUpgrade;
|
@@ -6,7 +6,9 @@ server {
|
|
6
6
|
|
7
7
|
include config-lmm/errors.conf;
|
8
8
|
|
9
|
-
|
9
|
+
location / {
|
10
|
+
return 308 https://$host$request_uri;
|
11
|
+
}
|
10
12
|
}
|
11
13
|
|
12
14
|
server {
|
@@ -21,11 +23,13 @@ server {
|
|
21
23
|
|
22
24
|
server_name _;
|
23
25
|
|
24
|
-
deny all;
|
25
|
-
|
26
26
|
ssl_early_data on;
|
27
27
|
|
28
28
|
include config-lmm/errors.conf;
|
29
29
|
include config-lmm/security.conf;
|
30
30
|
include config-lmm/ssl.conf;
|
31
|
+
|
32
|
+
location / {
|
33
|
+
return 403;
|
34
|
+
}
|
31
35
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
worker_processes 4;
|
3
3
|
|
4
|
-
error_log
|
4
|
+
error_log stderr info;
|
5
5
|
|
6
6
|
events {
|
7
7
|
worker_connections 1024;
|
@@ -18,7 +18,7 @@ http {
|
|
18
18
|
|
19
19
|
include /etc/nginx/main.conf;
|
20
20
|
|
21
|
-
# Load modular configuration files from the /etc/nginx/
|
21
|
+
# Load modular configuration files from the /etc/nginx/vhosts.d directory.
|
22
22
|
# See http://nginx.org/en/docs/ngx_core_module.html#include
|
23
23
|
# for more information.
|
24
24
|
include vhosts.d/*.conf;
|
@@ -1,21 +1,24 @@
|
|
1
1
|
|
2
|
+
require_relative 'Connection'
|
3
|
+
|
2
4
|
module ConfigLMM
|
3
5
|
module LMM
|
4
6
|
class Nginx < Framework::NginxApp
|
5
|
-
|
6
|
-
|
7
|
+
PACKAGE_NAME = 'Nginx'
|
8
|
+
SERVICE_NAME = :nginx
|
9
|
+
ERROR_PAGES_REPO = 'https://github.com/ConfigLMM/HttpErrorPages.git'
|
7
10
|
|
8
11
|
def actionNginxBuild(id, target, activeState, context, options)
|
9
|
-
|
10
12
|
dir = options['output'] + '/nginx/'
|
11
|
-
mkdir(dir + 'conf.d', options[:dry])
|
12
|
-
mkdir(dir + 'servers-lmm', options[:dry])
|
13
|
-
copy(__dir__ + '/config-lmm', dir, options[:dry])
|
14
|
-
copy(__dir__ + '/nginx.conf', dir, options[:dry])
|
15
|
-
copy(__dir__ + '/conf.d/configlmm.conf', dir + 'conf.d/', options[:dry])
|
16
|
-
|
17
|
-
|
18
|
-
mkdir(options['output'] + WWW_DIR + '
|
13
|
+
local.mkdir(dir + 'conf.d', options[:dry])
|
14
|
+
local.mkdir(dir + 'servers-lmm', options[:dry])
|
15
|
+
local.copy(__dir__ + '/config-lmm', dir, options[:dry])
|
16
|
+
local.copy(__dir__ + '/nginx.conf', dir, options[:dry])
|
17
|
+
local.copy(__dir__ + '/conf.d/configlmm.conf', dir + 'conf.d/', options[:dry])
|
18
|
+
local.copy(__dir__ + '/conf.d/languages.conf', dir + 'conf.d/', options[:dry])
|
19
|
+
|
20
|
+
local.mkdir(options['output'] + NginxConnection::WWW_DIR + 'root', options[:dry])
|
21
|
+
local.mkdir(options['output'] + NginxConnection::WWW_DIR + 'errors', options[:dry])
|
19
22
|
end
|
20
23
|
|
21
24
|
# TODO
|
@@ -26,80 +29,93 @@ module ConfigLMM
|
|
26
29
|
def actionNginxDeploy(id, target, activeState, context, options)
|
27
30
|
dir = options['output'] + '/nginx/'
|
28
31
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
self.class.sshExec!(ssh, "mkdir -p #{CONFIG_DIR}conf.d")
|
37
|
-
self.class.sshExec!(ssh, "mkdir -p #{WWW_DIR}root")
|
38
|
-
self.class.sshExec!(ssh, "mkdir -p #{WWW_DIR}errors")
|
39
|
-
ssh.scp.upload!(dir + 'nginx.conf', CONFIG_DIR + 'nginx.conf')
|
40
|
-
ssh.scp.upload!(dir + 'conf.d/configlmm.conf', CONFIG_DIR + 'conf.d/configlmm.conf')
|
41
|
-
resolverIP = self.class.sshExec!(ssh, "cat /etc/resolv.conf | grep 'nameserver' | grep -v ':' | head -n 1 | cut -d ' ' -f 2").strip
|
42
|
-
self.class.sshExec!(ssh, "sed -i 's|^resolver .*|resolver #{resolverIP};|' /etc/nginx/conf.d/configlmm.conf")
|
43
|
-
|
44
|
-
self.class.uploadFolder(dir + 'config-lmm', CONFIG_DIR, ssh)
|
45
|
-
self.class.uploadFolder(dir + 'servers-lmm', CONFIG_DIR, ssh)
|
46
|
-
|
47
|
-
template = ERB.new(File.read(__dir__ + '/main.conf.erb'))
|
48
|
-
renderTemplate(template, target, dir + 'main.conf', options)
|
49
|
-
ssh.scp.upload!(dir + 'main.conf', CONFIG_DIR + 'main.conf')
|
50
|
-
|
51
|
-
if !self.class.remoteFilePresent?(WWW_DIR + 'errors/HTTP500.html', ssh)
|
52
|
-
errorPages = File.expand_path(REPOS_CACHE + '/HttpErrorPages')
|
53
|
-
if !File.exist?(errorPages)
|
54
|
-
mkdir(File.expand_path(REPOS_CACHE), false)
|
55
|
-
begin
|
56
|
-
Framework::LinuxApp.ensurePackages(['git', 'Yarn'], '@me')
|
57
|
-
rescue RuntimeError => error
|
58
|
-
prompt.say(error, :color => :red)
|
59
|
-
end
|
60
|
-
`cd #{REPOS_CACHE} && git clone --quiet #{ERROR_PAGES_REPO} > /dev/null`
|
61
|
-
end
|
62
|
-
`cd #{errorPages} && yarn install --silent`
|
63
|
-
`cd #{errorPages} && yarn run static config-dist.json > /dev/null`
|
64
|
-
`cd #{errorPages} && cp -R dist errors`
|
65
|
-
self.class.uploadFolder(errorPages + '/errors', WWW_DIR, ssh)
|
66
|
-
end
|
32
|
+
# Consider:
|
33
|
+
# * Deploy on current host
|
34
|
+
# * Deploy on remote host thru SSH (eg. VPS)
|
35
|
+
# * Using already existing solution like Chef/Puppet/Ansible/etc
|
36
|
+
# * Provision from some Cloud provider
|
37
|
+
# We implement this as we go - what people actually use
|
67
38
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
39
|
+
self.withConnection(target['Location'], target) do |connection|
|
40
|
+
Linux.withConnection(connection) do |linuxConnection|
|
41
|
+
self.class.withConnection(linuxConnection) do |nginxConnection|
|
42
|
+
target['Deploy'] = true unless target.key?('Deploy')
|
72
43
|
|
73
|
-
|
74
|
-
|
44
|
+
if target['Deploy']
|
45
|
+
linuxConnection.ensurePackage(PACKAGE_NAME, options)
|
75
46
|
|
76
|
-
|
77
|
-
mkdir(WWW_DIR + 'root', options[:dry])
|
78
|
-
mkdir(WWW_DIR + 'errors', options[:dry])
|
47
|
+
linuxConnection.createDirs(options, "#{NginxConnection::CONFIG_DIR}conf.d", "#{NginxConnection::WWW_DIR}root", "#{NginxConnection::WWW_DIR}errors")
|
79
48
|
|
80
|
-
|
81
|
-
|
82
|
-
|
49
|
+
linuxConnection.upload(dir + 'nginx.conf', NginxConnection::CONFIG_DIR + 'nginx.conf', options)
|
50
|
+
linuxConnection.upload(dir + 'conf.d/configlmm.conf', NginxConnection::CONFIG_DIR + 'conf.d/configlmm.conf', options)
|
51
|
+
linuxConnection.upload(dir + 'conf.d/languages.conf', NginxConnection::CONFIG_DIR + 'conf.d/languages.conf', options)
|
83
52
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
53
|
+
if options['dry']
|
54
|
+
linuxConnection.exec("cat /etc/resolv.conf | grep 'nameserver' | grep -v ':' | head -n 1 | cut -d ' ' -f 2", { **options, 'dry': true })
|
55
|
+
end
|
56
|
+
resolverIP = linuxConnection.exec("cat /etc/resolv.conf | grep 'nameserver' | grep -v ':' | head -n 1 | cut -d ' ' -f 2", { **options, 'dry': false }).strip
|
57
|
+
|
58
|
+
linuxConnection.fileReplace('/etc/nginx/conf.d/configlmm.conf', '^resolver .*', "resolver #{resolverIP};", options)
|
59
|
+
|
60
|
+
linuxConnection.uploadFolder(dir + 'config-lmm', NginxConnection::CONFIG_DIR, options)
|
61
|
+
linuxConnection.uploadFolder(dir + 'servers-lmm', NginxConnection::CONFIG_DIR, options)
|
62
|
+
|
63
|
+
target = target.dup
|
64
|
+
target['NginxVersion'] = nginxConnection.nginxVersion
|
65
|
+
template = ERB.new(File.read(__dir__ + '/main.conf.erb'))
|
66
|
+
local.renderTemplate(template, target, dir + 'main.conf', options)
|
67
|
+
linuxConnection.upload(dir + 'main.conf', NginxConnection::CONFIG_DIR + 'main.conf', options)
|
68
|
+
|
69
|
+
if !linuxConnection.filePresent?(NginxConnection::WWW_DIR + 'errors/HTTP500.en_US.html', { **options, 'dry' => false })
|
70
|
+
errorPages = File.expand_path(REPOS_CACHE + '/HttpErrorPages')
|
71
|
+
if !File.exist?(errorPages)
|
72
|
+
local.mkdir(File.expand_path(REPOS_CACHE), options['dry'])
|
73
|
+
begin
|
74
|
+
Linux.withConnection(local) do |localLinux|
|
75
|
+
localLinux.ensurePackages(['git'], options) unless localLinux.hasBinaries?(['git'], options)
|
76
|
+
end
|
77
|
+
rescue RuntimeError => error
|
78
|
+
prompt.say(error, :color => :red)
|
79
|
+
end
|
80
|
+
local.exec("cd #{REPOS_CACHE} && git clone --quiet #{ERROR_PAGES_REPO}", false, options)
|
81
|
+
local.exec("cd #{errorPages} && cp -R dist errors", false, options)
|
82
|
+
else
|
83
|
+
local.exec("cd #{REPOS_CACHE}/HttpErrorPages && git pull", false, options)
|
84
|
+
local.exec("cd #{errorPages} && cp -R dist errors", false, options)
|
85
|
+
end
|
86
|
+
linuxConnection.uploadFolder(errorPages + '/errors', NginxConnection::WWW_DIR, options)
|
87
|
+
end
|
88
|
+
|
89
|
+
linuxConnection.createWildecardCertificate(options)
|
90
|
+
end
|
90
91
|
|
92
|
+
if target['Servers']
|
93
|
+
target['Servers'].each do |source|
|
94
|
+
name = File.basename(source)
|
95
|
+
linuxConnection.upload(source, NginxConnection::CONFIG_DIR + 'servers-lmm/' + name, options)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
if target['Deploy']
|
100
|
+
linuxConnection.ensureServiceAutoStart(SERVICE_NAME, options)
|
101
|
+
linuxConnection.startService(SERVICE_NAME, options)
|
102
|
+
|
103
|
+
linuxConnection.firewallAddService('http', options)
|
104
|
+
linuxConnection.firewallAddService('https', options)
|
105
|
+
else
|
106
|
+
linuxConnection.reloadService(SERVICE_NAME, options)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
91
110
|
end
|
92
|
-
# Consider:
|
93
|
-
# * Deploy on current host
|
94
|
-
# * Deploy on remote host thru SSH (eg. VPS)
|
95
|
-
# * Using already existing solution like Chef/Puppet/Ansible/etc
|
96
|
-
# * Provision from some Cloud provider
|
97
|
-
# We implement this as we go - what people actually use
|
98
111
|
end
|
99
112
|
|
100
113
|
def actionNginxProxyBuild(id, target, activeState, context, options)
|
101
114
|
target['ConfigName'] = target['Name']
|
102
|
-
|
115
|
+
|
116
|
+
self.class.withConnection(local) do |nginxConnection|
|
117
|
+
nginxConnection.writeConfig(__dir__, 'proxy', target, activeState, context, options)
|
118
|
+
end
|
103
119
|
actionNginxBuild(id, target, activeState, context, options)
|
104
120
|
end
|
105
121
|
|
@@ -107,17 +123,19 @@ module ConfigLMM
|
|
107
123
|
raise Framework::PluginProcessError.new('Proxy field must be set!') unless target['Proxy']
|
108
124
|
|
109
125
|
target['ConfigName'] = target['Name']
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
126
|
+
self.withConnection(target['Location'], target) do |connection|
|
127
|
+
Linux.withConnection(connection) do |linuxConnection|
|
128
|
+
self.class.withConnection(linuxConnection) do |nginxConnection|
|
129
|
+
nginxConnection.provision(__dir__, 'proxy', target, activeState, context, options)
|
130
|
+
end
|
115
131
|
end
|
116
|
-
else
|
117
|
-
useNginxProxy(__dir__, 'proxy', id, target, activeState, state, context, options, ssh)
|
118
132
|
end
|
119
133
|
end
|
120
134
|
|
135
|
+
def self.withConnection(linuxConnection)
|
136
|
+
yield(NginxConnection.new(linuxConnection))
|
137
|
+
end
|
138
|
+
|
121
139
|
end
|
122
140
|
end
|
123
141
|
end
|
@@ -23,10 +23,18 @@ server {
|
|
23
23
|
|
24
24
|
server_name <%= config['Domain'] %>;
|
25
25
|
|
26
|
-
|
27
|
-
|
26
|
+
<% if config['CertName'] %>
|
27
|
+
ssl_certificate "/etc/letsencrypt/live/<%= config['CertName'] %>/fullchain.pem";
|
28
|
+
ssl_certificate_key "/etc/letsencrypt/live/<%= config['CertName'] %>/privkey.pem";
|
29
|
+
ssl_trusted_certificate "/etc/letsencrypt/live/<%= config['CertName'] %>/chain.pem";
|
30
|
+
<% end %>
|
31
|
+
|
32
|
+
<% if !config.key?('HandleErrors') || config['HandleErrors'] %>
|
33
|
+
include config-lmm/errors.conf;
|
34
|
+
<% else %>
|
35
|
+
include config-lmm/gateway-errors.conf;
|
36
|
+
<% end %>
|
28
37
|
|
29
|
-
include config-lmm/errors.conf;
|
30
38
|
include config-lmm/security.conf;
|
31
39
|
|
32
40
|
<% if config['Private'] %>
|
@@ -4,6 +4,7 @@ Description=Odoo container
|
|
4
4
|
After=local-fs.target
|
5
5
|
|
6
6
|
[Container]
|
7
|
+
ContainerName=Odoo
|
7
8
|
Image=docker.io/odoo:latest
|
8
9
|
EnvironmentFile=/var/lib/odoo/.config/containers/systemd/Odoo.env
|
9
10
|
Network=slirp4netns:allow_host_loopback=true
|
@@ -12,7 +13,11 @@ UserNS=keep-id:uid=101,gid=101
|
|
12
13
|
Volume=/var/lib/odoo/config:/etc/odoo
|
13
14
|
Volume=/var/lib/odoo/data:/var/lib/odoo
|
14
15
|
Volume=/var/lib/odoo/addons:/mnt/extra-addons
|
16
|
+
LogDriver=journald
|
15
17
|
AutoUpdate=registry
|
16
18
|
|
19
|
+
[Service]
|
20
|
+
Restart=on-failure
|
21
|
+
|
17
22
|
[Install]
|
18
23
|
WantedBy=multi-user.target default.target
|
@@ -64,16 +64,15 @@ module ConfigLMM
|
|
64
64
|
if !target.key?('Proxy') || target['Proxy'] == true || target['Proxy'] == 'only'
|
65
65
|
deployNginxConfig(id, target, activeState, context, options)
|
66
66
|
end
|
67
|
-
activeState['Location'] = '@me'
|
68
67
|
end
|
69
68
|
end
|
70
69
|
|
71
|
-
def configurePostgreSQL(settings,
|
70
|
+
def configurePostgreSQL(settings, connection)
|
72
71
|
user = USER
|
73
72
|
password = SecureRandom.alphanumeric(20)
|
74
|
-
PostgreSQL.executeRemotely(settings,
|
75
|
-
|
76
|
-
PostgreSQL.executeSQL("ALTER USER #{user} WITH PASSWORD '#{password}'", nil,
|
73
|
+
PostgreSQL.executeRemotely(settings, connection) do |connection|
|
74
|
+
connection.exec("su --login #{PostgreSQL::USER_NAME} --command 'createuser --createdb #{user}'", true)
|
75
|
+
PostgreSQL.executeSQL("ALTER USER #{user} WITH PASSWORD '#{password}'", nil, connection)
|
77
76
|
end
|
78
77
|
password
|
79
78
|
end
|