The safest way to develop and run this repository is via the Docker container. Because we will create a predictable environment using Docker images with nodeJS in the version that this app was developed. And for that you need to have VSCode installed. And then you can use the remote access feature built into VSCode in the "ms-vscode-remote.remote-containers" extension.
Follow the step by step:
- Install Docker locally and VSCode.
- Install Docker extension, and Dev Containers extension in VsCode.
- Run
docker-compose upin the path of this repository. - Click on "Remote Explorer" on the side of your VSCode.
- In the Dropdown menu choose "Containers". It will display all running and stopped containers.
- Right click on the
devcontainer — listed as<folder>-dev-1, soratel-dev-1if you cloned intoratel— and click on "Attach to Container". In 1 minute or less, remote access is set up. - Open a terminal in the container and run
./dev/run.sh, which installs the dependencies and starts the dev server.
If you would rather run the steps yourself, note both of these, because the obvious commands do not work:
cd client # package.json lives here, not at the repository root
npm ci --legacy-peer-deps # not npm install, and the flag is required — see below
npm run startnpm ci installs the versions in package-lock.json, which are the ones CI builds and tests with.
npm install is free to pick newer minors, and at the time of writing that resolves a
react-draggable whose .mjs build webpack cannot resolve, so the bundle fails to compile — while
the dev server still starts and serves a page, which makes it a confusing way to fail. npm install
also rewrites package-lock.json, which is easy to commit by mistake.
--legacy-peer-deps is required rather than optional: the tree holds React 18 while
@wojtekmaj/enzyme-adapter-react-17 asks for React 17, so a bare npm ci stops with ERESOLVE and
installs nothing. dev/run.sh and CI pass the same flag.
Docker will forward the port. It will automatically run the Dashboard in your browser. And you can choose to use VSCode locally or in Container. But it's important to leave that connection open. Both Local and Remote windows in the container you can write. As long as the connection is open, writing is bound.
go install github.com/dgraph-io/ratel@latestYou may see errors when you run the above command:
# github.com/dgraph-io/ratel/server
go/src/github.com/dgraph-io/ratel/server/server.go:99:13: undefined: Asset
go/src/github.com/dgraph-io/ratel/server/server.go:107:13: undefined: Asset
go/src/github.com/dgraph-io/ratel/server/server.go:112:15: undefined: AssetInfo
go/src/github.com/dgraph-io/ratel/server/server.go:154:14: undefined: Asset
go/src/github.com/dgraph-io/ratel/server/server.go:160:16: undefined: AssetInfo
These errors can be ignored at this stage.
# Build ratel
# NOTE: ratel needs to be in your GOPATH for this to work.
cd go/src/github.com/dgraph-io/ratel/
./scripts/build.prod.sh
# Start the ratel server.
./build/ratel
# Visit localhost:8000 to use ratel.cd client/
npm cache clean --force
npm install --legacy-peer-deps --no-optional
npm start
# Visit localhost:3000 to use ratel.make buildexport DGRAPH_VERSION=latestunset USE_DOCKER
pushd client && run npm cache clean --force && npm install --legacy-peer-deps --no-optional && popd # node_modules
make testexport USE_DOCKER=1
make testFormatting is enforced by Trunk, configured in
.trunk/trunk.yaml. Trunk routes each file type to a formatter:
- JS / JSX / JSON → Biome, configured in
.trunk/configs/biome.json - SCSS / CSS / Markdown / YAML → Prettier, configured in
.trunk/configs/.prettierrc
For JS this repo's Biome config is 2-space indent, single quotes, and no semicolons — which differs from Biome's out-of-the-box defaults (tabs, double quotes, semicolons). So format through the repo config rather than an editor's bundled formatter, or you'll churn every file you touch and fail CI:
cd client/
npm run lint # runs `trunk fmt` against the repo configIf your editor formats on save, point its Biome/Prettier integration at the configs under
.trunk/configs/ (the Trunk VSCode extension does this automatically), or turn format-on-save off
and rely on npm run lint.
./scripts/build.prod.sh
# Or if you want to override version:
./scripts/build.prod.sh --version 20.04.1By default Ratel will serve the UI over HTTP. You can switch to serve the UI with only HTTPS by
setting the -tls_crt and -tls_key flags with the certificate and key files used to establish the
HTTPS connection.
./build/ratel -tls_crt example.crt -tls_key example.keyWhen hosting Ratel behind a reverse proxy under a subpath (e.g. https://example.com/ratel/), set
the -url-prefix flag (or the RATEL_URL_PREFIX environment variable) so the UI and its static
assets are served under that prefix:
./build/ratel -url-prefix /ratel
# or
RATEL_URL_PREFIX=/ratel ./build/ratelWith a prefix set, all routes move under the prefix (/ratel/, /ratel/static/...), requests to
the bare prefix (/ratel) redirect to /ratel/, asset URLs in the served index.html are
rewritten to include the prefix, and any path outside the prefix returns a 404 pointing at the
prefix. The flag value is normalized to have a leading slash and no trailing slash.