Initial release (#279)

* Ensure config is loaded before compiling Escript dependencies

* Update README

* Add CHANGELOG

* Update mix.exs

* Increase timeout for mix standalone test

* Add package info to mix.exs

* Update README.md

Co-authored-by: José Valim <jose.valim@dashbit.co>

Co-authored-by: José Valim <jose.valim@dashbit.co>
This commit is contained in:
Jonatan Kłosko 2021-05-19 23:30:53 +02:00 committed by GitHub
parent 889503ad68
commit 1e4200e338
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 70 additions and 28 deletions

5
CHANGELOG.md Normal file
View file

@ -0,0 +1,5 @@
# Changelog
## v0.1.0 (2021-05-19)
* Initial release

View file

@ -27,19 +27,6 @@ The current version provides only the initial step of our Livebook vision. Our p
We provide several distinct methods of running Livebook,
pick the one that best fits your use case.
### Mix
You can run latest Livebook directly with Mix.
```shell
git clone https://github.com/elixir-nx/livebook.git
cd livebook
mix deps.get --only prod
# Run the Livebook server
MIX_ENV=prod mix phx.server
```
You will need [Elixir v1.12](https://elixir-lang.org/install.html) or later.
### Escript
@ -48,20 +35,20 @@ Running Livebook using Escript makes for a very convenient option
for local usage and provides easy configuration via CLI options.
```shell
# Currently you need to build the Escript manually,
# we will publish it to Hex once we release the first version
git clone https://github.com/elixir-nx/livebook.git
cd livebook
mix deps.get --only prod
MIX_ENV=prod mix escript.build
mix escript.install hex livebook
# Start the Livebook server
./livebook server
livebook server
# See all the configuration options
./livebook server --help
livebook server --help
```
After you install the escript, make sure you add the directory where
Elixir keeps escripts to your [$PATH](https://en.wikipedia.org/wiki/PATH_(variable)).
If you installed Elixir with `asdf`, you'll need to run `asdf reshim elixir`.
once the Escript is built.
### Docker
Running Livebook using Docker is a great option for cloud deployments
@ -82,6 +69,19 @@ docker run -p 8080:8080 -u $(id -u):$(id -g) -v <LOCAL_DIR>:/data livebook/liveb
docker run -p 8080:8080 -e LIVEBOOK_PASSWORD="securesecret" livebook/livebook
```
### Mix
You can run latest Livebook directly with Mix.
```shell
git clone https://github.com/elixir-nx/livebook.git
cd livebook
mix deps.get --only prod
# Run the Livebook server
MIX_ENV=prod mix phx.server
```
### Security considerations
Livebook is built to document and execute code. Anyone with access to a Livebook instance will be able to access any file and execute any code in the machine Livebook is running.
@ -111,6 +111,23 @@ The following environment variables configure Livebook:
* LIVEBOOK_SECRET_KEY_BASE - sets a secret key that is used to sign and encrypt the session and other payloads used by Livebook. Must be at least 64 characters long and it can be generated by commands such as: 'openssl rand -base64 48'. Defaults to a random secret on every boot.
## Development
Livebook is primarily a Phoenix web application and can be setup as such:
```shell
git clone https://github.com/elixir-nx/livebook.git
cd livebook
mix deps.get
# Run the Livebook server
mix phx.server
# To test escript
MIX_ENV=prod mix escript.build
./livebook server
```
<!-- Environment variables -->
## License

30
mix.exs
View file

@ -1,18 +1,24 @@
defmodule Livebook.MixProject do
use Mix.Project
@version "0.1.0"
@description "Interactive and collaborative code notebooks - made with Phoenix LiveView"
def project do
[
app: :livebook,
version: "0.1.0",
version: @version,
elixir: "~> 1.12",
name: "Livebook",
description: @description,
elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:phoenix] ++ Mix.compilers(),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps(),
escript: escript(),
releases: releases()
releases: releases(),
package: package()
]
end
@ -48,18 +54,23 @@ defmodule Livebook.MixProject do
[
"dev.setup": ["deps.get", "cmd npm install --prefix assets"],
"dev.build": ["cmd npm run deploy --prefix ./assets"],
"format.all": ["format", "cmd npm run format --prefix ./assets"]
"format.all": ["format", "cmd npm run format --prefix ./assets"],
# TODO: loadconfig no longer required on Elixir v1.13
# Currently this ensures we load configuration before
# compiling dependencies as part of `mix escript.install`.
# See https://github.com/elixir-lang/elixir/commit/a6eefb244b3a5892895a97b2dad4cce2b3c3c5ed
"escript.build": ["loadconfig", "escript.build"]
]
end
defp escript() do
defp escript do
[
main_module: LivebookCLI,
app: nil
]
end
defp releases() do
defp releases do
[
livebook: [
include_executables_for: [:unix],
@ -67,4 +78,13 @@ defmodule Livebook.MixProject do
]
]
end
def package do
[
licenses: ["Apache-2.0"],
links: %{
"GitHub" => "https://github.com/elixir-nx/livebook"
}
]
end
end

View file

@ -11,8 +11,8 @@ defmodule Livebook.Runtime.MixStandaloneTest do
ref = emitter.ref
# Wait for the Mix setup to finish and for node initialization
assert_receive {:emitter, ^ref, {:output, "Running mix deps.get...\n"}}, 5_000
assert_receive {:emitter, ^ref, {:ok, runtime}}, 5_000
assert_receive {:emitter, ^ref, {:output, "Running mix deps.get...\n"}}, 8_000
assert_receive {:emitter, ^ref, {:ok, runtime}}, 8_000
Runtime.connect(runtime)
%{node: node} = runtime