forked from labring/FastGPT
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
6,045 additions
and
416 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,4 +28,5 @@ next-env.d.ts | |
platform.json | ||
testApi/ | ||
local/ | ||
.husky/ | ||
.husky/ | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Dockerfile | ||
.dockerignore | ||
node_modules | ||
npm-debug.log | ||
README.md | ||
.git | ||
|
||
.yalc/ | ||
yalc.lock | ||
testApi/ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
MONGODB_URI=mongodb://username:psw@0.0.0.0:27017/?authSource=admin | ||
MONGODB_NAME=fastgpt | ||
ADMIN_USER=username | ||
ADMIN_PASS=password | ||
ADMIN_SECRET=any | ||
VITE_PUBLIC_SERVER_URL=http://localhost:3001 # 和server.js一致 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Install dependencies only when needed | ||
FROM node:current-alpine AS builder | ||
RUN npm config set registry https://registry.npmmirror.com/ | ||
RUN apk add --no-cache libc6-compat && npm install -g pnpm | ||
RUN pnpm config set registry https://registry.npmmirror.com/ | ||
|
||
WORKDIR /app | ||
ENV NEXT_TELEMETRY_DISABLED 1 | ||
ENV VITE_PUBLIC_SERVER_URL '' | ||
# Install dependencies based on the preferred package manager | ||
COPY . . | ||
RUN \ | ||
[ -f pnpm-lock.yaml ] && pnpm install || \ | ||
(echo "Lockfile not found." && exit 1) | ||
|
||
RUN pnpm build | ||
|
||
# Production image, copy all the files and run next | ||
FROM node:current-alpine AS runner | ||
WORKDIR /app | ||
|
||
ENV NODE_ENV production | ||
ENV NEXT_TELEMETRY_DISABLED 1 | ||
|
||
RUN addgroup --system --gid 1001 nodejs | ||
RUN adduser --system --uid 1001 nextjs | ||
|
||
RUN sed -i 's/https/http/' /etc/apk/repositories | ||
RUN apk add curl \ | ||
&& apk add ca-certificates \ | ||
&& update-ca-certificates | ||
|
||
COPY package.json pnpm-lock.yaml* ./ | ||
COPY --from=builder /app/server.js ./server.js | ||
COPY --from=builder /app/service ./service | ||
COPY --from=builder /app/dist ./dist | ||
|
||
RUN npm config set registry https://registry.npmmirror.com/ | ||
RUN npm install -g pnpm | ||
RUN pnpm config set registry https://registry.npmmirror.com/ | ||
RUN pnpm install --prod | ||
RUN npm remove -g pnpm | ||
|
||
ENV PORT=3001 | ||
|
||
EXPOSE 3001 | ||
|
||
CMD ["node", "server.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,41 @@ | ||
## fastgpt-admin | ||
原作地址:https://github.com/c121914yu/FastGPT/ | ||
# FastGpt Admin | ||
|
||
## 项目原理 | ||
使用tushan项目做前端,然后构造了一个与mongodb做沟通的API做后端,可以做到创建、修改和删除用户 | ||
|
||
## 使用方法 | ||
1. 修改根目录下的server.js文件中的mongodb数据库连接地址。 | ||
2. pnpm i && pnpm dev | ||
3. 默认账号密码为tushan | ||
使用 tushan 项目做前端,然后构造了一个与 mongodb 做沟通的 API 做后端,可以做到创建、修改和删除用户 | ||
|
||
## 开发 | ||
|
||
## 可能会有的功能 | ||
1. 对接数据库中的其他数据 | ||
2. tokens充值功能 | ||
1. 复制 .env.template 文件,添加环境变量 | ||
2. pnpm i | ||
3. pnpm dev | ||
|
||
## 部署 | ||
|
||
1. 本地打包 | ||
|
||
`docker build -t registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-admin:latest . --network host --build-arg HTTP_PROXY=http://127.0.0.1:7890 --build-arg HTTPS_PROXY=http://127.0.0.1:7890` | ||
|
||
2. 直接拉镜像: `registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-admin:latest` | ||
3. 部署时候填写环境变量: 数据库同 FastGpt 一致 | ||
|
||
``` | ||
MONGODB_URI=mongodb://username:psw@0.0.0.0:27017/?authSource=admin | ||
MONGODB_NAME=fastgpt | ||
ADMIN_USER=username | ||
ADMIN_PASS=password | ||
ADMIN_SECRET=any | ||
VITE_PUBLIC_SERVER_URL=http://localhost:3001 # 和server.js一致 | ||
``` | ||
|
||
## sealos 部署 | ||
|
||
1. 进入 sealos 官网: https://cloud.sealos.io/ | ||
2. 打开 App Launchpad(应用管理) 工具 | ||
3. 新建应用 | ||
1. 镜像名: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-admin:latest | ||
2. 容器端口: 3001 | ||
3. 环境变量: 参考上面 | ||
4. 打开外网访问开关 | ||
4. 点击部署。 完成后大约等待 1 分钟, | ||
5. 点击 sealos 提供的外网访问地址,可以直接访问。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.