Adding custom infrastructure services to your project
As the FastIoT will take care of generating docker-compose.yaml
files for your project and for integration tests
it needs to know the services, e.g. databases, to load. Those services are named Infrastructure Service to
differentiate them between FastIoT Services.
Various services are already preconfigured and you only need to add those to your project. See
fastiot.cli.common.infrastructure_services
for the services available.
To add your own service you have to follow a few basic steps:
Create the Service inheriting either from
fastiot.cli.model.infrastructure_service.InfrastructureService
or if you only have some minor adjustments inherit from any service inheriting fromfastiot.cli.model.infrastructure_service.InfrastructureService
itself. You may add those class anywhere in your project. It is recommended to use something likeyour_project_lib.extension.services
.Add the corresponding import, e.g.
your_project_lib.extension.services
to yourconfigure.py
in your project root dir using thefastiot.cli.model.project.ProjectContext.extensions
. Make sure this will really import the class.You should now be able to add a service in your
deployment.yaml
with the name you specified.Build your configuration using fiot config. If the command fails try to raise the debug level: FASTIOT_DEBUG_LEVEL="DEBUG" fiot config
You should now have a docker-compose file with your new infrastructure service added!