897d5670a3
The current build of livebook does not work with the new [Livebook Teams](https://livebook.dev/teams/) features. The problem can be observed by running the current version of livebook, adding a new team and going to the team page. The process will crash and the team page will show a 500 error. The base of the problem is that the escript build method is not officially supported. This commit changes the livebook package to use the `mix release` workflow, which is also the one used to build the official Docker container. Unfortunately, the binary built with `mix release` does not support command line arguments like the `escript` binary does. Instead, users need to pass in most of the configuration as environment variables, as documented [here](https://hexdocs.pm/livebook/readme.html#environment-variables). As a result, this commit also changes the Livebook service to reflect this new way of configuring Livebook. Finally, the Livebook release configuration specifically excludes the ERTS (Erlang Runtime System), which means that the resulting release cannot run without Erlang installed. I have tested the results (both of the package and the service) locally.
56 lines
1.7 KiB
Markdown
56 lines
1.7 KiB
Markdown
# Livebook {#module-services-livebook}
|
|
|
|
[Livebook](https://livebook.dev/) is a web application for writing
|
|
interactive and collaborative code notebooks.
|
|
|
|
## Basic Usage {#module-services-livebook-basic-usage}
|
|
|
|
Enabling the `livebook` service creates a user
|
|
[`systemd`](https://www.freedesktop.org/wiki/Software/systemd/) unit
|
|
which runs the server.
|
|
|
|
```
|
|
{ ... }:
|
|
|
|
{
|
|
services.livebook = {
|
|
enableUserService = true;
|
|
environment = {
|
|
LIVEBOOK_PORT = 20123;
|
|
LIVEBOOK_PASSWORD = "mypassword";
|
|
};
|
|
# See note below about security
|
|
environmentFile = "/var/lib/livebook.env";
|
|
};
|
|
}
|
|
```
|
|
|
|
::: {.note}
|
|
|
|
The Livebook server has the ability to run any command as the user it
|
|
is running under, so securing access to it with a password is highly
|
|
recommended.
|
|
|
|
Putting the password in the Nix configuration like above is an easy way to get
|
|
started but it is not recommended in the real world because the resulting
|
|
environment variables can be read by unprivileged users. A better approach
|
|
would be to put the password in some secure user-readable location and set
|
|
`environmentFile = /home/user/secure/livebook.env`.
|
|
|
|
:::
|
|
|
|
The [Livebook
|
|
documentation](https://hexdocs.pm/livebook/readme.html#environment-variables)
|
|
lists all the applicable environment variables. It is recommended to at least
|
|
set `LIVEBOOK_PASSWORD` or `LIVEBOOK_TOKEN_ENABLED=false`.
|
|
|
|
### Extra dependencies {#module-services-livebook-extra-dependencies}
|
|
|
|
By default, the Livebook service is run with minimum dependencies, but
|
|
some features require additional packages. For example, the machine
|
|
learning Kinos require `gcc` and `gnumake`. To add these, use
|
|
`extraPackages`:
|
|
|
|
```
|
|
services.livebook.extraPackages = with pkgs; [ gcc gnumake ];
|
|
```
|