{"id":34837255,"url":"https://github.com/arenadata/ad-runtime-utils","last_synced_at":"2026-01-16T10:47:25.511Z","repository":{"id":305941063,"uuid":"1024401048","full_name":"arenadata/ad-runtime-utils","owner":"arenadata","description":null,"archived":false,"fork":false,"pushed_at":"2026-01-14T09:57:21.000Z","size":89,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-14T13:46:59.492Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arenadata.png","metadata":{"files":{"readme":"README.MD","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-07-22T16:32:01.000Z","updated_at":"2026-01-14T09:55:27.000Z","dependencies_parsed_at":"2025-07-22T20:31:55.625Z","dependency_job_id":"621c89da-4dee-4c53-a29f-ca2788ca60a9","html_url":"https://github.com/arenadata/ad-runtime-utils","commit_stats":null,"previous_names":["arenadata/ad-runtime-utils"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/arenadata/ad-runtime-utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arenadata%2Fad-runtime-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arenadata%2Fad-runtime-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arenadata%2Fad-runtime-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arenadata%2Fad-runtime-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arenadata","download_url":"https://codeload.github.com/arenadata/ad-runtime-utils/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arenadata%2Fad-runtime-utils/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28478059,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T06:30:42.265Z","status":"ssl_error","status_checked_at":"2026-01-16T06:30:16.248Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-12-25T16:08:36.627Z","updated_at":"2026-01-16T10:47:25.487Z","avatar_url":"https://github.com/arenadata.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Why Is This Necessary?\n\n1. **Single Entry Point**  \n   Provides a unified interface for all utility functions (database checks, maintenance tasks, etc.).\n\n2. **One Binary**  \n   Replaces a bunch of shell scripts with a single executable, centralizing logic in one place.\n\n3. **Declarative Configuration**  \n   Uses a YAML‑based config to declare versions, paths, and overrides, making behavior transparent and easy to manage.\n\n4. **Service‑Ready \u0026 UI‑Friendly**  \n   Can run as a long‑running service and expose a consistent API for integration with web dashboards or other user interfaces.\n\n## Runtime Detection Algorithm\n\nThis section describes how ad-runtime-utils chooses the correct installation path for a given runtime (Java, Python, etc.), both when a service is specified and in the default (no-service) case.\n\n---\n\n### 1. Service-Specific Flow (`--service \u003cNAME\u003e`)\n\n1. **Service override_path**\n    - If `services.\u003cNAME\u003e.runtimes.\u003cRT\u003e.override_path` is set and `\u003cpath\u003e/bin/\u003cexe\u003e` exists → **return** that path.\n\n2. **Service env_var**\n    - If `services.\u003cNAME\u003e.runtimes.\u003cRT\u003e.env_var` is set, and the named environment variable is non-empty and points at a valid `\u003cpath\u003e/bin/\u003cexe\u003e` → **return** its value.\n\n3. **Service version**\n    - Read `services.\u003cNAME\u003e.runtimes.\u003cRT\u003e.version`.\n    - If missing or empty → **error**:\n      ```\n      version not specified for service '\u003cNAME\u003e' runtime '\u003cRT\u003e'\n      ```\n\n4. **Per-version Autodetect** (`autodetect.runtimes.\u003cRT\u003e.\u003cversion\u003e`)\n    1. If `override_path` is set and valid → **return** it.\n    2. If `env_var` is set and points at a valid path → **return** it.\n    3. Otherwise, for each glob in `paths` (in order):\n        - `candidates := Glob(pattern + \"*\")`\n        - sort in reverse lexical order\n        - first candidate with `\u003ccand\u003e/bin/\u003cexe\u003e` → **return** that path.\n\n5. **Fallback to Default-Flow**\n    - If none of the above steps succeed, repeat the **Default-Flow** (see below), but format output as:\n      ```\n      \u003cNAME\u003e: /path/from/default-flow\n      ```\n\n6. **Error**\n    - If still nothing is found →\n      ```\n      no \u003cRT\u003e environment found for service '\u003cNAME\u003e' (version '\u003cversion\u003e')\n      ```\n\n---\n\n### 2. Default Flow (no `--service`)\n\n1. **Default override_path**\n    - If `default.runtimes.\u003cRT\u003e.override_path` is set and valid → **return** it.\n\n2. **Default env_var**\n    - If `default.runtimes.\u003cRT\u003e.env_var` is set and points at a valid path → **return** it.\n\n3. **Default version**\n    - Read `default.runtimes.\u003cRT\u003e.version`.\n    - If missing or empty → **error**:\n      ```\n      default version not specified for runtime '\u003cRT\u003e'\n      ```\n\n4. **Per-version Autodetect** (`autodetect.runtimes.\u003cRT\u003e.\u003cversion\u003e`)\n    - Same 4.1–4.3 as in the Service-Specific Flow.\n\n5. **Error**  \n\n### 3. Listing All Detected Runtimes (--list / -l)\n\nWhen the --list (or -l) flag is provided:\n\nIt outputs all detected runtimes for:\n\n- The default configuration\n- Each defined service\n\n```\nDefault runtimes:\n  \u003cruntime\u003e: \u003cpath or \"error: \u003cmessage\u003e\"\u003e\n\nService \u003cservice-name\u003e:\n  \u003cruntime\u003e: \u003cpath or \"error: \u003cmessage\u003e\"\u003e\n  …\n```\n\n### 4. Starting a Service\n\nWhen --start and/or --supervise flags are provided --service is a required argument.\n\n- It starts the executable `services.\u003cservice-name\u003e.executable` with the specified arguments from `services.\u003cservice-name\u003e.executable_args`.\n\n- If the `--supervise` flag is provided, it will run the health checks, defined in `services.\u003cservice-name\u003e.health_checks` on service start to make sure the service is operational. If any of the checks fail the service will be stopped. `Type=notify` should be used in the systemd unit(see example in `examples/systemd` directory).\n\n- While using `--supervise` and health checks, make sure that systemd service has enough `TimeoutStartSec`. ideally should be a combined timeout of all health checks.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farenadata%2Fad-runtime-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farenadata%2Fad-runtime-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farenadata%2Fad-runtime-utils/lists"}