2021-10-28 14:55:51 +00:00
|
|
|
---
|
|
|
|
order: 3
|
|
|
|
---
|
|
|
|
|
|
|
|
# Installation and Startup Process
|
|
|
|
|
2021-10-31 01:58:25 +00:00
|
|
|
## Installation
|
2021-10-28 14:55:51 +00:00
|
|
|
|
|
|
|
```bash
|
|
|
|
yarn nocobase init
|
|
|
|
```
|
|
|
|
|
|
|
|
- app.constructor()
|
|
|
|
- app.parse()
|
|
|
|
- yarn nocobase init
|
2021-10-31 01:58:25 +00:00
|
|
|
Initialize the installation
|
2021-10-28 14:55:51 +00:00
|
|
|
- app.load()
|
2021-10-31 01:58:25 +00:00
|
|
|
Load the configuration
|
|
|
|
- app.exitAsync('beforeLoad')
|
|
|
|
Hook before all configurations are loaded
|
2021-10-28 14:55:51 +00:00
|
|
|
- app.pluginManager.load()
|
2021-10-31 01:58:25 +00:00
|
|
|
Load the configurations of all active plugins in order
|
|
|
|
- Load the configuration of plugin-collections
|
|
|
|
- Add app.on('init') listener
|
2021-10-28 14:55:51 +00:00
|
|
|
- db.getModel('collections').load()
|
2021-10-31 01:58:25 +00:00
|
|
|
Import the collections table configuration into db.table()
|
2021-10-28 14:55:51 +00:00
|
|
|
- app.db.sync({force: false})
|
2021-10-31 01:58:25 +00:00
|
|
|
Execute sync again to create the data table configured in the collections table
|
|
|
|
- app.exitAsync('afterLoad')
|
|
|
|
All hooks after the configuration is loaded
|
2021-10-28 14:55:51 +00:00
|
|
|
- app.db.sync({force: true})
|
2021-10-31 01:58:25 +00:00
|
|
|
Generate data tables, fields, indexes, etc. according to the configuration
|
2021-10-28 14:55:51 +00:00
|
|
|
- app.emitAsync('init')
|
2021-10-31 01:58:25 +00:00
|
|
|
Perform all init listeners, generally initialized data operations
|
|
|
|
- trigger the init event of plugin-collections and the data table is created
|
2021-10-28 14:55:51 +00:00
|
|
|
- app.stop()
|
2021-10-31 01:58:25 +00:00
|
|
|
End
|
2021-10-28 14:55:51 +00:00
|
|
|
|
2021-10-31 01:58:25 +00:00
|
|
|
## Startup
|
2021-10-28 14:55:51 +00:00
|
|
|
|
|
|
|
```bash
|
|
|
|
yarn nocobase start --init --sync
|
2021-10-31 01:58:25 +00:00
|
|
|
# --init for quick installation at startup
|
|
|
|
# --sync to quickly build or update tables when app.collection() is updated in the development environment
|
2021-10-28 14:55:51 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
- app.constructor()
|
|
|
|
- app.parse()
|
|
|
|
- yarn nocobase start
|
2021-10-31 01:58:25 +00:00
|
|
|
Initialize the installation
|
2021-10-28 14:55:51 +00:00
|
|
|
- app.load()
|
2021-10-31 01:58:25 +00:00
|
|
|
Load the configuration
|
|
|
|
- app.exitAsync('beforeLoad')
|
|
|
|
Hook before all configurations are loaded
|
2021-10-28 14:55:51 +00:00
|
|
|
- app.pluginManager.load()
|
2021-10-31 01:58:25 +00:00
|
|
|
Load the configurations of all active plugins in order
|
|
|
|
- Load the configuration of plugin-collections
|
|
|
|
- Add app.on('start') listener
|
2021-10-28 14:55:51 +00:00
|
|
|
- db.getModel('collections').load()
|
2021-10-31 01:58:25 +00:00
|
|
|
Import the collections table configuration into db.table(), no need for db.sync in the start process
|
|
|
|
- app.exitAsync('afterLoad')
|
|
|
|
All hooks after configuration loading
|
2021-10-28 14:55:51 +00:00
|
|
|
- app.db.sync({force: false})
|
2021-10-31 01:58:25 +00:00
|
|
|
yarn nocobase start --sync to quickly build or update tables when there are updates
|
|
|
|
yarn nocobase start --init quick init
|
2021-10-28 14:55:51 +00:00
|
|
|
- app.emitAsync('init')
|
2021-10-31 01:58:25 +00:00
|
|
|
yarn nocobase start --init shortcut init
|
|
|
|
- app.exitAsync('start')
|
|
|
|
Execute all start listeners, usually reading some necessary data from the data table
|
2021-10-28 14:55:51 +00:00
|
|
|
- app.listen()
|
2021-10-31 01:58:25 +00:00
|
|
|
Start the http server
|