Web publishing
An application whose Web target is checked becomes a server: its windows become pages, rendered by the server and displayed by any browser. To put it on the Internet, you place it behind an HTTPS proxy (Caddy, nginx or Apache), which holds the domain's certificate. Khnoum provides these configurations ready to use.
Setting up publishing
In the Project tab, the Web publishing card asks for:
| Setting | Example | Purpose |
|---|---|---|
| Domain | manage.example.com | the site's address |
| Path | / or /manage | the site root, or a sub-path if the domain hosts something else |
| Local port | 8080 | the port the server listens on, on the machine itself |
The card shows the resulting public address, for example https://manage.example.com/manage/.
What the export produces
The web export (see Export) produces:
-
the application's server, for each chosen system and processor;
-
its system service: systemd on Linux, OpenRC on Alpine. The service restarts on error, runs under a dedicated account and keeps its data in
/var/lib/<name>; -
a
publicationfolder with the configuration of each proxy and its instructions:Caddyfile;nginx.conf;apache.conf;LISEZMOI.md.
Linux packages also install it in
/usr/share/doc/<name>/proxy/.
Choosing a proxy
| Proxy | HTTPS certificate |
|---|---|
| Caddy | obtained and renewed automatically (Let's Encrypt): the simplest |
| nginx | to be obtained with certbot (certbot --nginx -d <domain>), at the locations expected by the configuration |
| Apache | same (certbot --apache -d <domain>), with the ssl, proxy, proxy_http, headers and rewrite modules |
Copy the configuration into the proxy's folder and reload it: the site answers on its domain over HTTPS.
Server variables
The service is already set up from the Web publishing card; these variables let you change it without exporting again:
| Variable | Default | Purpose |
|---|---|---|
ADRESSE | 127.0.0.1 | listening address (local: only the proxy connects to it) |
PORT | 8080 | listening port |
KHNOUM_CHEMIN | / | publishing path (/manage) |
KHNOUM_HTTPS | inferred from the proxy | 1 forces secure cookies |
KHNOUM_DONNEES | /var/lib/<name> | folder for local data (SQLite, files) |
Database passwords are given to the service through their variables (see Data), never in the project.
Security and monitoring
The web application protects every form against cross-site request forgery (CSRF). Behind an HTTPS proxy, its cookies are marked Secure and restricted to its path. The /k/sante address answers "ok" as long as the server is running: a monitoring tool can watch it. Stopping the service lets the requests in progress finish.