fastiot.cli.common package
Submodules
fastiot.cli.common.docker_templates module
fastiot.cli.common.infrastructure_services module
Infrastructure Services
This file contains all preconfigured infrastructure services.
Those are easy to integrate just by adding their name into the infrastructure-services:
key in your
deployment.yaml
.
- pydantic model fastiot.cli.common.infrastructure_services.NatsService[source]
Service definition for the nats message broker.
Usually no configuration is needed for this service!
- Validators:
-
field name:
str
= 'nats' Name of the external service, e.g. mariadb. Per convention these names should be in lower case
- Validated by:
-
field image:
str
= 'nats:latest' Name of the image
-
field ports:
List
[InfrastructureServicePort
] = [InfrastructureServicePort(container_port=4222, default_port_mount=4222, env_var='FASTIOT_NATS_PORT')] List of ports to assign to the service
- pydantic model fastiot.cli.common.infrastructure_services.MariaDBService[source]
Definition of the Service to use MariaDB.
The environment variables are documented at
fastiot.env.env.MariaDBEnv
.- With the following steps you are able to provision your MariaDB with an initial SQL-File at the first start:
Add a file like
entry.sql
to your deployment dirAdd the environment variable
FASTIOT_MARIA_DB_ENTRY
to your.env
in the deployment dir likeFASTIOT_MARIA_DB_ENTRY='./entry.sql'
Run fiot config to update your configuration.
See also
- Working with databases
How to add databases to your service.
- Validators:
-
field name:
str
= 'mariadb' Name of the external service, e.g. mariadb. Per convention these names should be in lower case
- Validated by:
-
field image:
str
= 'mariadb:10.8' Name of the image
-
field ports:
List
[InfrastructureServicePort
] = [InfrastructureServicePort(container_port=3306, default_port_mount=3306, env_var='FASTIOT_MARIA_DB_PORT')] List of ports to assign to the service
-
field environment:
List
[InfrastructureServiceEnvVar
] = [InfrastructureServiceEnvVar(name='MYSQL_ROOT_USER', default='root', env_var='FASTIOT_MARIA_DB_USER'), InfrastructureServiceEnvVar(name='MYSQL_ROOT_PASSWORD', default='12345', env_var='FASTIOT_MARIA_DB_PASSWORD'), InfrastructureServiceEnvVar(name='MYSQL_INITDB_SKIP_TZINFO', default='yes', env_var='')]
-
field password_env_vars:
List
[str
] = ['FASTIOT_MARIA_DB_PASSWORD'] List of environment variables containing a password. Those will be filled with random passwords for new projects automatically.
-
field volumes:
List
[InfrastructureServiceVolume
] = [InfrastructureServiceVolume(container_volume='/var/lib/mysql', env_var='FASTIOT_MARIA_DB_VOLUME', default_volume_mount=None, tmpfs_for_tests=True), InfrastructureServiceVolume(container_volume='/docker-entrypoint-initdb.d/entry.sql', env_var='FASTIOT_MARIA_DB_ENTRY', default_volume_mount='', tmpfs_for_tests=False)] List of volumes to mount inside the service
- pydantic model fastiot.cli.common.infrastructure_services.MongoDBService[source]
Definition of the service to use a MongoDB.
See also
- Working with databases
How to add databases to your service.
- Validators:
-
field name:
str
= 'mongodb' Name of the external service, e.g. mariadb. Per convention these names should be in lower case
- Validated by:
-
field image:
str
= 'mongo:5.0' Name of the image
-
field ports:
List
[InfrastructureServicePort
] = [InfrastructureServicePort(container_port=27017, default_port_mount=27017, env_var='FASTIOT_MONGO_DB_PORT')] List of ports to assign to the service
-
field environment:
List
[InfrastructureServiceEnvVar
] = [InfrastructureServiceEnvVar(name='MONGO_INITDB_ROOT_USERNAME', default='root', env_var='FASTIOT_MONGO_DB_USER'), InfrastructureServiceEnvVar(name='MONGO_INITDB_ROOT_PASSWORD', default='12345', env_var='FASTIOT_MONGO_DB_PASSWORD')]
-
field password_env_vars:
List
[str
] = ['FASTIOT_MONGO_DB_PASSWORD'] List of environment variables containing a password. Those will be filled with random passwords for new projects automatically.
-
field volumes:
List
[InfrastructureServiceVolume
] = [InfrastructureServiceVolume(container_volume='/data/db', env_var='FASTIOT_MONGO_DB_VOLUME', default_volume_mount=None, tmpfs_for_tests=True)] List of volumes to mount inside the service
-
field compose_extras:
List
[InfrastructureServiceComposeExtras
] = [InfrastructureServiceComposeExtras(option_name='mem_limit', env_var='FASTIOT_MONGO_DB_MEM_LIMIT', default_value='')] Add additional infos to be added to the docker-compose file.
Caution: These parameters will not be checked! Make sure, that those do not make the docker-compose file invalid!
- pydantic model fastiot.cli.common.infrastructure_services.MongoDB4Service[source]
Infrastructure service for a MongoDB in version 4.
This is the latest version to work with a Raspberry Pi 4 (s. https://stackoverflow.com/questions/68419196 for more details)
- Validators:
-
field name:
str
= 'mongodb4' Name of the external service, e.g. mariadb. Per convention these names should be in lower case
- Validated by:
-
field image:
str
= 'mongo:4.4.18' Name of the image
- pydantic model fastiot.cli.common.infrastructure_services.InfluxDBService[source]
Definition of the InfluxDB Service
See also
- Working with databases
How to add databases to your service.
- Validators:
-
field name:
str
= 'influxdb' Name of the external service, e.g. mariadb. Per convention these names should be in lower case
- Validated by:
-
field image:
str
= 'influxdb:2.0' Name of the image
-
field ports:
List
[InfrastructureServicePort
] = [InfrastructureServicePort(container_port=8086, default_port_mount=8086, env_var='FASTIOT_INFLUX_DB_PORT')] List of ports to assign to the service
-
field environment:
List
[InfrastructureServiceEnvVar
] = [InfrastructureServiceEnvVar(name='DOCKER_INFLUXDB_INIT_USERNAME', default='influx_db_admin', env_var='FASTIOT_INFLUX_DB_USER'), InfrastructureServiceEnvVar(name='DOCKER_INFLUXDB_INIT_PASSWORD', default='mf9ZXfeLKuaL3HL7w', env_var='FASTIOT_INFLUX_DB_PASSWORD'), InfrastructureServiceEnvVar(name='DOCKER_INFLUXDB_INIT_MODE', default='setup', env_var='FASTIOT_INFLUX_DB_MODE'), InfrastructureServiceEnvVar(name='DOCKER_INFLUXDB_INIT_ORG', default='FASTIOT', env_var='FASTIOT_INFLUX_DB_ORG'), InfrastructureServiceEnvVar(name='DOCKER_INFLUXDB_INIT_BUCKET', default='things', env_var='FASTIOT_INFLUX_DB_BUCKET'), InfrastructureServiceEnvVar(name='DOCKER_INFLUXDB_INIT_ADMIN_TOKEN', default='12345', env_var='FASTIOT_INFLUX_DB_TOKEN')]
-
field password_env_vars:
List
[str
] = ['FASTIOT_INFLUX_DB_TOKEN', 'FASTIOT_INFLUX_DB_PASSWORD'] List of environment variables containing a password. Those will be filled with random passwords for new projects automatically.
-
field volumes:
List
[InfrastructureServiceVolume
] = [InfrastructureServiceVolume(container_volume='/var/lib/influxdb2', env_var='FASTIOT_INFLUX_DB_VOLUME', default_volume_mount=None, tmpfs_for_tests=True)] List of volumes to mount inside the service
- pydantic model fastiot.cli.common.infrastructure_services.TimeScaleDBService[source]
Definition of a TimeScaleDB Service
See also
- Working with databases
How to add databases to your service.
- Validators:
-
field name:
str
= 'timescaledb' Name of the external service, e.g. mariadb. Per convention these names should be in lower case
- Validated by:
-
field image:
str
= 'timescale/timescaledb:latest-pg14' Name of the image
-
field ports:
List
[InfrastructureServicePort
] = [InfrastructureServicePort(container_port=5432, default_port_mount=5432, env_var='FASTIOT_TIME_SCALE_DB_PORT')] List of ports to assign to the service
-
field environment:
List
[InfrastructureServiceEnvVar
] = [InfrastructureServiceEnvVar(name='POSTGRES_USER', default='postgres', env_var='FASTIOT_TIME_SCALE_DB_USER'), InfrastructureServiceEnvVar(name='POSTGRES_PASSWORD', default='12345', env_var='FASTIOT_TIME_SCALE_DB_PASSWORD'), InfrastructureServiceEnvVar(name='POSTGRES_DB', default='fastiot_db', env_var='FASTIOT_TIME_SCALE_DB_DATABASE')]
-
field host_name_env_var:
str
= 'FASTIOT_TIME_SCALE_DB_HOST' The environment variable setting the hostname. This variable needs special attention: When working in a local development environment this defaults to localhost. Within a docker network the value needs to be the docker-internal hostname.
-
field password_env_vars:
List
[str
] = ['FASTIOT_TIME_SCALE_DB_PASSWORD'] List of environment variables containing a password. Those will be filled with random passwords for new projects automatically.
-
field volumes:
List
[InfrastructureServiceVolume
] = [InfrastructureServiceVolume(container_volume='/var/lib/postgresql/data', env_var='FASTIOT_TIME_SCALE_DB_VOLUME', default_volume_mount=None, tmpfs_for_tests=True)] List of volumes to mount inside the service
- pydantic model fastiot.cli.common.infrastructure_services.RedisService[source]
Definition of the Redis Service.
See also
fastiot.db.redis_helper.RedisHelper
How to easily interact using the integrated RedisHelper.
fastiot_sample_services.redis_producer
Example service for sending and receiving data over a Redis Server.
- Validators:
-
field name:
str
= 'redis' Name of the external service, e.g. mariadb. Per convention these names should be in lower case
- Validated by:
-
field image:
str
= 'redis:7' Name of the image
-
field ports:
List
[InfrastructureServicePort
] = [InfrastructureServicePort(container_port=6379, default_port_mount=6379, env_var='FASTIOT_REDIS_PORT')] List of ports to assign to the service
-
field environment:
List
[InfrastructureServiceEnvVar
] = [InfrastructureServiceEnvVar(name='REDIS_PASSWORD', default='12345', env_var='FASTIOT_REDIS_PASSWORD')]
-
field password_env_vars:
List
[str
] = ['FASTIOT_REDIS_PASSWORD'] List of environment variables containing a password. Those will be filled with random passwords for new projects automatically.
-
field volumes:
List
[InfrastructureServiceVolume
] = [InfrastructureServiceVolume(container_volume='/data', env_var='FASTIOT_REDIS_VOLUME', default_volume_mount=None, tmpfs_for_tests=True)] List of volumes to mount inside the service
- pydantic model fastiot.cli.common.infrastructure_services.ElasticSearch[source]
Definition of an ElasticDB Service
- Validators:
-
field name:
str
= 'elasticsearch' Name of the external service, e.g. mariadb. Per convention these names should be in lower case
- Validated by:
-
field image:
str
= 'docker.elastic.co/elasticsearch/elasticsearch:7.17.8' Name of the image
-
field password_env_vars:
List
[str
] = ['FASTIOT_ELASTICSEARCH_PASSWORD'] List of environment variables containing a password. Those will be filled with random passwords for new projects automatically.
-
field ports:
List
[InfrastructureServicePort
] = [InfrastructureServicePort(container_port=9200, default_port_mount=9200, env_var='FASTIOT_ELASTICSEARCH_PORT')] List of ports to assign to the service
-
field environment:
List
[InfrastructureServiceEnvVar
] = [InfrastructureServiceEnvVar(name='ELASTIC_PASSWORD', default='12345', env_var='FASTIOT_ELASTICSEARCH_PASSWORD'), InfrastructureServiceEnvVar(name='ES_JAVA_OPTS', default='-Xmx256m -Xms256m', env_var=''), InfrastructureServiceEnvVar(name='discovery.type', default='single-node', env_var=''), InfrastructureServiceEnvVar(name='cluster.name', default='single-node-cluster', env_var=''), InfrastructureServiceEnvVar(name='network.host', default='0.0.0.0', env_var='')]
-
field volumes:
List
[InfrastructureServiceVolume
] = [InfrastructureServiceVolume(container_volume='/usr/share/elasticsearch/data', env_var='FASTIOT_ELASTICSEARCH_VOLUME', default_volume_mount=None, tmpfs_for_tests=True)] List of volumes to mount inside the service