Application Configuration
Last Updated:2020-08-18
The default configuration file of application configuration is var/db/baetyl/application.yml
under working directory, and the configuration is interpreted as follows:
version: Application version
services: Application service list
- name: [Must]Service name, which must the unique in the service list
image: [Must]Service entry It indicates the service image under Docker container mode; it indicates the position of service operation package under Naitve progress mode.
replica: It is 0 by default, the number of service duplicates, indicating the number of service instances enabled. Generally, only one service needs to be enabled. The service is generally set as 0 during the function run, and the service instance is not started by master program, but by the function management service dynamically.
mounts: Storage volume mapping list
- name: [Must] Storage volume name, corresponding to one in the storage volume list.
path: [Must] Path of storage volume mapping in the container
readonly:Default value: false, Storage volume read only or not
ports:Exported port in the Docker container mode, for example:
- 0.0.0.0:1883:1883 #If you do not want to expose it to the device rather than the host to access, it may be changed to 127.0.0.1:1883:1883.
- 0.0.0.0:1884:1884/tcp
- 8080:8080/tcp
- 9884:8884
devices:Device mapping under Docker container mode, for example:
- /dev/video0
- /dev/sda:/dev/xvdc:r
args:Service instance startup parameters, for example:
- '-c'
- 'conf/conf.yml'
env:Service instance environment variables, for example:
version: v1
restart: Service instance restart strategy configuration item
retry:
max: It is empty by default, indicating the maximum number of service restarts of retries.
Policy: Default value: Always, Restart strategy. no: No restartalways: Always restart; on-failure: Restart in case of abnormal service exit.
backoff:
min: Default value: 1s, Minimum restart interval time
max: Default value: 5m, Maximum restart interval time
factor: Default value: 2, Restart interval increase multiple
resources: Service instance resource limitation configuration item under Docker container mode.
cpu:
cpus: The ratio of CPU available for the service instance, for example: 1.5, Indicating that 1.5 CPU cores are available for use.
setcpus:CPU cores available for the service instance, for example: 0-2, Indicating that the 0-2 CPU cores can be used; 0 indicates that the 0 CUP core can be used, and 1 indicates that 1 CPU core can be used.
memory:
limit: Memory available for the service instance, for example: 500m, Indicating that 500Mpa memory is available.
swap: Swap space available for the service instance, for example: 1g, means 1 G memory can be used.
pids:
limit: Number of processes that can be created for the service instance.
volumes: Application storage volume list.
- name: [Must] Storage volume name, unique in the storage volume list
path: [Must] Path of storage volume on the host machine, relative to the working directory of master program.