Skip to content

Commit 1a87118

Browse files
committed
Improved documentation
1 parent 454f4d1 commit 1a87118

File tree

7 files changed

+99
-96
lines changed

7 files changed

+99
-96
lines changed

docs/development/dependencies.md

Lines changed: 0 additions & 12 deletions
This file was deleted.

docs/development/docs.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
# Documentation
22

3-
**in progress**
3+
Here are the instructions to serve the documentation on localhost:8001:
4+
5+
```bash
6+
python -m venv venv
7+
source venv/bin/activate
8+
python -m pip install -r docs/doc-requirements.txt
9+
mkdocs serve --dev-addr localhost:8001
10+
```

docs/development/index.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
Here are some useful details for `fractal-web` developments:
44

5+
* [Development setup](setup.md)
56
* [Code-base structure](structure.md)
6-
* [External dependencies](dependencies.md)
7-
* [Tests](tests.md)
7+
* [Testing](tests.md)
88
* [Documentation](docs.md)
99
* [Precommit](precommit.md)
10-
* [JSON Schema component](json_schemas.md)
1110
* [Release](release.md)

docs/development/json_schemas.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/development/setup.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Development setup
2+
3+
## Install node
4+
5+
Versions 18 or 20 of Node.js are recommended. See the [quickstart](../quickstart.md) for more details about how to install node.
6+
7+
## Install fractal-web from git repository
8+
9+
Clone this repository
10+
```bash
11+
git clone https://github.com/fractal-analytics-platform/fractal-web.git
12+
cd fractal-web
13+
```
14+
then optionally checkout to a specific version tag
15+
```
16+
git checkout v0.6.0
17+
```
18+
and finally install via
19+
```bash
20+
npm install
21+
```
22+
23+
## Set environment variables
24+
25+
To properly run fractal-web you have to configure some environment variables. The [environment variables page](../environment-variables.md) contains the complete list of supported environment variables and their default values. It also includes some troubleshooting infomation about errors related to environment variables misconfiguration.
26+
27+
When running the application from the git repository, environment variables are set either in `.env` or `.env.development` files, see
28+
[vite documentation](https://vitejs.dev/guide/env-and-mode.html#env-files)
29+
(briefly: `.env.development` is the relevant file when using `npm run dev` and `.env` is the relevant file when using `npm run preview`).
30+
31+
You can also add your customizations in a file named `.env.local` or `.env.development.local` to avoid writing on env files that are under version control.
32+
33+
## Run fractal-web from git repo
34+
35+
For development, run the client application via
36+
37+
```bash
38+
npm run dev
39+
```
40+
41+
The application will run at `http://localhost:5173`.
42+
43+
To test a production build, first execute
44+
45+
```bash
46+
npm run build
47+
```
48+
49+
And then
50+
51+
```bash
52+
npm run preview
53+
```
54+
55+
Also in this case the application runs at `http://localhost:5173`.

docs/environment-variables.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,30 @@ The following environment variables can be used to configure fractal-web.
1515
* `PUBLIC_OAUTH_CLIENT_NAME`: if set, the application enables the external account login via OAuth2; the name is used to create the authorization call sent to fractal-server;
1616
* `LOG_FILE`: the path of the file where logs will be written; by default is unset and no file will be created;
1717
* `LOG_LEVEL_FILE`: the log level of logs that will be written to the file; the default value is `info`;
18-
* `LOG_LEVEL_CONSOLE`: the log level of logs that will be written to the console; the default value is `warn`;
18+
* `LOG_LEVEL_CONSOLE`: the log level of logs that will be written to the console; the default value is `warn`.
19+
20+
When running directly using `node` command these extra variables can also be configured:
21+
22+
* `PORT`: specifies the port where Svelte server will run; the default value is 5173;
23+
* `ORIGIN` the URL where the app will be served (e.g. http://localhost:5173).
24+
25+
## Common issues related to environment variables
26+
27+
The `node` command relies on some extra environment variables, and especially on `ORIGIN`:
28+
29+
> HTTP doesn't give SvelteKit a reliable way to know the URL that is currently
30+
> being requested. The simplest way to tell SvelteKit where the app is being
31+
> served is to set the `ORIGIN` environment variable
32+
> (see [SvelteKit node servers documentation](https://kit.svelte.dev/docs/adapter-node#environment-variables-origin-protocolheader-hostheader-and-port-header)).
33+
> A wrong origin value will result in the error message "Cross-site POST form submissions are forbidden".
34+
35+
Unexpected behaviors can be related to wrong values of the `AUTH_COOKIE_DOMAIN` variable:
36+
37+
> A typical gotcha: if there is a mismatch between the cookie domain and the
38+
> URL you are using (e.g. one points to localhost and the other one to
39+
> 127.0.0.1), then the cookie won't be set and this will fail silently,
40+
> therefore likely triggering other unexpected behaviors.
41+
> If you leave the `AUTH_COOKIE_DOMAIN` empty, the cookie domain will be
42+
> inferred from the HTTP call. This is useful to avoid domain mismatch issues
43+
> during testing and development, but in production is suggested to set it as
44+
> the name of the domain where the fractal-web server is running.

docs/quickstart.md

Lines changed: 7 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Quickstart instructions
22

3+
> This page describes how to install fractal-web from release packages. If you need to install it from the git repository see the [development setup page](./development/setup.md).
4+
35
## Install node
46

57
Versions 18 or 20 of Node.js are recommended (check your version with `node
@@ -14,11 +16,7 @@ nvm install 18
1416
nvm alias default 18
1517
```
1618

17-
## Install fractal-web
18-
19-
There are 2 ways to install fractal-web: from release packages (more suited for production and testing) and from git repository (more suited for development).
20-
21-
### Install fractal-web from release packages
19+
## Install fractal-web from release packages
2220

2321
Starting from version 1.1.0, fractal-web releases provide tar.gz files containing the built files for each supported node version. You can install these packages with the following command:
2422

@@ -30,60 +28,17 @@ FRACTAL_WEB_VERSION=1.1.0 && NODE_MAJOR_VERSION=20 && wget -qO- "https://github.
3028

3129
To start the application installed in this way see the section "Run fractal-web from the build folder".
3230

33-
### Install fractal-web from git repository
34-
35-
Clone this repository
36-
```bash
37-
git clone https://github.com/fractal-analytics-platform/fractal-web.git
38-
cd fractal-web
39-
```
40-
then optionally checkout to a specific version tag
41-
```
42-
git checkout v0.6.0
43-
```
44-
and finally install via
45-
```bash
46-
npm install
47-
```
48-
4931
## Set environment variables
5032

51-
To properly run fractal-web you have to configure some environment variables. The [environment variables page](./environment-variables.md) contains the complete list of supported environment variables and their default values.
52-
53-
If you want to run the application executing `node` in the `build` folder you have to export the environment variables in your shell. See the section "Run fractal-web from the build folder" for more details.
54-
55-
When running the application from the git repository, environment variables are set either in `.env` or `.env.development` files, see
56-
[vite documentation](https://vitejs.dev/guide/env-and-mode.html#env-files)
57-
(briefly: `.env.development` is the relevant file when using `npm run dev` and `.env` is the relevant file when using `npm run preview`).
58-
59-
You can also add your customizations in a file named `.env.local` or `.env.development.local` to avoid writing on env files that are under version control.
60-
61-
### Common issues related to environment variables
62-
63-
The `node` command relies on some extra environment variables, and especially on `ORIGIN`:
64-
65-
> HTTP doesn't give SvelteKit a reliable way to know the URL that is currently
66-
> being requested. The simplest way to tell SvelteKit where the app is being
67-
> served is to set the `ORIGIN` environment variable
68-
> (see [SvelteKit node servers documentation](https://kit.svelte.dev/docs/adapter-node#environment-variables-origin-protocolheader-hostheader-and-port-header)).
69-
> A wrong origin value will result in the error message "Cross-site POST form submissions are forbidden".
70-
71-
Unexpected behaviors can be related to wrong values of the `AUTH_COOKIE_DOMAIN` variable:
33+
To properly run fractal-web you have to configure some environment variables. The [environment variables page](./environment-variables.md) contains the complete list of supported environment variables and their default values. It also includes some troubleshooting infomation about errors related to environment variables misconfiguration.
7234

73-
> A typical gotcha: if there is a mismatch between the cookie domain and the
74-
> URL you are using (e.g. one points to localhost and the other one to
75-
> 127.0.0.1), then the cookie won't be set and this will fail silently,
76-
> therefore likely triggering other unexpected behaviors.
77-
> If you leave the `AUTH_COOKIE_DOMAIN` empty, the cookie domain will be
78-
> inferred from the HTTP call. This is useful to avoid domain mismatch issues
79-
> during testing and development, but in production is suggested to set it as
80-
> the name of the domain where the fractal-web server is running.
35+
If you want to run the application executing `node` in the `build` folder you have to export the environment variables in your shell. The following section provides an example on how to do that with a script.
8136

8237
## Run fractal-web from the build folder
8338

8439
You can create a script with the following content to run fractal-web installed from a release package:
8540

86-
```commandline
41+
```bash
8742
#!/bin/sh
8843

8944
export FRACTAL_SERVER_HOST=http://localhost:8000
@@ -112,30 +67,6 @@ node build/
11267

11368
**Note**: starting from Node 20 you can also load the environment variables from a file using the `--env-file` flag:
11469

115-
```commandline
116-
node --env-file=.env build
117-
```
118-
119-
## Run fractal-web from git repo
120-
121-
For development, run the client application via
122-
12370
```bash
124-
npm run dev
125-
```
126-
127-
The application will run at `http://localhost:5173`.
128-
129-
To test a production build, first execute
130-
131-
```bash
132-
npm run build
133-
```
134-
135-
And then
136-
137-
```bash
138-
npm run preview
71+
node --env-file=.env build
13972
```
140-
141-
Also in this case the application runs at `http://localhost:5173`.

0 commit comments

Comments
 (0)