This chapter introduces how to set up the Yao development and debugging environment locally. For production use, please refer to the deployment document.
Latest Version download and installation:
https://github.com/YaoApp/xgen-dev-app/blob/main/README.md
Go to the project directory and use the run
command to run streams, scripts, plugins, and built-in handlers.
yao run <process> [args...]
cd /data/customeryao run xiang.main.Inspect
Parameters Table:
Parameters | Required | Description |
---|---|---|
process | is | running process name. [process docs](../Base Features/Using processes) |
args... | no | A table of input arguments for the process. [process docs](../Base Features/Using processes) |
yao start
Enter the project directory and use the start
command to start the service. The default service port is 5099
, which can be specified by declaring an environment variable. [environment variable](#environment variable)
cd /data/customeryao start
Parameters Table:
Parameters | Required | Description |
---|---|---|
--alpha | No | If you want to try some of Yao's beta features, use the yao start --alpha command to start |
--debug | No | Force open development mode yao start --debug command to start |
You can configure database connections by declaring environment variables, specifying service ports, and configuring database connections. For example:
export YAO_ENV="production" # development | production run modeexport YAO_ROOT="/data/app" # Application directoryexport YAO_HOST="127.0.0.1" # Service HOSTexport YAO_PORT="5099" # listen portexport YAO_LOG="/data/app/logs/application.log" # log file locationexport YAO_LOG_MODE="TEXT" # log mode TEXT | JSONexport YAO_JWT_SECRET="bLp@bi!oqo-2U+hoTRUG"export YAO_DB_DRIVER="mysql" # database type mysql | sqlite3export YAO_DB_PRIMARY="root:123456@tcp(db-server:3308)/xiang?charset=utf8mb4&parseTime=True&loc=Local" # Main library connectionexport YAO_DB_SECONDARY="root:123456@tcp(db-server:3308)/xiang?charset=utf8mb4&parseTime=True&loc=Local" # Connect from the libraryexport YAO_DB_AESKEY="ZLX=T&f6refeCh-ro*r@" # Encrypted storage field key MySQL Only
You can add .env
to the root directory of the project directory, and the environment variables declared in .env will be used first when the service starts; or append the above command to the ~/.bashrc
file (macos ~/.bash_profile
)
/data/customer/.env
file contents
YAO_ENV="production" # development | production run modeYAO_ROOT="/data/app" # Application directoryYAO_HOST="127.0.0.1" # Service HOSTYAO_PORT="5099" # Listening portYAO_LOG="/data/app/logs/application.log" # log file locationYAO_LOG_MODE="TEXT" # log mode TEXT | JSONYAO_JWT_SECRET="bLp@bi!oqo-2U+hoTRUG"YAO_DB_DRIVER="mysql" # database type mysql | sqlite3YAO_DB_PRIMARY="root:123456@tcp(db-server:3308)/xiang?charset=utf8mb4&parseTime=True&loc=Local" # Main library connectionYAO_DB_SECONDARY="root:123456@tcp(db-server:3308)/xiang?charset=utf8mb4&parseTime=True&loc=Local" # Connect from the libraryYAO_DB_AESKEY="ZLX=T&f6refeCh-ro*r@" # Encrypted storage field key MySQL Only
Next, it is recommended to study the following chapters:
Create Data Model:Learn how to create models and store data in the databaseThis chapter introduces how to set up the Yao development and debugging environment locally. For production use, please refer to the deployment document.
Latest Version download and installation:
https://github.com/YaoApp/xgen-dev-app/blob/main/README.md
Go to the project directory and use the run
command to run streams, scripts, plugins, and built-in handlers.
yao run <process> [args...]
cd /data/customeryao run xiang.main.Inspect
Parameters Table:
Parameters | Required | Description |
---|---|---|
process | is | running process name. [process docs](../Base Features/Using processes) |
args... | no | A table of input arguments for the process. [process docs](../Base Features/Using processes) |
yao start
Enter the project directory and use the start
command to start the service. The default service port is 5099
, which can be specified by declaring an environment variable. [environment variable](#environment variable)
cd /data/customeryao start
Parameters Table:
Parameters | Required | Description |
---|---|---|
--alpha | No | If you want to try some of Yao's beta features, use the yao start --alpha command to start |
--debug | No | Force open development mode yao start --debug command to start |
You can configure database connections by declaring environment variables, specifying service ports, and configuring database connections. For example:
export YAO_ENV="production" # development | production run modeexport YAO_ROOT="/data/app" # Application directoryexport YAO_HOST="127.0.0.1" # Service HOSTexport YAO_PORT="5099" # listen portexport YAO_LOG="/data/app/logs/application.log" # log file locationexport YAO_LOG_MODE="TEXT" # log mode TEXT | JSONexport YAO_JWT_SECRET="bLp@bi!oqo-2U+hoTRUG"export YAO_DB_DRIVER="mysql" # database type mysql | sqlite3export YAO_DB_PRIMARY="root:123456@tcp(db-server:3308)/xiang?charset=utf8mb4&parseTime=True&loc=Local" # Main library connectionexport YAO_DB_SECONDARY="root:123456@tcp(db-server:3308)/xiang?charset=utf8mb4&parseTime=True&loc=Local" # Connect from the libraryexport YAO_DB_AESKEY="ZLX=T&f6refeCh-ro*r@" # Encrypted storage field key MySQL Only
You can add .env
to the root directory of the project directory, and the environment variables declared in .env will be used first when the service starts; or append the above command to the ~/.bashrc
file (macos ~/.bash_profile
)
/data/customer/.env
file contents
YAO_ENV="production" # development | production run modeYAO_ROOT="/data/app" # Application directoryYAO_HOST="127.0.0.1" # Service HOSTYAO_PORT="5099" # Listening portYAO_LOG="/data/app/logs/application.log" # log file locationYAO_LOG_MODE="TEXT" # log mode TEXT | JSONYAO_JWT_SECRET="bLp@bi!oqo-2U+hoTRUG"YAO_DB_DRIVER="mysql" # database type mysql | sqlite3YAO_DB_PRIMARY="root:123456@tcp(db-server:3308)/xiang?charset=utf8mb4&parseTime=True&loc=Local" # Main library connectionYAO_DB_SECONDARY="root:123456@tcp(db-server:3308)/xiang?charset=utf8mb4&parseTime=True&loc=Local" # Connect from the libraryYAO_DB_AESKEY="ZLX=T&f6refeCh-ro*r@" # Encrypted storage field key MySQL Only
Next, it is recommended to study the following chapters:
Create Data Model:Learn how to create models and store data in the database