This is the reference implementation of the Kvarn server library, offering a simple config to get you started using Kvarn.
See
moella --help
for config options
It's e.g. currently used by my domains icelk.dev and kvarn.org.
See kvarn.org for an example config and the schema of the config. You can also take a look at the icelk.dev config for a production example.
First install moella
.
Next, create a config file, let's say host.ron
:
(
hosts: [
Plain (
name: "my-website.com",
pk: "pk.pem",
cert: "cert.pem",
auto_cert: true,
path: "./",
extensions: ["arbetrary-name"],
options: (
public_data_directory: "build",
disable_server_cache: true,
disable_client_cache: false,
)
),
],
extensions: {
"arbetrary-name": [
// most of this can be removed; it's just an example
Csp ({
"/*": FromDefault ({
script_src: [UnsafeInline, WasmUnsafeEval],
style_src: [
Uri("https://fonts.googleapis.com"),
Uri("https://fonts.googleapis.com"),
UnsafeInline,
],
default_src: [ Uri("https://fonts.gstatic.com") ],
img_src: [Uri("*"), Scheme("data:")]
}),
// SVG XSS attacks if viewing file
"/groups/logo-images/*": FromDefault ({}),
}),
ClientCache ({
"/": MaxAge(3600),
"/_app/immutable/": Full,
"/groups/logo-images/": Changing,
"/groups/data": Changing,
"/groups/locations": Changing,
}),
]
},
import: [/* some other config file */],
ports: Standard(All),
)
Now, run moella -c host.ron --dev
. Your website should be working. Remove the --dev
flag when deploying.
See kvarn.org for more details.
If you have cargo
installed, simply run cargo install moella
.
There are builds available for Linux in Github Actions, and for other platforms under Releases.
To run it, download the binary appropriate for your platform.
- Platform specifics:
- If you run Linux: run
chmod +x <downloaded binary>
to make it executable. - If you run macOS: run
chmod +x <downloaded binary>
, then open Finder and find the binary. Right click and clickOpen
. Accept the warning. - On Windows, it should just run
- If you run Linux: run
- Lastly, run the command
./<downloaded binary> --help
in your shell to get usage information.
Install Rust and then run the following:
**If you're on macOS or Windows, you need to add --no-default-features -F bin
.
$ cargo install moella
During development, Mölla requires
Kvarn to be cloned at ../kvarn
,
Kvarn Search at ../kvarn-search
,
and Kvarn Auth at ../kvarn-auth
.