Raxol.Cloud.Integrations (Raxol v0.5.0)
View SourceCloud integration utilities for Raxol applications.
This module provides integration utilities for connecting various cloud services with Raxol applications, focusing on edge computing, monitoring, and service discovery. It serves as a central coordination point for cloud-related features.
Features:
- Edge-to-cloud integration helpers
- Centralized configuration management
- Service discovery and registration
- Multi-cloud provider support
- Deployment and scaling utilities
Summary
Functions
Deploys an application component to the appropriate environment based on configuration.
Discovers services available in the current environment.
Executes a function in the optimal location (edge or cloud) based on current conditions.
Gets a connection to a cloud service with the specified parameters.
Initializes all cloud integrations with the provided configuration.
Registers the current application as a service in the service discovery system.
Scales a service based on current metrics and conditions.
Returns the current status of all cloud integrations.
Functions
Deploys an application component to the appropriate environment based on configuration.
Options
:component
- Name of the component to deploy:version
- Version to deploy:environment
- Target environment (:production, :staging, :development):strategy
- Deployment strategy (:blue_green, :canary, :rolling)
Examples
iex> deploy(
...> component: :api_service,
...> version: "1.2.3",
...> environment: :production,
...> strategy: :blue_green
...> )
{:ok, %{deployment_id: "dep-12345", status: :in_progress}}
Discovers services available in the current environment.
Options
:type
- Type of service to discover (:all, or a specific service type):provider
- Cloud provider to query (:all, or a specific provider):region
- Region to search in
Examples
iex> discover_services(type: :database)
{:ok, [
%{name: "main-db", type: :database, endpoint: "main-db.example.com:5432"},
%{name: "analytics-db", type: :database, endpoint: "analytics-db.example.com:5432"}
]}
Executes a function in the optimal location (edge or cloud) based on current conditions.
This is a wrapper around EdgeComputing.execute/2 that adds monitoring.
Examples
iex> execute(fn -> perform_calculation(data) end, priority: :speed)
{:ok, result}
Gets a connection to a cloud service with the specified parameters.
Options
:service
- Service name or type to connect to (required):provider
- Cloud provider to use (:aws, :azure, :gcp, or :custom):region
- Region to connect to:config
- Additional configuration for the connection
Examples
iex> get_service_connection(
...> service: :storage,
...> provider: :aws,
...> region: "us-west-2"
...> )
{:ok, %{
...> client: client,
...> endpoint: "s3.us-west-2.amazonaws.com",
...> service: :storage,
...> provider: :aws
...> }}
Initializes all cloud integrations with the provided configuration.
Options
:edge
- Options for edge computing (passed to EdgeComputing.init/1):monitoring
- Options for monitoring system (passed to Monitoring.init/1):providers
- List of cloud providers to enable [:aws, :azure, :gcp, :custom]:service_discovery
- Service discovery configuration:deployment
- Deployment and scaling configuration
Examples
iex> init(
...> edge: [mode: :auto, sync_interval: 30000],
...> monitoring: [backends: [:prometheus], active: true],
...> providers: [:aws]
...> )
:ok
Registers the current application as a service in the service discovery system.
Options
:name
- Service name (required):type
- Service type (required):endpoint
- Service endpoint (required):metadata
- Additional metadata about the service:health_check_path
- Path for health checks
Examples
iex> register_service(
...> name: "user-api",
...> type: :api,
...> endpoint: "user-api.example.com:8080",
...> health_check_path: "/health"
...> )
{:ok, %{registration_id: "reg-12345", status: :registered}}
Scales a service based on current metrics and conditions.
Options
:service
- Service name to scale (required):min
- Minimum number of instances:max
- Maximum number of instances:desired
- Desired number of instances (if specified, overrides automatic scaling):metrics
- Metrics to use for scaling decisions
Examples
iex> scale(
...> service: "api-server",
...> min: 2,
...> max: 10,
...> metrics: [
...> %{name: "cpu", target: 70},
...> %{name: "requests", target: 1000}
...> ]
...> )
{:ok, %{service: "api-server", current: 2, target: 4, status: :scaling}}
Returns the current status of all cloud integrations.
Examples
iex> status()
%{
edge: %{mode: :auto, connected: true, ...},
monitoring: %{active: true, ...},
providers: %{aws: :connected, ...}
}