module PlaceOS::Core

Overview

Sequences the acquisition and production of resources

Defined in:

constants.cr
placeos-core.cr
placeos-core/driver_cleanup.cr
placeos-core/driver_manager.cr
placeos-core/error.cr
placeos-core/mappings/control_system_modules.cr
placeos-core/mappings/driver_module_names.cr
placeos-core/mappings/module_names.cr
placeos-core/module_manager.cr
placeos-core/process_check.cr
placeos-core/process_manager.cr
placeos-core/process_manager/edge.cr
placeos-core/process_manager/local.cr
placeos-core/resource_manager.cr
telemetry.cr

Constant Summary

API_VERSION = "v1"
APP_NAME = "core"
ARCH = {% if flag?(:x86_64) %} "amd64" {% else %}{% if flag?(:aarch64) %} "arm64" {% else %} {% abort("unsupported architechture") %} {% end %}{% end %}
BUILD_COMMIT = {{ (env("PLACE_COMMIT")) || "DEV" }}
BUILD_HOST = ENV["BUILD_API_HOST"]?
BUILD_PORT = ENV["BUILD_API_PORT"]?
BUILD_TIME = {{ (system("date -u")).chomp.stringify }}
CLUSTER_NODE_TTL = (ENV["CLUSTER_NODE_TTL"]? || "20").to_i

seconds before a node is considered offline should not be divisible by 3

CORE_HOST = ENV["CORE_HOST"]? || System.hostname

core self-registers to etcd with this information. In k8s we can grab the Pod information from the environment https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/#use-pod-fields-as-values-for-environment-variables

CORE_PORT = (ENV["CORE_PORT"]? || "3000").to_i
DRIVERS = ENV["ENGINE_DRIVERS"]? || (File.join(PlaceOS::Compiler.repository_dir, "drivers"))
Log = ::Log.for(self)
PROCESS_CHECK_PERIOD = (ENV["PLACE_CORE_PROCESS_CHECK_PERIOD"]?.try(&.to_i?) || 80).seconds

Used in ModuleManager

PROCESS_COMMS_TIMEOUT = (ENV["PLACE_CORE_PROCESS_COMMS_TIMEOUT"]?.try(&.to_i?) || 40).seconds
PROD = ENV["SG_ENV"]?.try(&.downcase) == "production"
REDIS_CLIENT = Driver::RedisStorage.shared_redis_client
REDIS_LOCK = Driver::RedisStorage.redis_lock

Minimize the number of connections being made to redis

REDIS_URL = ENV["REDIS_URL"]? || "redis://localhost:6379"
RESPONSE_CODE_HEADER = "Response-Code"
VERSION = "4.17.0"

Class Method Summary

Class Method Detail

def self.build_host #

[View source]
def self.production? : Bool #

[View source]
def self.start_managers #

[View source]
def self.wait_for_resources #

Wait for the upstream services to be ready

  • redis
  • postgres

[View source]