Skip to content

Commit a3852f1

Browse files
chore: update readme (#841)
1 parent e70289b commit a3852f1

File tree

3 files changed

+45
-17
lines changed

3 files changed

+45
-17
lines changed

.env.example

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
DISABLE_ESLINT_PLUGIN=true
2+
TSC_COMPILE_ON_ERROR=true
3+
4+
REACT_APP_BACKEND=http://localhost:8765
5+
REACT_APP_META_BACKEND=undefined
6+
META_YDB_BACKEND=undefined

README.md

+38-16
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ Open http://localhost:8765 to view it in the browser.
2727
-e MON_PORT=8765 \
2828
cr.yandex/yc/yandex-docker-local-ydb:latest
2929
```
30-
2. Run the frontend app in the development mode, via invoking `npm run dev`
31-
3. Open [localhost:3000](http://localhost:3000) to view it in the browser. The page will reload if you make edits.\
30+
2. Install dependencies with `npm ci`
31+
3. Run the frontend app in the development mode, via invoking `npm run dev`
32+
4. Open [localhost:3000](http://localhost:3000) to view it in the browser. The page will reload if you make edits.\
3233
You will also see any lint errors in the console.
3334

3435
For API reference, open Swagger UI on http://localhost:8765/viewer/api/.
@@ -43,26 +44,45 @@ To test new features, you can use ydb version that is currently in testing mode
4344
or use a build from `main` brunch with `ghcr.io/ydb-platform/local-ydb:trunk` image.
4445
Also you can set specific version like `cr.yandex/yc/yandex-docker-local-ydb:23.1`
4546

46-
### Custom backend in dev mode
47+
### Custom configuration in dev mode with .env file
4748

48-
YDB docker represents a single node cluster with only one version, small amount of storage groups, PDisks and VDisks. It may be not enough for development purposes. If you have your own development cluster with sufficient amount of entities, you can run the app in the dev mode with this cluster as backend. To do it, set you host to `REACT_APP_BACKEND` variable in `dev` script. For example:
49+
You can run the app with your own params by adding `.env` file to project root. There is an example in `.env.example`.
50+
51+
1. Add `.env` file to project root by copying example
52+
53+
```shell script
54+
cp .env.example .env
55+
```
56+
57+
2. Set your own set of params in `.env`
58+
3. Run `npm run start`. Your custom params from `.env` file will be applied
59+
60+
#### Custom backend in dev mode
61+
62+
YDB docker represents a single node cluster with only one version, small amount of storage groups, PDisks and VDisks. It may be not enough for development purposes. If you have your own development cluster with sufficient amount of entities, you can run the app in the dev mode with this cluster as backend. To do it, alter `REACT_APP_BACKEND` param in your `.env` file:
4963

5064
```
51-
"dev": "DISABLE_ESLINT_PLUGIN=true TSC_COMPILE_ON_ERROR=true REACT_APP_BACKEND=http://your-cluster-host:8765 npm start"
65+
REACT_APP_BACKEND=http://your-cluster-host:8765
66+
REACT_APP_META_BACKEND=undefined
67+
META_YDB_BACKEND=undefined
5268
```
5369

54-
### Meta backend in dev mode (multi cluster)
70+
#### Meta backend in dev mode (multi cluster)
5571

56-
If you have meta backend, you can run the app in dev mode with this backend like this:
72+
If you have meta backend for multi cluster version, you can run the app in dev mode with this backend by setting `REACT_APP_META_BACKEND` param in `.env`:
5773

5874
```
59-
DISABLE_ESLINT_PLUGIN=true TSC_COMPILE_ON_ERROR=true REACT_APP_BACKEND= REACT_APP_META_BACKEND=http://your-meta-host:8765 npm start
75+
REACT_APP_BACKEND=undefined
76+
REACT_APP_META_BACKEND=http://your-meta-host:8765
77+
META_YDB_BACKEND=undefined
6078
```
6179

62-
if you need to connect to the meta backend from a server then run the app like this:
80+
If you need to connect to the meta backend from a server, you need to set `META_YDB_BACKEND` param in `.env`:
6381

6482
```
65-
DISABLE_ESLINT_PLUGIN=true TSC_COMPILE_ON_ERROR=true REACT_APP_BACKEND= REACT_APP_META_BACKEND= META_YDB_BACKEND=http://your-meta-host:8765 npm start
83+
REACT_APP_BACKEND=undefined
84+
REACT_APP_META_BACKEND=undefined
85+
META_YDB_BACKEND=http://your-meta-host:8765
6686
```
6787

6888
## E2E Tests
@@ -96,18 +116,20 @@ The build is minified and the filenames include the hashes.
96116

97117
To test production bundle with latest YDB backend release, do the following:
98118

99-
1. Build a production bundle with a few tweaks for embedded version: `npm run build:embedded`.
100-
2. Invoke `docker run -it --hostname localhost -dp 2135:2135 -p 8765:8765 -v ~/projects/ydb-embedded-ui/build:/ydb_data/node_1/contentmonitoring cr.yandex/yc/yandex-docker-local-ydb:latest`
101-
3. Open [embedded YDB UI](http://localhost:8765/monitoring) to view it in the browser.
119+
1. Install dependencies with `npm ci`
120+
2. Build a production bundle with a few tweaks for embedded version: `npm run build:embedded`.
121+
3. Invoke `docker run -it --hostname localhost -dp 2135:2135 -p 8765:8765 -v ~/projects/ydb-embedded-ui/build:/ydb_data/node_1/contentmonitoring cr.yandex/yc/yandex-docker-local-ydb:latest`
122+
4. Open [embedded YDB UI](http://localhost:8765/monitoring) to view it in the browser.
102123

103124
### Testing production bundle with specific cluster host
104125

105126
If you want to test embedded version in production mode, but YDB docker is not enough and you have your own ydb development cluster, you can manually update UI for the specific cluster host.
106127

107128
It also could be usefull for development purposes, because some operations, that are not 'read-only', like some update queries or tablets restart could be allowed by CORS only for the same origin and so could not be executed in dev mode.
108129

109-
1. Create production bundle with `npm run build:embedded`
110-
2. Copy your build files from `build` folder to `/contentmonitoring` folder on desired cluster host
111-
3. Open `http://your-cluster-host:8765/monitoring` to see updated UI
130+
1. Install dependencies with `npm ci`
131+
2. Create production bundle with `npm run build:embedded`
132+
3. Copy your build files from `build` folder to `/contentmonitoring` folder on desired cluster host
133+
4. Open `http://your-cluster-host:8765/monitoring` to see updated UI
112134

113135
It's assumed, that you have all the necessary access rights to update files on the host.

src/setupProxy.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const {createProxyMiddleware} = require('http-proxy-middleware');
33

44
module.exports = function (app) {
55
const metaYdbBackend = process.env.META_YDB_BACKEND;
6-
if (metaYdbBackend) {
6+
if (metaYdbBackend && metaYdbBackend !== 'undefined') {
77
app.use(
88
'/meta',
99
createProxyMiddleware({

0 commit comments

Comments
 (0)