Repo usability fixes

This commit is contained in:
Johan B.W. de Vries 2023-11-07 10:47:19 +01:00
parent dae2740e65
commit f7599e79c7
2 changed files with 60 additions and 4 deletions

View File

@ -11,7 +11,10 @@ examples/echoapp.toml: examples/echoserver.toml examples/echoclient.toml
cat examples/echoclient.toml >> $@ cat examples/echoclient.toml >> $@
clickhouse-sh: clickhouse-sh:
docker compose exec clickhouse /usr/bin/clickhouse client docker compose exec clickhouse /usr/bin/clickhouse client --database phasm_platform
clickhouse-schema:
cat config/clickhouse/schema.sql | docker compose exec -T clickhouse /usr/bin/clickhouse client --multiquery
redis-sh: redis-sh:
docker compose exec -it redis redis-cli docker compose exec -it redis redis-cli

View File

@ -1,8 +1,61 @@
# phasm-platform # phasm-platform
## Steps ## Background
[phasm](https://git.jbwdevries.nl/jbwdevries/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
```sh ```sh
# Setup the virtuel environment
make setup make setup
# Run the dependent services using docker compose
make init make init
make run-controller
# 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
```
```sql
-- 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;
``` ```