{"id":27969174,"url":"https://github.com/future-architect/docradle","last_synced_at":"2025-05-07T21:08:50.959Z","repository":{"id":57507193,"uuid":"233794067","full_name":"future-architect/docradle","owner":"future-architect","description":"Helper tool for Docker container","archived":false,"fork":false,"pushed_at":"2020-01-22T13:19:03.000Z","size":129,"stargazers_count":12,"open_issues_count":0,"forks_count":3,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-05-07T21:08:46.340Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/future-architect.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-14T08:33:22.000Z","updated_at":"2022-07-21T02:50:55.000Z","dependencies_parsed_at":"2022-08-29T20:01:31.528Z","dependency_job_id":null,"html_url":"https://github.com/future-architect/docradle","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/future-architect%2Fdocradle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/future-architect%2Fdocradle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/future-architect%2Fdocradle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/future-architect%2Fdocradle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/future-architect","download_url":"https://codeload.github.com/future-architect/docradle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252954409,"owners_count":21830905,"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":[],"created_at":"2025-05-07T21:08:50.265Z","updated_at":"2025-05-07T21:08:50.949Z","avatar_url":"https://github.com/future-architect.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# docradle\n\n[![Actions Status](https://github.com/future-architect/docradle/workflows/test/badge.svg)](https://github.com/future-architect/docradle/actions)\n\nHelper tool for Docker container. This tool works as command wrapper and provides the following features:\n\n* Check environment variables (existence and value check, set default value)\n* Read environment variables from .env file.\n* Check other depending processes\n* Transfer/modify/mask stdout/stderr logs\n* Report CPU/memory usage\n\n## Install\n\n### Install via Go get\n\n```sh\n$ go get github.com/future-architect/docradle/...\n```\n\n## How to Use\n\n### Initialize\n\n```sh\n$ docradle init\n\nConfig file \"docradle.json\" is generated successfully.\n\nRun with the following command:\n\n$ docradle run your-command options...\n```\n\nThen edit `docradle.json`. \n\n### Execution\n\nTo use docradle, run like this:\n\n```sh\n$ docradle run \u003ccommand\u003e \u003cargs\u003e...\n```\n\n* \"--config, -c\": Config file name. Default file name is one of \"docradle.json\", \"docradle.yaml\", \"docradle.yml\", \"docradle.cue\".\n* \"--dryrun, -d\": Check only\n* \"--dotenv, -e\": .env file name to read. Default file name is \".env\".\n\n## Settings\n\nYou can use config file in \".json\", \".yaml\", \".yml\", [\".cue\"](https://cuelang.org/).\nCurrent recommended format is JSON because you can use data check via JSON schema (on IntelliJ and Visual Studio Code).\n\n### Environment Variables\n\nDeclare environment variables what your application use.\n\n```json\n{\n  \"env\": [\n    {\n      \"$comment\": \"\u003cyour comment\u003e\",\n      \"name\":  \"TEST\",\n      \"default\": \"default value\",\n      \"required\": true,\n      \"pattern\": \"\",\n      \"mask\": \"auto\"\n    }\n  ]\n}\n```\n\n* `name`(required): env-var name\n* `default`(optional): Default value if this env-var is not passed.\n* `required`(optional): If this value is true and this env-var is not passed, docradle shows error and stop running. Default value is `false`.\n* `pattern`(optional): Regexp pattern to check env-var value\n* `mask`(optional): Hide the value from console log. You can use `\"auto\"`, `\"hide\"`, `\"show\"`. If `\"auto\"`, docradle decide the name contains the one of the following names:\n  * `\"CREDENTIAL\"`\n  * `\"PASSWORD\"`\n  * `\"SECRET\"`\n  * `\"_TOKEN\"`\n  * `\"_KEY\"`\n\n### Config Files\n\nSome docker images assumes overwriting config file by using \"--volume\".\nAnd sometimes, overwrite config via environment variables is useful (for example prebuild JavaScript application).\nThis feature is for these capability.\n\n```json\n{\n  \"file\": [\n    {\n      \"name\": \"my-app.json\",\n      \"moveTo\": \"/opt/config\",\n      \"required\": false,\n      \"default\": \"/opt/config/config.json\",\n      \"rewrite\": [\n        {\n          \"pattern\": \"$VERSION\",\n          \"replace\": \"${APP_MODE}\"\n        }\n      ]\n    }\n  ]\n}\n```\n\n* `name`(required): File name. This file is search from working directory to root.\n* `moveTo`(optional): Move the matched file to this directory. It make simplify `-v` option of Docker.\n* `required`(optional): If this value is true and this file doesn't exist, docradle shows error and stop running. Default value is `false`.\n* `default`(optional): Default file if file not match. This file will be moved to `moveTo` location.\n* `rewrite`(optional): Rewriting config file content by using environment variables.\n\nIf you make your static web application to aware release/staging mode without rebuilding on runtime and any server APIs, you can use like this:\n\n```json\n{\n  \"pattern\": \"\u003cbody\u003e\",\n  \"replace\": \"\u003cbody\u003e\u003cscript\u003evar process = { env: \\\"${ENV}\\\" };\u003c/script\u003e\"\n}\n```\n\n### Dependency Check\n\nSometimes, docker images run before its dependency. It is a feature to wait that.\n\n```json\n{\n  \"dependsOn\": [\n    {\n      \"url\": \"http://microservice\",\n      \"header\": [\"Authorization: Bearer 12345\"],\n      \"timeout\": 3.0,\n      \"interval\": 1.0\n    }\n  ]\n}\n```\n\n* `url`(required): The target to observe. The schema should be one of `file`, `http`, `https`, `tcp`, `tcp4`, `tcp6`, `unix`.\n* `header`(optional): If the target is `http` or `https`, This header is passed to target server.\n* `timeout`(optional): Timeout duration (second). If the target server doesn't work within this term, docradle shows error and stop running. Default value is 10 seconds.\n* `interval`(optional): Interval to access target service. Default value is 1 second.\n\n### Stdout/Stderr settings\n\nDocradle is designed to work with application that shows structured log (now only support JSON) to stdout, stderr. And its output is always JSON.\n\n```json\n{\n  \"stdout\": {\n    \"defaultLevel\": \"info\",\n    \"structured\": true,\n    \"exportConfig\": \"\",\n    \"exportHost\": \"\",\n    \"passThrough\": true,\n    \"mask\": [\"password\"],\n    \"tags\": {\"tag-key\": \"tag-value\"}\n  },\n  \"stderr\": {\n    \"$comment\": \"Setting for stderr. It is as same as stdout's config\"\n  },\n  \"logLevel\":  \"info\"\n}\n```\n\nIf application output is not JSON or `structured` option is `false`, Docradle captures it and outputs like this:\n\n```text\n# Application output\nhello\n\n# docradle output\n{\"level\": \"info\", \"message\": \"hello\", time\":1579946400}\n```\n\n* `stdout/stderr.defaultLevel`(optional): If log level(level key in output JSON) is not included in output, This output level is used. Default value for stdout is `\"info\"`, for stderr is `\"error\"`.\n* `stdout/stderr.structured`(optional): If it is `true`, docradle try to parse console output as JSON. Default value is `true`.\n* `stdout/stderr.exportConfig`(optional/experimental): Transfer log output to external server. It accepts the following systems:\n  * `fluentd://(tagnames)`: Fluentd\n  * `kafka://(topic)`: Kafka\n* `stdout/stderr.exportHost`(optional/experimental): It is the host name of the above systems.\n* `stdout/stderr.passThrough`(optional): If it is true, docradle dump log output to its stdout/stderr too. Default value is `true`.\n* `stdout/stderr.mask`(optional): If output JSON contains one of this key, The value would be masked.\n* `stdout/stderr.tags`(optional): This JSON contents would be added to output log.\n* `logLevel`(optional): Log filtering option. Default value is `\"info\"`.\n\n## License\n\nApache 2\n\n## Related Project\n\n- [Dockerize](https://github.com/jwilder/dockerize)\n\n  The feature \"dependsOn\" is inspired by Dockerize.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffuture-architect%2Fdocradle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffuture-architect%2Fdocradle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffuture-architect%2Fdocradle/lists"}