Skip to content

Commit

Permalink
Merge pull request #170 from Dogtiti/refactor/docker
Browse files Browse the repository at this point in the history
fix: refactor docker
  • Loading branch information
Dogtiti authored May 18, 2023
2 parents 1e8aa5e + 4e1101a commit 78055a6
Show file tree
Hide file tree
Showing 16 changed files with 343 additions and 123 deletions.
20 changes: 16 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,27 @@ NODE_ENV=development

# Next Auth config:
# Generate a secret with `openssl rand -base64 32`, or visit https://generate-secret.vercel.app/
NEXTAUTH_SECRET=changeme
NEXTAUTH_SECRET=***
NEXTAUTH_URL=http://localhost:3000

# Prisma
DATABASE_URL=file:./db.sqlite

# External APIs:
OPENAI_API_KEY=changeme
OPENAI_API_KEY=***

# Guest Mode:
//The key NEXT_PUBLIC_GUEST_KEY should be in this format: abc,qwe,123, where each comma-separated value can be used
NEXT_PUBLIC_GUEST_KEY=changeme
The key NEXT_PUBLIC_GUEST_KEY should be in this format: abc,qwe,123, where each comma-separated value can be used
NEXT_PUBLIC_GUEST_KEY=***

# Websearch. Fill both of these values to enable it locally
NEXT_PUBLIC_WEB_SEARCH_ENABLED=false # Disables the ability to toggle web search
SERP_API_KEY=*** # https://serper.dev/ for an API key

# Auth providers. Required to enable sign in, in production. Development mode uses local auth.
GOOGLE_CLIENT_ID=***
GOOGLE_CLIENT_SECRET=***
GITHUB_CLIENT_ID=***
GITHUB_CLIENT_SECRET=***
DISCORD_CLIENT_SECRET=***
DISCORD_CLIENT_ID=***
14 changes: 12 additions & 2 deletions .github/workflows/build-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,20 @@ jobs:
uses: docker/build-push-action@v4
with:
context: .
file: prod.Dockerfile
build-args: |
NEXTAUTH_URL=http://localhost:3000
DATABASE_URL=file:../db/db.sqlite
SKIP_ENV_VALIDATION=1
DATABASE_URL=file:./db.sqlite
OPENAI_API_KEY: ${OPENAI_API_KEY}
NEXT_PUBLIC_WEB_SEARCH_ENABLED: ${NEXT_PUBLIC_WEB_SEARCH_ENABLED}
SERP_API_KEY: ${SERP_API_KEY}
NEXT_PUBLIC_FF_AUTH_ENABLED: ${NEXT_PUBLIC_FF_AUTH_ENABLED}
GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID}
GOOGLE_CLIENT_SECRET: ${GOOGLE_CLIENT_SECRET}
GITHUB_CLIENT_ID: ${GITHUB_CLIENT_ID}
GITHUB_CLIENT_SECRET: ${GITHUB_CLIENT_SECRET}
DISCORD_CLIENT_ID: ${DISCORD_CLIENT_ID}
DISCORD_CLIENT_SECRET: ${DISCORD_CLIENT_SECRET}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
42 changes: 0 additions & 42 deletions Dockerfile

This file was deleted.

16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ One-Click to deploy well-designed AutoGPT-Next-Web web UI on Vercel.
- [ ] 5. Add support for WeChat login

