Install and debug

This chapter introduces how to set up the Yao development and debugging environment locally. For production use, please refer to the deployment document.

Install

Run the script in the terminal:

curl -fsSL https://website.yaoapps.com/install.sh | bash
Yao uses Sqlite to store data by default, if you need to use MySQL and PostgreSQL databases are used as data sources, please refer to the official database documentation to download and install. Recommended Use MySQL 8 or Postgres14.

debug commands

Run Run the process

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/customer
yao run xiang.main.Inspect

Parameters Table:

ParametersRequiredDescription
processisrunning process name. [process docs](../Base Features/Using processes)
args...noA table of input arguments for the process. [process docs](../Base Features/Using processes)

Start Start the service

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/customer
yao start

Parameters Table:

ParametersRequiredDescription
--alphaNoIf you want to try some of Yao's beta features, use the yao start --alpha command to start
--debugNoForce open development mode yao start --debug command to start

Environment variables

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 mode
export YAO_ROOT="/data/app" # Application directory
export YAO_HOST="127.0.0.1" # Service HOST
export YAO_PORT="5099" # listen port
export YAO_LOG="/data/app/logs/application.log" # log file location
export YAO_LOG_MODE="TEXT" # log mode TEXT | JSON
export YAO_JWT_SECRET="bLp@bi!oqo-2U+hoTRUG"
export YAO_DB_DRIVER="mysql" # database type mysql | sqlite3
export YAO_DB_PRIMARY="root:123456@tcp(db-server:3308)/xiang?charset=utf8mb4&parseTime=True&loc=Local" # Main library connection
export YAO_DB_SECONDARY="root:123456@tcp(db-server:3308)/xiang?charset=utf8mb4&parseTime=True&loc=Local" # Connect from the library
export 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 mode
YAO_ROOT="/data/app" # Application directory
YAO_HOST="127.0.0.1" # Service HOST
YAO_PORT="5099" # Listening port
YAO_LOG="/data/app/logs/application.log" # log file location
YAO_LOG_MODE="TEXT" # log mode TEXT | JSON
YAO_JWT_SECRET="bLp@bi!oqo-2U+hoTRUG"
YAO_DB_DRIVER="mysql" # database type mysql | sqlite3
YAO_DB_PRIMARY="root:123456@tcp(db-server:3308)/xiang?charset=utf8mb4&parseTime=True&loc=Local" # Main library connection
YAO_DB_SECONDARY="root:123456@tcp(db-server:3308)/xiang?charset=utf8mb4&parseTime=True&loc=Local" # Connect from the library
YAO_DB_AESKEY="ZLX=T&f6refeCh-ro*r@" # Encrypted storage field key MySQL Only

related information

Next, it is recommended to study the following chapters:

Create Data Model:Learn how to create models and store data in the database

Install and debug

This chapter introduces how to set up the Yao development and debugging environment locally. For production use, please refer to the deployment document.

Install

Run the script in the terminal:

curl -fsSL https://website.yaoapps.com/install.sh | bash
Yao uses Sqlite to store data by default, if you need to use MySQL and PostgreSQL databases are used as data sources, please refer to the official database documentation to download and install. Recommended Use MySQL 8 or Postgres14.

debug commands

Run Run the process

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/customer
yao run xiang.main.Inspect

Parameters Table:

ParametersRequiredDescription
processisrunning process name. [process docs](../Base Features/Using processes)
args...noA table of input arguments for the process. [process docs](../Base Features/Using processes)

Start Start the service

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/customer
yao start

Parameters Table:

ParametersRequiredDescription
--alphaNoIf you want to try some of Yao's beta features, use the yao start --alpha command to start
--debugNoForce open development mode yao start --debug command to start

Environment variables

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 mode
export YAO_ROOT="/data/app" # Application directory
export YAO_HOST="127.0.0.1" # Service HOST
export YAO_PORT="5099" # listen port
export YAO_LOG="/data/app/logs/application.log" # log file location
export YAO_LOG_MODE="TEXT" # log mode TEXT | JSON
export YAO_JWT_SECRET="bLp@bi!oqo-2U+hoTRUG"
export YAO_DB_DRIVER="mysql" # database type mysql | sqlite3
export YAO_DB_PRIMARY="root:123456@tcp(db-server:3308)/xiang?charset=utf8mb4&parseTime=True&loc=Local" # Main library connection
export YAO_DB_SECONDARY="root:123456@tcp(db-server:3308)/xiang?charset=utf8mb4&parseTime=True&loc=Local" # Connect from the library
export 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 mode
YAO_ROOT="/data/app" # Application directory
YAO_HOST="127.0.0.1" # Service HOST
YAO_PORT="5099" # Listening port
YAO_LOG="/data/app/logs/application.log" # log file location
YAO_LOG_MODE="TEXT" # log mode TEXT | JSON
YAO_JWT_SECRET="bLp@bi!oqo-2U+hoTRUG"
YAO_DB_DRIVER="mysql" # database type mysql | sqlite3
YAO_DB_PRIMARY="root:123456@tcp(db-server:3308)/xiang?charset=utf8mb4&parseTime=True&loc=Local" # Main library connection
YAO_DB_SECONDARY="root:123456@tcp(db-server:3308)/xiang?charset=utf8mb4&parseTime=True&loc=Local" # Connect from the library
YAO_DB_AESKEY="ZLX=T&f6refeCh-ro*r@" # Encrypted storage field key MySQL Only

related information

Next, it is recommended to study the following chapters:

Create Data Model:Learn how to create models and store data in the database