{"id":21436766,"url":"https://github.com/modfin/dcr","last_synced_at":"2025-10-06T11:58:06.514Z","repository":{"id":57534873,"uuid":"110147903","full_name":"modfin/dcr","owner":"modfin","description":"a wrapper for docker compose","archived":false,"fork":false,"pushed_at":"2023-10-12T14:04:37.000Z","size":23,"stargazers_count":2,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-06-20T05:01:46.893Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/modfin.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-09T17:50:11.000Z","updated_at":"2023-04-11T11:05:47.000Z","dependencies_parsed_at":"2023-10-13T02:14:01.170Z","dependency_job_id":null,"html_url":"https://github.com/modfin/dcr","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/modfin%2Fdcr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modfin%2Fdcr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modfin%2Fdcr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modfin%2Fdcr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/modfin","download_url":"https://codeload.github.com/modfin/dcr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225981809,"owners_count":17554923,"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":"2024-11-23T00:15:25.471Z","updated_at":"2025-10-06T11:58:06.492Z","avatar_url":"https://github.com/modfin.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dcr\nA wrapper for docker compose\n\n## Configuration\nThis project uses two configuration files: `.dcrgroups` and `.dcrconfig.yaml`, both residing in the same directory as the Docker compose file.\n- `.dcrgroups`: This file defines groups of services that can be started or stopped together.\n- `.dcrconfig.yaml`: This file is meant for general configurations. At the moment, it only includes settings for running CLI-based commands run before each service is started.\n\n### .dcrconfig.yaml\nUnder the top-level property `action-config`, you can specify a set of CLI commands that are run for each service in conjunction with a `dcr` command. At the moment, only `pre-start-actions` (actions that are run when `up`ing a service) are supported. The actions are run in the order they are specified in the `action` list:\n```yaml\naction-config:\n    pre-start-actions:\n      actions:\n        - echo \"Running pre-start command for service\"\n        - echo \"This can be any command you want to run before starting the service\"\n```\n\n#### -- Enable (`enabled: true`) --\nThe actions are disabled by default. To enable them, set `enabled` to `true`:\n```yaml\naction-config:\n  pre-start-actions:\n    enabled: true # Must be true for actions to be run.\n    actions:\n      - echo \"Running pre-start command for service\"\n      - echo \"This can be any command you want to run before starting the service\"\n```\n\n#### -- Showing Output (`verbose: true`) --\nOutput from actions is suppressed by default. To show the output, set `verbose` to `true`:\n```yaml\naction-config:\n  pre-start-actions:\n    enabled: true\n    verbose: true # Now the actions below will echo output to the terminal\n    actions:\n      - echo \"Running pre-start command for service\"\n      - echo \"This can be any command you want to run before starting the service\"\n```\n\n#### -- Using Service Names (`%s`) --\nTo interpolate the service name(s) for which the command is run, include `%s` in the command string. Assume that you start `service-1` and `service-2` with the following configuration:\n```yaml\naction-config:\n  pre-start-actions:\n    enabled: true\n    verbose: true\n    actions:\n      - echo \"Running pre-start command for service %s\"\n```\n\nThis would output:\n```\nRunning pre-start command for service service-1\nRunning pre-start command for service service-2\n```\n\n#### -- Filtering Services (`filter` regex) --\nSpecific services can be targeted by specifying a `filter` regex. Assume that you start `postgres-db` and `redis` with the following configuration:\n```yaml\naction-config:\n  pre-start-actions:\n    enabled: true\n    verbose: true\n    filter: \"^postgres\"\n    actions:\n      - echo \"Running pre-start command for service %s\"\n```\n\nThis would output:\n```\nRunning pre-start command for service postgres-db\n```\n\n#### -- Reusable Action Templates --\nYou can specify a template name together with the `type: \"template\"` for a CLI command defined under `action-templates` for reusability:\n```yaml\naction-config:\n  pre-start-actions:\n    enabled: true\n    verbose: true\n    actions:\n      - action: \"list\"\n        type: \"template\"\n  action-templates:\n    list:\n      action: \"echo '%s'\"\n      description: \"List available services\" # Only used for documentation purposes at the moment \n```\n\n### Zdap Integration\nThis project is integrated with Zdap, a command-line interface (CLI) tool used by developers to create, attach, and detach database instances from their local Docker environment.\n\nThe Zdap configurations are specified under `integrations` -\u003e `zdap` and shares the same properties as `action-config` but also comes with exclusive features.\n\nUnlike `action-config`, the `pre-start-actions` specified under `zdap` run only for the dependencies that are listed under `depends_on` in `docker-compose.yml` per service started by DCR. For example, starting a service `service-1` that depends on `zdap-db-1` and `zdap-db-2` will run the pre-start actions only for `zdap-db-1` and `zdap-db-2`, but not for `service-1`.\n\n#### -- Enable (`--zdap`) --\nLike the `pre-start-actions` in `action-config`, they are disabled by default and can be enabled by setting `enabled` to `true`. You may also enable them by passing the flag `--zdap` when running `up`, e.g.\n```\ndcr --zdap . up -d service-1\n```\n\n#### -- Only Uncloned Dependencies --\nTo only run actions for uncloned dependencies, set `only-uncloned-dependencies` to `true`. This will skip running actions for dependencies that have already been cloned. For example, if you have a service that depends on a Zdap database instance, the pre-start actions will only run if the database instance has not been cloned yet.\n```yaml\nintegrations:\n  zdap:\n    only-uncloned-dependencies: true # Only run pre-start actions for uncloned Zdap dependencies\n    pre-start-actions:\n      enabled: true\n      actions:\n        - action: \"detach\"\n          type: \"template\"\n        - action: \"attach\"\n          type: \"template\"\n    action-templates:\n      detach:\n        action: \"zdap detach %s\"\n        description: \"Detach the zdap resource\"\n      attach:\n        action: \"zdap attach %s\"\n        description: \"Attach the zdap resource\"\n```\n\n#### -- Ignored Resources --\nYou may also specify a list of services to be ignored under `ignored-resources`:\n```yaml\nintegrations:\n  zdap:\n    pre-start-actions:\n      enabled: true\n      actions:\n        - action: \"detach\"\n          type: \"template\"\n        - action: \"attach\"\n          type: \"template\"\n    ignored-resources:\n      - \"zdap-db-1\" # This resource will be ignored\n    action-templates:\n      detach:\n        action: \"zdap detach %s\"\n        description: \"Detach the zdap resource\"\n      attach:\n        action: \"zdap attach %s\"\n        description: \"Attach the zdap resource\"\n```\n\n#### -- Zdap Resource Overrides --\nIf the service name in `docker-compose.yml` does not coincide with the Zdap resource name, you can override it by specifying the `name` of the Docker compose service, and the `resource-name` of the Zdap resource under `resource-name-overrides`:\n```yaml\nintegrations:\n  zdap:\n    pre-start-actions:\n      enabled: true\n      actions:\n        - action: \"detach\"\n          type: \"template\"\n        - action: \"attach\"\n          type: \"template\"\n    action-templates:\n      detach:\n        action: \"zdap detach %s\"\n        description: \"Detach the zdap resource\"\n      attach:\n        action: \"zdap attach %s\"\n        description: \"Attach the zdap resource\"\n    resource-name-overrides:\n      - name: \"db-1\" # The name of the Docker compose service\n        resource-name: \"zdap-db-1\" # The name of the Zdap resource to rename the Docker compose service to\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmodfin%2Fdcr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmodfin%2Fdcr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmodfin%2Fdcr/lists"}