diff --git a/README.md b/README.md index 601bd2916..b8bd14419 100644 --- a/README.md +++ b/README.md @@ -51,9 +51,9 @@ Requirements Node: -- Node.js 12.20+ +- Node.js 14+ -Database: +Database(Choose one): - PostgreSQL 10.x+ - MySQL 8.x+ @@ -64,110 +64,38 @@ Installation ## Create a project with [Docker](https://docs.docker.com/get-docker/) (Recommended) -### 1. Create an empty project directory +### 1. Download NocoBase + +Download with Git (or [Download Zip](https://github.com/nocobase/nocobase/archive/refs/heads/main.zip),and extract it to the `nocobase` directory) ```bash -mkdir my-nocobase-app && cd my-nocobase-app/ +git clone https://github.com/nocobase/nocobase.git nocobase ``` -### 2. Create a `docker-compose.yml` file +### 2. Select database (choose one) -#### SQLite +Supports SQLite, MySQL, PostgreSQL -```yml -version: "3" -networks: - nocobase: - driver: bridge -services: - app: - image: nocobase/nocobase:latest - networks: - - nocobase - environment: - - LOCAL_STORAGE_BASE_URL=http://localhost:13000/storage/uploads - volumes: - - ./storage:/app/nocobase/storage - ports: - - "13000:80" -``` - -#### MySQL - -```yml -version: "3" -networks: - nocobase: - driver: bridge -services: - app: - image: nocobase/nocobase:latest - networks: - - nocobase - environment: - - DB_DIALECT=mysql - - DB_HOST=mysql - - DB_DATABASE=nocobase - - DB_USER=nocobase - - DB_PASSWORD=nocobase - - LOCAL_STORAGE_BASE_URL=http://localhost:13000/storage/uploads - volumes: - - ./storage:/app/nocobase/storage - ports: - - "13000:80" - mysql: - image: mysql:8 - environment: - MYSQL_DATABASE: nocobase - MYSQL_USER: nocobase - MYSQL_PASSWORD: nocobase - MYSQL_ROOT_PASSWORD: nocobase - restart: always - networks: - - nocobase -``` - -#### PostgreSQL - -```yml -version: "3" -networks: - nocobase: - driver: bridge -services: - app: - image: nocobase/nocobase:latest - networks: - - nocobase - environment: - - DB_DIALECT=postgres - - DB_HOST=postgres - - DB_DATABASE=nocobase - - DB_USER=nocobase - - DB_PASSWORD=nocobase - - LOCAL_STORAGE_BASE_URL=http://localhost:13000/storage/uploads - volumes: - - ./storage:/app/nocobase/storage - ports: - - "13000:80" - postgres: - image: postgres:10 - restart: always - networks: - - nocobase - command: postgres -c wal_level=logical - environment: - POSTGRES_USER: nocobase - POSTGRES_DB: nocobase - POSTGRES_PASSWORD: nocobase +```bash +# SQLite +cd nocobase/docker/app-sqlite +# MySQL +cd nocobase/docker/app-mysql +# PostgreSQL +cd nocobase/docker/app-postgres ``` ### 3. Install and start NocoBase +> You can download and install Docker [here](https://docs.docker.com/get-docker/) + It may take dozens of seconds ```bash -$ docker-compose up +# run in the background +$ docker-compose up -d +# view app logs +$ docker-compose logs app app-sqlite-app-1 | nginx started app-sqlite-app-1 | yarn run v1.22.15 @@ -181,15 +109,6 @@ app-sqlite-app-1 | 2022-04-28T15:45:38: PM2 log: App [index:0] online app-sqlite-app-1 | 🚀 NocoBase server running at: http://localhost:13000/ ``` -You can also use `docker-compose up -d` to run in the background - -```bash -# in the background -$ docker-compose up -d -# view app logs -$ docker-compose logs app -``` - ### 4. Log in to NocoBase Open [http://localhost:13000](http://localhost:13000) in a web browser. The initial account and password are `admin@nocobase.com` and `admin123`. diff --git a/README.zh-CN.md b/README.zh-CN.md index f2f408449..2036e485e 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -49,9 +49,9 @@ NocoBase 架构 Node: -- Node.js 12.20+ +- Node.js 14+ -Database: +Database(任选其一): - PostgreSQL 10.x+ - MySQL 8.x+ @@ -62,110 +62,38 @@ Database: ## 使用 [Docker](https://docs.docker.com/get-docker/) 创建项目(推荐) -### 1. 创建项目文件夹 +### 1. 将 NocoBase 下载到本地 + +使用 Git 下载(或直接[下载 Zip 包](https://github.com/nocobase/nocobase/archive/refs/heads/main.zip),并解压到 nocobase 目录下) ```bash -mkdir my-nocobase-app && cd my-nocobase-app/ +git clone https://github.com/nocobase/nocobase.git nocobase ``` -### 2. 创建 `docker-compose.yml` 文件 +### 2. 选择数据库(任选其一) -#### SQLite +支持 SQLite、MySQL、PostgreSQL 数据库 -```yml -version: "3" -networks: - nocobase: - driver: bridge -services: - app: - image: nocobase/nocobase:latest - networks: - - nocobase - environment: - - LOCAL_STORAGE_BASE_URL=http://localhost:13000/storage/uploads - volumes: - - ./storage:/app/nocobase/storage - ports: - - "13000:80" -``` - -#### MySQL - -```yml -version: "3" -networks: - nocobase: - driver: bridge -services: - app: - image: nocobase/nocobase:latest - networks: - - nocobase - environment: - - DB_DIALECT=mysql - - DB_HOST=mysql - - DB_DATABASE=nocobase - - DB_USER=nocobase - - DB_PASSWORD=nocobase - - LOCAL_STORAGE_BASE_URL=http://localhost:13000/storage/uploads - volumes: - - ./storage:/app/nocobase/storage - ports: - - "13000:80" - mysql: - image: mysql:8 - environment: - MYSQL_DATABASE: nocobase - MYSQL_USER: nocobase - MYSQL_PASSWORD: nocobase - MYSQL_ROOT_PASSWORD: nocobase - restart: always - networks: - - nocobase -``` - -#### PostgreSQL - -```yml -version: "3" -networks: - nocobase: - driver: bridge -services: - app: - image: nocobase/nocobase:latest - networks: - - nocobase - environment: - - DB_DIALECT=postgres - - DB_HOST=postgres - - DB_DATABASE=nocobase - - DB_USER=nocobase - - DB_PASSWORD=nocobase - - LOCAL_STORAGE_BASE_URL=http://localhost:13000/storage/uploads - volumes: - - ./storage:/app/nocobase/storage - ports: - - "13000:80" - postgres: - image: postgres:10 - restart: always - networks: - - nocobase - command: postgres -c wal_level=logical - environment: - POSTGRES_USER: nocobase - POSTGRES_DB: nocobase - POSTGRES_PASSWORD: nocobase +```bash +# SQLite +cd nocobase/docker/app-sqlite +# MySQL +cd nocobase/docker/app-mysql +# PostgreSQL +cd nocobase/docker/app-postgres ``` ### 3. 安装并启动 NocoBase +> 请确保你已经安装了 Docker,如果没有安装[点此下载](https://docs.docker.com/get-docker/) + 安装过程可能需要等待几十秒钟 ```bash -$ docker-compose up +# 在后台运行 +$ docker-compose up -d +# 查看 app 进程的情况 +$ docker-compose logs app app-sqlite-app-1 | nginx started app-sqlite-app-1 | yarn run v1.22.15 @@ -179,15 +107,6 @@ app-sqlite-app-1 | 2022-04-28T15:45:38: PM2 log: App [index:0] online app-sqlite-app-1 | 🚀 NocoBase server running at: http://localhost:13000/ ``` -你也可以使用 `docker-compose up -d` 在后台运行,如: - -```bash -# 在后台运行 -$ docker-compose up -d -# 查看 app 进程的情况 -$ docker-compose logs app -``` - ### 4. 登录 NocoBase 使用浏览器打开 http://localhost:13000/ 初始化账号和密码是 `admin@nocobase.com` 和 `admin123`。 diff --git a/docker-compose.yml b/docker-compose.yml index 85922c7ec..89de6d580 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -48,7 +48,7 @@ services: nocobase: build: context: . - dockerfile: ./docker/nocobase/Dockerfile + dockerfile: ./docker/node/Dockerfile networks: - nocobase command: [ "yarn", "start-pm2" ] diff --git a/docker/app-mysql/docker-compose.yml b/docker/app-mysql/docker-compose.yml new file mode 100644 index 000000000..c77d08e6e --- /dev/null +++ b/docker/app-mysql/docker-compose.yml @@ -0,0 +1,32 @@ +version: "3" +networks: + nocobase: + driver: bridge +services: + app: + image: nocobase/nocobase:latest + networks: + - nocobase + depends_on: + - mysql + environment: + - DB_DIALECT=mysql + - DB_HOST=mysql + - DB_DATABASE=nocobase + - DB_USER=nocobase + - DB_PASSWORD=nocobase + - LOCAL_STORAGE_BASE_URL=http://localhost:13000/storage/uploads + volumes: + - ./storage:/app/nocobase/storage + ports: + - "13000:80" + mysql: + image: mysql:8 + environment: + MYSQL_DATABASE: nocobase + MYSQL_USER: nocobase + MYSQL_PASSWORD: nocobase + MYSQL_ROOT_PASSWORD: nocobase + restart: always + networks: + - nocobase \ No newline at end of file diff --git a/docker/app-postgres/docker-compose.yml b/docker/app-postgres/docker-compose.yml new file mode 100644 index 000000000..011eea8ac --- /dev/null +++ b/docker/app-postgres/docker-compose.yml @@ -0,0 +1,32 @@ +version: "3" +networks: + nocobase: + driver: bridge +services: + app: + image: nocobase/nocobase:latest + networks: + - nocobase + environment: + - DB_DIALECT=postgres + - DB_HOST=postgres + - DB_DATABASE=nocobase + - DB_USER=nocobase + - DB_PASSWORD=nocobase + - LOCAL_STORAGE_BASE_URL=http://localhost:13000/storage/uploads + volumes: + - ./storage:/app/nocobase/storage + ports: + - "13000:80" + depends_on: + - postgres + postgres: + image: postgres:10 + restart: always + networks: + - nocobase + command: postgres -c wal_level=logical + environment: + POSTGRES_USER: nocobase + POSTGRES_DB: nocobase + POSTGRES_PASSWORD: nocobase \ No newline at end of file diff --git a/docker/app-sqlite/docker-compose.yml b/docker/app-sqlite/docker-compose.yml new file mode 100644 index 000000000..326eaeefd --- /dev/null +++ b/docker/app-sqlite/docker-compose.yml @@ -0,0 +1,15 @@ +version: "3" +networks: + nocobase: + driver: bridge +services: + app: + image: nocobase/nocobase:latest + networks: + - nocobase + environment: + - LOCAL_STORAGE_BASE_URL=http://localhost:13000/storage/uploads + volumes: + - ./storage:/app/nocobase/storage + ports: + - "13000:80" \ No newline at end of file diff --git a/docker/nocobase/Dockerfile b/docker/node/Dockerfile similarity index 100% rename from docker/nocobase/Dockerfile rename to docker/node/Dockerfile