docs: update readme.md

This commit is contained in:
chenos 2022-04-29 10:55:01 +08:00
parent 1fbf6c6335
commit aacec30673
7 changed files with 122 additions and 205 deletions

123
README.md
View File

@ -51,9 +51,9 @@ Requirements
Node: Node:
- Node.js 12.20+ - Node.js 14+
Database: Database(Choose one):
- PostgreSQL 10.x+ - PostgreSQL 10.x+
- MySQL 8.x+ - MySQL 8.x+
@ -64,110 +64,38 @@ Installation
## Create a project with [Docker](https://docs.docker.com/get-docker/) (Recommended) ## 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 ```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 ```bash
version: "3" # SQLite
networks: cd nocobase/docker/app-sqlite
nocobase: # MySQL
driver: bridge cd nocobase/docker/app-mysql
services: # PostgreSQL
app: cd nocobase/docker/app-postgres
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
``` ```
### 3. Install and start NocoBase ### 3. Install and start NocoBase
> You can download and install Docker [here](https://docs.docker.com/get-docker/)
It may take dozens of seconds It may take dozens of seconds
```bash ```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 | nginx started
app-sqlite-app-1 | yarn run v1.22.15 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/ 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 ### 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`. Open [http://localhost:13000](http://localhost:13000) in a web browser. The initial account and password are `admin@nocobase.com` and `admin123`.

View File

@ -49,9 +49,9 @@ NocoBase 架构
Node: Node:
- Node.js 12.20+ - Node.js 14+
Database: Database(任选其一):
- PostgreSQL 10.x+ - PostgreSQL 10.x+
- MySQL 8.x+ - MySQL 8.x+
@ -62,110 +62,38 @@ Database:
## 使用 [Docker](https://docs.docker.com/get-docker/) 创建项目(推荐) ## 使用 [Docker](https://docs.docker.com/get-docker/) 创建项目(推荐)
### 1. 创建项目文件夹 ### 1. 将 NocoBase 下载到本地
使用 Git 下载(或直接[下载 Zip 包](https://github.com/nocobase/nocobase/archive/refs/heads/main.zip),并解压到 nocobase 目录下)
```bash ```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 ```bash
version: "3" # SQLite
networks: cd nocobase/docker/app-sqlite
nocobase: # MySQL
driver: bridge cd nocobase/docker/app-mysql
services: # PostgreSQL
app: cd nocobase/docker/app-postgres
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
``` ```
### 3. 安装并启动 NocoBase ### 3. 安装并启动 NocoBase
> 请确保你已经安装了 Docker如果没有安装[点此下载](https://docs.docker.com/get-docker/)
安装过程可能需要等待几十秒钟 安装过程可能需要等待几十秒钟
```bash ```bash
$ docker-compose up # 在后台运行
$ docker-compose up -d
# 查看 app 进程的情况
$ docker-compose logs app
app-sqlite-app-1 | nginx started app-sqlite-app-1 | nginx started
app-sqlite-app-1 | yarn run v1.22.15 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/ 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 ### 4. 登录 NocoBase
使用浏览器打开 http://localhost:13000/ 初始化账号和密码是 `admin@nocobase.com``admin123` 使用浏览器打开 http://localhost:13000/ 初始化账号和密码是 `admin@nocobase.com``admin123`

View File

@ -48,7 +48,7 @@ services:
nocobase: nocobase:
build: build:
context: . context: .
dockerfile: ./docker/nocobase/Dockerfile dockerfile: ./docker/node/Dockerfile
networks: networks:
- nocobase - nocobase
command: [ "yarn", "start-pm2" ] command: [ "yarn", "start-pm2" ]

View File

@ -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

View File

@ -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

View File

@ -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"