OpenFactory Deployment Strategies#
OpenFactory Assets are deployed on the OpenFactory cluster using one of the deployment strategy classes listed below.
These classes inherit from the abstract base class openfactory.openfactory_deploy_strategy.OpenFactoryServiceDeploymentStrategy.
Currently, two deployment strategies are implemented:
openfactory.openfactory_deploy_strategy.LocalDockerDeploymentStrategyIntended for development purposes when no OpenFactory cluster is available. This strategy deploys all OpenFactory services as standalone Docker containers on the local machine.
openfactory.openfactory_deploy_strategy.SwarmDeploymentStrategyThis is the default deployment strategy used in OpenFactory. It deploys services as Docker Swarm services, suitable for production or multi-node environments.
- class openfactory.openfactory_deploy_strategy.OpenFactoryServiceDeploymentStrategy[source]#
Bases:
ABCAbstract base class for OpenFactory service deployment strategies.
- abstractmethod deploy(*, image, name, env, labels=None, command=None, ports=None, networks=None, constraints=None, resources=None, mode=None)[source]#
Deploy a service using the specified parameters.
- Return type:
- Parameters:
image (str) – Docker image to deploy.
name (str) – Name of the service or container.
env (List[str]) – Environment variables in KEY=VALUE format.
labels (Optional[Dict[str, str]]) – Metadata labels (Swarm only).
command (Optional[str]) – Command to override the default entrypoint.
ports (Optional[Dict[int, int]]) – Port mappings from host to container (host:container).
networks (Optional[List[str]]) – Networks to connect the service or container to.
constraints (Optional[List[str]]) – Constraints for placement (Swarm only).
resources (Optional[Dict[str, Any]]) – Resource limits and reservations.
mode (Optional[Dict[str, Any]]) – Service mode (Swarm only).
- class openfactory.openfactory_deploy_strategy.LocalDockerDeploymentStrategy[source]#
Bases:
OpenFactoryServiceDeploymentStrategyDeployment strategy for local Docker containers (non-Swarm).
- deploy(*, image, name, env, labels=None, command=None, ports=None, networks=None, constraints=None, resources=None, mode=None)[source]#
Run a local Docker container.
See parent method for argument descriptions.
- Return type:
Note
Only the first network in the list is used.
constraints and mode are ignored for local containers.
- class openfactory.openfactory_deploy_strategy.SwarmDeploymentStrategy[source]#
Bases:
OpenFactoryServiceDeploymentStrategyDeployment strategy for Docker Swarm mode.