{"id":20761291,"url":"https://github.com/philips-labs/siderite","last_synced_at":"2025-05-11T07:31:24.504Z","repository":{"id":38275298,"uuid":"246872344","full_name":"philips-labs/siderite","owner":"philips-labs","description":"companion tool to make interacting with Iron.io more pleasant","archived":true,"fork":false,"pushed_at":"2025-03-11T09:04:31.000Z","size":583,"stargazers_count":5,"open_issues_count":9,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-11T05:44:23.759Z","etag":null,"topics":["hsdp","ironio","lambda","scheduler"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/philips-labs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2020-03-12T15:44:56.000Z","updated_at":"2025-03-11T09:04:52.000Z","dependencies_parsed_at":"2023-10-03T17:26:59.397Z","dependency_job_id":"5231ba25-aa28-4889-a6c8-2b6d3ed0ebba","html_url":"https://github.com/philips-labs/siderite","commit_stats":null,"previous_names":[],"tags_count":46,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philips-labs%2Fsiderite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philips-labs%2Fsiderite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philips-labs%2Fsiderite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philips-labs%2Fsiderite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/philips-labs","download_url":"https://codeload.github.com/philips-labs/siderite/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253533419,"owners_count":21923433,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["hsdp","ironio","lambda","scheduler"],"created_at":"2024-11-17T10:18:46.563Z","updated_at":"2025-05-11T07:31:24.461Z","avatar_url":"https://github.com/philips-labs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DEPRECATED: please use https://github.com/dip-software/siderite\n\n# siderite\nsiderite is a companion tool to the iron CLI to make the interaction with the Iron.io service more pleasant. It can both prepare the payloads for your tasks and also act as a runner in your dockerized workload to interpret the payload.\n\n## Disclaimer\n\n\u003e [!Important]\n\u003e This repository is managed as Philips Inner-source / Open-source.\n\u003e This repository is NOT endorsed or supported by HSSA\u0026P or I\u0026S Cloud Operations. \n\u003e You are expected to self-support or raise tickets on the Github project and NOT raise tickets in HSP ServiceNow. \n\n# requirements\n* IronCLI - https://dev.iron.io/worker/reference/cli/\n* CF CLI - https://docs.cloudfoundry.org/cf-cli/install-go-cli.html\n* Access to Cloud foundyr\n\n# install siderite binary\nEnsure you have [Go 1.21 or newer](https://golang.org/dl/) installed, then:\n\n```shell\n$ go install github.com/philips-labs/siderite@latest\n```\n\n# configuration\nnext you need to have a Iron.io instances provisioned through an Iron.io service broker. The service details of this instance should be in your home folder as `~/.iron.json`. This can be done using the sequence of commands shown below:\n\n```shell\n$ cf cs hsdp-iron dev-large-encrypted iron\n$ cf csk iron siderite\n$ cf service-key iron siderite |tail -n +2 \u003e ~/.iron.json\n```\n\n# usage\nsiderite defines the following JSON payload format\n```json\n{\n\t\"version\": \"1\",\n\t\"cmd\": [\"cmd\", \"-option\"],\n\t\"env\": {\n\t\t\"ENV_VARIABLE_NAME\": \"ENV_VARIABLE_VALUE\",\n\t\t\"FOO\": \"BAR\"\n\t}\n}\n```\n\n| field | type |description | required | example      |\n|-------|------|-------|----------|--------------|\n| version | string | version of JSON payload | Required | must be `\"1\"` for now |\n| cmd | []string | command to execute, array string | Required | `[\"df\", \"-h\"]` |\n| env | hashmap | hash with environment variables | Optional | `{\"foo\": \"bar\"}` |\n\n## logging\n\nThe siderite binary supports direct logging to HSDP logging when the following environment variables\nare set:\n\n| environment | description | required |\n|-------------|-------------|----------|\n| SIDERITE_LOGINGESTOR_PRODUCT_KEY| The HSDP logging product key | Required |\n| SIDERITE_LOGINGESTOR_KEY | The HSDP logging shared key | Optional |\n| SIDERITE_LOGINGESTOR_SECRET | The HSDP logging shared secret | Optional |\n| SIDERITE_LOGINGESTOR_URL | The HSDP logging base URL | Required when not setting region and environment |\n| SIDERITE_LOGINGESTOR_SERVICE_ID | The HSDP service identity ID to use | Optional |\n| SIDERITE_LOGINGESTOR_SERVICE_PRIVATE_KEY | The private key belonging to the service identity | Optional |\n| SIDERITE_LOGINGESTOR_REGION | The HSDP region | Required for service identity |\n| SIDERITE_LOGINGESTOR_ENVIRONMENT | The HSDP environment (`client-test`, `prod`) | Required for service identity |\n\n## logging using HSDP Logdrainer\n\nIf you only have access to a Logdrainer endpoint URL then you can configure it as well\n\n| environment | description | required |\n|-------------|-------------|----------|\n| SIDERITE_LOGDRAINER_URL | The logdrainer endpoint used in CF | Optional |\n\n# commands\n\n## doctor\nchecks your system for correct configuration and suggest steps to take\n```shell\n$ siderite doctor\n[✓] iron CLI installed (version 0.1.6)\n[✓] iron configuration file (/Users/andy/.iron.json)\n[✓] cf CLI installed (cf version 6.49.0+d0dfa93bb.2020-01-07)\n```\n\n## encrypt\nencrypts input (stdin by default) with the cluster public key\n```shell\n$ echo '{\"cmd\":\"ls\"}'|siderite encrypt\nVRUYw6MZqakMz1KX6Ag21EfwEj9VBCV0jVpo3buEY8kIqaZK+dgC7YoJNjQ7tFfM9bPFMw+8yVawNG0u4IeLeSkSH+aLCA8bXVMl5hKVVOelY+eGceD9qXhTq9RDAyuY2RJ3XCHIUfQre1XIn8jO2GCtIUSIvKJ7XB6lYPg2jocXsYQ8xvVOnESiWexTur94afdB82HpFx6yDcHlrblovEdqtVk/fzOZ8A==\n```\n\n## env2payload\nconverts ENV style input (on stdin by default) to the siderite JSON payload format\n```shell\n$ echo 'FOO=BAR'|siderite env2payload -c \"echo\",\"\\$FOO\"\n{\n  \"version\": \"1\",\n  \"env\": {\n    \"FOO\": \"BAR\"\n  },\n  \"cmd\": [\n    \"echo\",\n    \"$FOO\"\n  ]\n}\n```\n\n## runner\nopens the payload file references by `PAYLOAD_FILE` environment and executes the command, mapping all output to stdout. This mode should be used as the `ENTRYPOINT` command in your Docker image\n\n## task and function\n\nThe siderite binary also acts as the entrypoint / command for [hsdp_function](https://registry.terraform.io/providers/philips-software/hsdp/latest/docs/guides/functions) compatible Docker images. \n\n# example usage\n\n## converting a CF Java8 app to an IronIO scheduled task\n  \nThe example steps below assume that your CF app is deployed under name `app` and your application is available as `app.jar`. For best results your `app.jar` should have a \"run once\" mode where the processing starts immediately after startup and terminates once done. This ensures you only consume the time your app is run instead of having your task terminated by IronIO after the 1 hour default timeout.\n\n### 1. install iron CLI\n\n```bash\ncurl -sSL http://get.iron.io/cli | sh\n```\nFurther details: https://dev.iron.io/worker/reference/cli/\n\n### 2. provision Iron instance via marketplace\n\n```bash\ncf cs hsdp-iron dev-large-encrypted iron\n```\n\n### 3. setup service key\n\n```bash\ncf csk iron siderite\n```\n\n### 4. setup ~/.iron.json\n```bash\ncf service-key iron siderite | tail -n +2 \u003e ~/.iron.json\n```\n\n### 5. capture ENV variables from your existing CF app\n\n```bash\ncf ssh app -c env | siderite env2payload \u003e payload.json\n```\n\n### 6. add cmd to payload.json\n\n```json\n{\n  \"version\": \"1\",\n  \"cmd\": [\"java\", \"-jar\", \"/data/app.jar\"],\n  \"env\": {\n    \"VCAP_SERVICES\": \"[REDACTED]\",\n    \"VCAP_APPLICATION\": \"[REDACTED]\",\n    \"ADD_MORE_STUFF\": \"here\"\n  }\n}\n```\n\n### 7. encrypt payload.json to payload.enc with CLI tool\n\n```bash\ncat payload.json |siderite encrypt \u003e payload.enc\n```\n\n### 8. create Docker image and push to private repo\n\n:triangular_flag_on_post: Below is an example only. Do not use Java8, it is obsolete! \n\n\u003e [Dockerfile](https://github.com/philips-labs/siderite-java8)\n\n```Dockerfile\nFROM loafoe/siderite-java8:v0.11.0\n\nRUN mkdir -p /data\nADD app.jar /data\n```\n\n```bash\ndocker login docker.na1.hsdp.io\ndocker build -t docker.na1.hsdp.io/yournamespace/app .\ndocker push docker.na1.hsdp.io/yournamespace/app\n```\n\n\u003e The `loafoe/siderite-java8:latest` contains the latest Java 8 runtime and the `siderite` tool as the `ENTRYPOINT`. It will detect the decrypted `payload.json`, set the ENVironment according to the `env` content and will execute the `cmd` command in the container\n\n### 9. register docker image as code with Iron \n\n\u003e Store docker credentials with Iron\n\n```bash\niron docker login \\\n  -url https://docker.na1.hsdp.io \\\n  -u ServiceUserName \\\n  -p ServidePassword \\\n  -e your.name@philips.com\n```\n\n```bash\niron register docker.na1.hsdp.io/yournamespace/app\n```\n\n### 10. get the cluster ID\n\n```bash\ncf service-key iron key| \\\n  grep -v Getting| \\\n  jq .cluster_info[].cluster_id -r\n```\n\n### 11. schedule your task using Iron.io CLI\n\n\u003e Below example schedules your app code to run every hour. Make sure `payload.enc` file and `cluster_id` value are available!\n\n```bash\niron worker schedule \\\n  -cluster replace_with_cluser_id \\\n  -run-every 3600 \\\n  -payload-file payload.enc \\\n  docker.na1.hsdp.io/yournamespace/app\n```\n\n# best practices\n\n- Package your workload in Docker images\n- Encrypt payload data\n- Limit log output to actionable log entries only\n- Use [logproxy](https://github.com/philips-software/logproxy) to forward IronIO logs to HSDP logging.\n  \n# siderite name\nSiderite is a mineral composed of iron(II) carbonate (FeCO3). It takes its name from the Greek word σίδηρος sideros, \"iron\". It is a valuable iron mineral, since it is 48% iron and contains no sulfur or phosphorus. [Wikipedia](https://en.wikipedia.org/wiki/Siderite)\n\n# license\n\nLicense is MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilips-labs%2Fsiderite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphilips-labs%2Fsiderite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilips-labs%2Fsiderite/lists"}