## Business Version
During the period of maintaining open source projects, many friends came to consult about customizing the system. Considering that there may be more friends who have similar needs, we decided to start the internal test plan of the commercial version~
* plan support -
User login system, billing system, charging system, etc., so that everyone can directly deploy a charged version of AutoGPT, and can directly obtain income
* way of participation -
To pre-order the commercial version and view the details of the commercial version plan, please click the link below [AutoGPT-Next-Web Business Vision](https://egqz2y6eul.feishu.cn/docx/PxoMd7LGfoobAixiuWacxRWQnNd)

During the period of maintaining open source projects, many friends came to consult about customizing the system. Considering that there may be more friends who have similar needs, we decided to start the internal test plan of the commercial version~

- plan support -
User login system, billing system, charging system, etc., so that everyone can directly deploy a charged version of AutoGPT, and can directly obtain income
- way of participation -
To pre-order the commercial version and view the details of the commercial version plan, please click the link below [AutoGPT-Next-Web Business Vision](https://egqz2y6eul.feishu.cn/docx/PxoMd7LGfoobAixiuWacxRWQnNd)

## Get Started

Expand All @@ -66,15 +68,15 @@ A: The project originated from AgentGPT. Our goal is to continuously provide use
The easiest way to run AutoGPT-Next-Web locally is by using docker.

```bash
docker-compose -f docker-compose-local.yml up -d --remove-orphans
docker-compose -f docker-compose.dev.yml up -d --remove-orphans
```

### Docker-Image

Using `docker-image`

```bash
docker-compose up -d --remove-orphans
docker-compose -f docker-compose.prod.yml up -d --remove-orphans
```

### Local Development Setup
Expand Down
61 changes: 61 additions & 0 deletions dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
FROM node:19-alpine

RUN apk update && apk add --no-cache openssl

ARG NEXTAUTH_SECRET=$(openssl rand -base64 32)
ENV NEXTAUTH_SECRET=$NEXTAUTH_SECRET

ARG DATABASE_URL
ENV DATABASE_URL=$DATABASE_URL

ARG NEXTAUTH_SECRET=
ENV NEXTAUTH_SECRET=$NEXTAUTH_SECRET

ARG NEXTAUTH_URL
ENV NEXTAUTH_URL=$NEXTAUTH_URL

ARG SKIP_ENV_VALIDATION
ENV SKIP_ENV_VALIDATION=$SKIP_ENV_VALIDATION

WORKDIR /app



# Install dependencies based on the preferred package manager
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./

# Copy the rest of the application code
COPY . .

# Prevent Husky errors by disabling the `prepare` script
RUN npm pkg set scripts.prepare="exit 0"

# set npm registry
RUN npm config set registry 'https://registry.npmmirror.com/'

RUN \
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
elif [ -f package-lock.json ]; then npm ci; \
elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i; \
# Allow install without lockfile, so example works even without Node.js installed locally
else echo "Warning: Lockfile not found. It is recommended to commit lockfiles to version control." && yarn install; \
fi




ENTRYPOINT ["sh", "entrypoint.sh"]

# Next.js collects completely anonymous telemetry data about general usage. Learn more here: https://nextjs.org/telemetry
# Uncomment the following line to disable telemetry at run time
# ENV NEXT_TELEMETRY_DISABLED 1

# Note: Don't expose ports here, Compose will handle that for us

# Start Next.js in development mode based on the preferred package manager
CMD \
if [ -f yarn.lock ]; then yarn dev; \
elif [ -f package-lock.json ]; then npm run dev; \
elif [ -f pnpm-lock.yaml ]; then pnpm dev; \
else yarn dev; \
fi
16 changes: 0 additions & 16 deletions docker-compose-local.yml

This file was deleted.

29 changes: 29 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: '3'

volumes:
db:
src:
public:

services:
autogpt:
build:
context: .
dockerfile: dev.Dockerfile
args:
NEXTAUTH_URL: http://localhost:3000
DATABASE_URL: file:./db.sqlite
SKIP_ENV_VALIDATION: 1 # omit this property to enable schema validation for the environment variables
container_name: autogpt
environment:
OPENAI_API_KEY: ${OPENAI_API_KEY} # openai api key
NEXT_PUBLIC_WEB_SEARCH_ENABLED: ${NEXT_PUBLIC_WEB_SEARCH_ENABLED} # enable web search
SERP_API_KEY: ${SERP_API_KEY} # serp api key
NEXT_PUBLIC_GUEST_KEY: ${NEXT_PUBLIC_GUEST_KEY} # guest key
ports:
- 3000:3000
volumes:
- src:/app/src
- public:/app/public
- db:/app/db
restart: unless-stopped
26 changes: 26 additions & 0 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: '3'

services:
autogpt:
container_name: autogpt
image: dogtititi/autogpt-next-web:lastest
# build:
# context: .
# dockerfile: prod.Dockerfile
# args:
# NEXTAUTH_URL: http://localhost:3000
# DATABASE_URL: file:./db.sqlite
# OPENAI_API_KEY: ${OPENAI_API_KEY} # openai api key
# NEXT_PUBLIC_WEB_SEARCH_ENABLED: ${NEXT_PUBLIC_WEB_SEARCH_ENABLED} # enable web search
# SERP_API_KEY: ${SERP_API_KEY} # serp api key
# NEXT_PUBLIC_GUEST_KEY: ${NEXT_PUBLIC_GUEST_KEY} # guest key
# NEXT_PUBLIC_FF_AUTH_ENABLED: ${NEXT_PUBLIC_FF_AUTH_ENABLED} # auth enable
# GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID} # google client id
# GOOGLE_CLIENT_SECRET: ${GOOGLE_CLIENT_SECRET} # google client secret
# GITHUB_CLIENT_ID: ${GITHUB_CLIENT_ID} # github client id
# GITHUB_CLIENT_SECRET: ${GITHUB_CLIENT_SECRET} # github client secret
# DISCORD_CLIENT_ID: ${DISCORD_CLIENT_ID} # discord client id
# DISCORD_CLIENT_SECRET: ${DISCORD_CLIENT_SECRET} # discord client secret
ports:
- 3000:3000
restart: unless-stopped
15 changes: 0 additions & 15 deletions docker-compose.yml

This file was deleted.

14 changes: 8 additions & 6 deletions docs/README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ One-Click to deploy well-designed AutoGPT-Next-Web web UI on Vercel.
- [ ] 5. 增加微信登录支持

## 商业愿景

在维护开源项目的期间,很多朋友前来咨询关于定制系统的事宜。考虑到可能有更多有类似需求的朋友,我们决定启动商业版本的内部测试计划
* 计划支持 -
用户登录系统、计费系统、收费系统等,使每个人都可以直接部署一个收费版本的AutoGPT,并直接获得收入。
* 参与方式 -
要预定商业版并查看商业版计划的详情,请单击下面的链接[AutoGPT-Next-Web商业愿景](https://egqz2y6eul.feishu.cn/docx/PxoMd7LGfoobAixiuWacxRWQnNd)

- 计划支持 -
用户登录系统、计费系统、收费系统等,使每个人都可以直接部署一个收费版本的 AutoGPT,并直接获得收入。
- 参与方式 -
要预定商业版并查看商业版计划的详情,请单击下面的链接[AutoGPT-Next-Web 商业愿景](https://egqz2y6eul.feishu.cn/docx/PxoMd7LGfoobAixiuWacxRWQnNd)

## 常见问题

Expand All @@ -66,15 +68,15 @@ A:项目源自于 AgentGPT,我们目标是持续输出对国内用户友好
使用 Docker 是在本地运行 AutoGPT-Next-Web 最简单的方法。

```bash
docker-compose -f docker-compose-local.yml up -d --remove-orphans
docker-compose -f docker-compose.dev.yml up -d --remove-orphans
```

### Docker-Image

使用 `docker-image` 部署

```bash
docker-compose up -d --remove-orphans
docker-compose -f docker-compose.prod.yml up -d --remove-orphans
```

### 本地开发环境配置
Expand Down
22 changes: 12 additions & 10 deletions docs/README_JA.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

## 特徴

1. Vercel を使ったワンクリックの無料デプロイメントが1分で完了
1. Vercel を使ったワンクリックの無料デプロイメントが 1 分で完了
2. 現地での対応力を向上させました: 中国語で入力すると、英語ではなく中国語で内容が表示
3. AgentGPT に合わせた UI 設計、レスポンシブデザイン、ダークモードへの対応
4. 独自ドメインをお持ちですか?バインド後、障壁なくどこでもすぐにアクセスできるのがさらに良い
Expand All @@ -39,11 +39,13 @@
- [ ] 5. WeChat のログインに対応

## ビジネスバージョン

オープンソースプロジェクトを維持する期間中、多くの友人がシステムのカスタマイズについて相談に来ました。類似のニーズを持つ友人がより多くいる可能性があることを考慮して、商用版の内部テスト計画を開始することにしました〜
* 計画サポート -
ユーザーログインシステム、請求システム、課金システムなどをサポートし、誰でも直接有料版のAutoGPTを展開し、収入を直接獲得することができます。
* 参加方法 -
商業版を事前予約し、商業版計画の詳細を見るには、以下のリンク[AutoGPT-Next-Webビジネスビジョン](https://egqz2y6eul.feishu.cn/docx/PxoMd7LGfoobAixiuWacxRWQnNd)

- 計画サポート -
ユーザーログインシステム、請求システム、課金システムなどをサポートし、誰でも直接有料版の AutoGPT を展開し、収入を直接獲得することができます。
- 参加方法 -
商業版を事前予約し、商業版計画の詳細を見るには、以下のリンク[AutoGPT-Next-Web ビジネスビジョン](https://egqz2y6eul.feishu.cn/docx/PxoMd7LGfoobAixiuWacxRWQnNd)

## はじめに

Expand All @@ -67,15 +69,15 @@ AutoGPT-Next-Web をローカルで実行する最も簡単な方法は、docker
便利なセットアップスクリプトが提供されているので、ぜひお試しください。

```bash
./setup.sh --docker
docker-compose -f docker-compose.dev.yml up -d --remove-orphans
```

### Docker-compose
### Docker-Image

`docker-compose` デプロイを使用
`docker-image` デプロイを使用

```bash
./setup.sh --docker-compose
docker-compose -f docker-compose.prod.yml up -d --remove-orphans
```

### ローカル開発セットアップ
Expand Down Expand Up @@ -126,7 +128,7 @@ DATABASE_URL=file:./db.sqlite
OPENAI_API_KEY=''
```

5. sqliteを使用するためにprismaスキーマを変更:
5. sqlite を使用するために prisma スキーマを変更:

```bash
./prisma/useSqlite.sh
Expand Down
9 changes: 0 additions & 9 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
#!/bin/env sh

# copy .env file if not exists
[ ! -f .env ] && [ -f .env.example ] && cp .env.example .env
cp .env .env.temp
dos2unix .env.temp
cat .env.temp > .env
rm .env.temp

source .env

# change schema.prisma
sed -ie 's/mysql/sqlite/g' prisma/schema.prisma
sed -ie 's/@db.Text//' prisma/schema.prisma
Expand Down
Loading

1 comment on commit 78055a6

@vercel
Copy link

@vercel vercel bot commented on 78055a6 May 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

auto-gpt-next-web – ./

auto-gpt-next-web-dogtiti.vercel.app
auto-gpt-next-web-git-main-dogtiti.vercel.app
auto-agentgpt.com

Please sign in to comment.