You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
(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`.
Copy file name to clipboardExpand all lines: docs/environment-variables.md
+27-1Lines changed: 27 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,4 +15,30 @@ The following environment variables can be used to configure fractal-web.
15
15
*`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;
16
16
*`LOG_FILE`: the path of the file where logs will be written; by default is unset and no file will be created;
17
17
*`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.
> 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
+
3
5
## Install node
4
6
5
7
Versions 18 or 20 of Node.js are recommended (check your version with `node
@@ -14,11 +16,7 @@ nvm install 18
14
16
nvm alias default 18
15
17
```
16
18
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
22
20
23
21
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:
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
-
49
31
## Set environment variables
50
32
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
(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.
72
34
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.
81
36
82
37
## Run fractal-web from the build folder
83
38
84
39
You can create a script with the following content to run fractal-web installed from a release package:
85
40
86
-
```commandline
41
+
```bash
87
42
#!/bin/sh
88
43
89
44
export FRACTAL_SERVER_HOST=http://localhost:8000
@@ -112,30 +67,6 @@ node build/
112
67
113
68
**Note**: starting from Node 20 you can also load the environment variables from a file using the `--env-file` flag:
114
69
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
-
123
70
```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
139
72
```
140
-
141
-
Also in this case the application runs at `http://localhost:5173`.
0 commit comments