tachybase_todo/docs/zh-CN/getting-started/installation/docker-compose.md
Junyi 796e73ae5a
refactor(doc): change to new structure (#804)
* refactor(doc): change to new structure

* docs: add database docs

* docs: add collection docs

* docs: add db field examples

* docs(api): fix filename and menu path

* docs: add database docs

* docs: add db operators doc

* docs: add resourcer menu

* docs: add resourcer docs

* docs: fix api docs

* docs: refactor api menu structure

* feat: update docs (#830)

* feat: updates

* feat: update docs

* chore: ignore docs from ci

Co-authored-by: Junyi <mytharcher@users.noreply.github.com>
Co-authored-by: mytharcher <mytharcher@gmail.com>

* docs: add database methods docs

* docs: add missed api

* docs: fix api docs

* feat: update development docs (#833)

* feat: update development docs

* feat: update docs

* feat: update docs

* docs: add first plugin example (#834)

* feat: update docs

* feat: update docs

* docs: fix typo

Co-authored-by: chenos <chenlinxh@gmail.com>
2022-09-19 09:23:01 +08:00

3.5 KiB
Raw Blame History

group
path title order
/getting-started/installation/docker-compose Docker 安装 (👍 推荐) 1

Docker 安装

0. 先决条件

请确保你已经安装了 Docker

1. 将 NocoBase 下载到本地

使用 Git 下载(或直接下载 Zip 包,并解压到 nocobase 目录下)

git clone https://gitee.com/nocobase/nocobase.git nocobase

2. 选择数据库(任选其一)

将目录切换到第一步下载的文件夹里(根据实际情况调整)。

# MacOS, Linux...
cd /your/path/nocobase
# Windows
cd C:\your\path\nocobase

不同数据库的 docker 配置有些许差异,请选择切换到对应的目录下。

SQLite

cd docker/app-sqlite

MySQL

cd docker/app-mysql

PostgreSQL

cd docker/app-postgres

3. 配置 docker-compose.yml非必须

非开发人员,跳过这一步。如果你懂得开发,也可以进一步了解怎么配置 docker-compose.yml

目录结构(与 docker 相关)

├── nocobase
  ├── docker
    ├── app-sqlite
      ├── storage
      ├── docker-compose.yml
    ├── app-mysql
      ├── storage
      ├── docker-compose.yml
    ├── app-postgres
      ├── storage
      ├── docker-compose.yml

docker-compose.yml 的配置说明:

SQLite 只有 app 服务PostgreSQL 和 MySQL 会有对应的 postgres 或 mysql 服务,可以使用例子的数据库服务,或者自己配置。

services:
  app:
  postgres:
  mysql:

app 端口,例子为 13000 端口,访问地址为 http://your-ip:13000/

services:
  app:
    ports:
      - "13000:80"

NocoBase 版本(点此查看最新版本),升级时,需要修改为最新版本。

services:
  app:
    image: nocobase/nocobase:0.7.0-alpha.78

环境变量

services:
  app:
    image: nocobase/nocobase:0.7.0-alpha.78
    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
  • DB_* 为数据库相关,如果不是例子默认的数据库服务,请根据实际情况修改;
  • LOCAL_STORAGE_BASE_URL 为本地存储的根 URL如果不是本地安装需要改为对应的 ip 或域名。

4. 安装并启动 NocoBase

安装过程可能需要等待几分钟

# 在后台运行
$ docker-compose up -d
# 查看 app 进程的情况
$ docker-compose logs app

app-sqlite-app-1  | nginx started
app-sqlite-app-1  | yarn run v1.22.15
app-sqlite-app-1  | $ cross-env DOTENV_CONFIG_PATH=.env node -r dotenv/config packages/app/server/lib/index.js install -s
app-sqlite-app-1  | Done in 2.72s.
app-sqlite-app-1  | yarn run v1.22.15
app-sqlite-app-1  | $ pm2-runtime start --node-args="-r dotenv/config" packages/app/server/lib/index.js -- start
app-sqlite-app-1  | 2022-04-28T15:45:38: PM2 log: Launching in no daemon mode
app-sqlite-app-1  | 2022-04-28T15:45:38: PM2 log: App [index:0] starting in -fork mode-
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/

5. 登录 NocoBase

使用浏览器打开 http://localhost:13000/ 初始化账号和密码是 admin@nocobase.comadmin123