Runway 1.2.0
This commit is contained in:
1 parent
5fa0c1ef9f
commit
9144c206be
90 files changed
+2737
-554
No files matched your search
+128
-16
@@ -1950,14 +1950,80 @@ chosen in settings. Nothing uses them unless a plugin that needs a database is i
|
||||
|
||||
| Plugin | What it is |
|
||||
|---|---|
|
||||
| `database` | The generic plugin: the connection pool, the settings, one schema per site, migrations, backups, the **Database** screen. Requires Runway 1.1.0 or later. |
|
||||
| `database-postgresql` | The PostgreSQL provider: bundles the pgjdbc driver. PostgreSQL **14 or later**, database encoding `UTF8`. |
|
||||
| `database-mariadb` | The MariaDB provider: bundles MariaDB Connector/J (LGPL-2.1; its unmodified sources are published next to the zip). MariaDB **10.11 or later**; MySQL is not supported. |
|
||||
| `database` | The generic plugin: the connection pool, the provider choice and the limits, one schema per site, migrations, backups, the **Database** screen and the connection tests. Version 2.0.0 requires Runway 1.2.0 or later (1.0.0 ran on 1.1.0). |
|
||||
| `database-postgresql` | The PostgreSQL provider: bundles the pgjdbc driver and holds the server's settings (host, account, password, TLS). PostgreSQL **14 or later**, database encoding `UTF8`. |
|
||||
| `database-mariadb` | The MariaDB provider: bundles MariaDB Connector/J (LGPL-2.1; its unmodified sources are published next to the zip) and holds the server's settings, collation included. MariaDB **10.11 or later**; MySQL is not supported. |
|
||||
|
||||
Install `database` and the provider for your server (installing both providers is harmless: the setting picks one),
|
||||
then restart. A plugin that needs the database declares it, so without `database` it shows as **Blocked** with the
|
||||
Install `database` and the provider for your server, then restart. With one provider installed, it is the one used;
|
||||
with both, the database plugin's `provider` setting picks one. A plugin that needs the database declares it, so without `database` it shows as **Blocked** with the
|
||||
reason, and Runway runs normally.
|
||||
|
||||
**Setting it up, step by step.** The whole path for one server; each step is explained further down.
|
||||
|
||||
1. **Prepare the server**: an account and a UTF-8 database for Runway (*Preparing the server*, below). On PostgreSQL
|
||||
the account only owns that database; on MariaDB it also needs the grant on the namespace's databases.
|
||||
2. **Install the plugins.** From the release (the plugin zips are published with each Runway release, §11), download `runway-plugin-database-<version>.zip`, the provider's
|
||||
zip (`runway-plugin-database-postgresql-…` or `runway-plugin-database-mariadb-…`) and `SHA256SUMS`, check them
|
||||
(`sha256sum -c --ignore-missing SHA256SUMS`), and upload each zip on **Plugins**. Add the plugins that will use
|
||||
the database (for a first try, `runway-demo-database`, the guestbook). Do not restart yet.
|
||||
3. **Enter the settings**: the server, the account, the password and TLS on the provider's page (**Plugins →
|
||||
Database — PostgreSQL → Settings**, or **Database — MariaDB**), or in its settings file (*Setting it up without the
|
||||
console*, below). The database plugin's own page (**Plugins → Database → Settings**) needs a change only when both
|
||||
providers are installed, or for the namespace and the limits. Settings take effect on the next restart.
|
||||
4. **Test them**: on **Plugins → Database → Settings**, below the form, **Connection tests** → **Test the saved
|
||||
PostgreSQL settings** (or MariaDB) connects once with what is saved and changes nothing. The answer is one of those
|
||||
in *When it does not connect*, below.
|
||||
5. **Restart once.** Runway starts without waiting for the database, then connects on its own thread.
|
||||
6. **Check**: **Settings → Database** says *Connected* and shows the server's version; the server log has one line
|
||||
`database: connected to … (postgresql), namespace 'rw'` (or `mariadb`). If it says anything else, see *When it
|
||||
does not connect*, below.
|
||||
7. **Try it** (with the guestbook): place `<div id="guestbook" data-widget="guestbook/main"></div>` on a page of a
|
||||
site, sign the guestbook as a visitor, and the site's schema appears on the server (`rw_s_<site>_<n>`); the entries
|
||||
are managed under **Guestbook** in that site's console (the site superadmin has it; anyone else needs the
|
||||
guestbook's *manage* permission, granted on **Permissions**).
|
||||
|
||||
**Setting it up without the console.** The server's settings live in the provider's file,
|
||||
`external/plugin-settings/database-postgresql.yml` (or `database-mariadb.yml`), nested under
|
||||
`runway.plugin.<provider plugin id>` like every plugin's (§11). `host`, `database` and `username` are required; the
|
||||
other keys keep their defaults when absent:
|
||||
|
||||
```yaml
|
||||
# external/plugin-settings/database-postgresql.yml (owner: the service account; mode 600 — it holds the password)
|
||||
runway:
|
||||
plugin:
|
||||
database-postgresql: # database-mariadb for MariaDB
|
||||
host: "127.0.0.1"
|
||||
port: 5432 # blank or absent: 5432 / 3306
|
||||
database: "runway"
|
||||
username: "runway"
|
||||
password: "…"
|
||||
tls: disable # same host only; otherwise verify-full (the default) or require
|
||||
```
|
||||
|
||||
The database plugin's own file, `external/plugin-settings/database.yml` (under `runway.plugin.database`), is needed
|
||||
only to choose the provider when both are installed (`provider: postgresql` or `mariadb`; the default `auto` uses the
|
||||
one installed), or to change the namespace or a limit.
|
||||
|
||||
The password may be written **in clear**: it is used as written and stays in clear in the file. Runway does not
|
||||
encrypt a hand-written value, and nothing outside the console can produce the encrypted `ENC(...)` form; it is made
|
||||
only when the password is typed on the settings form, with the platform secret key (§8). So either keep the file
|
||||
readable by the service account only (`chown runway: …; chmod 600 …`), or type the password once on the form, which
|
||||
replaces it with `ENC(...)`. Saving the form with the password field left blank keeps whatever is stored, clear or
|
||||
encrypted, as long as the settings it is bound to do not change (below).
|
||||
|
||||
**Upgrading from database 1.x.** Until 2.0.0 the server's settings were in the database plugin's own file. After the
|
||||
upgrade, a `database.yml` that still holds them gives the status *Not configured: the server settings moved to the
|
||||
database-postgresql plugin in database 2.0.0: move host, …* and Runway does not connect with them. Move every server
|
||||
key (`host`, `port`, `database`, `username`, `password`, `tls`, `caCertificate`, and on MariaDB `collation`) into the
|
||||
provider's file, under `runway.plugin.database-postgresql` (or `database-mariadb`), as above; keep `provider`,
|
||||
`namespace` and the limits in `database.yml`. An encrypted password (`ENC(...)`) can be moved as it is: it is
|
||||
encrypted with the platform secret key, not with anything tied to the file. **Move the keys before you save the
|
||||
Database plugin's settings form**: a save writes only the settings the form has, so it removes the old server keys
|
||||
from `database.yml`, encrypted password included (if that happens, type the settings on the provider's page). Or retype the settings on the provider's
|
||||
page and delete the old keys. Install the 2.0.0 versions of all three plugins together; a 1.x provider with
|
||||
database 2.0.0 gives *No provider: the database-postgresql plugin is older than 2.0.0*. Then test (step 4 above)
|
||||
and restart.
|
||||
|
||||
**What Runway creates.** Every name starts with the **namespace** (setting `namespace`, default `rw`):
|
||||
|
||||
- `<ns>_app` — Runway's own registry tables (`rw_…`) and data that belongs to no site;
|
||||
@@ -1981,6 +2047,13 @@ CREATE DATABASE runway OWNER runway ENCODING 'UTF8' TEMPLATE template0;
|
||||
would refuse it; on a UTF-8 cluster it changes nothing. If PostgreSQL then answers that the encoding does not match
|
||||
the locale, the cluster's locale is not UTF-8 either: add `LOCALE 'C.UTF-8'` (PostgreSQL 14 and later).
|
||||
|
||||
Owning the database is all the account needs: Runway creates its schemas inside it. The server must accept the
|
||||
account over TCP with a password: on PostgreSQL that is a `pg_hba.conf` line for the database, the account and the
|
||||
address Runway connects from, for example `host runway runway 127.0.0.1/32 scram-sha-256` for a server on the same
|
||||
host (reload PostgreSQL after editing it), and, for a server on another host, `listen_addresses` covering an
|
||||
interface Runway can reach. Give the host as `127.0.0.1` rather than `localhost` to avoid depending on which of
|
||||
`127.0.0.1` and `::1` the name resolves to.
|
||||
|
||||
```sql
|
||||
-- MariaDB (as root). The pattern is the namespace, then an escaped underscore: `rw\_%` for the default `rw`.
|
||||
CREATE USER 'runway'@'10.0.0.%' IDENTIFIED BY '…';
|
||||
@@ -1992,21 +2065,35 @@ GRANT ALL PRIVILEGES ON `rw\_%`.* TO 'runway'@'10.0.0.%';
|
||||
A MariaDB account without the pattern grant connects but cannot create the namespace's databases: the **Database**
|
||||
screen stays at *Connecting* with an "Access denied" error until the grant exists.
|
||||
|
||||
**Settings** (**Plugins → database → Settings**, Runway-wide, applied on **restart**):
|
||||
**Settings** (Runway-wide, applied on **restart**). The server's, on the provider's page (**Plugins → Database —
|
||||
PostgreSQL → Settings**, or **Database — MariaDB**):
|
||||
|
||||
| Setting | Meaning |
|
||||
|---|---|
|
||||
| `provider` | `postgresql` or `mariadb`. |
|
||||
| `host`, `port` | One server: a host name or an IP address (no lists, no options). A blank port means 5432 / 3306. |
|
||||
| `database` | The database to connect to (see above). |
|
||||
| `username`, `password` | The account. The password is stored encrypted. It is **bound** to provider, host, port, database, username, TLS and the CA certificate: change any of them without typing the password again and the stored password is removed, so it can never be sent to a server someone else chose. |
|
||||
| `username`, `password` | The account. The password is stored encrypted. It is **bound** to host, port, database, username, TLS and the CA certificate: change any of them without typing the password again and the stored password is removed, so it can never be sent to a server someone else chose. |
|
||||
| `tls` | `verify-full` (default: encrypted, the certificate and the host name checked against the Java trust store or `caCertificate`), `require` (encrypted, the server **not** checked), `disable`. Use `disable` only for a database on the same host or a private network you trust. |
|
||||
| `caCertificate` | Advanced. The PEM certificate of the CA that signed the server's certificate, when the Java trust store does not know it. |
|
||||
| `collation` | Advanced, MariaDB's page only: for plugins' tables. Blank means `utf8mb4_uca1400_ai_ci`. Runway's own identifier columns are always binary. |
|
||||
|
||||
The rest, on the database plugin's page (**Plugins → Database → Settings**):
|
||||
|
||||
| Setting | Meaning |
|
||||
|---|---|
|
||||
| `provider` | `auto` (default: the one provider plugin installed), `postgresql` or `mariadb`. Needed only when both providers are installed. |
|
||||
| `namespace` | Advanced. Default `rw`; lower-case letters and digits, up to 12. Changing it later starts from empty schemas: the old ones stay on the server. |
|
||||
| `poolMax` | Connections plugins may hold at once (default 10). One site may use at most half, so a busy site cannot starve the others. |
|
||||
| `statementTimeoutSeconds` | A plugin's statement that runs longer is stopped (default 10). Migrations, backups and restores have their own 30-minute limit. |
|
||||
| `backupBudgetMiB` | The compressed size a site's database data may reach in its backup (default 128). |
|
||||
| `collation` | Advanced, MariaDB only: for plugins' tables. Blank means `utf8mb4_uca1400_ai_ci`. Runway's own identifier columns are always binary. |
|
||||
|
||||
**Connection tests**, below the database plugin's settings form (same permission as the form, and the same as the
|
||||
Database screen: `CONFIGURE_PLATFORM`): *Running now* shows the status; **Test the running connection** borrows from
|
||||
the live pool; **Test the saved PostgreSQL settings** (one button per installed provider) opens one throwaway
|
||||
connection with the settings saved on that provider's page — which the next restart would apply — and changes
|
||||
nothing. The tests take no typed values: a form with a username and a password box is one a browser fills in with
|
||||
your own saved console login, which a test would then send to whatever server the form named. Answers are fixed
|
||||
categories (below); the driver's own message goes only to the server log, never with a password.
|
||||
|
||||
**Runway never fails to start because of the database.** Nothing connects while Runway starts; the plugin connects
|
||||
right after, on its own thread, retrying with back-off. Until it succeeds, plugins that need it say so (for example
|
||||
@@ -2018,11 +2105,7 @@ administrators hold) shows:
|
||||
- the status: *Connected*, *Connecting* (with the last error), *Not configured* (with the setting at fault), *No
|
||||
provider*, or *Server not supported*; the provider, server version, driver, pool use and the number of sites with
|
||||
data;
|
||||
- **Test running connection** (the live pool) and **Test these settings** (typed values, one throwaway connection,
|
||||
nothing saved). Answers are fixed categories — unreachable, TLS failure, authentication failed, database missing or
|
||||
no access, unsupported server — and the driver's own message goes only to the server log, never with a password.
|
||||
A blank password in the test reuses the saved one only for exactly the same provider, server, database, account and
|
||||
TLS settings;
|
||||
- a link to the settings page and its **Connection tests** (above);
|
||||
- **Plugin tables needing attention**, with recovery actions (below);
|
||||
- the plugins using the database, the nodes seen in the last five minutes, the largest site backup against the
|
||||
budget (a warning from 75%), and the last failed restore.
|
||||
@@ -2043,7 +2126,28 @@ sites carry on — and the screen lists the case:
|
||||
|
||||
Every recovery action is written to the server log with the operator's name.
|
||||
|
||||
**Clusters.** Every node needs the same `external/plugin-settings/database.yml` and the same platform secret key
|
||||
**When it does not connect.** The **Database** screen's status, and the server log's `database:` lines, say why;
|
||||
**Test the saved … settings** checks what is saved before you restart. While the status is *Connecting*,
|
||||
Runway retries on its own, waiting twice as long each time up to a minute (every 5 minutes for *Server not
|
||||
supported*); a fixed server is picked up without a restart. A changed setting needs a restart.
|
||||
|
||||
| Status / test answer | Usual cause | What to do |
|
||||
|---|---|---|
|
||||
| *Not configured: …* (log: `database: not configured: …`; test: *The settings cannot be used: …*) | A setting is missing or invalid; the message names the plugin and the setting (for example *database-postgresql settings: no host is set*), or says *no server is set* on the provider's page, or *both provider plugins are installed* (choose one in `provider`), or *the server settings moved* (*Upgrading from database 1.x*, above). | Set it and restart. |
|
||||
| *No provider: …* | No provider plugin is installed, `provider` names a product whose plugin is not, two plugins offer the same product, or the provider is older than 2.0.0 (*the database-postgresql plugin is older than 2.0.0*). | Install `database-postgresql` or `database-mariadb` (2.0.0 or later), or change `provider`; restart. |
|
||||
| *Connecting:* … / *The server could not be reached.* | Wrong host or port, the server is down, it listens on another interface, or a firewall is in between. The connection attempt gives up after 5 seconds. | From the Runway host, check the address and port (`pg_isready -h … -p …`, `nc -vz … 3306`); `listen_addresses` / `bind-address` on the server. |
|
||||
| *The server refused the username or password.* | Wrong password; on PostgreSQL, no `pg_hba.conf` line matches the database, account and Runway's address; on MariaDB, no account matches the address Runway connects from. | Fix the password (retype it; §11 on bound secrets), the `pg_hba.conf` line (then reload), or the account's host part. |
|
||||
| *The TLS handshake failed* | `verify-full` against a server whose certificate the Java trust store does not know (a private CA, or a self-signed certificate), or whose name does not match `host`; or TLS asked for from a server that has none (on PostgreSQL the status shows *The server does not support SSL*; database 1.0.0 reported this one as a refused password). | Paste the CA into `caCertificate`, use the name on the certificate as `host`, or, for a server on the same host or a trusted private network only, `tls: disable`. |
|
||||
| *The database does not exist on the server, or the account has no access to it.* | The `database` setting names a database that is not there, or (MariaDB) the account has no rights on it. On PostgreSQL an account without the `CONNECT` right answers *The test failed; see the server log*. | Create it as shown above, or fix the name. |
|
||||
| *Connecting:* … *Access denied* (MariaDB) | The account connects but lacks the grant on the namespace's databases. | Add the namespace pattern grant shown above. |
|
||||
| *Server not supported: …* | PostgreSQL older than 14, MariaDB older than 10.11, MySQL, or a PostgreSQL database whose encoding is not UTF-8 (*the database's encoding is … UTF8 is needed*). | Upgrade the server or use another one; recreate the database as UTF-8 as shown above. |
|
||||
|
||||
The test answers are fixed categories. The status and *Last error* on the screen, and the log's `database:` line,
|
||||
carry the driver's own message (never a password): the exception, its SQL state and the text, which is where the
|
||||
detail is.
|
||||
|
||||
**Clusters.** Every node needs the same `external/plugin-settings/database.yml` and provider file
|
||||
(`database-postgresql.yml` or `database-mariadb.yml`) and the same platform secret key
|
||||
(`runway.security.secret-key`), because the password is stored encrypted with it. The database is shared, so a site
|
||||
deleted on one node has its schema dropped once, by that node. To change the server or the provider, stop **every**
|
||||
node first.
|
||||
@@ -2508,6 +2612,14 @@ holder and explains why; the routes answer `403` regardless. A backup the holder
|
||||
there for an administrator — or the platform operator, on `/__app/backups` — to download or restore. See the
|
||||
*Site Manager & Designer Guide* §12 for the end-user workflow.
|
||||
|
||||
**Who did it is recorded.** Each backup act on the site console that took effect — saving, downloading (full,
|
||||
transfer, or a saved backup), deleting and restoring — is a line in that site's own audit journal (`backup.saved`,
|
||||
`backup.downloaded`, `backup.deleted`, `site.restored`; Site Manager & Designer Guide §3). The same acts on
|
||||
`/__app/backups` are in the platform's activity log, under the same names, and not in the site's journal. **A
|
||||
restore keeps the site's logs and traffic history** (on either console): it replaces the content only, so the
|
||||
journal still holds what happened before it; logs or stats inside an archive are ignored, as no backup writes them.
|
||||
A site created from a backup starts its own logs.
|
||||
|
||||
**Pending editorial work travels with the site.** On a site whose manager has turned on review
|
||||
(*Site Manager & Designer Guide* §10), changes waiting for approval are kept beside their pages under
|
||||
`sites/<id>/templates/.pending/<slug>/`. They are site content, never served, listed or indexed: a backup
|
||||
@@ -2543,7 +2655,7 @@ with:
|
||||
|
||||
- `users.yml` and `permissions.yml` **omitted** — accounts, hashes and grants;
|
||||
- traffic history (`stats/bandwidth.csv`) and logs — absent, as from **every** backup: they are transient
|
||||
per-site data that no backup carries;
|
||||
per-site data that no backup carries (and a restore keeps the target site's own);
|
||||
- every per-site plugin value that is **declared** secret, stored `ENC(...)`, or **named** like a credential
|
||||
(`secret`, `password`, `passwd`, `token`, `credential`, `apiKey`, `privateKey`) — **blanked** at any depth,
|
||||
including inside nested maps and lists, and kept as an empty key so the recipient sees what to fill in;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
> the contribution seams, settings, permissions, and the rules that keep plugins compatible.
|
||||
|
||||
> **Doc status.** The plugin contract is **SPI `1.0.0`, frozen** (Runway `1.0.0`): from here it changes only
|
||||
> additively within `1.x` (SPI `1.1.0` added `PluginSettings.appSecret`) — the commitment and the full type list are in [SPI-STABILITY.md](SPI-STABILITY.md); the
|
||||
> additively within `1.x` (SPI `1.1.0` added `PluginSettings.appSecret`, `1.2.0` `PluginSettings.savedApp`) — the commitment and the full type list are in [SPI-STABILITY.md](SPI-STABILITY.md); the
|
||||
> `plugin.yml` keys and their tolerance rules are covered by
|
||||
> [CONFIGURATION-AND-DATA-STABILITY.md](CONFIGURATION-AND-DATA-STABILITY.md) §4. A plugin is built against
|
||||
> `runway-spi` **only**; the kernel refuses one that links its internal classes (§3, *The 1.0 contract at a
|
||||
@@ -104,7 +104,7 @@ boots.
|
||||
> **Which floor to declare.** The lowest SPI version whose additions you use — the evolution log on
|
||||
> `RunwaySpi.VERSION` lists them per version. `>=0.4.0`, `>=0.5.0` and `>=0.6.0` are all **1.x floors** (the service
|
||||
> tier those versions introduced is the 1.0 contract), so a plugin built against them loads on every `1.x` kernel;
|
||||
> declare `>=1.0.0` only if you use `HeadContext.origin()`, and `>=1.1.0` if you call `PluginSettings.appSecret`. The floor is an **SPI level** — the value of
|
||||
> declare `>=1.0.0` only if you use `HeadContext.origin()`, `>=1.1.0` if you call `PluginSettings.appSecret`, and `>=1.2.0` if you call `PluginSettings.savedApp`. The floor is an **SPI level** — the value of
|
||||
> `RunwaySpi.VERSION` — not the version of the `runway-spi` artifact you compile against, which is the kernel's
|
||||
> release version (kernel `1.0.0` carries SPI `1.0.0`; §3).
|
||||
|
||||
@@ -216,7 +216,7 @@ Then depend on `mx.quest:runway-spi:<ver>` (`provided`) and `mx.quest:runway-spi
|
||||
|
||||
| You need | Use | Never |
|
||||
|---|---|---|
|
||||
| your per-site settings and secrets (app-level ones: `@ConfigurationProperties("runway.plugin.<id>")`; an app-level secret in clear: `PluginSettings.appSecret`, SPI 1.1.0) | `PluginSettings` (+ `SettingsView`) | `SitePluginConfigService`, `SecretCipher`, `@Value("${runway.plugin…}")` on a per-site key |
|
||||
| your per-site settings and secrets (app-level ones: `@ConfigurationProperties("runway.plugin.<id>")`; an app-level secret in clear: `PluginSettings.appSecret`, SPI 1.1.0; an app-level setting as saved, before the restart applies it: `PluginSettings.savedApp`, SPI 1.2.0) | `PluginSettings` (+ `SettingsView`) | `SitePluginConfigService`, `SecretCipher`, `@Value("${runway.plugin…}")` on a per-site key |
|
||||
| your per-site files | `PluginSiteFiles`; declare personal data in `siteData.personal` | `SiteFileStore`, `StorageLayout`, a path you build |
|
||||
| the site, the request's site, a permission check, a message | `Sites`, `RequestContext`, `AccessCheck` (`@authz`), `Messages` | `SiteResolver`, `AuthzExpressions`, `SiteAwareMessageSource` |
|
||||
| a starter page | `SitePages.install` → `InstallResult` | `PageWriteService`, writing templates |
|
||||
@@ -226,6 +226,7 @@ Then depend on `mx.quest:runway-spi:<ver>` (`provided`) and `mx.quest:runway-spi
|
||||
| a start/stop hook | `PluginLifecycle` | `RunwayPlugin`/`PluginContext` (removed at `1.0.0`) |
|
||||
| a console screen | `@ConsoleScreen` on a `@Controller` under `/__admin/<id>` or `/__app/<id>` | your own `@ControllerAdvice` calling `OperatorShellModel` |
|
||||
| an HTTP route on the site | `EndpointContributor` (`Route`, `Route.anonymousPost` for a public form) | a `@Controller` outside the console prefixes, a servlet `Filter` |
|
||||
| tables in PostgreSQL or MariaDB | the `database` plugin's own SPI (`Databases`, `DatabaseConsumer`, migrations shipped in your jar; `requires: [ "database >= 1.0.0" ]`): `plugins/docs/PLUGIN-AUTHORING-GUIDE.md` §7.14, example `plugins/runway-demo-database/` | a JDBC driver or pool of your own, a connection string in your settings |
|
||||
| an absolute URL in head markup | `HeadContext.origin()` (1.0.0) | the `Host` header |
|
||||
|
||||
**How the kernel enforces it** — each is a **Blocked** plugin with the reason in its row on the **Plugins** screen,
|
||||
@@ -332,7 +333,7 @@ if you use any `0.6.0` type, `">=0.5.0"` for a `0.5.0` service.
|
||||
|
||||
| Service | What it gives you |
|
||||
|---|---|
|
||||
| `PluginSettings` | `site(siteId)` → a `SettingsView` of **your** per-site settings: the `siteSettings:` defaults overlaid by what the operator saved (`sites/<id>/plugins/<yourId>.yml`), unknown stored keys preserved, secret keys absent. `secret(siteId, key)` → a `type: secret` value in clear (an `ENC(...)` value decrypted; a hand-written plaintext returned as is; empty when unset, undeclared as secret, or undecryptable). `appSecret(key)` (SPI 1.1.0) → the same for a secret declared in your app-level `settings:`, as the running application holds it. |
|
||||
| `PluginSettings` | `site(siteId)` → a `SettingsView` of **your** per-site settings: the `siteSettings:` defaults overlaid by what the operator saved (`sites/<id>/plugins/<yourId>.yml`), unknown stored keys preserved, secret keys absent. `secret(siteId, key)` → a `type: secret` value in clear (an `ENC(...)` value decrypted; a hand-written plaintext returned as is; empty when unset, undeclared as secret, or undecryptable). `appSecret(key)` (SPI 1.1.0) → the same for a secret declared in your app-level `settings:`, as the running application holds it. `savedApp(key)` (SPI 1.2.0) → one of your app-level settings as **saved** now (a secret in clear; a blank non-secret as its declared default), read from your settings file, for checking a change before the restart applies it. |
|
||||
| `SettingsView` | lenient typed reads: `string(key, fallback)` (blank → fallback), `bool`, `integer` (and a clamped form), `decimal`, `list` (a YAML list or a comma/newline string). A value that does not parse yields the fallback, never an exception. Nested values are frozen; parse structures from `values()` yourself. |
|
||||
| `PluginInfo` | your `id`, `version` and install folder. Injectable; also handed to `PluginLifecycle.started`. |
|
||||
| `PluginLifecycle` | optional `started(PluginInfo)` after the platform is up (in plugin load order) and `stopping()` at shutdown (reverse order, only if started). Collected by type — no `id()` to keep in sync. |
|
||||
@@ -928,7 +929,8 @@ holds one. Read a per-site secret with `PluginSettings.secret(siteId, key)` —
|
||||
appears in `site(siteId)`. Read an **app-level** secret (declared `type: secret` under `settings:`) with
|
||||
`PluginSettings.appSecret(key)` (SPI 1.1.0, so declare `requiresSpi: ">=1.1.0"`): your `@ConfigurationProperties`
|
||||
bind it only in its `ENC(...)` form, which you cannot decrypt. It answers the value the running application started
|
||||
with, so a saved change applies after the restart, like every app-level setting. Encryption requires `runway.security.secret-key` to be set — until it is, a secret can't be
|
||||
with, so a saved change applies after the restart, like every app-level setting. To check a saved change before
|
||||
that restart (a connection test, say), read it with `PluginSettings.savedApp(key)` (SPI 1.2.0). Encryption requires `runway.security.secret-key` to be set — until it is, a secret can't be
|
||||
saved and the form says so. A **blank secret on resubmit keeps** the stored value (you never retype
|
||||
it), and secrets are never echoed back into the form.
|
||||
|
||||
@@ -1001,6 +1003,11 @@ Because the plugin classloader is **shared** and **parent-first** (§10), the ow
|
||||
to the same `Class` for owner and implementers, so a `List<TheSpi>` injection collects
|
||||
implementations across plugins by type.
|
||||
|
||||
The shipped example is the **`database`** plugin: it publishes `mx.quest.database.spi`, which the provider plugins
|
||||
implement (`DatabaseProvider`) and which plugins that keep data in PostgreSQL or MariaDB use (`Databases`,
|
||||
`DatabaseConsumer`). How to use it — scopes, transactions, migrations, backups — is in
|
||||
`plugins/docs/PLUGIN-AUTHORING-GUIDE.md` §7.14; how operators set it up is ADMINISTRATION §11.1.
|
||||
|
||||
---
|
||||
|
||||
## 8. Static assets, templates & i18n
|
||||
|
||||
@@ -235,7 +235,12 @@ site refused, such as a `503` while it is in maintenance) and its **audit journa
|
||||
(`login.success`, `login.failure`) and sign-outs (`logout`), each with the address it came from (`ip=…`, in full:
|
||||
the anonymizing setting below applies to the access log only); password recovery through an emailed link
|
||||
(`recovery.requested`, `recovery.completed`); page changes (`page.saved`, `page.deleted`, `page.published`,
|
||||
`page.unpublished`); user changes (`user.created`, `user.password-reset`, `user.deleted`); role and permission
|
||||
`page.unpublished`); user changes (`user.created`, `user.updated`, `user.suspended`, `user.resumed`,
|
||||
`user.password-reset`, `user.deleted`); static files (`static.uploaded`, `static.folder-created`, `static.deleted`);
|
||||
backups made on your console (§12): a backup saved on the server (`backup.saved`) or deleted (`backup.deleted`), a
|
||||
backup downloaded (`backup.downloaded`: `full` for a fresh full backup, `transfer` for a transfer copy, `full` and the
|
||||
name for a saved one) and a restore (`site.restored`, naming the backup, or `(upload)` for an uploaded file) — the
|
||||
platform operator's own backup work is in the platform's log, not here; role and permission
|
||||
changes on **Permissions** (`permissions.role-assigned`, `permissions.permission-granted`,
|
||||
`permissions.role-created` and their counterparts); and settings changes — a plugin's settings
|
||||
(`plugin.settings-changed`, naming the plugin), the site settings (`site-config.changed`, naming which parts —
|
||||
@@ -257,7 +262,8 @@ happens when a line is written, so switching it changes only the lines written a
|
||||
how many **days** of logs to keep, 30 by default, up to the
|
||||
platform's maximum (90 unless your operator changed it; the field's hint says it). A value above it is refused. If
|
||||
the operator lowers the maximum below what you chose, your choice is kept, the logs are kept only up to the new
|
||||
maximum, and the panel says so until you save a value within it. Logs are *transient*: they never travel in a backup, so restoring a site never carries old logs.
|
||||
maximum, and the panel says so until you save a value within it. Logs are *transient*: they never travel in a backup, and a restore keeps the logs your site has now, so the
|
||||
journal still shows everything before the restore (and, for a restore made on your console, the restore itself).
|
||||
|
||||
The **Bandwidth** screen (`/__admin/bandwidth`, site-admin only) charts your site's data transfer — a
|
||||
30-day daily graph plus 24-hour / 7-day / 30-day totals. Like logs, the underlying stats are transient and
|
||||
@@ -836,6 +842,20 @@ index-backed plugin rebuilds its index).
|
||||
page or master template (described in **§7**); you decide where it appears and — on the **Content
|
||||
widgets** screen below — how each placement behaves.
|
||||
|
||||
**Plugins that keep data in a database.** Most plugins keep your site's data in your site's folder. Some keep it in
|
||||
a database server the platform operator runs (PostgreSQL or MariaDB) instead: things that pile up, such as visitors'
|
||||
entries. For you it works the same way: each site has its own part of the database, kept apart from every other site's,
|
||||
and your **full backups** carry it (**§12**). Your dashboard has a **Database** card saying whether your site keeps
|
||||
any data there, and how the last restore of that data went. If the database cannot be reached, those plugins say
|
||||
so on the page (for example *This example needs the database*) and the rest of your site works as usual; the
|
||||
operator sees why on their own console.
|
||||
|
||||
One such plugin is an example, the **guestbook** (`runway-demo-database`), if your operator installed it:
|
||||
place `<div id="guestbook" data-widget="guestbook/main"></div>` on a page; visitors sign it there, and you read and
|
||||
delete the entries under **Guestbook** in your console (it needs the *manage* permission of that plugin, which a role
|
||||
gets on **Permissions**). Its settings, under **Settings → Runway demo — database**, turn it off for your site and cap how many
|
||||
entries are kept (500 by default; the oldest go first).
|
||||
|
||||
### Content widgets — configuring each placement
|
||||
|
||||
Open **Resources → Content widgets** (`/__admin/widgets`). The screen lists **every widget a
|
||||
@@ -1316,12 +1336,20 @@ backup they save stays on the server, where an administrator — or the platform
|
||||
download or restore it. Why: handing out the permission to keep the site safe should not also hand out
|
||||
a copy of everyone's credentials.
|
||||
|
||||
**Data in a database.** When plugins keep data for your site in a database (**§8**), a full backup carries it, and
|
||||
a backup taken while the database cannot be reached **fails** rather than leaving that data out: a backup is
|
||||
complete or it is not a backup. On restore, that data is loaded beside the live data and switched in only when all
|
||||
of it loaded; if loading fails, your site's files are still restored, the database data **stays as it was**, and the
|
||||
dashboard's **Database** card shows the failed restore (tell the operator; the detail is on their console).
|
||||
|
||||
**Restoring.** Restore **replaces your entire site** with the contents of a backup — every
|
||||
page, template, user and setting reverts to the moment the backup was taken. Because it is
|
||||
destructive, **only the site's administrators (the site superadmin, or the Administrator tier) may
|
||||
restore**; the restore controls are hidden for everyone else. You can restore either from a **saved backup** (pick it from the list) or by
|
||||
**uploading a `.zip`** you downloaded earlier. One thing does not revert: the site's **host names and base URL**
|
||||
(how visitors reach it) stay as the platform operator has set them now, whatever the backup says.
|
||||
**uploading a `.zip`** you downloaded earlier. Two things do not revert: the site's **host names and base URL**
|
||||
(how visitors reach it) stay as the platform operator has set them now, whatever the backup says; and its **logs and
|
||||
bandwidth history** stay as they are, so the audit journal keeps its record (the backup acts made here are in it,
|
||||
§3).
|
||||
|
||||
Restore is safe by design: the platform first checks the file is a genuine, complete site
|
||||
backup and only then swaps it in, in one step. **A corrupt, empty, or wrong file is rejected
|
||||
@@ -1361,7 +1389,7 @@ kind of `.zip`, restorable in the same way, with the parts that are yours alone
|
||||
| Plugin settings that are **not** secrets | Plugin secrets (blanked, so you can see what to fill in) |
|
||||
| | Hostnames and base URL (replaced with a placeholder) |
|
||||
| | Traffic figures |
|
||||
| | Plugin-held data such as form submissions |
|
||||
| | Plugin-held data such as form submissions, and everything plugins keep for your site in a database (§8) |
|
||||
| | Changes waiting for review — unpublished drafts, who submitted them, reviewers' notes |
|
||||
|
||||
The recipient restores it exactly like a backup. Their copy comes up with your content and appearance, no
|
||||
|
||||
+11
-1
@@ -50,7 +50,7 @@ contribution, a host-coupled seam that is not part of the 1.0 contract (see "Wha
|
||||
|
||||
| Type | Since | Scope | What it gives a plugin |
|
||||
|---|---|---|---|
|
||||
| `service.PluginSettings` (+ `model.SettingsView`) | 0.4.0 | plugin-scoped | its per-site settings, defaults applied, and its declared secrets decrypted (app-level settings bind through `@ConfigurationProperties("runway.plugin.<id>")`; an app-level `secret` setting in clear through `appSecret(key)`, since 1.1.0) |
|
||||
| `service.PluginSettings` (+ `model.SettingsView`) | 0.4.0 | plugin-scoped | its per-site settings, defaults applied, and its declared secrets decrypted (app-level settings bind through `@ConfigurationProperties("runway.plugin.<id>")`; an app-level `secret` setting in clear through `appSecret(key)`, since 1.1.0; an app-level setting as saved but not yet applied through `savedApp(key)`, since 1.2.0) |
|
||||
| `model.PluginInfo` | 0.4.0 | plugin-scoped | its own id, version and install facts |
|
||||
| `service.PluginLifecycle` | 0.4.0 | callback | `started(PluginInfo)` / `stopping()`, in load order and reverse |
|
||||
| `service.PluginSiteFiles` (+ `model.FileEntry`) | 0.5.0 | plugin-scoped | its own per-site subtree `sites/<id>/plugins/<pluginId>/`: atomic text writes, capped reads, listing, deletes; confined against crafted paths **and** symbolic links |
|
||||
@@ -101,6 +101,16 @@ additive rules below apply to them unchanged.
|
||||
It is a `default` method answering empty, so an implementation written against `1.0.0` still compiles. A plugin
|
||||
that calls it declares `requiresSpi: ">=1.1.0"`.
|
||||
|
||||
### What `1.2.0` added
|
||||
|
||||
- **`PluginSettings.savedApp(key)`**: the calling plugin's own **app-level** setting as it is **saved now**, which
|
||||
may differ from the running value until the restart that applies it. It answers the saved value when not blank (a
|
||||
`secret` in clear, as `appSecret` decrypts it), otherwise the declared default of a non-secret setting, otherwise
|
||||
empty; only keys the plugin declared in its own `settings:` are read, from its own settings file, on each call. It
|
||||
lets a plugin check settings before that restart: the database plugin's connection test uses it. It is a `default`
|
||||
method answering empty, so an implementation written against `1.1.0` still compiles. A plugin that calls it
|
||||
declares `requiresSpi: ">=1.2.0"`.
|
||||
|
||||
## The compatibility rules (in force from `1.0.0`)
|
||||
|
||||
The SPI is **binary API**. A plugin compiled against a released `runway-spi` keeps loading on any later version of
|
||||
|
||||
Reference in new issue
Block a user