fastiot.cli.model.manifest module¶
Data model for fastiot service manifests
- pydantic model fastiot.cli.model.manifest.Port[source]¶
A port entry represents one port used by the service which should be mounted outside the container.
-
field port:
int
[Required]¶ The default port location.
-
field env_variable:
str
[Required]¶ The environment variable which is passed to the container to change the port, e.g. for automated testing.
-
field port:
- pydantic model fastiot.cli.model.manifest.Volume[source]¶
A volume entry represents one directory used by the service which should be mounted outside the container.
-
field location:
str
[Required]¶ The volume location to be used. If you provide something like
/opt/mydata
it will be accessible asopt/mydata
in your container.
-
field env_variable:
str
[Required]¶ See attribute env_variable in
fastiot.cli.model.manifest.Port
.
-
field location:
- pydantic model fastiot.cli.model.manifest.Device[source]¶
A device entry represents one device used by the service which should be mounted outside the container.
-
field location:
str
[Required]¶ The default device location, e.g.
/dev/ttyS0
for a serial port
-
field env_variable:
str
[Required]¶ See attribute env_variable in
fastiot.cli.model.manifest.Port
.
-
field location:
- class fastiot.cli.model.manifest.MountConfigDirEnum(value)[source]¶
Set if the configuration dir needs to be mounted in the container
- required = 'required'¶
- optional = 'optional'¶
- no = 'no'¶
- class fastiot.cli.model.manifest.CPUPlatform(value)[source]¶
Definition of the CPU platform the container will be built for
- amd64 = 'amd64'¶
- amd64_2 = 'amd64_2'¶
- arm64 = 'arm64'¶
- armv7 = 'armv7'¶
- pydantic model fastiot.cli.model.manifest.Healthcheck[source]¶
Configuration options for Docker Healtcheck. This allows for automatic restarting the service if the service does not provide the configured life sign.
-
field cmd:
str
= ''¶ Command to run. This could e.g. be a curl request to your API or check wether a logfile gets updated every n seconds.
-
field interval:
str
= '30s'¶ Interval to check the service
-
field timeout:
str
= '30s'¶ Timeout for the command
-
field start_period:
str
= '1s'¶
-
field retries:
int
= 3¶
-
field cmd:
- pydantic model fastiot.cli.model.manifest.NPM[source]¶
Use this part if your project contains a frontend created with npm, e.g. a vue.js application
-
field src:
str
[Required]¶
-
field dist:
str
= 'dist'¶ Destination where npm will place its files for distribution. If not changed npm will have save its files in the <src>/dist which is also the default here. If you have something like:
service.exports = { outputDir:"../flask_server/static", assetsDir: "static" }
in your npm config or in case of vue js application in the file
vue.config.js
use the outputDir variable as relative path here, e.g.dist: ../static
-
field src:
- pydantic model fastiot.cli.model.manifest.ServiceManifest[source]¶
Every service needs a
manifest.yaml
to describe the service.The following options may be used. The file always starts with a
fastiot_service:
in the first level. Then options from the following may (name
must) follow.fastiot.cli.model.manifest.ServiceManifest.name
is needed, others are mostly optional!-
field name:
str
[Required]¶ Name needs to comply with the services name (Mandatory)
-
field ports:
List
[Port
] = []¶ Provide a list with some name for the service and a port that this container will open, e.g. when operating as a webserver.`
-
field template:
str
= 'python3'¶ Specify the template to use. You can provide your custom Templates by overwriting
fastiot.cli.model.docker_template.DockerTemplate
. Make sure that you imported it e.g. via configure.py’s extensions property.
-
field base_image:
str
= 'python:3.10-slim-bullseye'¶ Use this to provide an alternative base image, otherwise
fastiot.cli.constants.DEFAULT_BASE_IMAGE
will be used.Be aware, that the further Dockerfile will be unchanged, thus your base image should be based on some Debian-style. If this does not work for you, you may also provide a
Dockerfile
in your service which will automatically be used.
-
field depends_on:
List
[str
] = []¶ List of infrastructure services that need to be deployed
-
field mount_config_dir:
MountConfigDirEnum
= MountConfigDirEnum.optional¶ Specify, if a config dir must be mounted.
-
field privileged:
bool
= False¶ Enable if this service needs privileged permissions inside docker, e.g. for hardware access
-
field platforms:
List
[CPUPlatform
] = [<CPUPlatform.amd64: 'amd64'>]¶ Define the cpu platforms to build the container for. It defaults to amd64. If doing local builds the first one specified (or amd64 if none) will be used to build the image.
-
field healthcheck:
Healthcheck
= Healthcheck(cmd='', interval='30s', timeout='30s', start_period='1s', retries=3)¶ Configure healthcheck for the container
-
field copy_dirs_to_container:
List
[str
] = []¶ Directories which shall be copied to container. They must be specified relative to
manifest.yaml
.
-
field npm:
Optional
[NPM
] = None¶ If your project contains a vue.js application you can automatically build it here. For required configuration see
fastiot.cli.model.manifest.Vue
-
field additional_requirements:
List
[str
] = []¶ If a specific service needs more packages installed than the others, you may add these here. It will look in the requirements directory for the specified additional requirements and copy them inside the container. The
install.sh
must be handle to install these.
-
field compile:
bool
= True¶ If your service should not be compiled can change to False. Per default your service will be compiled using Nuitka to have some obfuscation in the code and potentially speed up the program.
-
field compose_extras:
Optional
[Dict
] = {}¶ ATTENTION: Use at your own risk! Adding options not known or duplicating entries in
docker-compose.yaml
will make the file invalid and the services will deny to start.If you want to set some more options for your container, like mem_limit, you may list them here. You need to know which option accepts docker-compose. Please refer to https://docs.docker.com/compose/compose-file/compose-file-v2/#service-configuration-reference .
For configuring this you can refer to
src/fastiot_sample_services/producer/manifest.yaml
. It shows, how you can add more compose extras in manifest.yaml.
- static from_yaml_file(filename, check_service_name='')[source]¶
Does the magic of import yaml to pydantic model
- Return type:
-
field name: