--console host and --webmail host install them without containers, from their releases' tarballs (inbuxa-admin #106, inbuxa-webmail #68), each checked against a checksum pinned in internal/release. - The console is files: unpacked into <dir>/console, root-owned and readable, and pointed at the server the way its image's entrypoint does (the api-base-url meta tag). The managed Caddy serves the directory, mounted read-only, or the operator's web server does from the configuration --proxy snippets writes; both with the image's rules (app routes fall back to index.html, hashed assets cached for good, index.html never). With --local or --proxy none nothing would serve it, and the plan says so. - The webmail is the /app its image runs, in <dir>/webmail, owned by root, under inbuxa-webmail.service as its own user on the installer's own Node (now 26, as its image) in /opt/inbuxa/node, on 127.0.0.1:8080, with the container's environment in <dir>/webmail.env. It can't write its own files, which is what its IMMUTABLE setting checks. The unit is ProtectSystem=strict. A server in a container is reached at its loopback port and sees it at the project network's gateway, which is what gets exempted from the auto-ban. - Both unpack beside the old copy and swap only when complete; a re-run skips an unchanged release and restarts the webmail only when what it reads at start changed. A webmail moved back into a container gives its port back first. status and export report them as host. With all three on the host and --proxy snippets, no container runtime is installed. The release pins are empty until those releases exist, and the host shapes say so; INBUXA_CONSOLE_TARBALL and INBUXA_WEBMAIL_TARBALL (and CONSOLE_TARBALL=, WEBMAIL_TARBALL= in e2e/vm/run.sh) install a local tarball meanwhile. Also: the "using docker" line no longer prints when nothing runs in a container; Verify takes the plan's options and checks a host console by its files. Tests: plan (console host needs a web server; host front ends wait for their releases; the webmail wants the installer's own Node), compose (console files, the webmail unit, Caddy on the host's network, the gateway exemption, nginx serving the directory), apply (api-base-url replaced or inserted, the webmail's environment, unpack's swap and marker). e2e: webmail-host.sh 18/18 (signing in included), all-host.sh 17/17 (no runtime, behind nginx), both with tarballs taken out of the current images as the release jobs will; install-local, install-host, install-public, proxy-snippets, interface, status-export and topology pass unchanged.
136 lines
4.0 KiB
Cheetah
136 lines
4.0 KiB
Cheetah
# Written by the inbuxa installer {{.Version}} for {{.Domain}}.
|
|
#
|
|
# For the web server already on this machine: nginx. Include it from
|
|
# /etc/nginx/conf.d/ (or sites-enabled/), set each ssl_certificate pair to the
|
|
# certificate you have for those names, check it with `nginx -t`, and reload.
|
|
# The installer loads nothing and restarts nothing; this is yours to adjust.
|
|
#
|
|
# Everything is passed to loopback, where the installer put each program:
|
|
# 127.0.0.1:8081 the mail server's web side (JMAP, CalDAV, CardDAV,
|
|
# autoconfig, MTA-STS)
|
|
# 127.0.0.1:8082 the console
|
|
# 127.0.0.1:8080 the webmail
|
|
#
|
|
# The mail server trusts X-Forwarded-For from here, so every block sets it to
|
|
# the client's own address rather than passing on what the client sent.
|
|
{{- if .ServesServer}}
|
|
|
|
# Port 80 for the server's names: its own certificate challenges, which it
|
|
# answers itself once certificates are turned on in the console, and a
|
|
# redirect for everything else.
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name {{join .ServerNames " "}};
|
|
|
|
location /.well-known/acme-challenge/ {
|
|
proxy_pass http://127.0.0.1:8081;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-For $remote_addr;
|
|
}
|
|
location / {
|
|
return 308 https://$host$request_uri;
|
|
}
|
|
}
|
|
|
|
# The mail server's web side. Push arrives as a long-lived stream, so it is
|
|
# not buffered and not timed out early.
|
|
server {
|
|
listen 443 ssl;
|
|
listen [::]:443 ssl;
|
|
http2 on;
|
|
server_name {{join .ServerNames " "}};
|
|
|
|
ssl_certificate /etc/ssl/inbuxa/{{.MailHost}}.fullchain.pem;
|
|
ssl_certificate_key /etc/ssl/inbuxa/{{.MailHost}}.key.pem;
|
|
|
|
client_max_body_size 100m;
|
|
|
|
location / {
|
|
proxy_pass http://127.0.0.1:8081;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-For $remote_addr;
|
|
proxy_set_header X-Forwarded-Proto https;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $http_connection;
|
|
proxy_buffering off;
|
|
proxy_read_timeout 1h;
|
|
}
|
|
}
|
|
{{- end}}
|
|
{{- if or .Console .ConsoleFiles}}
|
|
|
|
# The console: static files. It talks to the mail server from the browser,
|
|
# so nothing here proxies the API.
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name {{.ConsoleHost}};
|
|
return 308 https://$host$request_uri;
|
|
}
|
|
server {
|
|
listen 443 ssl;
|
|
listen [::]:443 ssl;
|
|
http2 on;
|
|
server_name {{.ConsoleHost}};
|
|
|
|
ssl_certificate /etc/ssl/inbuxa/{{.ConsoleHost}}.fullchain.pem;
|
|
ssl_certificate_key /etc/ssl/inbuxa/{{.ConsoleHost}}.key.pem;
|
|
|
|
{{- if .ConsoleFiles}}
|
|
# Installed on this machine as files: served from them. Any path that
|
|
# is not a file is the app's own route; hashed assets are cached for a
|
|
# year, and index.html, which names them, never.
|
|
root {{.ConsoleFiles}};
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
location /assets/ {
|
|
expires 1y;
|
|
add_header Cache-Control "public, immutable";
|
|
}
|
|
location = /index.html {
|
|
add_header Cache-Control "no-cache";
|
|
}
|
|
{{- else}}
|
|
location / {
|
|
proxy_pass http://127.0.0.1:8082;
|
|
proxy_set_header Host $host;
|
|
}
|
|
{{- end}}
|
|
}
|
|
{{- end}}
|
|
{{- if .ServesWebmail}}
|
|
|
|
# The webmail. Push arrives as Server-Sent Events: flushed as written, and
|
|
# held open.
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name {{.WebmailHost}};
|
|
return 308 https://$host$request_uri;
|
|
}
|
|
server {
|
|
listen 443 ssl;
|
|
listen [::]:443 ssl;
|
|
http2 on;
|
|
server_name {{.WebmailHost}};
|
|
|
|
ssl_certificate /etc/ssl/inbuxa/{{.WebmailHost}}.fullchain.pem;
|
|
ssl_certificate_key /etc/ssl/inbuxa/{{.WebmailHost}}.key.pem;
|
|
|
|
client_max_body_size 100m;
|
|
|
|
location / {
|
|
proxy_pass http://127.0.0.1:8080;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-For $remote_addr;
|
|
proxy_set_header X-Forwarded-Proto https;
|
|
proxy_buffering off;
|
|
proxy_read_timeout 1h;
|
|
}
|
|
}
|
|
{{- end}}
|