├── .cargo └── config.toml ├── .clabot ├── .dockerignore ├── .editorconfig ├── .github └── workflows │ ├── 001-tester-ubuntu-make-test-auraed.yml │ ├── 002-tester-ubuntu-make-test-auraescript.yml │ ├── 003-tester-ubuntu-make-test-aer.yml │ └── README.md ├── .gitignore ├── .vale.ini ├── .vale └── Aurae │ ├── CaseSensitiveTerms.yml │ └── Spelling.yml ├── CNAME ├── CODE_OF_CONDUCT.md ├── Cargo.lock ├── Cargo.toml ├── LICENSE ├── Makefile ├── README.md ├── RELEASE.md ├── SECURITY.md ├── aer ├── Cargo.toml ├── macros │ ├── Cargo.toml │ └── src │ │ ├── lib.rs │ │ └── subcommand.rs └── src │ ├── bin │ └── main.rs │ ├── cri │ ├── image_service.rs │ ├── mod.rs │ └── pod_service.rs │ ├── discovery │ ├── discovery_service.rs │ └── mod.rs │ ├── grpc │ ├── health_service.rs │ └── mod.rs │ ├── lib.rs │ ├── observe │ ├── mod.rs │ └── observe_service.rs │ └── runtime │ ├── cell_service.rs │ └── mod.rs ├── api ├── README.md ├── buf.yaml ├── cri │ └── v1 │ │ └── release-1.26.proto ├── grpc │ └── health │ │ └── v1 │ │ └── health.proto └── v0 │ ├── README.md │ ├── cells │ └── cells.proto │ ├── discovery │ └── discovery.proto │ ├── observe │ └── observe.proto │ └── vms │ └── vms.proto ├── auraed ├── Cargo.toml ├── LICENSE ├── README.md ├── src │ ├── auraed_path.rs │ ├── bin │ │ └── main.rs │ ├── cells │ │ ├── cell_service │ │ │ ├── cell_service.rs │ │ │ ├── cells │ │ │ │ ├── cell.rs │ │ │ │ ├── cell_name.rs │ │ │ │ ├── cells.rs │ │ │ │ ├── cells_cache.rs │ │ │ │ ├── cgroups │ │ │ │ │ ├── allocation.rs │ │ │ │ │ ├── cgroup.rs │ │ │ │ │ ├── cpu │ │ │ │ │ │ └── mod.rs │ │ │ │ │ ├── cpuset │ │ │ │ │ │ ├── cpus.rs │ │ │ │ │ │ ├── mems.rs │ │ │ │ │ │ └── mod.rs │ │ │ │ │ ├── error.rs │ │ │ │ │ ├── limit.rs │ │ │ │ │ ├── memory │ │ │ │ │ │ └── mod.rs │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── protection.rs │ │ │ │ │ └── weight.rs │ │ │ │ ├── error.rs │ │ │ │ ├── mod.rs │ │ │ │ └── nested_auraed │ │ │ │ │ ├── isolation_controls.rs │ │ │ │ │ ├── mod.rs │ │ │ │ │ └── nested_auraed.rs │ │ │ ├── error.rs │ │ │ ├── executables │ │ │ │ ├── error.rs │ │ │ │ ├── executable.rs │ │ │ │ ├── executable_name.rs │ │ │ │ ├── executables.rs │ │ │ │ └── mod.rs │ │ │ ├── mod.rs │ │ │ └── validation.rs │ │ └── mod.rs │ ├── cri │ │ ├── error.rs │ │ ├── image_service.rs │ │ ├── mod.rs │ │ ├── oci.rs │ │ ├── runtime_service.rs │ │ ├── sandbox.rs │ │ └── sandbox_cache.rs │ ├── discovery │ │ └── mod.rs │ ├── ebpf │ │ ├── bpf_context.rs │ │ ├── bpf_file.rs │ │ ├── kprobe │ │ │ ├── kprobe_program.rs │ │ │ └── mod.rs │ │ ├── mod.rs │ │ ├── perf_buffer_reader.rs │ │ ├── perf_event_broadcast.rs │ │ └── tracepoint │ │ │ ├── mod.rs │ │ │ └── tracepoint_program.rs │ ├── graceful_shutdown.rs │ ├── init │ │ ├── fileio.rs │ │ ├── fs.rs │ │ ├── logging.rs │ │ ├── mod.rs │ │ ├── network │ │ │ ├── mod.rs │ │ │ └── sriov.rs │ │ ├── power.rs │ │ └── system_runtimes │ │ │ ├── cell_system_runtime.rs │ │ │ ├── container_system_runtime.rs │ │ │ ├── daemon_system_runtime.rs │ │ │ ├── mod.rs │ │ │ └── pid1_system_runtime.rs │ ├── lib.rs │ ├── logging │ │ ├── log_channel.rs │ │ ├── mod.rs │ │ └── stream_logger.rs │ ├── observe │ │ ├── cgroup_cache.rs │ │ ├── error.rs │ │ ├── mod.rs │ │ ├── observe_service.rs │ │ ├── observed_event_stream.rs │ │ └── proc_cache.rs │ ├── spawn │ │ └── mod.rs │ └── vms │ │ ├── error.rs │ │ ├── manager.rs │ │ ├── mod.rs │ │ ├── virtual_machine.rs │ │ ├── virtual_machines.rs │ │ └── vm_service.rs └── tests │ ├── cell_list_must_list_allocated_cells_recursively.rs │ ├── common │ ├── cells.rs │ ├── mod.rs │ └── observe.rs │ ├── observe_get_posix_signals_stream_must_get_posix_signals_for_a_cell.rs │ ├── observe_get_posix_signals_stream_must_get_posix_signals_for_a_nested_cell.rs │ ├── observe_get_posix_signals_stream_must_get_posix_signals_for_the_host.rs │ ├── observe_get_posix_signals_stream_must_map_host_pids_to_namespace_pids.rs │ └── vms_start_must_start_vm_with_auraed.rs ├── auraescript ├── Cargo.toml ├── LICENSE ├── README.md ├── aurae.ts ├── build.rs ├── default.config.toml ├── macros │ ├── Cargo.toml │ └── src │ │ ├── lib.rs │ │ └── ops.rs └── src │ ├── bin │ └── main.rs │ ├── builtin │ ├── auraescript_client.rs │ └── mod.rs │ ├── cells.rs │ ├── cri.rs │ ├── discovery.rs │ ├── health.rs │ ├── lib.rs │ ├── observe.rs │ └── vms.rs ├── buf.gen.yaml ├── client ├── Cargo.toml ├── macros │ ├── Cargo.toml │ └── src │ │ ├── lib.rs │ │ └── service.rs └── src │ ├── cells │ ├── cell_service.rs │ └── mod.rs │ ├── client.rs │ ├── config │ ├── auth_config.rs │ ├── cert_material.rs │ ├── client_cert_details.rs │ ├── mod.rs │ ├── system_config.rs │ └── x509_details.rs │ ├── cri │ ├── image_service.rs │ ├── mod.rs │ └── runtime_service.rs │ ├── discovery │ ├── discovery_service.rs │ └── mod.rs │ ├── grpc │ ├── health │ │ ├── health.rs │ │ └── mod.rs │ └── mod.rs │ ├── lib.rs │ ├── observe │ ├── mod.rs │ └── observe_service.rs │ └── vms │ ├── mod.rs │ └── vm_service.rs ├── clippy.toml ├── crates ├── proto-reader │ ├── Cargo.toml │ └── src │ │ ├── helpers.rs │ │ └── lib.rs ├── test-helpers-macros │ ├── Cargo.toml │ └── src │ │ └── lib.rs ├── test-helpers │ ├── Cargo.toml │ └── src │ │ └── lib.rs └── validation │ ├── Cargo.toml │ ├── macros │ ├── Cargo.toml │ └── src │ │ ├── lib.rs │ │ └── validation.rs │ └── src │ ├── allow_regex.rs │ ├── lib.rs │ ├── maximum_length.rs │ ├── maximum_value.rs │ ├── minimum_length.rs │ ├── minimum_value.rs │ ├── required.rs │ ├── required_not_empty.rs │ ├── valid_enum.rs │ ├── valid_json.rs │ └── valid_url.rs ├── deny.toml ├── docs ├── .gitignore ├── CNAME ├── assets │ ├── aurae-corporate-cla.pdf │ ├── img │ │ ├── blog-cell.png │ │ ├── blog-cells.png │ │ ├── blog-instance.png │ │ └── blog-spawn.png │ └── logo │ │ ├── LOGO AURAE HORIZONTAL 1.psd │ │ ├── LOGO AURAE VERTICAL 1.ai │ │ ├── LOGO ONLY AURAE 1.ai │ │ ├── LOGO ONLY AURAE 1.psd │ │ ├── TEXT ONLY AURAE 1.ai │ │ ├── aurae-text.png │ │ ├── aurae-white-purple.png │ │ ├── aurae-white-purple.xcf │ │ ├── aurae-white.png │ │ └── aurae.png ├── auraed │ ├── index.md │ └── philosophy.md ├── auraescript │ └── index.md ├── blog │ ├── 2022-10-24-aurae-cells.md │ └── 2022-12-11-cgroups.md ├── build.md ├── certs.md ├── community │ └── index.md ├── contributors.md ├── crate │ ├── .gitignore │ └── .gitkeep ├── development-environments │ ├── index.md │ └── macOS │ │ ├── apple-silicon │ │ └── clion-parallels.md │ │ └── lima.md ├── index.md ├── quickstart.md ├── signals.md └── stdlib │ ├── index.md │ └── v0 │ ├── .gitignore │ └── .gitkeep ├── ebpf-shared ├── Cargo.toml └── src │ └── lib.rs ├── ebpf ├── Cargo.lock ├── Cargo.toml ├── LICENSE.GPL-2.0 ├── LICENSE.MIT ├── Makefile ├── README.md └── src │ ├── probe-kprobe-taskstats-exit.rs │ ├── probe-tracepoint-sched-sched-process-fork.rs │ └── probe-tracepoint-signal-signal-generate.rs ├── examples ├── README.md ├── cell_validation_errors.ts ├── cells.ts ├── cells_isolated_network.ts ├── cells_isolated_processes.ts ├── cells_isolated_processes_and_network.ts ├── cells_memory.ts ├── cells_output.ts ├── cells_quota.ts ├── discovery_discover.ts ├── grpc_health.ts ├── pods-cri-nginx.ts └── virtual_machines.ts ├── flake.lock ├── flake.nix ├── hack ├── .header.script ├── .header.source ├── _common.mk ├── certgen ├── certgen-client ├── certgen.client.ext ├── certgen.server.ext ├── code-format ├── common ├── container ├── file-definitions ├── headers-check ├── headers-strip ├── headers-write ├── install-build-deps.sh ├── oci-alpine ├── oci-busybox ├── serve.sh ├── server-tls-info └── spawn ├── hypervisor └── guest-kernel │ └── linux-config-x86_64 ├── images ├── Dockerfile.build ├── Dockerfile.nested ├── Dockerfile.test └── README.md ├── mkdocs.yml ├── pods ├── error.rs ├── image.rs ├── mod.rs ├── pod.rs ├── pod_name.rs └── pods.rs ├── proto ├── Cargo.toml ├── LICENSE └── src │ └── lib.rs ├── rust-toolchain.toml └── rustfmt.toml /.cargo/config.toml: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- # 2 | # | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | # 3 | # | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | # 4 | # | ███████║██║ ██║██████╔╝███████║█████╗ | # 5 | # | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | # 6 | # | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | # 7 | # | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | # 8 | # +--------------------------------------------+ # 9 | # # 10 | # Distributed Systems Runtime # 11 | # ---------------------------------------------------------------------------- # 12 | # Copyright 2022 - 2024, the aurae contributors # 13 | # SPDX-License-Identifier: Apache-2.0 # 14 | # ---------------------------------------------------------------------------- # 15 | [build] 16 | rustflags = "--cfg tokio_unstable" 17 | -------------------------------------------------------------------------------- /.clabot: -------------------------------------------------------------------------------- 1 | HISTORY 2 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | .cache 2 | .dockerignore 3 | .github* 4 | .gitignore 5 | .idea* 6 | Dockerfile 7 | docs* 8 | docs/crate/* 9 | target* 10 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | ; https://editorconfig.org/ 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | [*] 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | 10 | # Unix-style newlines with a newline ending every file 11 | end_of_line = lf 12 | insert_final_newline = true 13 | 14 | [Makefile] 15 | indent_style = tab 16 | indent_size = 4 17 | 18 | [*.md] 19 | indent_size = 4 20 | trim_trailing_whitespace = false 21 | eclint_indent_style = unset 22 | 23 | # TODO: what's right for proto files? toml? yaml? (at least for buf.gen.yaml) 24 | 25 | [*.rs] 26 | indent_style = space 27 | indent_size = 4 28 | 29 | [*.ts] 30 | indent_style = space 31 | indent_size = 4 32 | 33 | [Dockerfile] 34 | indent_size = 4 35 | -------------------------------------------------------------------------------- /.github/workflows/README.md: -------------------------------------------------------------------------------- 1 | # GitHub Workflows 2 | 3 | Please use the following naming convention such that we can easily map failed builds back to YAML files here in the repository. 4 | 5 | ``` 6 | $number-$friendlyname-$environment-$testcommands 7 | ``` 8 | 9 | Where **number** is just a unique identifier to easily map failed builds to YAML files. See below for more guidance on choosing a number. 10 | Where **friendlyname** is a good descriptor to describe what is being checked (avoid words like "build" or "main" as they are too generic) 11 | Where **environment** describes the environment it is running in, such as `alpine:latest` or `armv7`. 12 | Where **testcommands** are the commands that a user can replicate on their computer! Do NOT test commands that can not be easily replicated! 13 | 14 | ``` 15 | 007-linter-alpine-make-lint.yaml 16 | ``` 17 | 18 | A new linter running in alpine that tests the command `make lint` and **007** can easily be mapped backed to the file. 19 | 20 | ## Choosing a number 21 | 22 | - 001-099: Reserved for workflows that don't use a container image 23 | 24 | ## Testing workflows 25 | 26 | Workflows can be testing using the tool [act](https://github.com/nektos/act). You'll need to install that locally, then you can run commands to test each file individually, locally: 27 | 28 | `make ci-local file=001-tester-ubuntu-make-test.yml` 29 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea* 2 | target* 3 | docs/crate/* 4 | auraescript/lib* 5 | auraescript/node_modules* 6 | pki* 7 | **/gen/ 8 | hypervisor/guest-kernel/linux-cloud-hypervisor 9 | /.direnv/ 10 | /.envrc 11 | -------------------------------------------------------------------------------- /.vale.ini: -------------------------------------------------------------------------------- 1 | StylesPath = .vale 2 | 3 | MinAlertLevel = warning 4 | 5 | # inline-level HTML tags to ignore 6 | IgnoredScopes = code, tt, a, h1, h2, h3, h4 7 | 8 | [*.md] 9 | BasedOnStyles = Aurae 10 | -------------------------------------------------------------------------------- /.vale/Aurae/CaseSensitiveTerms.yml: -------------------------------------------------------------------------------- 1 | --- 2 | extends: substitution 3 | ignorecase: false 4 | level: warning 5 | message: Use '%s' rather than '%s'. 6 | action: 7 | name: replace 8 | swap: 9 | aurae: Aurae 10 | Auraed: auraed 11 | CGroup|c group: cgroup 12 | dns: DNS 13 | gid: GID 14 | makefile: Makefile 15 | OS|Operating System: operating system 16 | pid: PID 17 | uid: UID 18 | unix: Unix 19 | -------------------------------------------------------------------------------- /.vale/Aurae/Spelling.yml: -------------------------------------------------------------------------------- 1 | --- 2 | extends: spelling 3 | level: warning 4 | message: "Use correct American English spelling. Did you really mean '%s'?" 5 | # A "filter" is a case-sensitive regular expression specifying words to ignore during spell checking. 6 | # Spelling rule applies to individual words 7 | filters: 8 | - '[eE]num' 9 | - ADHD 10 | - API 11 | - Aspie 12 | - Aurae 13 | - auraed 14 | - authn 15 | - authz 16 | - cgroup 17 | - composable 18 | - LGTBQIA 19 | - loopback 20 | - Makefile 21 | - namespace 22 | - neurodivergent 23 | - protobuf 24 | - RPC 25 | - runtime 26 | - seccomp 27 | - stdlib 28 | - sublicense 29 | - systemd 30 | - toolchain 31 | - transphobia 32 | - untrusted 33 | - virtualized 34 | - CLion 35 | - Deno 36 | - buf 37 | -------------------------------------------------------------------------------- /CNAME: -------------------------------------------------------------------------------- 1 | aurae.io -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | As part of the [Nivenly](https://nivenly.org) we have adopted the [Nivenly Covenant](https://nivenly.org/covenant/) as our code of conduct. 2 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- # 2 | # | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | # 3 | # | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | # 4 | # | ███████║██║ ██║██████╔╝███████║█████╗ | # 5 | # | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | # 6 | # | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | # 7 | # | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | # 8 | # +--------------------------------------------+ # 9 | # # 10 | # Distributed Systems Runtime # 11 | # ---------------------------------------------------------------------------- # 12 | # Copyright 2022 - 2024, the aurae contributors # 13 | # SPDX-License-Identifier: Apache-2.0 # 14 | # ---------------------------------------------------------------------------- # 15 | 16 | [workspace] 17 | members = ["aer", "auraed", "auraescript", "client", "ebpf-shared", "proto"] 18 | exclude = ["ebpf"] 19 | resolver = "2" 20 | 21 | [workspace.dependencies] 22 | anyhow = "1.0.72" 23 | chrono = { version = "0.4.26", default-features = false, features = [ 24 | "clock", 25 | "std", 26 | "wasmbind", 27 | ] } # default features except `oldtime` 28 | client = { path = "./client" } 29 | clap = { version = "4.3.21", features = ["derive"] } 30 | fancy-regex = "0.14.0" 31 | futures-util = "0.3.28" 32 | heck = "0.5.0" 33 | lazy_static = "1.4.0" 34 | nix = "0.28.0" 35 | proc-macro2 = "1.0" 36 | proto = { path = "./proto" } 37 | proto-reader = { path = "./crates/proto-reader" } 38 | protobuf = "3.2.0" 39 | protobuf-parse = "=3.2.0" # This crate makes no promises of stabilty, so we pin to the exact version 40 | quote = "1.0" 41 | serial_test = "3.2.0" 42 | serde = "1.0.183" 43 | serde_json = "1.0.104" 44 | syn = { version = "1.0.109", features = [ 45 | "full", 46 | ] } # used in macros, so full doesn't affect binary size 47 | test-helpers = { path = "./crates/test-helpers" } 48 | test-helpers-macros = { path = "./crates/test-helpers-macros" } 49 | thiserror = "2.0" 50 | tokio = "1.43.0" 51 | tonic = "0.12.3" 52 | tonic-health = "0.12.3" 53 | tracing = "0.1" 54 | uuid = { version = "1.2.2", features = ["v4"] } 55 | url = "2.3.1" 56 | validation = { path = "./crates/validation" } 57 | 58 | -------------------------------------------------------------------------------- /RELEASE.md: -------------------------------------------------------------------------------- 1 | # Releases 2 | 3 | Releases are created in the [releases](https://github.com/aurae-runtime/release) project so that all projects can be built at the same time. 4 | 5 | When a pre-release is created in that project, it will create a pre-release in this project with the same version. Notes will be autogenerated off the commit changes. 6 | 7 | That pre-release will trigger the `199-release-make-ci-upload-release-artifacts` pipeline in this project. This will create the artifacts using `make ci-upload-release-artifacts` and then upload them to the pre-release created for this project. 8 | 9 | When the pre-release in the `releases` project is approved by a maintainer and realeased, then this project will also get released. 10 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | > **Warning** 4 | > At this time, Aurae is in early development, and we do not recommend running it in any production environment. 5 | 6 | ## Reporting a Vulnerability 7 | 8 | You are welcome to report suspected security vulnerabilities to security@aurae.io. Due to Aurae's early development status, we may not respond or fix the issues reported, but we will use reports to help inform and prioritize our backlog. Once we have a release that we recommend for production, we will define a security SLA for the community. 9 | 10 | In your report, please include as much detail as possible: 11 | 12 | - the version/git sha of Aurae you are running 13 | - your operating system distribution & version 14 | - steps to reproduce 15 | - expected behavior 16 | - affected modules/lines of code 17 | -------------------------------------------------------------------------------- /aer/Cargo.toml: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- # 2 | # | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | # 3 | # | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | # 4 | # | ███████║██║ ██║██████╔╝███████║█████╗ | # 5 | # | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | # 6 | # | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | # 7 | # | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | # 8 | # +--------------------------------------------+ # 9 | # # 10 | # Distributed Systems Runtime # 11 | # ---------------------------------------------------------------------------- # 12 | # Copyright 2022 - 2024, the aurae contributors # 13 | # SPDX-License-Identifier: Apache-2.0 # 14 | # ---------------------------------------------------------------------------- # 15 | [package] 16 | name = "aer" 17 | version = "0.0.0" 18 | edition = "2024" 19 | authors = ["The Aurae Authors", "Kris Nóva "] 20 | license = "Apache-2.0" 21 | 22 | [[bin]] 23 | name = "aer" 24 | path = "src/bin/main.rs" 25 | 26 | [dependencies] 27 | anyhow = { workspace = true } 28 | client = { workspace = true } 29 | clap = { workspace = true } 30 | futures-util = { workspace = true } 31 | macros = { package = "aer-macros", path = "macros" } 32 | proto = { workspace = true } 33 | serde = { workspace = true } 34 | tokio = { workspace = true } 35 | -------------------------------------------------------------------------------- /aer/macros/Cargo.toml: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- # 2 | # | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | # 3 | # | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | # 4 | # | ███████║██║ ██║██████╔╝███████║█████╗ | # 5 | # | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | # 6 | # | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | # 7 | # | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | # 8 | # +--------------------------------------------+ # 9 | # # 10 | # Distributed Systems Runtime # 11 | # ---------------------------------------------------------------------------- # 12 | # Copyright 2022 - 2024, the aurae contributors # 13 | # SPDX-License-Identifier: Apache-2.0 # 14 | # ---------------------------------------------------------------------------- # 15 | [package] 16 | name = "aer-macros" 17 | version = "0.0.0" 18 | edition = "2024" 19 | publish = false 20 | authors = ["The Aurae Authors", "Kris Nóva "] 21 | license = "Apache-2.0" 22 | 23 | [lib] 24 | proc-macro = true 25 | 26 | [dependencies] 27 | heck = { workspace = true } 28 | itertools = "0.14.0" 29 | proc-macro2 = { workspace = true } 30 | protobuf = { workspace = true } 31 | protobuf-parse = { workspace = true } 32 | proto-reader = { path = "../../crates/proto-reader" } # using workspace isn't working 33 | quote = { workspace = true } 34 | syn = { workspace = true } 35 | -------------------------------------------------------------------------------- /aer/macros/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | // The project prefers .expect("reason") instead of .unwrap() so we fail 17 | // on any .unwrap() statements in the code. 18 | #![warn(clippy::unwrap_used)] 19 | // Lint groups: https://doc.rust-lang.org/rustc/lints/groups.html 20 | #![warn(future_incompatible, nonstandard_style, unused)] 21 | #![warn( 22 | improper_ctypes, 23 | non_shorthand_field_patterns, 24 | no_mangle_generic_items, 25 | unconditional_recursion, 26 | unused_comparisons, 27 | while_true 28 | )] 29 | #![warn(missing_debug_implementations, 30 | // TODO: missing_docs, 31 | trivial_casts, 32 | trivial_numeric_casts, 33 | unused_extern_crates, 34 | unused_import_braces, 35 | unused_qualifications, 36 | unused_results 37 | )] 38 | 39 | use proc_macro::TokenStream; 40 | 41 | mod subcommand; 42 | 43 | #[proc_macro] 44 | pub fn subcommand(input: TokenStream) -> TokenStream { 45 | subcommand::subcommand(input, true) 46 | } 47 | 48 | #[proc_macro] 49 | pub fn subcommand_for_dev_only(input: TokenStream) -> TokenStream { 50 | subcommand::subcommand(input, false) 51 | } 52 | -------------------------------------------------------------------------------- /api/buf.yaml: -------------------------------------------------------------------------------- 1 | version: v1 2 | breaking: 3 | use: 4 | - FILE 5 | lint: 6 | use: 7 | - STANDARD 8 | ignore: 9 | - cri/v1/release-1.26.proto 10 | - grpc/health/v1/health.proto 11 | except: 12 | - PACKAGE_VERSION_SUFFIX 13 | - PACKAGE_DIRECTORY_MATCH 14 | -------------------------------------------------------------------------------- /api/grpc/health/v1/health.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The gRPC Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // The canonical version of this proto can be found at 16 | // https://github.com/grpc/grpc-proto/blob/master/grpc/health/v1/health.proto 17 | 18 | syntax = "proto3"; 19 | 20 | package grpc.health.v1; 21 | 22 | option csharp_namespace = "Grpc.Health.V1"; 23 | option go_package = "google.golang.org/grpc/health/grpc_health_v1"; 24 | option java_multiple_files = true; 25 | option java_outer_classname = "HealthProto"; 26 | option java_package = "io.grpc.health.v1"; 27 | 28 | message HealthCheckRequest { 29 | string service = 1; 30 | } 31 | 32 | message HealthCheckResponse { 33 | enum ServingStatus { 34 | UNKNOWN = 0; 35 | SERVING = 1; 36 | NOT_SERVING = 2; 37 | SERVICE_UNKNOWN = 3; // Used only by the Watch method. 38 | } 39 | ServingStatus status = 1; 40 | } 41 | 42 | service Health { 43 | // If the requested service is unknown, the call will fail with status 44 | // NOT_FOUND. 45 | rpc Check(HealthCheckRequest) returns (HealthCheckResponse); 46 | 47 | // Performs a watch for the serving status of the requested service. 48 | // The server will immediately send back a message indicating the current 49 | // serving status. It will then subsequently send a new message whenever 50 | // the service's serving status changes. 51 | // 52 | // If the requested service is unknown when the call is received, the 53 | // server will send a message setting the serving status to 54 | // SERVICE_UNKNOWN but will *not* terminate the call. If at some 55 | // future point, the serving status of the service becomes known, the 56 | // server will send a new message with the service's serving status. 57 | // 58 | // If the call terminates with status UNIMPLEMENTED, then clients 59 | // should assume this method is not supported and should not retry the 60 | // call. If the call terminates with any other status (including OK), 61 | // clients should retry the call with appropriate exponential backoff. 62 | rpc Watch(HealthCheckRequest) returns (stream HealthCheckResponse); 63 | } 64 | -------------------------------------------------------------------------------- /api/v0/README.md: -------------------------------------------------------------------------------- 1 | # V0 Aurae Standard Library 2 | 3 | The `V0` release is an experimental and risky API. This API should never be ran in production as it is subject to change at any time. 4 | 5 | -------------------------------------------------------------------------------- /auraed/README.md: -------------------------------------------------------------------------------- 1 | # Aurae Daemon 2 | 3 | See https://aurae.io/crate/auraed -------------------------------------------------------------------------------- /auraed/src/cells/cell_service/cells/cgroups/allocation.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | use std::fmt::{Display, Formatter}; 17 | use std::ops::Deref; 18 | use validation::{ValidatedField, ValidationError}; 19 | 20 | #[derive(Debug, Clone, Copy, Ord, PartialOrd, Eq, PartialEq, Hash)] 21 | pub struct Allocation(i64); 22 | 23 | #[allow(unused)] 24 | impl Allocation { 25 | #[cfg(test)] 26 | pub fn new(allocation: i64) -> Self { 27 | Self(allocation) 28 | } 29 | 30 | pub fn into_inner(self) -> i64 { 31 | self.0 32 | } 33 | } 34 | 35 | impl ValidatedField for Allocation { 36 | fn validate( 37 | input: Option, 38 | field_name: &str, 39 | parent_name: Option<&str>, 40 | ) -> Result { 41 | let input = validation::required(input, field_name, parent_name)?; 42 | 43 | validation::minimum_value(input, 0, "units", field_name, parent_name)?; 44 | 45 | Ok(Self(input)) 46 | } 47 | } 48 | 49 | impl Deref for Allocation { 50 | type Target = i64; 51 | 52 | fn deref(&self) -> &Self::Target { 53 | &self.0 54 | } 55 | } 56 | 57 | impl Display for Allocation { 58 | fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { 59 | self.0.fmt(f) 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /auraed/src/cells/cell_service/cells/cgroups/cpu/mod.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | use super::{Limit, Weight}; 17 | 18 | #[derive(Debug, Clone)] 19 | pub struct CpuController { 20 | pub weight: Option, 21 | pub max: Option, 22 | pub period: Option, 23 | } 24 | -------------------------------------------------------------------------------- /auraed/src/cells/cell_service/cells/cgroups/cpuset/mod.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | pub use cpus::Cpus; 17 | pub use mems::Mems; 18 | 19 | mod cpus; 20 | mod mems; 21 | 22 | #[derive(Debug, Clone)] 23 | pub struct CpusetController { 24 | pub cpus: Option, 25 | pub mems: Option, 26 | } 27 | -------------------------------------------------------------------------------- /auraed/src/cells/cell_service/cells/cgroups/error.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | use crate::cells::cell_service::cells::CellName; 17 | use thiserror::Error; 18 | 19 | pub type Result = std::result::Result; 20 | 21 | #[derive(Error, Debug)] 22 | pub enum CgroupsError { 23 | #[error("cgroup '{cell_name}' creation failed: {source}")] 24 | CreateCgroup { cell_name: CellName, source: anyhow::Error }, 25 | #[error("cgroup '{cell_name}' failed to add task: {source}")] 26 | AddTaskToCgroup { cell_name: CellName, source: anyhow::Error }, 27 | #[error("cgroup '{cell_name}' deletion failed: {source}")] 28 | DeleteCgroup { cell_name: CellName, source: anyhow::Error }, 29 | #[error("cgroup '{cell_name}' failed to read stats: {source}")] 30 | ReadStats { cell_name: CellName, source: anyhow::Error }, 31 | } 32 | -------------------------------------------------------------------------------- /auraed/src/cells/cell_service/cells/cgroups/limit.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | use std::fmt::{Display, Formatter}; 17 | use std::ops::Deref; 18 | use validation::{ValidatedField, ValidationError}; 19 | 20 | #[derive(Debug, Clone, Copy, Ord, PartialOrd, Eq, PartialEq, Hash)] 21 | pub struct Limit(i64); 22 | 23 | impl Limit { 24 | #[cfg(test)] 25 | pub fn new(limit: i64) -> Self { 26 | Self(limit) 27 | } 28 | 29 | pub fn into_inner(self) -> i64 { 30 | self.0 31 | } 32 | } 33 | 34 | impl ValidatedField for Limit { 35 | fn validate( 36 | input: Option, 37 | field_name: &str, 38 | parent_name: Option<&str>, 39 | ) -> Result { 40 | let input = validation::required(input, field_name, parent_name)?; 41 | 42 | validation::minimum_value(input, 0, "units", field_name, parent_name)?; 43 | 44 | Ok(Self(input)) 45 | } 46 | } 47 | 48 | impl Deref for Limit { 49 | type Target = i64; 50 | 51 | fn deref(&self) -> &Self::Target { 52 | &self.0 53 | } 54 | } 55 | 56 | impl Display for Limit { 57 | fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { 58 | self.0.fmt(f) 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /auraed/src/cells/cell_service/cells/cgroups/memory/mod.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | use super::{Limit, Protection}; 17 | 18 | #[derive(Debug, Clone)] 19 | pub struct MemoryController { 20 | pub min: Option, 21 | pub low: Option, 22 | pub high: Option, 23 | pub max: Option, 24 | } 25 | -------------------------------------------------------------------------------- /auraed/src/cells/cell_service/cells/cgroups/mod.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | pub use cgroup::Cgroup; 17 | pub use cpu::CpuController; 18 | pub use cpuset::CpusetController; 19 | pub use limit::Limit; 20 | pub use memory::MemoryController; 21 | pub use protection::Protection; 22 | pub use weight::Weight; 23 | 24 | pub mod cpu; 25 | pub mod cpuset; 26 | pub mod error; 27 | pub mod memory; 28 | 29 | mod allocation; 30 | mod cgroup; 31 | mod limit; 32 | mod protection; 33 | mod weight; 34 | 35 | #[derive(Debug, Clone)] 36 | pub struct CgroupSpec { 37 | pub cpu: Option, 38 | pub cpuset: Option, 39 | pub memory: Option, 40 | } 41 | -------------------------------------------------------------------------------- /auraed/src/cells/cell_service/cells/cgroups/protection.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | use std::fmt::{Display, Formatter}; 17 | use std::ops::Deref; 18 | use validation::{ValidatedField, ValidationError}; 19 | 20 | #[derive(Debug, Clone, Copy, Ord, PartialOrd, Eq, PartialEq, Hash)] 21 | pub struct Protection(i64); 22 | 23 | impl Protection { 24 | #[cfg(test)] 25 | pub fn new(allocation: i64) -> Self { 26 | Self(allocation) 27 | } 28 | 29 | pub fn into_inner(self) -> i64 { 30 | self.0 31 | } 32 | } 33 | 34 | impl ValidatedField for Protection { 35 | fn validate( 36 | input: Option, 37 | field_name: &str, 38 | parent_name: Option<&str>, 39 | ) -> Result { 40 | let input = validation::required(input, field_name, parent_name)?; 41 | 42 | validation::minimum_value(input, 0, "units", field_name, parent_name)?; 43 | 44 | Ok(Self(input)) 45 | } 46 | } 47 | 48 | impl Deref for Protection { 49 | type Target = i64; 50 | 51 | fn deref(&self) -> &Self::Target { 52 | &self.0 53 | } 54 | } 55 | 56 | impl Display for Protection { 57 | fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { 58 | self.0.fmt(f) 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /auraed/src/cells/cell_service/cells/error.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | use super::{cgroups::error::CgroupsError, CellName}; 17 | use std::io; 18 | use thiserror::Error; 19 | use tracing::error; 20 | 21 | pub type Result = std::result::Result; 22 | 23 | #[derive(Error, Debug)] 24 | pub enum CellsError { 25 | #[error("cell '{cell_name}' already exists'")] 26 | CellExists { cell_name: CellName }, 27 | #[error("cell '{cell_name}' not found")] 28 | CellNotFound { cell_name: CellName }, 29 | #[error("cell '{cell_name}' is not allocated")] 30 | CellNotAllocated { cell_name: CellName }, 31 | #[error("cell '{cell_name}' could not be allocated: {source}")] 32 | FailedToAllocateCell { cell_name: CellName, source: io::Error }, 33 | #[error("cell '{cell_name}' allocation was aborted: {source}")] 34 | AbortedAllocateCell { cell_name: CellName, source: CgroupsError }, 35 | #[error("cell '{cell_name}' could not kill children: {source}")] 36 | FailedToKillCellChildren { cell_name: CellName, source: io::Error }, 37 | #[error("cell '{cell_name}' could not be freed: {source}")] 38 | FailedToFreeCell { cell_name: CellName, source: CgroupsError }, 39 | #[error( 40 | "cgroup '{cell_name}' exists on host, but is not controlled by auraed" 41 | )] 42 | CgroupIsNotACell { cell_name: CellName }, 43 | #[error("cgroup '{cell_name}` not found on host")] 44 | CgroupNotFound { cell_name: CellName }, 45 | } 46 | -------------------------------------------------------------------------------- /auraed/src/cells/cell_service/cells/nested_auraed/mod.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | pub use isolation_controls::IsolationControls; 17 | pub use nested_auraed::NestedAuraed; 18 | 19 | mod isolation_controls; 20 | #[allow(clippy::module_inception)] 21 | mod nested_auraed; 22 | -------------------------------------------------------------------------------- /auraed/src/cells/cell_service/executables/error.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | use super::ExecutableName; 17 | use std::io; 18 | use thiserror::Error; 19 | 20 | pub type Result = std::result::Result; 21 | 22 | #[derive(Error, Debug)] 23 | pub enum ExecutablesError { 24 | #[error("executable '{executable_name}' exists")] 25 | ExecutableExists { executable_name: ExecutableName }, 26 | #[error("executable '{executable_name}' not found")] 27 | ExecutableNotFound { executable_name: ExecutableName }, 28 | #[error("executable '{executable_name}' failed to start: {source}")] 29 | FailedToStartExecutable { 30 | executable_name: ExecutableName, 31 | source: io::Error, 32 | }, 33 | #[error("executable '{executable_name}' failed to stop: {source}")] 34 | FailedToStopExecutable { 35 | executable_name: ExecutableName, 36 | source: io::Error, 37 | }, 38 | } 39 | -------------------------------------------------------------------------------- /auraed/src/cells/cell_service/executables/mod.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | pub use error::{ExecutablesError, Result}; 17 | pub use executable::Executable; 18 | pub use executable_name::ExecutableName; 19 | pub use executables::Executables; 20 | use tokio::process::Command; 21 | 22 | mod error; 23 | mod executable; 24 | mod executable_name; 25 | #[allow(clippy::module_inception)] 26 | mod executables; 27 | 28 | pub struct ExecutableSpec { 29 | pub name: ExecutableName, 30 | pub description: String, 31 | pub command: Command, 32 | } 33 | -------------------------------------------------------------------------------- /auraed/src/cells/cell_service/mod.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | pub use cell_service::CellService; 16 | use error::Result; 17 | 18 | #[allow(clippy::module_inception)] 19 | mod cell_service; 20 | mod cells; 21 | mod error; 22 | mod executables; 23 | mod validation; 24 | -------------------------------------------------------------------------------- /auraed/src/cells/mod.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | pub(crate) use cell_service::CellService; 17 | 18 | mod cell_service; 19 | -------------------------------------------------------------------------------- /auraed/src/ebpf/bpf_file.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | use crate::AURAED_RUNTIME; 17 | use aya::{Ebpf, EbpfError}; 18 | use tracing::trace; 19 | 20 | pub trait BpfFile { 21 | const OBJ_NAME: &'static str; 22 | 23 | fn load() -> Result { 24 | trace!("Loading eBPF file: {}", Self::OBJ_NAME); 25 | 26 | Ebpf::load_file(format!( 27 | "{}/ebpf/{}", 28 | AURAED_RUNTIME 29 | .get() 30 | .expect("runtime") 31 | .library_dir 32 | .to_string_lossy(), 33 | Self::OBJ_NAME 34 | )) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /auraed/src/ebpf/kprobe/kprobe_program.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | use aya::programs::{KProbe, ProgramError}; 16 | use aya::Ebpf; 17 | use tracing::{trace, warn}; 18 | 19 | pub trait KProbeProgram { 20 | const PROGRAM_NAME: &'static str; 21 | const FUNCTION_NAME: &'static str; 22 | const PERF_BUFFER: &'static str; 23 | 24 | fn load_and_attach(bpf: &mut Ebpf) -> Result<(), anyhow::Error> { 25 | trace!("Loading eBPF program: {}", Self::PROGRAM_NAME); 26 | 27 | // Load the eBPF TracePoint program 28 | let program: &mut KProbe = bpf 29 | .program_mut(Self::PROGRAM_NAME) 30 | .ok_or_else(|| anyhow::anyhow!("failed to get eBPF program"))? 31 | .try_into()?; 32 | 33 | // Load the program 34 | match program.load() { 35 | Ok(_) => Ok(()), 36 | Err(ProgramError::AlreadyLoaded) => { 37 | warn!("Already loaded eBPF program {}", Self::PROGRAM_NAME); 38 | Ok(()) 39 | } 40 | other => other, 41 | }?; 42 | 43 | // Attach to kernel trace event 44 | match program.attach(Self::FUNCTION_NAME, 0) { 45 | Ok(_) => Ok(()), 46 | Err(ProgramError::AlreadyAttached) => { 47 | warn!("Already attached eBPF program {}", Self::PROGRAM_NAME); 48 | Ok(()) 49 | } 50 | Err(e) => Err(e), 51 | }?; 52 | 53 | Ok(()) 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /auraed/src/ebpf/kprobe/mod.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | use super::{bpf_file::BpfFile, perf_buffer_reader::PerfBufferReader}; 16 | use aurae_ebpf_shared::ProcessExit; 17 | pub use kprobe_program::KProbeProgram; 18 | 19 | mod kprobe_program; 20 | 21 | pub struct TaskstatsExitKProbeProgram; 22 | 23 | impl KProbeProgram for TaskstatsExitKProbeProgram { 24 | const PROGRAM_NAME: &'static str = "kprobe_taskstats_exit"; 25 | const FUNCTION_NAME: &'static str = "taskstats_exit"; 26 | const PERF_BUFFER: &'static str = "PROCESS_EXITS"; 27 | } 28 | 29 | impl BpfFile for TaskstatsExitKProbeProgram { 30 | /// Definition of the Aurae eBPF probe to capture all generated (and valid) 31 | /// kernel signals at runtime. 32 | const OBJ_NAME: &'static str = "instrument-kprobe-taskstats-exit"; 33 | } 34 | 35 | impl PerfBufferReader for TaskstatsExitKProbeProgram {} 36 | -------------------------------------------------------------------------------- /auraed/src/ebpf/mod.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | pub use bpf_context::BpfContext; 17 | use bpf_file::BpfFile; 18 | pub use kprobe::TaskstatsExitKProbeProgram; 19 | pub use tracepoint::SchedProcessForkTracepointProgram; 20 | pub use tracepoint::SignalSignalGenerateTracepointProgram; 21 | 22 | mod bpf_context; 23 | mod bpf_file; 24 | pub(crate) mod kprobe; 25 | pub(crate) mod perf_buffer_reader; 26 | pub(crate) mod perf_event_broadcast; 27 | pub(crate) mod tracepoint; 28 | -------------------------------------------------------------------------------- /auraed/src/ebpf/perf_event_broadcast.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | use tokio::sync::broadcast::{Receiver, Sender}; 17 | 18 | #[derive(Debug, Clone)] 19 | pub struct PerfEventBroadcast(Sender); 20 | 21 | impl PerfEventBroadcast { 22 | pub fn new(tx: Sender) -> Self { 23 | Self(tx) 24 | } 25 | 26 | pub fn subscribe(&self) -> Receiver { 27 | self.0.subscribe() 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /auraed/src/init/fileio.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | use std::path::Path; 17 | 18 | use anyhow::anyhow; 19 | use walkdir::WalkDir; 20 | 21 | #[allow(unused)] 22 | pub(crate) fn show_dir( 23 | dir: impl AsRef, 24 | recurse: bool, 25 | ) -> anyhow::Result<()> { 26 | let mut dir = WalkDir::new(dir); 27 | if !recurse { 28 | dir = dir.max_depth(0); 29 | } 30 | 31 | for entry in dir { 32 | match entry { 33 | Ok(p) => println!("{}", p.path().display()), 34 | Err(e) => { 35 | return if let Some(path) = e.path() { 36 | Err(anyhow!( 37 | "Error reading directory. Could not read path {}. Error: {}", 38 | path.display(), 39 | e 40 | )) 41 | } else { 42 | Err(anyhow!("Error reading directory. Error: {}", e)) 43 | } 44 | } 45 | } 46 | } 47 | 48 | Ok(()) 49 | } 50 | -------------------------------------------------------------------------------- /auraed/src/init/system_runtimes/cell_system_runtime.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | use std::path::PathBuf; 17 | 18 | use super::{SocketStream, SystemRuntime, SystemRuntimeError}; 19 | use crate::init::{ 20 | logging, system_runtimes::create_unix_socket_stream, BANNER, 21 | }; 22 | use crate::AURAED_RUNTIME; 23 | use tonic::async_trait; 24 | use tracing::info; 25 | 26 | pub(crate) struct CellSystemRuntime; 27 | 28 | #[async_trait] 29 | impl SystemRuntime for CellSystemRuntime { 30 | async fn init( 31 | self, 32 | verbose: bool, 33 | socket_address: Option, 34 | ) -> Result { 35 | println!("{BANNER}"); 36 | logging::init(verbose, false)?; 37 | info!("Running as a cell"); 38 | create_unix_socket_stream( 39 | socket_address.map(PathBuf::from).unwrap_or_else(|| { 40 | AURAED_RUNTIME.get().expect("runtime").default_socket_address() 41 | }), 42 | ) 43 | .await 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /auraed/src/init/system_runtimes/container_system_runtime.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | use std::path::PathBuf; 17 | 18 | use super::{SocketStream, SystemRuntime, SystemRuntimeError}; 19 | use crate::init::{ 20 | logging, system_runtimes::create_unix_socket_stream, BANNER, 21 | }; 22 | use crate::AURAED_RUNTIME; 23 | use tonic::async_trait; 24 | use tracing::info; 25 | 26 | pub(crate) struct ContainerSystemRuntime; 27 | 28 | #[async_trait] 29 | impl SystemRuntime for ContainerSystemRuntime { 30 | async fn init( 31 | self, 32 | verbose: bool, 33 | socket_address: Option, 34 | ) -> Result { 35 | println!("{BANNER}"); 36 | logging::init(verbose, true)?; 37 | info!("Running as a container."); 38 | create_unix_socket_stream( 39 | socket_address.map(PathBuf::from).unwrap_or_else(|| { 40 | AURAED_RUNTIME.get().expect("runtime").default_socket_address() 41 | }), 42 | ) 43 | .await 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /auraed/src/logging/mod.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | //! Internal logging system for Auraed and all spawned Executables, Containers 17 | //! and Instances. 18 | 19 | use std::time::SystemTime; 20 | 21 | /// Abstraction Layer for one log generating entity 22 | /// LogChannel provides channels between Log producers and log consumers 23 | pub mod log_channel; 24 | 25 | /// Implements Log trait. Used to add grpc API to log targets for rust internal logging 26 | pub mod stream_logger; 27 | 28 | /// Get UNIX timestamp in seconds for logging 29 | pub fn get_timestamp_sec() -> i64 { 30 | let unix_ts = SystemTime::now() 31 | .duration_since(SystemTime::UNIX_EPOCH) 32 | .expect("System Clock went backwards"); 33 | 34 | unix_ts.as_secs() as i64 35 | } 36 | -------------------------------------------------------------------------------- /auraed/src/logging/stream_logger.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | use log::Log; 17 | use proto::observe::LogItem; 18 | use tokio::sync::broadcast::Sender; 19 | 20 | /// Sends log messages generated in rust code to the logging channel 21 | /// The logging channel is consumed by the observe API 22 | #[derive(Debug)] 23 | pub struct StreamLogger { 24 | /// Channel used to send log messages to grpc API 25 | pub producer: Sender, 26 | } 27 | 28 | impl StreamLogger { 29 | #[allow(unused)] 30 | /// Constructor requires channel between api and logger 31 | pub fn new(producer: Sender) -> StreamLogger { 32 | StreamLogger { producer } 33 | } 34 | } 35 | 36 | impl Log for StreamLogger { 37 | fn enabled(&self, _metadata: &log::Metadata) -> bool { 38 | true 39 | } 40 | 41 | fn log(&self, record: &log::Record) { 42 | // send returns an Err if there are no receivers. We ignore that. 43 | let _ = self.producer.send(LogItem { 44 | channel: "rust-logs".to_string(), 45 | line: format!( 46 | "{}:{} -- {}", 47 | record.level(), 48 | record.target(), 49 | record.args() 50 | ), 51 | timestamp: 0, 52 | }); 53 | } 54 | 55 | fn flush(&self) {} 56 | } 57 | -------------------------------------------------------------------------------- /auraed/src/observe/error.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | use proto::observe::LogChannelType; 17 | use thiserror::Error; 18 | use tonic::Status; 19 | use tracing::error; 20 | 21 | #[derive(Debug, Error)] 22 | pub enum ObserveServiceError { 23 | #[error("Channel already registered with type {channel_type:?} for {pid}")] 24 | ChannelAlreadyRegistered { pid: i32, channel_type: LogChannelType }, 25 | #[error("Failed to find any registered channels for {pid}")] 26 | NoChannelsForPid { pid: i32 }, 27 | #[error("Failed to find channel type {channel_type:?} for {pid}")] 28 | ChannelNotRegistered { pid: i32, channel_type: LogChannelType }, 29 | #[error("{channel_type} is not a valid LogChannelType")] 30 | InvalidLogChannelType { channel_type: i32 }, 31 | } 32 | 33 | impl From for Status { 34 | fn from(err: ObserveServiceError) -> Self { 35 | let msg = err.to_string(); 36 | error!("{msg}"); 37 | match err { 38 | ObserveServiceError::ChannelAlreadyRegistered { .. } => { 39 | Status::internal(msg) 40 | } 41 | ObserveServiceError::NoChannelsForPid { .. } 42 | | ObserveServiceError::ChannelNotRegistered { .. } => { 43 | Status::not_found(msg) 44 | } 45 | ObserveServiceError::InvalidLogChannelType { .. } => { 46 | Status::invalid_argument(msg) 47 | } 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /auraed/src/observe/mod.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | pub(crate) use error::ObserveServiceError; 17 | pub(crate) use observe_service::ObserveService; 18 | 19 | mod cgroup_cache; 20 | mod error; 21 | mod observe_service; 22 | mod observed_event_stream; 23 | mod proc_cache; 24 | -------------------------------------------------------------------------------- /auraed/src/vms/mod.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | mod error; 17 | mod manager; 18 | mod virtual_machine; 19 | mod virtual_machines; 20 | mod vm_service; 21 | 22 | pub(crate) use vm_service::VmService; 23 | -------------------------------------------------------------------------------- /auraescript/Cargo.toml: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- # 2 | # | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | # 3 | # | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | # 4 | # | ███████║██║ ██║██████╔╝███████║█████╗ | # 5 | # | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | # 6 | # | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | # 7 | # | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | # 8 | # +--------------------------------------------+ # 9 | # # 10 | # Distributed Systems Runtime # 11 | # ---------------------------------------------------------------------------- # 12 | # Copyright 2022 - 2024, the aurae contributors # 13 | # SPDX-License-Identifier: Apache-2.0 # 14 | # ---------------------------------------------------------------------------- # 15 | 16 | [package] 17 | name = "auraescript" 18 | version = "0.0.0" 19 | edition = "2024" 20 | authors = ["The Aurae Authors", "Kris Nóva "] 21 | license = "Apache-2.0" 22 | 23 | [[bin]] 24 | name = "auraescript" 25 | path = "src/bin/main.rs" 26 | 27 | [dependencies] 28 | anyhow = { workspace = true } 29 | client = { workspace = true } 30 | deno_ast = { version = "0.46.0", features = ["transpiling"] } 31 | deno_core = "0.340.0" 32 | deno_error = "0.5.6" 33 | macros = { package = "auraescript_macros", path = "./macros" } 34 | proto = { workspace = true } 35 | tokio = { workspace = true, features = ["fs", "rt-multi-thread"] } 36 | -------------------------------------------------------------------------------- /auraescript/README.md: -------------------------------------------------------------------------------- 1 | # AuraeScript 2 | 3 | AuraeScript is a turing complete language for platform teams built on [Deno](https://deno.land). 4 | 5 | AuraeScript is a lightweight client that wraps the [Aurae Standard Library](https://aurae.io/stdlib/). 6 | 7 | AuraeScript is a quick way to access the core Aurae APIs and follows normal UNIX parlance. AuraeScript should feel simple and intuitive for any Go, C, Python, or Rust programmer. 8 | 9 | ```typescript 10 | // @ts-ignore 11 | import {AllocateCellRequest, Cell, CellServiceClient} from "../lib/runtime.ts"; 12 | 13 | let cells = new CellServiceClient(); 14 | 15 | cells.Allocate({ 16 | cell: Cell.fromPartial({ 17 | name: "test", 18 | cpus: "2" 19 | }) 20 | }).then(r => { 21 | console.log("done") 22 | }); 23 | ``` 24 | 25 | ## Build From Source 26 | 27 | ⚠️ Early Active Development ⚠️ 28 | 29 | ``` 30 | git clone git@github.com:aurae-runtime/aurae.git 31 | cd aurae 32 | make pki config all 33 | ``` 34 | 35 | Alternatively it is possible to build `auraescript` by itself. Check out this repository and use the Makefile. 36 | 37 | ```bash 38 | make auraescript 39 | ``` 40 | 41 | ...or manually using Cargo. 42 | 43 | ```bash 44 | cd auraescript 45 | cargo build 46 | cargo install --path . 47 | ``` 48 | 49 | ### Architecture 50 | 51 | AuraeScript follows a similar client paradigm to Kubernetes `kubectl` command. However, unlike Kubernetes this is not a command line tool like `kubectl`. AuraeScript is a fully supported programing language complete with a systems standard library. The Aurae runtime projects supports many clients, and the easiest client to get started building with is AuraeScript. 52 | 53 | Download the static binary directly to your system, and you can begin writing AuraeScript programs directly against a running Aurae server. 54 | 55 | -------------------------------------------------------------------------------- /auraescript/aurae.ts: -------------------------------------------------------------------------------- 1 | type CreateClientDefault = { 2 | kind: "default"; 3 | }; 4 | type CreateClientPath = { 5 | kind: "path"; 6 | path: string; 7 | }; 8 | type CreateClientOpts = { 9 | kind: "opts"; 10 | ca_crt: string; 11 | client_crt: string; 12 | client_key: string; 13 | socket: string; 14 | }; 15 | type CreateClient = 16 | | CreateClientDefault 17 | | CreateClientPath 18 | | CreateClientOpts; 19 | 20 | export function createClient(opts: CreateClient = { kind: "default" }): Promise { 21 | if (typeof opts.kind === "undefined") { 22 | // resolve kind 23 | if ("path" in opts) { 24 | opts.kind = "path"; 25 | } else if ("ca_crt" in opts) { 26 | opts.kind = "opts"; 27 | } 28 | } 29 | let config; 30 | switch (opts.kind) { 31 | case "default": { 32 | config = Deno.core.ops.as__aurae_config__try_default(); 33 | break; 34 | } 35 | case "path": { 36 | config = Deno.core.ops.as__aurae_config__parse_from_file(opts.path); 37 | break; 38 | } 39 | case "opts": { 40 | config = Deno.core.ops.as__aurae_config__from_options( 41 | opts.ca_crt, opts.client_crt, opts.client_key, opts.socket 42 | ); 43 | break; 44 | } 45 | default: { 46 | const _exhaustiveCheck: never = opts; 47 | return _exhaustiveCheck; 48 | } 49 | } 50 | // @ts-ignore 51 | return Deno.core.ops.as__client_new(config); 52 | } 53 | -------------------------------------------------------------------------------- /auraescript/build.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | use std::fs::OpenOptions; 16 | use std::io::Write; 17 | use std::path::PathBuf; 18 | 19 | fn main() { 20 | generate_aurae_ts(); 21 | } 22 | 23 | fn generate_aurae_ts() { 24 | // Currently nothing is generated. 25 | // We are only copying the contents of helpers.ts to the gen directory. 26 | // If we do generate code in the future, we won't need to change all the imports. 27 | 28 | let aurae = include_str!("./aurae.ts"); 29 | 30 | let gen_dir = match std::env::var("CARGO_MANIFEST_DIR") { 31 | Ok(out_dir) => { 32 | let mut out_dir = PathBuf::from(out_dir); 33 | out_dir.push("gen"); 34 | out_dir 35 | } 36 | _ => PathBuf::from("gen"), 37 | }; 38 | 39 | let ts_path = { 40 | let mut out_dir = gen_dir; 41 | out_dir.push("aurae.ts"); 42 | out_dir 43 | }; 44 | 45 | let mut ts = OpenOptions::new() 46 | .write(true) 47 | .truncate(true) 48 | .create(true) 49 | .open(ts_path.clone()) 50 | .unwrap_or_else(|_| { 51 | panic!("Failed to create or overwrite {ts_path:?}") 52 | }); 53 | 54 | write!(ts, "{aurae}") 55 | .unwrap_or_else(|_| panic!("Could not write to {ts_path:?}")); 56 | } 57 | -------------------------------------------------------------------------------- /auraescript/default.config.toml: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- # 2 | # | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | # 3 | # | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | # 4 | # | ███████║██║ ██║██████╔╝███████║█████╗ | # 5 | # | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | # 6 | # | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | # 7 | # | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | # 8 | # +--------------------------------------------+ # 9 | # # 10 | # Distributed Systems Runtime # 11 | # ---------------------------------------------------------------------------- # 12 | # Copyright 2022 - 2024, the aurae contributors # 13 | # SPDX-License-Identifier: Apache-2.0 # 14 | # ---------------------------------------------------------------------------- # 15 | 16 | 17 | # Client Cert Material 18 | [auth] 19 | ca_crt = "~/.aurae/pki/ca.crt" 20 | client_crt = "~/.aurae/pki/_signed.client.nova.crt" 21 | client_key = "~/.aurae/pki/client.nova.key" 22 | 23 | [system] 24 | socket = "/var/run/aurae/aurae.sock" 25 | -------------------------------------------------------------------------------- /auraescript/macros/Cargo.toml: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- # 2 | # | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | # 3 | # | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | # 4 | # | ███████║██║ ██║██████╔╝███████║█████╗ | # 5 | # | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | # 6 | # | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | # 7 | # | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | # 8 | # +--------------------------------------------+ # 9 | # # 10 | # Distributed Systems Runtime # 11 | # ---------------------------------------------------------------------------- # 12 | # Copyright 2022 - 2024, the aurae contributors # 13 | # SPDX-License-Identifier: Apache-2.0 # 14 | # ---------------------------------------------------------------------------- # 15 | [package] 16 | name = "auraescript_macros" 17 | version = "0.0.0" 18 | edition = "2024" 19 | publish = false 20 | authors = ["The Aurae Authors", "Kris Nóva "] 21 | license = "Apache-2.0" 22 | 23 | [lib] 24 | proc-macro = true 25 | 26 | [dependencies] 27 | heck = { workspace = true } 28 | proc-macro2 = { workspace = true } 29 | protobuf = { workspace = true } 30 | protobuf-parse = { workspace = true } 31 | proto-reader = { workspace = true } 32 | quote = { workspace = true } 33 | syn = { workspace = true } 34 | -------------------------------------------------------------------------------- /auraescript/macros/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | // The project prefers .expect("reason") instead of .unwrap() so we fail 17 | // on any .unwrap() statements in the code. 18 | #![warn(clippy::unwrap_used)] 19 | // Lint groups: https://doc.rust-lang.org/rustc/lints/groups.html 20 | #![warn(future_incompatible, nonstandard_style, unused)] 21 | #![warn( 22 | improper_ctypes, 23 | non_shorthand_field_patterns, 24 | no_mangle_generic_items, 25 | unconditional_recursion, 26 | unused_comparisons, 27 | while_true 28 | )] 29 | #![warn(missing_debug_implementations, 30 | // TODO: missing_docs, 31 | trivial_casts, 32 | trivial_numeric_casts, 33 | unused_extern_crates, 34 | unused_import_braces, 35 | unused_qualifications, 36 | unused_results 37 | )] 38 | 39 | use proc_macro::TokenStream; 40 | 41 | mod ops; 42 | 43 | #[proc_macro] 44 | pub fn ops_generator(input: TokenStream) -> TokenStream { 45 | ops::ops_generator(input) 46 | } 47 | -------------------------------------------------------------------------------- /auraescript/src/bin/main.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | // Lint groups: https://doc.rust-lang.org/rustc/lints/groups.html 17 | #![warn(future_incompatible, nonstandard_style, unused)] 18 | #![warn( 19 | improper_ctypes, 20 | non_shorthand_field_patterns, 21 | no_mangle_generic_items, 22 | unconditional_recursion, 23 | unused_comparisons, 24 | while_true 25 | )] 26 | #![warn(missing_debug_implementations, 27 | // TODO: missing_docs, 28 | trivial_casts, 29 | trivial_numeric_casts, 30 | unused_extern_crates, 31 | unused_import_braces, 32 | unused_qualifications, 33 | unused_results 34 | )] 35 | #![warn(clippy::unwrap_used)] 36 | 37 | use anyhow::Context; 38 | use auraescript::runtime; 39 | use deno_core::resolve_path; 40 | use std::env::current_dir; 41 | 42 | fn main() -> anyhow::Result<()> { 43 | let args: Vec = std::env::args().collect(); 44 | 45 | // only supports a single script for now 46 | if args.len() != 2 { 47 | println!("Usage: auraescript "); 48 | std::process::exit(1); 49 | } 50 | 51 | let main_module = resolve_path( 52 | &args[1].clone(), 53 | current_dir().context("Unable to get CWD")?.as_path(), 54 | )?; 55 | 56 | let rt = runtime(main_module.clone()); 57 | tokio::runtime::Builder::new_current_thread() 58 | .enable_all() 59 | .build()? 60 | .block_on(rt) 61 | .map_err(|e| e.into()) 62 | } 63 | -------------------------------------------------------------------------------- /auraescript/src/builtin/mod.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | //! The builtin functionality for AuraeScript. 17 | //! 18 | //! AuraeScript has a small amount of magic with regard to authentication and 19 | //! managing the client and requests, responses, and output. 20 | //! 21 | //! Most of the built-in logic that makes AuraeScript useful to an end-user 22 | //! lives in this module. 23 | 24 | pub(crate) mod auraescript_client; 25 | 26 | const VERSION: &str = env!("CARGO_PKG_VERSION"); 27 | const AUTHORS: &str = env!("CARGO_PKG_AUTHORS"); 28 | 29 | /// Show meta information about AuraeScript. 30 | #[allow(unused)] 31 | fn about() { 32 | println!("\n"); 33 | println!("Aurae. Distributed Runtime."); 34 | println!("Authors: {AUTHORS}"); 35 | version(); 36 | println!("\n"); 37 | } 38 | 39 | /// Show version information. 40 | fn version() { 41 | println!("Version: {VERSION}"); 42 | } 43 | -------------------------------------------------------------------------------- /auraescript/src/cells.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | #![allow(non_snake_case)] 17 | 18 | macros::ops_generator!("../api/v0/cells/cells.proto", cells, CellService); 19 | -------------------------------------------------------------------------------- /auraescript/src/discovery.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | #![allow(non_snake_case)] 17 | 18 | macros::ops_generator!( 19 | "../api/v0/discovery/discovery.proto", 20 | discovery, 21 | DiscoveryService, 22 | ); 23 | -------------------------------------------------------------------------------- /auraescript/src/health.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | #![allow(non_snake_case)] 17 | 18 | // TODO: macro doesn't support streaming. Does deno? 19 | macros::ops_generator!( 20 | "../api/grpc/health/v1/health.proto", 21 | grpc::health, 22 | Health, 23 | ); 24 | -------------------------------------------------------------------------------- /auraescript/src/observe.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | #![allow(non_snake_case)] 17 | 18 | macros::ops_generator!( 19 | "../api/v0/observe/observe.proto", 20 | observe, 21 | ObserveService, 22 | ); 23 | -------------------------------------------------------------------------------- /auraescript/src/vms.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | #![allow(non_snake_case)] 16 | 17 | macros::ops_generator!("../api/v0/vms/vms.proto", vms, VmService); 18 | -------------------------------------------------------------------------------- /buf.gen.yaml: -------------------------------------------------------------------------------- 1 | version: v1 2 | plugins: 3 | - plugin: buf.build/community/neoeinstein-prost:v0.4.0 4 | out: proto/gen 5 | opt: 6 | - bytes=. 7 | - file_descriptor_set 8 | - compile_well_known_types 9 | - extern_path=.google.protobuf=::pbjson_types 10 | - plugin: buf.build/community/neoeinstein-prost-serde:v0.3.1 11 | out: proto/gen 12 | opt: 13 | - extern_path=.google.protobuf=::pbjson_types 14 | - plugin: buf.build/community/neoeinstein-tonic:v0.4.1 15 | out: proto/gen 16 | opt: 17 | - compile_well_known_types 18 | - extern_path=.google.protobuf=::pbjson_types 19 | - plugin: buf.build/community/stephenh-ts-proto:v2.3.0 20 | out: auraescript/gen 21 | opt: 22 | - outputEncodeMethods=false 23 | - outputClientImpl=false 24 | - lowerCaseServiceMethods=true 25 | -------------------------------------------------------------------------------- /client/Cargo.toml: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- # 2 | # | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | # 3 | # | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | # 4 | # | ███████║██║ ██║██████╔╝███████║█████╗ | # 5 | # | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | # 6 | # | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | # 7 | # | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | # 8 | # +--------------------------------------------+ # 9 | # # 10 | # Distributed Systems Runtime # 11 | # ---------------------------------------------------------------------------- # 12 | # Copyright 2022 - 2024, the aurae contributors # 13 | # SPDX-License-Identifier: Apache-2.0 # 14 | # ---------------------------------------------------------------------------- # 15 | [package] 16 | name = "client" 17 | version = "0.0.0" 18 | edition = "2024" 19 | authors = ["The Aurae Authors", "Kris Nóva "] 20 | license = "Apache-2.0" 21 | 22 | [dependencies] 23 | anyhow = { workspace = true } 24 | macros = { package = "client-macros", path = "macros" } 25 | proto = { workspace = true } 26 | serde = { workspace = true } 27 | thiserror = { workspace = true } 28 | tokio = { workspace = true, features = ["fs", "rt-multi-thread"] } 29 | toml = "0.8.20" 30 | tonic = { workspace = true, features = ["tls"] } 31 | tower = { version = "0.5.2", features = ["util"] } 32 | x509-certificate = "0.24.0" 33 | hyper-util = "0.1.6" 34 | -------------------------------------------------------------------------------- /client/macros/Cargo.toml: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- # 2 | # | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | # 3 | # | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | # 4 | # | ███████║██║ ██║██████╔╝███████║█████╗ | # 5 | # | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | # 6 | # | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | # 7 | # | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | # 8 | # +--------------------------------------------+ # 9 | # # 10 | # Distributed Systems Runtime # 11 | # ---------------------------------------------------------------------------- # 12 | # Copyright 2022 - 2024, the aurae contributors # 13 | # SPDX-License-Identifier: Apache-2.0 # 14 | # ---------------------------------------------------------------------------- # 15 | [package] 16 | name = "client-macros" 17 | version = "0.0.0" 18 | edition = "2024" 19 | publish = false 20 | authors = ["The Aurae Authors", "Kris Nóva "] 21 | license = "Apache-2.0" 22 | 23 | [lib] 24 | proc-macro = true 25 | 26 | [dependencies] 27 | heck = { workspace = true } 28 | proc-macro2 = { workspace = true } 29 | proto-reader = { path = "../../crates/proto-reader" } # using workspace isn't working 30 | quote = { workspace = true } 31 | syn = { workspace = true } 32 | -------------------------------------------------------------------------------- /client/macros/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | // The project prefers .expect("reason") instead of .unwrap() so we fail 17 | // on any .unwrap() statements in the code. 18 | #![warn(clippy::unwrap_used)] 19 | // Lint groups: https://doc.rust-lang.org/rustc/lints/groups.html 20 | #![warn(future_incompatible, nonstandard_style, unused)] 21 | #![warn( 22 | improper_ctypes, 23 | non_shorthand_field_patterns, 24 | no_mangle_generic_items, 25 | unconditional_recursion, 26 | unused_comparisons, 27 | while_true 28 | )] 29 | #![warn(missing_debug_implementations, 30 | // TODO: missing_docs, 31 | trivial_casts, 32 | trivial_numeric_casts, 33 | unused_extern_crates, 34 | unused_import_braces, 35 | unused_qualifications, 36 | unused_results 37 | )] 38 | 39 | use proc_macro::TokenStream; 40 | 41 | mod service; 42 | 43 | // TODO (future-highway): Due to needing to ignore certain tests in CI, we can't format 44 | // the code in the docs as cargo test will try to test it. Workaround or add the needed 45 | // deps to this crate to make it pass. 46 | /// # Example: 47 | /// macros::ops_generator!( 48 | /// module_name, 49 | /// ServiceName, 50 | /// snake_case_rpc_name(RequestMessageName) -> ResponseMessageName, 51 | /// other(OtherRequest) -> OtherResponse 52 | /// ); 53 | #[proc_macro] 54 | pub fn service(input: TokenStream) -> TokenStream { 55 | service::service(input) 56 | } 57 | -------------------------------------------------------------------------------- /client/src/cells/cell_service.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | macros::service!("../api/v0/cells/cells.proto", cells, CellService); 17 | -------------------------------------------------------------------------------- /client/src/cells/mod.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | pub mod cell_service; 16 | -------------------------------------------------------------------------------- /client/src/config/auth_config.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | use crate::config::cert_material::CertMaterial; 17 | use serde::Deserialize; 18 | 19 | /// Authentication material for an AuraeScript client. 20 | /// 21 | /// This material is read from disk many times during runtime. 22 | /// Changing this material during a process will impact the currently 23 | /// running process. 24 | #[derive(Debug, Clone, Deserialize)] 25 | pub struct AuthConfig { 26 | /// The same CA certificate the server has. 27 | pub ca_crt: String, 28 | /// The unique client certificate signed by the server. 29 | pub client_crt: String, 30 | /// The client secret key. 31 | pub client_key: String, 32 | } 33 | 34 | impl AuthConfig { 35 | pub async fn to_cert_material(&self) -> anyhow::Result { 36 | CertMaterial::from_config(self).await 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /client/src/discovery/discovery_service.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | macros::service!( 17 | "../api/v0/discovery/discovery.proto", 18 | discovery, 19 | DiscoveryService 20 | ); 21 | -------------------------------------------------------------------------------- /client/src/discovery/mod.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | pub mod discovery_service; 16 | -------------------------------------------------------------------------------- /client/src/grpc/health/health.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | macros::service!("../api/grpc/health/v1/health.proto", grpc::health, Health); 17 | -------------------------------------------------------------------------------- /client/src/grpc/health/mod.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | #[allow(clippy::module_inception)] 16 | pub mod health; 17 | -------------------------------------------------------------------------------- /client/src/grpc/mod.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | pub mod health; 17 | -------------------------------------------------------------------------------- /client/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | pub use crate::client::{Client, ClientError}; 16 | pub use config::{AuraeConfig, AuraeSocket, AuthConfig, SystemConfig}; 17 | 18 | pub mod cells; 19 | mod client; 20 | mod config; 21 | pub mod cri; 22 | pub mod discovery; 23 | pub mod grpc; 24 | pub mod observe; 25 | pub mod vms; 26 | -------------------------------------------------------------------------------- /client/src/observe/mod.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | pub mod observe_service; 16 | -------------------------------------------------------------------------------- /client/src/observe/observe_service.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | macros::service!("../api/v0/observe/observe.proto", observe, ObserveService); 17 | -------------------------------------------------------------------------------- /client/src/vms/mod.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | pub mod vm_service; 17 | -------------------------------------------------------------------------------- /client/src/vms/vm_service.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | macros::service!("../api/v0/vms/vms.proto", vms, VmService); 17 | -------------------------------------------------------------------------------- /clippy.toml: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- # 2 | # | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | # 3 | # | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | # 4 | # | ███████║██║ ██║██████╔╝███████║█████╗ | # 5 | # | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | # 6 | # | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | # 7 | # | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | # 8 | # +--------------------------------------------+ # 9 | # # 10 | # Distributed Systems Runtime # 11 | # ---------------------------------------------------------------------------- # 12 | # Copyright 2022 - 2024, the aurae contributors # 13 | # SPDX-License-Identifier: Apache-2.0 # 14 | # ---------------------------------------------------------------------------- # 15 | allow-unwrap-in-tests = true 16 | -------------------------------------------------------------------------------- /crates/proto-reader/Cargo.toml: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- # 2 | # | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | # 3 | # | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | # 4 | # | ███████║██║ ██║██████╔╝███████║█████╗ | # 5 | # | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | # 6 | # | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | # 7 | # | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | # 8 | # +--------------------------------------------+ # 9 | # # 10 | # Distributed Systems Runtime # 11 | # ---------------------------------------------------------------------------- # 12 | # Copyright 2022 - 2024, the aurae contributors # 13 | # SPDX-License-Identifier: Apache-2.0 # 14 | # ---------------------------------------------------------------------------- # 15 | [package] 16 | name = "proto-reader" 17 | version = "0.0.0" 18 | edition = "2024" 19 | publish = false 20 | authors = ["The Aurae Authors", "Kris Nóva "] 21 | license = "Apache-2.0" 22 | 23 | [dependencies] 24 | #heck = { workspace = true } 25 | proc-macro2 = { workspace = true } 26 | protobuf = { workspace = true } 27 | protobuf-parse = { workspace = true } 28 | quote = { workspace = true } 29 | syn = { workspace = true } 30 | -------------------------------------------------------------------------------- /crates/test-helpers-macros/Cargo.toml: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- # 2 | # | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | # 3 | # | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | # 4 | # | ███████║██║ ██║██████╔╝███████║█████╗ | # 5 | # | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | # 6 | # | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | # 7 | # | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | # 8 | # +--------------------------------------------+ # 9 | # # 10 | # Distributed Systems Runtime # 11 | # ---------------------------------------------------------------------------- # 12 | # Copyright 2022 - 2024, the aurae contributors # 13 | # SPDX-License-Identifier: Apache-2.0 # 14 | # ---------------------------------------------------------------------------- # 15 | [package] 16 | name = "test-helpers-macros" 17 | version = "0.0.0" 18 | edition = "2024" 19 | publish = false 20 | authors = ["The Aurae Authors", "Kris Nóva "] 21 | license = "Apache-2.0" 22 | 23 | [lib] 24 | proc-macro = true 25 | 26 | [dependencies] 27 | heck = { workspace = true } 28 | proc-macro2 = { workspace = true } 29 | quote = { workspace = true } 30 | syn = { workspace = true } 31 | -------------------------------------------------------------------------------- /crates/test-helpers-macros/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | use proc_macro::TokenStream; 16 | use quote::quote; 17 | use syn::{parse_macro_input, ItemFn}; 18 | 19 | #[proc_macro_attribute] 20 | pub fn shared_runtime_test( 21 | _attr: TokenStream, 22 | input: TokenStream, 23 | ) -> TokenStream { 24 | // Because this attribute goes on a test, we know there are no inputs to the function. 25 | 26 | let ast = parse_macro_input!(input as ItemFn); 27 | 28 | let ItemFn { attrs, vis, sig, block } = ast; 29 | let mut sig = sig; 30 | sig.asyncness = None; 31 | let sig = sig; 32 | 33 | let stmts = &block.stmts; 34 | 35 | let expanded = quote! { 36 | #[test] #(#attrs)* #vis #sig { 37 | async fn action() { 38 | #(#stmts)* 39 | } 40 | 41 | common::test(action()) 42 | } 43 | }; 44 | 45 | expanded.into() 46 | } 47 | -------------------------------------------------------------------------------- /crates/test-helpers/Cargo.toml: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- # 2 | # | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | # 3 | # | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | # 4 | # | ███████║██║ ██║██████╔╝███████║█████╗ | # 5 | # | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | # 6 | # | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | # 7 | # | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | # 8 | # +--------------------------------------------+ # 9 | # # 10 | # Distributed Systems Runtime # 11 | # ---------------------------------------------------------------------------- # 12 | # Copyright 2022 - 2024, the aurae contributors # 13 | # SPDX-License-Identifier: Apache-2.0 # 14 | # ---------------------------------------------------------------------------- # 15 | [package] 16 | name = "test-helpers" 17 | version = "0.0.0" 18 | edition = "2024" 19 | publish = false 20 | authors = ["The Aurae Authors", "Kris Nóva "] 21 | license = "Apache-2.0" 22 | 23 | [dependencies] 24 | nix = { workspace = true } 25 | once_cell = "1" 26 | -------------------------------------------------------------------------------- /crates/validation/Cargo.toml: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- # 2 | # | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | # 3 | # | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | # 4 | # | ███████║██║ ██║██████╔╝███████║█████╗ | # 5 | # | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | # 6 | # | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | # 7 | # | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | # 8 | # +--------------------------------------------+ # 9 | # # 10 | # Distributed Systems Runtime # 11 | # ---------------------------------------------------------------------------- # 12 | # Copyright 2022 - 2024, the aurae contributors # 13 | # SPDX-License-Identifier: Apache-2.0 # 14 | # ---------------------------------------------------------------------------- # 15 | [package] 16 | name = "validation" 17 | version = "0.0.0" 18 | edition = "2024" 19 | publish = false 20 | authors = ["The Aurae Authors", "Kris Nóva "] 21 | license = "Apache-2.0" 22 | 23 | [features] 24 | default = [] 25 | json = ["dep:serde", "dep:serde_json"] 26 | regex = ["dep:fancy-regex", "dep:lazy_static"] 27 | secrecy = ["dep:secrecy"] 28 | tonic = ["dep:tonic"] 29 | url = ["dep:url"] 30 | 31 | [dependencies] 32 | fancy-regex = { workspace = true, optional = true } 33 | lazy_static = { workspace = true, optional = true } 34 | thiserror = { workspace = true } 35 | validator = "0.16.1" 36 | secrecy = { version = "0.10.3", optional = true } 37 | serde = { workspace = true, optional = true } 38 | serde_json = { workspace = true, optional = true } 39 | tonic = { workspace = true, optional = true } 40 | url = { workspace = true, optional = true } 41 | 42 | [dev-dependencies] 43 | num_enum = "0.7.3" 44 | num_enum_derive = "0.7.3" 45 | -------------------------------------------------------------------------------- /crates/validation/macros/Cargo.toml: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- # 2 | # | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | # 3 | # | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | # 4 | # | ███████║██║ ██║██████╔╝███████║█████╗ | # 5 | # | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | # 6 | # | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | # 7 | # | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | # 8 | # +--------------------------------------------+ # 9 | # # 10 | # Distributed Systems Runtime # 11 | # ---------------------------------------------------------------------------- # 12 | # Copyright 2022 - 2024, the aurae contributors # 13 | # SPDX-License-Identifier: Apache-2.0 # 14 | # ---------------------------------------------------------------------------- # 15 | [package] 16 | name = "validation_macros" 17 | version = "0.0.0" 18 | edition = "2024" 19 | publish = false 20 | authors = ["The Aurae Authors", "Kris Nóva "] 21 | license = "Apache-2.0" 22 | 23 | [lib] 24 | proc-macro = true 25 | 26 | [dependencies] 27 | heck = { workspace = true } 28 | proc-macro2 = { workspace = true } 29 | quote = { workspace = true } 30 | syn = { workspace = true } 31 | -------------------------------------------------------------------------------- /crates/validation/src/allow_regex.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | use super::ValidationError; 16 | use fancy_regex::Regex; 17 | 18 | pub fn allow_regex( 19 | value: &str, 20 | pattern: &Regex, 21 | field_name: &str, 22 | parent_name: Option<&str>, 23 | ) -> Result<(), ValidationError> { 24 | match pattern.is_match(value) { 25 | Ok(true) => Ok(()), 26 | Ok(false) | Err(_) => Err(ValidationError::AllowRegexViolation { 27 | field: super::field_name(field_name, parent_name), 28 | pattern: pattern.to_string(), 29 | }), 30 | } 31 | } 32 | 33 | #[cfg(test)] 34 | mod tests { 35 | use super::*; 36 | use crate::DOMAIN_NAME_LABEL_REGEX; 37 | 38 | #[test] 39 | fn test_allow_regex() { 40 | assert!(matches!( 41 | allow_regex("my-name", &DOMAIN_NAME_LABEL_REGEX, "test", None), 42 | Ok(..) 43 | )); 44 | 45 | assert!(matches!( 46 | allow_regex("my*name", &DOMAIN_NAME_LABEL_REGEX, "test", None), 47 | Err(ValidationError::AllowRegexViolation { .. }) 48 | )); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /crates/validation/src/maximum_length.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | use super::ValidationError; 16 | use validator::{validate_length, HasLen}; 17 | 18 | pub fn maximum_length( 19 | value: T, 20 | length: u64, 21 | units: &str, 22 | field_name: &str, 23 | parent_name: Option<&str>, 24 | ) -> Result<(), ValidationError> { 25 | match validate_length(value, None, Some(length), None) { 26 | true => Ok(()), 27 | false => Err(ValidationError::Maximum { 28 | field: super::field_name(field_name, parent_name), 29 | maximum: length.to_string(), 30 | units: units.to_string(), 31 | }), 32 | } 33 | } 34 | 35 | #[cfg(test)] 36 | mod tests { 37 | use super::*; 38 | use validator::HasLen; 39 | 40 | #[test] 41 | fn test_maximum_length() { 42 | let value = vec![1, 2]; 43 | 44 | let maximum = value.length() - 1; 45 | let result = maximum_length(&value, maximum, "test", "test", None); 46 | assert!(matches!(result, Err(ValidationError::Maximum { .. }))); 47 | 48 | let maximum = value.length(); 49 | let result = maximum_length(&value, maximum, "test", "test", None); 50 | assert!(matches!(result, Ok(..))); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /crates/validation/src/maximum_value.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | use super::ValidationError; 16 | use std::fmt::Display; 17 | use validator::validate_range; 18 | 19 | pub fn maximum_value( 20 | value: T, 21 | maximum: T, 22 | units: &str, 23 | field_name: &str, 24 | parent_name: Option<&str>, 25 | ) -> Result<(), ValidationError> { 26 | match validate_range(value, None, Some(maximum)) { 27 | true => Ok(()), 28 | false => Err(ValidationError::Maximum { 29 | field: super::field_name(field_name, parent_name), 30 | maximum: maximum.to_string(), 31 | units: units.to_string(), 32 | }), 33 | } 34 | } 35 | 36 | #[cfg(test)] 37 | mod tests { 38 | use super::*; 39 | 40 | #[test] 41 | fn test_maximum_value() { 42 | assert!(matches!(maximum_value(1, 2, "test", "test", None), Ok(..))); 43 | 44 | assert!(matches!( 45 | maximum_value(2, 1, "test", "test", None), 46 | Err(ValidationError::Maximum { .. }) 47 | )); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /crates/validation/src/minimum_length.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | use super::ValidationError; 16 | use validator::{validate_length, HasLen}; 17 | 18 | pub fn minimum_length( 19 | value: T, 20 | length: u64, 21 | units: &str, 22 | field_name: &str, 23 | parent_name: Option<&str>, 24 | ) -> Result<(), ValidationError> { 25 | match validate_length(value, Some(length), None, None) { 26 | true => Ok(()), 27 | false => Err(ValidationError::Minimum { 28 | field: super::field_name(field_name, parent_name), 29 | minimum: length.to_string(), 30 | units: units.to_string(), 31 | }), 32 | } 33 | } 34 | 35 | #[cfg(test)] 36 | mod tests { 37 | use super::*; 38 | use validator::HasLen; 39 | 40 | #[test] 41 | fn test_minimum_length() { 42 | let value = "123456"; 43 | 44 | assert!(matches!( 45 | minimum_length(value, value.length() + 1, "test", "test", None), 46 | Err(ValidationError::Minimum { .. }) 47 | )); 48 | 49 | assert!(matches!( 50 | minimum_length(value, value.length() - 1, "test", "test", None), 51 | Ok(..) 52 | )); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /crates/validation/src/minimum_value.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | use super::ValidationError; 16 | use std::fmt::Display; 17 | use validator::validate_range; 18 | 19 | pub fn minimum_value( 20 | value: T, 21 | minimum: T, 22 | units: &str, 23 | field_name: &str, 24 | parent_name: Option<&str>, 25 | ) -> Result<(), ValidationError> { 26 | match validate_range(value, Some(minimum), None) { 27 | true => Ok(()), 28 | false => Err(ValidationError::Minimum { 29 | field: super::field_name(field_name, parent_name), 30 | minimum: minimum.to_string(), 31 | units: units.to_string(), 32 | }), 33 | } 34 | } 35 | 36 | #[cfg(test)] 37 | mod tests { 38 | use super::*; 39 | 40 | #[test] 41 | fn test_minimum_value() { 42 | assert!(matches!( 43 | minimum_value(1, 2, "test", "test", None), 44 | Err(ValidationError::Minimum { .. }) 45 | )); 46 | 47 | assert!(matches!(minimum_value(2, 1, "test", "test", None), Ok(..))); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /crates/validation/src/required.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | use super::ValidationError; 16 | 17 | pub fn required( 18 | value: Option, 19 | field_name: &str, 20 | parent_name: Option<&str>, 21 | ) -> Result { 22 | match value { 23 | None => Err(ValidationError::Required { 24 | field: super::field_name(field_name, parent_name), 25 | }), 26 | Some(value) => Ok(value), 27 | } 28 | } 29 | 30 | #[cfg(test)] 31 | mod tests { 32 | use super::*; 33 | 34 | #[test] 35 | fn test_required() { 36 | assert!(matches!( 37 | required(Some("hi"), "test", None), 38 | Ok(x) if x == "hi" 39 | )); 40 | 41 | assert!(matches!( 42 | required(None::, "test", None), 43 | Err(ValidationError::Required { .. }) 44 | )); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /crates/validation/src/valid_enum.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | use super::ValidationError; 16 | 17 | pub fn valid_enum>( 18 | value: i32, 19 | field_name: &str, 20 | parent_name: Option<&str>, 21 | ) -> Result { 22 | match T::try_from(value) { 23 | Ok(value) => Ok(value), 24 | Err(_) => Err(ValidationError::Invalid { 25 | field: super::field_name(field_name, parent_name), 26 | }), 27 | } 28 | } 29 | 30 | #[cfg(test)] 31 | mod tests { 32 | use super::*; 33 | use num_enum_derive::TryFromPrimitive; 34 | 35 | #[derive(TryFromPrimitive)] 36 | #[repr(i32)] 37 | enum MyTestEnum { 38 | First = 10, 39 | Second = 11, 40 | } 41 | 42 | #[test] 43 | fn test_valid_enum() { 44 | assert!(matches!(valid_enum(10, "test", None), Ok(MyTestEnum::First))); 45 | 46 | assert!(matches!( 47 | valid_enum::(12312, "test", None), 48 | Err(ValidationError::Invalid { .. }) 49 | )); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /crates/validation/src/valid_json.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | use super::ValidationError; 16 | 17 | pub fn valid_json( 18 | value: &str, 19 | field_name: &str, 20 | parent_name: Option<&str>, 21 | ) -> Result { 22 | match serde_json::from_str(value) { 23 | Ok(x) => Ok(x), 24 | Err(_) => Err(ValidationError::Invalid { 25 | field: super::field_name(field_name, parent_name), 26 | }), 27 | } 28 | } 29 | 30 | #[cfg(test)] 31 | mod tests { 32 | use super::*; 33 | 34 | #[test] 35 | fn test_valid_json() { 36 | assert!(matches!(valid_json("[]", "test", None), Ok(..))); 37 | 38 | assert!(matches!( 39 | valid_json("1: 1", "test", None), 40 | Err(ValidationError::Invalid { .. }) 41 | )); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /crates/validation/src/valid_url.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | use super::ValidationError; 16 | use url::Url; 17 | 18 | pub fn valid_url( 19 | value: &str, 20 | field_name: &str, 21 | parent_name: Option<&str>, 22 | ) -> Result { 23 | match Url::parse(value) { 24 | Err(_) => Err(ValidationError::Invalid { 25 | field: super::field_name(field_name, parent_name), 26 | }), 27 | Ok(url) => Ok(url), 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | stdlib/v0/* -------------------------------------------------------------------------------- /docs/CNAME: -------------------------------------------------------------------------------- 1 | aurae.io -------------------------------------------------------------------------------- /docs/assets/aurae-corporate-cla.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aurae-runtime/aurae/cc42b133704ede44c5a0ff50185b00302f8882b3/docs/assets/aurae-corporate-cla.pdf -------------------------------------------------------------------------------- /docs/assets/img/blog-cell.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aurae-runtime/aurae/cc42b133704ede44c5a0ff50185b00302f8882b3/docs/assets/img/blog-cell.png -------------------------------------------------------------------------------- /docs/assets/img/blog-cells.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aurae-runtime/aurae/cc42b133704ede44c5a0ff50185b00302f8882b3/docs/assets/img/blog-cells.png -------------------------------------------------------------------------------- /docs/assets/img/blog-instance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aurae-runtime/aurae/cc42b133704ede44c5a0ff50185b00302f8882b3/docs/assets/img/blog-instance.png -------------------------------------------------------------------------------- /docs/assets/img/blog-spawn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aurae-runtime/aurae/cc42b133704ede44c5a0ff50185b00302f8882b3/docs/assets/img/blog-spawn.png -------------------------------------------------------------------------------- /docs/assets/logo/LOGO AURAE HORIZONTAL 1.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aurae-runtime/aurae/cc42b133704ede44c5a0ff50185b00302f8882b3/docs/assets/logo/LOGO AURAE HORIZONTAL 1.psd -------------------------------------------------------------------------------- /docs/assets/logo/LOGO AURAE VERTICAL 1.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aurae-runtime/aurae/cc42b133704ede44c5a0ff50185b00302f8882b3/docs/assets/logo/LOGO AURAE VERTICAL 1.ai -------------------------------------------------------------------------------- /docs/assets/logo/LOGO ONLY AURAE 1.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aurae-runtime/aurae/cc42b133704ede44c5a0ff50185b00302f8882b3/docs/assets/logo/LOGO ONLY AURAE 1.ai -------------------------------------------------------------------------------- /docs/assets/logo/LOGO ONLY AURAE 1.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aurae-runtime/aurae/cc42b133704ede44c5a0ff50185b00302f8882b3/docs/assets/logo/LOGO ONLY AURAE 1.psd -------------------------------------------------------------------------------- /docs/assets/logo/TEXT ONLY AURAE 1.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aurae-runtime/aurae/cc42b133704ede44c5a0ff50185b00302f8882b3/docs/assets/logo/TEXT ONLY AURAE 1.ai -------------------------------------------------------------------------------- /docs/assets/logo/aurae-text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aurae-runtime/aurae/cc42b133704ede44c5a0ff50185b00302f8882b3/docs/assets/logo/aurae-text.png -------------------------------------------------------------------------------- /docs/assets/logo/aurae-white-purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aurae-runtime/aurae/cc42b133704ede44c5a0ff50185b00302f8882b3/docs/assets/logo/aurae-white-purple.png -------------------------------------------------------------------------------- /docs/assets/logo/aurae-white-purple.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aurae-runtime/aurae/cc42b133704ede44c5a0ff50185b00302f8882b3/docs/assets/logo/aurae-white-purple.xcf -------------------------------------------------------------------------------- /docs/assets/logo/aurae-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aurae-runtime/aurae/cc42b133704ede44c5a0ff50185b00302f8882b3/docs/assets/logo/aurae-white.png -------------------------------------------------------------------------------- /docs/assets/logo/aurae.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aurae-runtime/aurae/cc42b133704ede44c5a0ff50185b00302f8882b3/docs/assets/logo/aurae.png -------------------------------------------------------------------------------- /docs/auraed/index.md: -------------------------------------------------------------------------------- 1 | # Aurae Daemon 2 | 3 | The Aurae Daemon (auraed) is the main daemon that powers Aurae. 4 | 5 | The Aurae Daemon runs as a gRPC server which listens over a Unix domain socket by default. 6 | 7 | ``` 8 | /var/run/aurae/aurae.sock 9 | ``` 10 | 11 | ## Running auraed 12 | 13 | Running as `/sbin/init` is currently under active development. 14 | 15 | To run auraed as a standard library server you can run the daemon alongside your current init system. 16 | 17 | ## Building from source 18 | 19 | We suggest using the [aurae](https://github.com/aurae-runtime/aurae) repository for building all parts of the project. 20 | 21 | If you intend on building this repository directly you can leverage the Makefile in this repository: 22 | 23 | ```bash 24 | make auraed 25 | ``` 26 | 27 | or use Cargo directly: 28 | 29 | ```bash 30 | cargo clippy 31 | cargo install --debug --path . 32 | ``` 33 | 34 | 35 | ## Running auraed in a Container 36 | 37 | It is possible to run auraed in a container as long as the following is considered: 38 | 39 | - Populating mTLS certificate material into the container. 40 | - Exposing either the socket or a network interface from the container for client connections. 41 | 42 | Building the container (replace with your values): 43 | 44 | ``` 45 | sudo -E docker build -t krisnova/aurae:latest -t krisnova/aurae:$sha -f images/Dockerfile.nested . 46 | sudo -E docker push krisnova/aurae:latest 47 | sudo -E docker push krisnova/aurae:$sha 48 | ``` 49 | 50 | Running the container as PID 1: 51 | 52 | **Note**: This pattern (and the `krisnova` registry) will never be officially supported by the project. This is temporary as with bootstrap the project. 53 | 54 | ``` 55 | make pki config 56 | sudo -E docker run -v /etc/aurae:/etc/aurae krisnova/aurae:latest 57 | ``` 58 | -------------------------------------------------------------------------------- /docs/auraed/philosophy.md: -------------------------------------------------------------------------------- 1 | # Aurae Daemon Philosophy 2 | -------------------------------------------------------------------------------- /docs/auraescript/index.md: -------------------------------------------------------------------------------- 1 | Aurae offers a Turing complete scripting language built on top of TypeScript called [AuraeScript](https://github.com/aurae-runtime/aurae/tree/main/auraescript). AuraeScript embeds the [Deno](https://deno.land) source code directly, and offers a remote client and SDK to interface directly with Aurae remotely. The AuraeScript library is automatically generated from the `.proto` files defined in the [Aurae Standard Library](https://aurae.io/stdlib/). 2 | 3 | Valid TypeScript files can be leveraged to replace static manifests, as well as interact directly with a running system. 4 | 5 | ```typescript 6 | #!/usr/bin/env auraescript 7 | let cells = new runtime.CellServiceClient(); 8 | 9 | let allocated = await cells.allocate({ 10 | cell: runtime.Cell.fromPartial({ 11 | name: "my-cell", 12 | cpus: "2" 13 | }) 14 | }); 15 | 16 | let started = await cells.start({ 17 | executable: runtime.Executable.fromPartial({ 18 | cellName: "my-cell", 19 | command: "sleep 4000", 20 | description: "Sleep for 4000 seconds", 21 | name: "sleep-4000" 22 | }) 23 | }) 24 | ``` 25 | 26 | See the [Full list of working examples](https://github.com/aurae-runtime/aurae/tree/main/examples) for more! -------------------------------------------------------------------------------- /docs/blog/2022-12-11-cgroups.md: -------------------------------------------------------------------------------- 1 | # Cgroups in Aurae 2 | 3 | We need a way to map `processes` to `cgroups` or in Aurae parlance `executables` to `cells`. 4 | 5 | Given a cgroup `my-cell` and two nested processes: 6 | 7 | - `sleep 500` with the name `sleep-500` 8 | - `sleep 60` with the name `sleep-60` 9 | 10 | How do we identify which PID to send signals to if the user intends to start/stop either the `sleep-500` or the `sleep-60` process within the cell? 11 | 12 | ### Research with Systemd 13 | 14 | The way `systemd` manages this is by storing the Unit file contents in memory during the duration of the process. This is why `systemd daemon-reload` must be executed before changes to the current unit file are effective. The mapping of the configuration in the Unit file to the sub-processes is managed in memory. 15 | 16 | ### Differences from Systemd 17 | 18 | We would like to be able to start and stop arbitrary processes within a given cell. We currently believe that systemd creates a cgroup for each service, and the only way to "add" nested processes to a cgroup is by restarting the service with a hook to launch the intended nested process. 19 | 20 | ### Option 1) The "/var/run/aurae/cells" Way 21 | 22 | We create a new directory upon starting the daemon called `/var/run/aurae/cells` that we assume ownership of. We bake in the initialization setup in the same way we manage `/var/run/aurae.sock`. 23 | 24 | For every cell that is allocated we also create a file: 25 | 26 | ``` 27 | /var/run/aurae/cells/my-cell 28 | ``` 29 | 30 | We use the [pre_exec](https://doc.rust-lang.org/std/os/unix/process/trait.CommandExt.html#tymethod.pre_exec) function to create a file descriptor for each nested process that points back to the cell file. 31 | The children will store the file descriptors and not the parent. 32 | 33 | 34 | _Author: [Kris Nóva](https://github.com/krisnova)_ 35 | -------------------------------------------------------------------------------- /docs/build.md: -------------------------------------------------------------------------------- 1 | # Building Aurae from Source 2 | 3 | Checkout the core [aurae](https://github.com/aurae-runtime/aurae) repository. 4 | 5 | **Note**: Aurae currently only targets support for Linux on X86 architecture. 6 | 7 | ```bash 8 | https://github.com/aurae-runtime/aurae.git 9 | ``` 10 | 11 | ### Dependencies 12 | 13 | The Aurae environment has certain dependencies that are expected to be available. Some of them can be installed via 14 | commands provided below. 15 | 16 | - [Rust](https://rustup.rs) 17 | - [Protocol Buffer Compiler](https://grpc.io/docs/protoc-installation/) 18 | - [buf](https://docs.buf.build/installation) 19 | - [musl libc](https://musl.libc.org) 20 | - [BPF Linker](https://github.com/aya-rs/bpf-linker) 21 | 22 | 23 | ##### Ubuntu 24 | 25 | ```bash 26 | sudo apt-get install -y protobuf-compiler; # Protocol Buffer Compiler 27 | sudo apt-get install -y musl-tools; # musl libc 28 | sudo apt-get install -y build-essential; # gcc compiler 29 | ``` 30 | 31 | ##### Fedora 32 | 33 | ```bash 34 | sudo dnf install -y protobuf-compiler; # Protocol Buffer Compiler 35 | sudo dnf install -y musl-gcc; # musl libc 36 | sudo dnf install -y '@Development Tools'; # gcc compiler 37 | ``` 38 | 39 | ##### Arch 40 | 41 | ```bash 42 | yay -S protobuf # Protocol Buffer Compiler 43 | yay -S buf # buf 44 | yay -S musl # musl libc 45 | yay -S gcc # gcc compiler 46 | ``` 47 | 48 | ### Prepare the Environment 49 | 50 | First you will need to create [authentication certificates](/certs) and create an `~/.aurae/config` file. 51 | 52 | ```bash 53 | make pki config # For quick-start only 54 | ``` 55 | 56 | Now you can compile and install the toolchain 57 | 58 | ```bash 59 | make all 60 | ``` 61 | 62 | You can optionally compile and install each binary directly. E.g.,: 63 | 64 | ```bash 65 | make auraed # compile and install auraed with cargo 66 | make auraescript # compile and install auraescript with cargo 67 | ``` 68 | 69 | *For more commands, and the dependencies between them, please see the Makefile at the root of the repository.* 70 | -------------------------------------------------------------------------------- /docs/certs.md: -------------------------------------------------------------------------------- 1 | # Generating Client Certificate Material 2 | 3 | For an easy start for managing certificate material you can leverage the convenient make target. 4 | 5 | ``` 6 | make pki config 7 | ``` 8 | 9 | Which uses the scripts in [/hack](https://github.com/aurae-runtime/aurae/tree/main/hack) to self sign X509 certificates with mock identities. 10 | 11 | ### Creating Clients 12 | 13 | After the initial PKI has been generated using the above `make pki` command, clients can easily be created using the following. 14 | 15 | ```bash 16 | ./hack/certgen-client 17 | ``` 18 | 19 | Where `` is a unique string for your client you wish to provide authentication material for. -------------------------------------------------------------------------------- /docs/community/index.md: -------------------------------------------------------------------------------- 1 | # Aurae Community 2 | 3 | Welcome to The Aurae Runtime project. 4 | 5 | The project name is pronounced like the English word "aura" and is named after a minor Greek/Roman mythological deity, whose name means "breeze". 6 | 7 | Aurae is a [Nivenly Foundation](https://github.com/nivenly) project and agrees to abide by the Nivenly covenant. 8 | 9 | # Getting Involved 10 | 11 | If you would like to get involved with Aurae development: 12 | 13 | - Join our [discord](https://discord.gg/aTe2Rjg5rq). 14 | - Read the [Nivenly Covenant](https://nivenly.org/covenant) which calls out the code of conduct. 15 | - Read the [Contribution Guidelines](https://github.com/aurae-runtime/community/blob/main/CONTRIBUTING.md). 16 | - Sign the [CLA](https://cla.nivenly.org/) to begin contributing as an individual contributor. 17 | 18 | # What is Aurae? 19 | 20 | [Aurae](https://github.com/aurae-runtime/aurae) is an opinionated turing complete scripting language built for the enterprise. Think of it like TypeScript for infrastructure platforms. 21 | 22 | [Auraed](https://github.com/aurae-runtime/auraed) is the project core runtime daemon, auth and identity management system, and gRPC server that listens on a Unix domain socket. 23 | -------------------------------------------------------------------------------- /docs/contributors.md: -------------------------------------------------------------------------------- 1 | # File moved 2 | 3 | [Please click here to see the new file location](/community) -------------------------------------------------------------------------------- /docs/crate/.gitignore: -------------------------------------------------------------------------------- 1 | * -------------------------------------------------------------------------------- /docs/crate/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aurae-runtime/aurae/cc42b133704ede44c5a0ff50185b00302f8882b3/docs/crate/.gitkeep -------------------------------------------------------------------------------- /docs/development-environments/index.md: -------------------------------------------------------------------------------- 1 | # Development Environments 2 | 3 | In an effort to ease the process of getting started and contributing to the project, the community documents development environments that are expected to work. **Please note, x86_64 architecture is currently the only officially supported target for running the Aurae Daemon (auared).** 4 | 5 | 1. [Apple Silicon - CLion & Parallels Desktop](macOS/apple-silicon/clion-parallels.md) 6 | - Uses CLion and an Ubuntu VM via Parallels Desktop to provide a development environment with a GUI. 7 | 2. [macOS - Lima](macOS/lima.md) 8 | - Uses an Ubuntu VM via [Lima](https://lima-vm.io/) to provide a development environment with an optional mounted 9 | unix socket for interacting with auread on the host machine. -------------------------------------------------------------------------------- /docs/development-environments/macOS/lima.md: -------------------------------------------------------------------------------- 1 | # Developing on macOS with Lima 2 | 3 | This development guide is intended for any macOS system with any text editor or IDE. 4 | 5 | Lima is a virtual machine launcher, mainly built for macOS, that provides convenient mechanisms for interacting and configuring virtual machines out of the box. 6 | 7 | ## Setup 8 | 1. Install lima. You can find the instructions at [Lima's Getting Started](https://github.com/lima-vm/lima#getting-started) documentation 9 | 10 | 2. Create an Ubuntu virtual machine. This command will walk you through the installation process: 11 | ```sh 12 | $ limactl start --name aurae 13 | ``` 14 | 15 | 3. SSH into your virtual machine 16 | ```sh 17 | $ limactl shell aurae 18 | ``` 19 | 20 | 4. Follow the aurae [Building from Source](https://aurae.io/build/) instructions. You can edit either stop the virtual 21 | machine, edit its configuration to create a writable mount of the source code directory from your host machine to the 22 | guest, or copy the contents of the source code directory to `/tmp/lima`, e.g., `/tmp/lima/aurae` 23 | 24 | 5. **[Optional]** Mount the unix socket from the guest machine to the host machine. Lima provides a simple way to 25 | configure this, but you first need to stop your virtual machine to edit its configuration: 26 | ```sh 27 | $ limactl stop aurea 28 | ``` 29 | Now you can edit the config: 30 | ```sh 31 | $ limactl edit aurea 32 | ``` 33 | And you can add a configuration like this to the bottom: 34 | ```yaml 35 | portForwards: 36 | - guestSocket: "/var/run/aurae/aurae.sock" 37 | hostSocket: "aurae.sock" 38 | ``` 39 | Then start your virtual machine again and start auraed: 40 | ```sh 41 | $ limactl start aurae 42 | $ limactl shell make auraed-start 43 | ``` 44 | In another shell copy the virtual machine's `~/.aurae` directory to your own: 45 | ```sh 46 | $ limactl copy -r aurae:~/.aurae ~/.aurae 47 | ``` 48 | Edit the contents of `~/.aurae/config` to fit the requirements of your host machine. Now you can interact with aurae 49 | from your host machine! 50 | 51 | 6. **[Optional]** If you're tired of specifying the name you gave your virtual machine, you can export an environment 52 | variable that `limactl` will use for the default, like so: 53 | ```sh 54 | $ export LIMA_INSTANCE=aurae 55 | ``` 56 | 57 | -------------------------------------------------------------------------------- /docs/signals.md: -------------------------------------------------------------------------------- 1 | # Signals 2 | 3 | The Aurae project calls out general rules for how all daemons (including `auraed` itself) should respond to various POSIX signals. 4 | 5 | The `auraed` daemon will proxy signals sent to nested cells and nested `auraed` instances. 6 | 7 | 8 | | Signal | Value | Proxy | Description | 9 | |---------|-------|---------|---------------------------------------------------------------------------------------------------------------------------------------| 10 | | SIGKILL | 9 | SIGKILL | The most destructive signal. Will immediately kill `auraed`. | 11 | | SIGHUP | 1 | SIGHUP | Sent when a controlling shell, or TTY is closed. Used to reload `auraed` and reopen file descriptors. | 12 | | SIGTERM | 15 | SIGTERM | Used to tell a nested `auraed` it is time to "die nicely" and begin stopping workloads in the cache, and destroying nested resources. | 13 | | SIGINT | 2 | SIGINT | Ignored by `auraed` | 14 | 15 | 16 | ## Observe signals with auraed eBPF 17 | 18 | ```bash 19 | aer observe get-posix-signals-stream 20 | ``` 21 | 22 | 23 | -------------------------------------------------------------------------------- /docs/stdlib/v0/.gitignore: -------------------------------------------------------------------------------- 1 | * -------------------------------------------------------------------------------- /docs/stdlib/v0/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aurae-runtime/aurae/cc42b133704ede44c5a0ff50185b00302f8882b3/docs/stdlib/v0/.gitkeep -------------------------------------------------------------------------------- /ebpf-shared/Cargo.toml: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- # 2 | # | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | # 3 | # | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | # 4 | # | ███████║██║ ██║██████╔╝███████║█████╗ | # 5 | # | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | # 6 | # | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | # 7 | # | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | # 8 | # +--------------------------------------------+ # 9 | # # 10 | # Distributed Systems Runtime # 11 | # ---------------------------------------------------------------------------- # 12 | # Copyright 2022 - 2024, the aurae contributors # 13 | # SPDX-License-Identifier: Apache-2.0 # 14 | # ---------------------------------------------------------------------------- # 15 | [package] 16 | name = "aurae-ebpf-shared" 17 | version = "0.0.0" 18 | publish = false 19 | edition = "2024" 20 | authors = ["The Aurae Authors", "Kris Nóva "] 21 | license = "Apache-2.0" 22 | 23 | [features] 24 | default = [] 25 | user = ["aya"] 26 | 27 | [dependencies] 28 | aya = { version = "0.13.1", optional = true } 29 | 30 | [lib] 31 | path = "src/lib.rs" 32 | -------------------------------------------------------------------------------- /ebpf-shared/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | #![no_std] 16 | 17 | pub trait HasCgroup { 18 | fn cgroup_id(&self) -> u64; 19 | } 20 | 21 | pub trait HasHostPid { 22 | fn host_pid(&self) -> i32; 23 | } 24 | 25 | #[repr(C)] 26 | #[derive(Clone, Copy, Debug, PartialEq, Eq)] 27 | pub struct Signal { 28 | pub cgroup_id: u64, 29 | pub signum: i32, 30 | pub pid: i32, 31 | } 32 | 33 | impl HasCgroup for Signal { 34 | fn cgroup_id(&self) -> u64 { 35 | self.cgroup_id 36 | } 37 | } 38 | 39 | impl HasHostPid for Signal { 40 | fn host_pid(&self) -> i32 { 41 | self.pid 42 | } 43 | } 44 | 45 | #[repr(C)] 46 | #[derive(Clone, Copy, Debug, PartialEq, Eq)] 47 | pub struct ForkedProcess { 48 | pub parent_pid: i32, 49 | pub child_pid: i32, 50 | } 51 | 52 | #[repr(C)] 53 | #[derive(Clone, Copy, Debug, PartialEq, Eq)] 54 | pub struct ProcessExit { 55 | pub pid: i32, 56 | } 57 | -------------------------------------------------------------------------------- /ebpf/Cargo.toml: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- # 2 | # | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | # 3 | # | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | # 4 | # | ███████║██║ ██║██████╔╝███████║█████╗ | # 5 | # | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | # 6 | # | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | # 7 | # | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | # 8 | # +--------------------------------------------+ # 9 | # # 10 | # Distributed Systems Runtime # 11 | # ---------------------------------------------------------------------------- # 12 | # Copyright 2022 - 2024, the aurae contributors # 13 | # SPDX-License-Identifier: Apache-2.0 # 14 | # ---------------------------------------------------------------------------- # 15 | [package] 16 | name = "ebpf-probes" 17 | version = "0.0.0" 18 | edition = "2024" 19 | license = "Dual MIT/GPL" 20 | 21 | [dependencies] 22 | aurae-ebpf-shared = { path = "../ebpf-shared" } 23 | aya-ebpf = "0.1.1" 24 | aya-log-ebpf = "0.1.1" 25 | 26 | [[bin]] 27 | name = "instrument-tracepoint-signal-signal-generate" 28 | path = "src/probe-tracepoint-signal-signal-generate.rs" 29 | 30 | [[bin]] 31 | name = "instrument-tracepoint-sched-sched-process-fork" 32 | path = "src/probe-tracepoint-sched-sched-process-fork.rs" 33 | 34 | [[bin]] 35 | name = "instrument-kprobe-taskstats-exit" 36 | path = "src/probe-kprobe-taskstats-exit.rs" 37 | 38 | [profile.dev] 39 | opt-level = 3 40 | debug = false 41 | debug-assertions = false 42 | overflow-checks = false 43 | lto = true 44 | panic = "abort" 45 | incremental = false 46 | codegen-units = 1 47 | rpath = false 48 | 49 | [profile.release] 50 | lto = true 51 | panic = "abort" 52 | codegen-units = 1 53 | -------------------------------------------------------------------------------- /ebpf/LICENSE.MIT: -------------------------------------------------------------------------------- 1 | Copyright 2023 The Aurae Authors (The Nivenly Foundation) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | 9 | -------------------------------------------------------------------------------- /ebpf/README.md: -------------------------------------------------------------------------------- 1 | # eBPF Probes -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | # Aurae Examples 2 | 3 | Run the examples like you would run a script. 4 | 5 | You may run directly from the same directory as long as the script is marked at executable 6 | 7 | ```bash 8 | chmod +x my_script.ts 9 | ``` 10 | 11 | and the script contains a valid [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) line at the top. 12 | 13 | ```bash 14 | #!/usr/bin/env auraescript 15 | ``` 16 | You may run the script as follows: 17 | 18 | ```bash 19 | ./my_script.ts 20 | ``` 21 | 22 | Additionally you can leverage the `auraescript` binary directly to execute your script which will execute a script without being executable and without a shebang. 23 | 24 | ```bash 25 | auraescript myscript.ts 26 | ``` -------------------------------------------------------------------------------- /examples/cell_validation_errors.ts: -------------------------------------------------------------------------------- 1 | // [ Free ] 2 | import * as aurae from "../auraescript/gen/aurae.ts"; 3 | import * as cells from "../auraescript/gen/cells.ts"; 4 | 5 | let client = await aurae.createClient(); 6 | const cellService = new cells.CellServiceClient(client); 7 | 8 | //// REGEX violation 9 | await cellService.allocate({ 10 | cell: cells.Cell.fromPartial({ 11 | name: "ae-no_underscore" 12 | }) 13 | }); 14 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | { 16 | description = "Aurea dev shell"; 17 | 18 | inputs = { 19 | nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; 20 | rust-overlay.url = "github:oxalica/rust-overlay"; 21 | flake-utils.url = "github:numtide/flake-utils"; 22 | }; 23 | 24 | outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }: 25 | flake-utils.lib.eachDefaultSystem (system: 26 | let 27 | overlays = [ (import rust-overlay) ]; 28 | pkgs = import nixpkgs { 29 | inherit system overlays; 30 | }; 31 | 32 | rust-version = (pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml).override { 33 | extensions = [ 34 | "clippy" 35 | "rust-docs" 36 | "rust-src" 37 | "rustfmt" 38 | "rust-analyzer" 39 | ]; 40 | }; 41 | in 42 | { 43 | devShells.default = with pkgs; mkShell { 44 | buildInputs = [ 45 | act 46 | # The version 1.50.0 requires us to follow NixOS' unstable channel. 47 | buf 48 | libseccomp 49 | protobuf 50 | rust-version 51 | ]; 52 | }; 53 | } 54 | ); 55 | } 56 | -------------------------------------------------------------------------------- /hack/.header.script: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- # 2 | # | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | # 3 | # | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | # 4 | # | ███████║██║ ██║██████╔╝███████║█████╗ | # 5 | # | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | # 6 | # | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | # 7 | # | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | # 8 | # +--------------------------------------------+ # 9 | # # 10 | # Distributed Systems Runtime # 11 | # ---------------------------------------------------------------------------- # 12 | # Copyright 2022 - 2024, the aurae contributors # 13 | # SPDX-License-Identifier: Apache-2.0 # 14 | # ---------------------------------------------------------------------------- # 15 | -------------------------------------------------------------------------------- /hack/.header.source: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | -------------------------------------------------------------------------------- /hack/_common.mk: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # ---------------------------------------------------------------------------- # 3 | # | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | # 4 | # | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | # 5 | # | ███████║██║ ██║██████╔╝███████║█████╗ | # 6 | # | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | # 7 | # | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | # 8 | # | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | # 9 | # +--------------------------------------------+ # 10 | # # 11 | # Distributed Systems Runtime # 12 | # ---------------------------------------------------------------------------- # 13 | # Copyright 2022 - 2024, the aurae contributors # 14 | # SPDX-License-Identifier: Apache-2.0 # 15 | # ---------------------------------------------------------------------------- # 16 | 17 | ifeq ($(__common__),) 18 | __common__ := defined 19 | 20 | .PHONY: help 21 | help: ## Show help messages for make targets 22 | @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(firstword $(MAKEFILE_LIST)) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' 23 | 24 | endif -------------------------------------------------------------------------------- /hack/certgen-client: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # ---------------------------------------------------------------------------- # 3 | # | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | # 4 | # | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | # 5 | # | ███████║██║ ██║██████╔╝███████║█████╗ | # 6 | # | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | # 7 | # | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | # 8 | # | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | # 9 | # +--------------------------------------------+ # 10 | # # 11 | # Distributed Systems Runtime # 12 | # ---------------------------------------------------------------------------- # 13 | # Copyright 2022 - 2024, the aurae contributors # 14 | # SPDX-License-Identifier: Apache-2.0 # 15 | # ---------------------------------------------------------------------------- # 16 | 17 | set -e 18 | # certgen-client assumes certgen has been ran 19 | 20 | if [ -z "$1" ]; then 21 | echo "Usage: ./hack/certgen-client " 22 | exit 1 23 | fi 24 | NAME=$1 25 | echo " -> Generating Client: ${NAME}..." 26 | 27 | ## Generate client CSR 28 | echo " -> Generating Client Material: client.${NAME}.key, client.${NAME}.csr..." 29 | openssl genrsa -out "./pki/client.${NAME}.key" 4096 2>/dev/null 30 | openssl req \ 31 | -new \ 32 | -addext "subjectAltName = DNS:${NAME}.unsafe.aurae.io" \ 33 | -subj "/C=IS/ST=aurae/L=aurae/O=Aurae/OU=Runtime/CN=${NAME}.unsafe.aurae.io" \ 34 | -key "./pki/client.${NAME}.key" \ 35 | -out "./pki/client.${NAME}.csr" 2>/dev/null 36 | 37 | ## Sign the client cert using the CA 38 | echo " -> Signing Client Material (Root CA): client.${NAME}.csr..." 39 | openssl x509 \ 40 | -req \ 41 | -extfile "./hack/certgen.client.ext" \ 42 | -days 9999 \ 43 | -in "./pki/client.${NAME}.csr" \ 44 | -CA "./pki/ca.crt" \ 45 | -CAkey "./pki/ca.key" \ 46 | -CAcreateserial \ 47 | -out "./pki/_signed.client.${NAME}.crt" 2>/dev/null 48 | 49 | ## Verify the client material is signed 50 | echo " -> Verify Client Material (Root CA): client.${NAME}.csr..." 51 | openssl verify -CAfile "./pki/ca.crt" "./pki/_signed.client.${NAME}.crt" 1>/dev/null && echo " -> Root Verification: Success!" 52 | -------------------------------------------------------------------------------- /hack/certgen.client.ext: -------------------------------------------------------------------------------- 1 | basicConstraints=CA:FALSE 2 | keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment 3 | authorityKeyIdentifier = keyid, issuer 4 | -------------------------------------------------------------------------------- /hack/certgen.server.ext: -------------------------------------------------------------------------------- 1 | subjectAltName = DNS:server.unsafe.aurae.io 2 | -------------------------------------------------------------------------------- /hack/code-format: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # ---------------------------------------------------------------------------- # 3 | # | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | # 4 | # | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | # 5 | # | ███████║██║ ██║██████╔╝███████║█████╗ | # 6 | # | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | # 7 | # | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | # 8 | # | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | # 9 | # +--------------------------------------------+ # 10 | # # 11 | # Distributed Systems Runtime # 12 | # ---------------------------------------------------------------------------- # 13 | # Copyright 2022 - 2024, the aurae contributors # 14 | # SPDX-License-Identifier: Apache-2.0 # 15 | # ---------------------------------------------------------------------------- # 16 | 17 | D=$(pwd) 18 | if [[ $D == *"hack"* ]]; then 19 | echo "" 20 | echo "/hack is a special directory. These scripts should only be executed from the Makefile." 21 | echo "..or the directory above this one." 22 | echo "" 23 | exit 99 24 | fi 25 | 26 | # This script assumes running from the top level directory within a Makefile 27 | 28 | . hack/file-definitions 29 | 30 | echo " [ Formatting Source Code ] " 31 | echo "" 32 | 33 | ## Rust 34 | cargo fmt --all --check 35 | 36 | ## Protobuf 37 | buf format -w --exit-code 38 | -------------------------------------------------------------------------------- /hack/common: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # ---------------------------------------------------------------------------- # 3 | # | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | # 4 | # | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | # 5 | # | ███████║██║ ██║██████╔╝███████║█████╗ | # 6 | # | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | # 7 | # | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | # 8 | # | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | # 9 | # +--------------------------------------------+ # 10 | # # 11 | # Distributed Systems Runtime # 12 | # ---------------------------------------------------------------------------- # 13 | # Copyright 2022 - 2024, the aurae contributors # 14 | # SPDX-License-Identifier: Apache-2.0 # 15 | # ---------------------------------------------------------------------------- # 16 | 17 | D=$(pwd) 18 | if [[ D == *"hack"* ]]; then 19 | echo "" 20 | echo "/hack is a special directory. These scripts should only be executed from the Makefile." 21 | echo "..or the directory above this one." 22 | echo "" 23 | echo "We suggest using the github.com/aurae-runtime/environment repository for building aurae" 24 | echo "projects from source." 25 | echo "" 26 | exit 99 27 | fi 28 | 29 | # This script assumes running from the top level directory within a Makefile 30 | -------------------------------------------------------------------------------- /hack/container: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # ---------------------------------------------------------------------------- # 3 | # | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | # 4 | # | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | # 5 | # | ███████║██║ ██║██████╔╝███████║█████╗ | # 6 | # | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | # 7 | # | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | # 8 | # | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | # 9 | # +--------------------------------------------+ # 10 | # # 11 | # Distributed Systems Runtime # 12 | # ---------------------------------------------------------------------------- # 13 | # Copyright 2022 - 2024, the aurae contributors # 14 | # SPDX-License-Identifier: Apache-2.0 # 15 | # ---------------------------------------------------------------------------- # 16 | 17 | sha=$(git rev-parse HEAD) 18 | 19 | sudo -E docker build -t krisnova/aurae:latest -t krisnova/aurae:$sha -f images/Dockerfile.nested . 20 | sudo -E docker push krisnova/aurae:latest 21 | sudo -E docker push krisnova/aurae:$sha 22 | -------------------------------------------------------------------------------- /hack/file-definitions: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # ---------------------------------------------------------------------------- # 3 | # | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | # 4 | # | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | # 5 | # | ███████║██║ ██║██████╔╝███████║█████╗ | # 6 | # | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | # 7 | # | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | # 8 | # | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | # 9 | # +--------------------------------------------+ # 10 | # # 11 | # Distributed Systems Runtime # 12 | # ---------------------------------------------------------------------------- # 13 | # Copyright 2022 - 2024, the aurae contributors # 14 | # SPDX-License-Identifier: Apache-2.0 # 15 | # ---------------------------------------------------------------------------- # 16 | 17 | D=$(pwd) 18 | if [[ $D == *"hack"* ]]; then 19 | echo "" 20 | echo "/hack is a special directory. These scripts should only be executed from the Makefile." 21 | echo "..or the directory above this one." 22 | echo "" 23 | exit 99 24 | fi 25 | 26 | # This script assumes running from the top level directory within a Makefile 27 | 28 | EXPECTEDSCRIPT=$(cat hack/.header.script) 29 | EXPECTEDSOURCE=$(cat hack/.header.source) 30 | 31 | ### Define Scripts 32 | SCRIPTS=$(find . \( \ 33 | -iname '*.sh' -or \ 34 | -iname '*.toml' \ 35 | \) -not -path '*/ignore/*' \ 36 | -not -path './hypervisor/*' ) 37 | 38 | ### HACK Dir Scripts 39 | HACKSCRIPTS=$(find -s hack -type f -not \( \ 40 | -name 'certgen.client.ext' -or \ 41 | -name 'certgen.server.ext' -or \ 42 | -name '.header.script' -or \ 43 | -name '.header.source' \ 44 | \)) 45 | 46 | ### Define Sources 47 | SOURCES=$(find . \( \ 48 | -iname '*.rs' -or \ 49 | -iname '*.go' -or \ 50 | -iname '*.c' -or \ 51 | -iname '*.h' \ 52 | \) -not -path '*/ignore/*' \ 53 | -not -path './hypervisor/*' ) 54 | 55 | ### Rust Sources 56 | RUSTSOURCES=$(find . \( \ 57 | -iname '*.rs' \ 58 | \) -not -path '*/ignore/*' \ 59 | -not -path -'*/gen/*' \ 60 | -not -path -'.target/*' \ 61 | -not -path -'./hypervisor/*' ) 62 | -------------------------------------------------------------------------------- /hack/oci-alpine: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- # 2 | # | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | # 3 | # | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | # 4 | # | ███████║██║ ██║██████╔╝███████║█████╗ | # 5 | # | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | # 6 | # | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | # 7 | # | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | # 8 | # +--------------------------------------------+ # 9 | # # 10 | # Distributed Systems Runtime # 11 | # ---------------------------------------------------------------------------- # 12 | # Copyright 2022 - 2024, the aurae contributors # 13 | # SPDX-License-Identifier: Apache-2.0 # 14 | # ---------------------------------------------------------------------------- # 15 | 16 | rm -rf target/alpine 17 | mkdir -p target/alpine/rootfs 18 | sudo -E docker pull alpine 19 | sudo -E docker create --name alpine-aurae alpine 20 | sudo -E docker export alpine-aurae | tar -C target/alpine/rootfs -xf - 21 | sudo -E docker rm alpine-aurae 22 | cd target/alpine 23 | sudo -E runc spec 24 | -------------------------------------------------------------------------------- /hack/oci-busybox: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # ---------------------------------------------------------------------------- # 3 | # | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | # 4 | # | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | # 5 | # | ███████║██║ ██║██████╔╝███████║█████╗ | # 6 | # | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | # 7 | # | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | # 8 | # | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | # 9 | # +--------------------------------------------+ # 10 | # # 11 | # Distributed Systems Runtime # 12 | # ---------------------------------------------------------------------------- # 13 | # Copyright 2022 - 2024, the aurae contributors # 14 | # SPDX-License-Identifier: Apache-2.0 # 15 | # ---------------------------------------------------------------------------- # 16 | 17 | rm -rf target/busybox 18 | mkdir -p target/busybox/rootfs 19 | sudo -E docker pull busybox 20 | sudo -E docker create --name busybox-aurae busybox 21 | sudo -E docker export busybox-aurae | tar -C target/busybox/rootfs -xf - 22 | sudo -E docker rm busybox-aurae 23 | cd target/busybox 24 | sudo -E runc spec 25 | -------------------------------------------------------------------------------- /hack/serve.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # ---------------------------------------------------------------------------- # 3 | # | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | # 4 | # | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | # 5 | # | ███████║██║ ██║██████╔╝███████║█████╗ | # 6 | # | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | # 7 | # | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | # 8 | # | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | # 9 | # +--------------------------------------------+ # 10 | # # 11 | # Distributed Systems Runtime # 12 | # ---------------------------------------------------------------------------- # 13 | # Copyright 2022 - 2024, the aurae contributors # 14 | # SPDX-License-Identifier: Apache-2.0 # 15 | # ---------------------------------------------------------------------------- # 16 | 17 | docker run --rm -it \ 18 | -p 8000:8000 \ 19 | -v $PWD:/docs:ro \ 20 | squidfunk/mkdocs-material 21 | -------------------------------------------------------------------------------- /hack/server-tls-info: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # ---------------------------------------------------------------------------- # 3 | # | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | # 4 | # | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | # 5 | # | ███████║██║ ██║██████╔╝███████║█████╗ | # 6 | # | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | # 7 | # | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | # 8 | # | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | # 9 | # +--------------------------------------------+ # 10 | # # 11 | # Distributed Systems Runtime # 12 | # ---------------------------------------------------------------------------- # 13 | # Copyright 2022 - 2024, the aurae contributors # 14 | # SPDX-License-Identifier: Apache-2.0 # 15 | # ---------------------------------------------------------------------------- # 16 | 17 | openssl s_client -showcerts -unix /var/run/aurae/aurae.sock 18 | -------------------------------------------------------------------------------- /hack/spawn: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # ---------------------------------------------------------------------------- # 3 | # | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | # 4 | # | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | # 5 | # | ███████║██║ ██║██████╔╝███████║█████╗ | # 6 | # | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | # 7 | # | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | # 8 | # | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | # 9 | # +--------------------------------------------+ # 10 | # # 11 | # Distributed Systems Runtime # 12 | # ---------------------------------------------------------------------------- # 13 | # Copyright 2022 - 2024, the aurae contributors # 14 | # SPDX-License-Identifier: Apache-2.0 # 15 | # ---------------------------------------------------------------------------- # 16 | 17 | CID="aurae-spawn-hack" 18 | BUNDLE="target/aurae-spawn" 19 | 20 | # [Spawn] 21 | # Assume we are running in the root top level directory 22 | # Assume we must create "aurae-spawn" as this is hard coded in auraed 23 | sudo -E auraed spawn --output ${BUNDLE} 24 | 25 | # [Run/Debug] 26 | echo "Delete: ${CID}" 27 | sudo -E youki delete ${CID} 28 | 29 | echo "Create: ${CID}" 30 | sudo -E youki create --bundle ${BUNDLE} ${CID} 31 | 32 | echo "Start : ${CID}" 33 | sudo -E youki start ${CID} 34 | -------------------------------------------------------------------------------- /images/README.md: -------------------------------------------------------------------------------- 1 | # Images 2 | 3 | This folder holds the container image manifests that are needed by the project. Changes to container manifests (currently Dockerfile's) that are built and stored in the Github Repository via the Github Actions pipeline cannot be merged in from a fork of the repository - the Github Token will not let their repository push to our package registry. 4 | 5 | ## Build image (Dockerfile.build) 6 | 7 | Used by Github Actions (GHA) as a build container. It uses docker [buildx](https://github.com/docker/buildx), which enables multi-stage builds and [GHA native layer caching](https://docs.docker.com/build/cache/backends/gha/). The container is automatically built as the first step in the GHA pipelines that may need it. 8 | 9 | Please (seriously please) be careful about adding commands here. This is our core way of validating that our binary is "healthy". If we need to install anything with the word "lib" in it to get the build to pass, we likely should be having other discussions instead of adding commands here. For example we should NOT be adding libraries such as "libseccomp" 10 | or "libdbus". 11 | 12 | Do not add GNU libraries here! 13 | If in doubt, please ask in Discord in the build channel. 14 | 15 | ## Testing image (Dockerfile.test) 16 | 17 | Used by Github Actions (GHA) as a testing container. It uses docker [buildx](https://github.com/docker/buildx), which enables multi-stage builds and [GHA native layer caching](https://docs.docker.com/build/cache/backends/gha/). The container is automatically built as the first step in the GHA pipelines that may need it. 18 | 19 | This image can also be used locally as a way to run tests in the same environment as GHA uses, and without requiring a local rust installation. 20 | 21 | 1. Build the container locally. Make sure you are in the root `aurae` directory for these steps. 22 | 23 | `make oci-image-build tag=builder ocifile=./images/Dockerfile.test` 24 | 25 | 2. Pass in whichever `make` command you would like to run inside the container. This example runs `make docs` inside the build container. 26 | 27 | `make oci-make tag=builder command=make docs` 28 | 29 | Since the `auraed` directory is mounted inside this container, you can also pass commands like `fmt`. This will modify files in the project. 30 | 31 | - `make oci-make tag=builder command=make fmt` 32 | -------------------------------------------------------------------------------- /mkdocs.yml: -------------------------------------------------------------------------------- 1 | site_name: "Aurae Runtime" 2 | site_url: "https://aurae.io" 3 | repo_url: "https://github.com/aurae-runtime/aurae" 4 | edit_uri: "edit/main/docs/" 5 | 6 | nav: 7 | - Home: index.md 8 | - Auraed: /auraed 9 | - AuraeScript: 10 | - About: /auraescript 11 | - Examples on GitHub: https://github.com/aurae-runtime/aurae/tree/main/examples 12 | - Aurae Standard Library: 13 | - Specification: /stdlib 14 | - V0: /stdlib/v0 15 | - Getting Started: 16 | - Building from Source: /build 17 | - Quick Start: /quickstart 18 | #- Examples: /examples 19 | - Development Environments: /development-environments 20 | - Signals: /signals 21 | - Certificates: /certs 22 | - Community: 23 | - Aurae Community: /community 24 | - Join our Discord: https://discord.gg/aTe2Rjg5rq 25 | - Reference: 26 | - auraed: /crate/auraed 27 | - auraescript: /crate/auraescript 28 | - client: /crate/client 29 | - aer: /crate/aer 30 | - src: 31 | - auraed: /crate/src/auraed/lib.rs.html 32 | - auraescript: /crate/src/auraescript/lib.rs.html 33 | - client: /crate/src/client/lib.rs.html 34 | - aer: /crate/src/aer/lib.rs.html 35 | - Blog: 36 | - Isolation with Aurae Cells: /blog/2022-10-24-aurae-cells 37 | - Cgroups in Aurae: /blog/2022-12-11-cgroups 38 | 39 | theme: 40 | name: material 41 | language: en 42 | logo: assets/logo/aurae-white.png 43 | favicon: assets/logo/aurae.png 44 | font: 45 | text: Terminus 46 | palette: 47 | scheme: slate 48 | primary: indigo 49 | accent: white 50 | 51 | extra_css: 52 | - assets/aurae.css 53 | 54 | markdown_extensions: 55 | - admonition 56 | - attr_list 57 | - def_list 58 | - pymdownx.highlight 59 | - pymdownx.snippets 60 | - footnotes 61 | - pymdownx.superfences: 62 | custom_fences: 63 | - name: mermaid 64 | class: mermaid 65 | format: !!python/name:pymdownx.superfences.fence_code_format 66 | - pymdownx.tabbed 67 | - pymdownx.emoji: 68 | emoji_index: !!python/name:materialx.emoji.twemoji 69 | emoji_generator: !!python/name:materialx.emoji.to_svg 70 | 71 | copyright: Copyright © 2022-2023 The Aurae Runtime Project 72 | extra: 73 | generator: false 74 | social: 75 | - icon: fontawesome/solid/paper-plane 76 | link: mailto: 77 | -------------------------------------------------------------------------------- /pods/image.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | use ocipkg::ImageName; 17 | use std::fmt::{Display, Formatter}; 18 | use std::ops::Deref; 19 | use validation::{ValidatedField, ValidationError}; 20 | 21 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] 22 | pub struct Image(ImageName); 23 | 24 | impl ValidatedField for Image { 25 | fn validate( 26 | input: Option, 27 | field_name: &str, 28 | parent_name: Option<&str>, 29 | ) -> Result { 30 | let input = 31 | validation::required_not_empty(input, field_name, parent_name)?; 32 | 33 | // Ensure that the input is a valid absolute url because 34 | // ocipkg defaults to docker and we don't want that 35 | // TODO: ":[version]" makes for a non-valid url 36 | // let _ = validation::valid_url(&input, field_name, parent_name)?; 37 | 38 | let input = ImageName::parse(&input).map_err(|_e| { 39 | ValidationError::Invalid { 40 | field: validation::field_name(field_name, parent_name), 41 | } 42 | })?; 43 | 44 | Ok(Self(input)) 45 | } 46 | } 47 | 48 | impl Display for Image { 49 | fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { 50 | Display::fmt(&self.0, f) 51 | } 52 | } 53 | 54 | impl Deref for Image { 55 | type Target = ImageName; 56 | 57 | fn deref(&self) -> &Self::Target { 58 | &self.0 59 | } 60 | } -------------------------------------------------------------------------------- /pods/mod.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | pub use error::{PodsError, Result}; 17 | use image::Image; 18 | use pod::Pod; 19 | use pod_name::PodName; 20 | 21 | mod error; 22 | mod image; 23 | mod pod; 24 | mod pod_name; 25 | #[allow(clippy::module_inception)] 26 | mod pods; 27 | 28 | #[derive(Debug)] 29 | pub struct PodSpec { 30 | image: Image, 31 | } -------------------------------------------------------------------------------- /pods/pod_name.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | use std::fmt::{Debug, Display, Formatter}; 17 | use std::ops::Deref; 18 | 19 | #[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)] 20 | pub struct PodName(String); 21 | 22 | impl PodName { 23 | #[cfg(test)] 24 | pub fn new(name: String) -> Self { 25 | Self(name) 26 | } 27 | } 28 | 29 | impl Display for PodName { 30 | fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { 31 | Display::fmt(&self.0, f) 32 | } 33 | } 34 | 35 | impl Deref for PodName { 36 | type Target = str; 37 | 38 | fn deref(&self) -> &Self::Target { 39 | &self.0 40 | } 41 | } -------------------------------------------------------------------------------- /proto/Cargo.toml: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- # 2 | # | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | # 3 | # | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | # 4 | # | ███████║██║ ██║██████╔╝███████║█████╗ | # 5 | # | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | # 6 | # | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | # 7 | # | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | # 8 | # +--------------------------------------------+ # 9 | # # 10 | # Distributed Systems Runtime # 11 | # ---------------------------------------------------------------------------- # 12 | # Copyright 2022 - 2024, the aurae contributors # 13 | # SPDX-License-Identifier: Apache-2.0 # 14 | # ---------------------------------------------------------------------------- # 15 | 16 | [package] 17 | name = "proto" 18 | version = "0.0.0" 19 | edition = "2024" 20 | authors = ["The Aurae Authors", "Kris Nóva "] 21 | license = "Apache-2.0" 22 | 23 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 24 | 25 | [dependencies] 26 | pbjson = "0.7.0" 27 | prost = "0.13.4" 28 | serde = { workspace = true } 29 | tonic = { workspace = true } 30 | -------------------------------------------------------------------------------- /proto/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------- *\ 2 | * | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | * 3 | * | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | * 4 | * | ███████║██║ ██║██████╔╝███████║█████╗ | * 5 | * | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | * 6 | * | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | * 7 | * | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | * 8 | * +--------------------------------------------+ * 9 | * * 10 | * Distributed Systems Runtime * 11 | * -------------------------------------------------------------------------- * 12 | * Copyright 2022 - 2024, the aurae contributors * 13 | * SPDX-License-Identifier: Apache-2.0 * 14 | \* -------------------------------------------------------------------------- */ 15 | 16 | //! Generated Protobuf definitions for the Aurae Standard Library 17 | 18 | #![allow(clippy::derive_partial_eq_without_eq)] 19 | #![allow(clippy::empty_docs)] 20 | #![allow(clippy::match_single_binding)] 21 | #![allow(clippy::doc_lazy_continuation)] 22 | #![allow(clippy::needless_lifetimes)] 23 | #![allow(clippy::doc_overindented_list_items)] 24 | 25 | pub mod cells { 26 | include!("../gen/aurae.cells.v0.rs"); 27 | } 28 | 29 | pub mod discovery { 30 | include!("../gen/aurae.discovery.v0.rs"); 31 | } 32 | 33 | pub mod grpc { 34 | pub mod health { 35 | include!("../gen/grpc.health.v1.rs"); 36 | } 37 | } 38 | 39 | pub mod cri { 40 | include!("../gen/runtime.v1.rs"); 41 | } 42 | 43 | pub mod observe { 44 | include!("../gen/aurae.observe.v0.rs"); 45 | } 46 | 47 | pub mod vms { 48 | include!("../gen/aurae.vms.v0.rs"); 49 | } 50 | -------------------------------------------------------------------------------- /rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- # 2 | # | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | # 3 | # | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | # 4 | # | ███████║██║ ██║██████╔╝███████║█████╗ | # 5 | # | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | # 6 | # | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | # 7 | # | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | # 8 | # +--------------------------------------------+ # 9 | # # 10 | # Distributed Systems Runtime # 11 | # ---------------------------------------------------------------------------- # 12 | # Copyright 2022 - 2024, the aurae contributors # 13 | # SPDX-License-Identifier: Apache-2.0 # 14 | # ---------------------------------------------------------------------------- # 15 | [toolchain] 16 | channel = "1.87.0" 17 | targets = ["x86_64-unknown-linux-musl"] 18 | profile = "default" 19 | -------------------------------------------------------------------------------- /rustfmt.toml: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- # 2 | # | █████╗ ██╗ ██╗██████╗ █████╗ ███████╗ | # 3 | # | ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝ | # 4 | # | ███████║██║ ██║██████╔╝███████║█████╗ | # 5 | # | ██╔══██║██║ ██║██╔══██╗██╔══██║██╔══╝ | # 6 | # | ██║ ██║╚██████╔╝██║ ██║██║ ██║███████╗ | # 7 | # | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | # 8 | # +--------------------------------------------+ # 9 | # # 10 | # Distributed Systems Runtime # 11 | # ---------------------------------------------------------------------------- # 12 | # Copyright 2022 - 2024, the aurae contributors # 13 | # SPDX-License-Identifier: Apache-2.0 # 14 | # ---------------------------------------------------------------------------- # 15 | max_width = 80 16 | use_small_heuristics = "Max" 17 | --------------------------------------------------------------------------------