phasm-platform/README.md
2023-11-07 10:47:19 +01:00

1.7 KiB

phasm-platform

Background

phasm is a language that compiles to WebAssembly. This platform can run compiled phasm code, with every module running as a container or as a service. Modules can call other modules, if they are registered as a service.

Think of it as Kubernetes, but except that every container is an OS, it's a program.

Terminology

A phasm cluster consists of controllers and workers. The controller manage the workers. The workers run the modules.

A worker can run in standalone mode. In that case, control functionality is limited, but for basic use cases, it will suffice.

Logging is done via ClickHouse. Modules can log directly, but the platform also logs routed calls from one module to another.

Controllers manage their state using redis.

Status

This project is build in lockstep with the phasm compiler.

The controller is not implemented at all yet.

The worker can currently run the examples that you see in the examples/ directory. These first need to be compiled from the .py files to .wasm files using the phasm compiler.

Running the worker

# Setup the virtuel environment
make setup

# Run the dependent services using docker compose
make init

# Import the schema for the logging
make clickhouse-schema

# Launch the worker. This won't output much.
# Press Ctrl+C when you're done running the processes.
make run-worker

# Run the ClickHouse CLI to get access to the logs
make clickhouse-sh
-- See the direct logging output from modules
SELECT * FROM container_logs ORDER BY timestamp;

-- See the routing logs between services
SELECT * FROM routing_logs ORDER BY timestamp;