Skip to content

Commit

Permalink
[#1624] improve(web): modified the usage document of web (#1626)
Browse files Browse the repository at this point in the history
### What changes were proposed in this pull request?

Modified the usage document of web.

### Why are the changes needed?

Fix: #1624
Fix: #1623

### Does this PR introduce _any_ user-facing change?

N/A

### How was this patch tested?

N/A
  • Loading branch information
ch3yne authored Feb 1, 2024
1 parent d0b7602 commit 3a97a4a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 26 deletions.
39 changes: 14 additions & 25 deletions web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@

# Gravitino Web UI

> **ℹ️ Tips**
>
> Under normal circumstances, you only need to visit [http://localhost:8090](http://localhost:8090) if you're just using the web UI to manage the Gravitino.
>
> You don't need to start the web development mode. If you need to modify the web part of the code, you can refer to the following document content for development and testing.
---

> **⚠️ Important**
>
> Before running commands, you must ensure that you are in the front-end directory `gravitino/web`. If not, run `cd web` first.
Expand All @@ -24,7 +32,7 @@

> **TIP**
>
> You should use the Pnpm package manager.
> You should use the `pnpm` package manager.
>
> **Requirements**
>
Expand Down Expand Up @@ -75,34 +83,15 @@ pnpm format

## Self-hosting deployment

### Node.js server

You can deploy Next.js to any hosting provider that supports Node.js. Make sure your `package.json` has the `build` and `start` scripts:

```json
{
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
}
}
```

`pnpm build` builds the production application in the `.next` folder. After building, `pnpm start` starts a Node.js server that supports hybrid pages, serving both statically generated and server-side rendered pages.
### Static HTML export

```bash
pnpm build
pnpm start
pnpm dist
```

### Static HTML export

The command `next export` allows you to export your app to static HTML, which runs standalone without the need for a Node.js server.

`next export` will generate a `dist` directory, producing content for any static hosting service.
The command `pnpm dist` allows you to export your app to static HTML, which runs standalone without the need for a Node.js server.

The command `pnpm dist` copies the files within the 'dist' directory to the root directory of the static server.
`pnpm dist` will generate a `dist` directory, producing content for any static hosting service.

## Docker

Expand All @@ -123,7 +112,7 @@ docker run -it -p 3000:3000 -v ${PWD}:/web -w /web --name gravitino-web node:20-
docker run -p 3000:3000 -v ${PWD}:/web --name gravitino-web node:20-slim /bin/bash -c "pnpm install && pnpm dist"
```

This command runs `pnpm install` to install the dependencies specified in the `package.json` file and then runs `pnpm export` to export a static version of the application.
This command runs `pnpm install` to install the dependencies specified in the `package.json` file and then runs `pnpm dist` to export a static version of the application.
The exported files are saved to the `dist` directory inside the container, and mounted in the `dist` directory in the current directory of the host machine.
This means that the exported files are accessible on the host machine after running the command.

Expand Down
1 change: 0 additions & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"scripts": {
"analyze": "env-cmd -f .env.analyze pnpm build",
"dev": "next dev --turbo",
"server": "next dev --turbo",
"build": "pnpm format && next build",
"dist": "env-cmd -f .env.static pnpm build",
"start": "next start",
Expand Down

0 comments on commit 3a97a4a

Please sign in to comment.