{"id":21802626,"url":"https://github.com/yc-actions/yc-coi-deploy","last_synced_at":"2025-04-13T18:42:46.641Z","repository":{"id":37424665,"uuid":"423122625","full_name":"yc-actions/yc-coi-deploy","owner":"yc-actions","description":"GitHub Action to deploy container to Virtual Machine in Yandex Cloud created from Container Optimized Image.","archived":false,"fork":false,"pushed_at":"2025-04-07T18:42:52.000Z","size":13065,"stargazers_count":20,"open_issues_count":5,"forks_count":7,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-07T18:43:30.211Z","etag":null,"topics":["container-optimized-image","deploy","docker","github-actions","yandex-cloud","yandex-cloud-compute"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/yc-actions.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":"2021-10-31T11:00:32.000Z","updated_at":"2025-04-07T17:59:18.000Z","dependencies_parsed_at":"2023-11-20T21:24:01.619Z","dependency_job_id":"e06d0b40-6963-4dd2-b048-541e7ecace16","html_url":"https://github.com/yc-actions/yc-coi-deploy","commit_stats":{"total_commits":302,"total_committers":6,"mean_commits":"50.333333333333336","dds":0.05960264900662249,"last_synced_commit":"d176eba12ae24973187c7656b65d068a262a55f2"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yc-actions%2Fyc-coi-deploy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yc-actions%2Fyc-coi-deploy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yc-actions%2Fyc-coi-deploy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yc-actions%2Fyc-coi-deploy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yc-actions","download_url":"https://codeload.github.com/yc-actions/yc-coi-deploy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248765000,"owners_count":21158201,"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":["container-optimized-image","deploy","docker","github-actions","yandex-cloud","yandex-cloud-compute"],"created_at":"2024-11-27T11:29:53.850Z","updated_at":"2025-04-13T18:42:46.588Z","avatar_url":"https://github.com/yc-actions.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## GitHub Action to deploy your container into Yandex Cloud virtual machine created from Container Optimized Image.\n\n[![Coverage](./badges/coverage.svg)](./badges/coverage.svg)\n\nThe action creates a VM with the provided name in the provided folder if there is no one. Then it deploys a container\nusing the provided image name and tag.\n\n**Table of Contents**\n\n\u003c!-- toc --\u003e\n\n- [Usage](#usage)\n- [Permissions](#permissions)\n- [License Summary](#license-summary)\n\n\u003c!-- tocstop --\u003e\n\n## Usage\n\n```yaml\n    - name: Login to Yandex Cloud Container Registry\n      id: login-cr\n      uses: yc-actions/yc-cr-login@v1\n      with:\n        yc-sa-json-credentials: ${{ secrets.YC_SA_JSON_CREDENTIALS }}\n\n    - name: Build, tag, and push image to Yandex Cloud Container Registry\n      env:\n        CR_REGISTRY: crp00000000000000000\n        CR_REPOSITORY: my-cr-repo\n        IMAGE_TAG: ${{ github.sha }}\n      run: |\n        docker build -t cr.yandex/$CR_REGISTRY/$CR_REPOSITORY:$IMAGE_TAG .\n        docker push cr.yandex/$CR_REGISTRY/$CR_REPOSITORY:$IMAGE_TAG\n\n    - name: Deploy COI VM\n      id: deploy-coi\n      uses: yc-actions/yc-coi-deploy@v2\n      env:\n        CR_REGISTRY: crp00000000000000000\n        CR_REPOSITORY: my-cr-repo\n        IMAGE_TAG: ${{ github.sha }}\n      with:\n        yc-sa-json-credentials: ${{ secrets.YC_SA_JSON_CREDENTIALS }}\n        folder-id: bbajn5q2d74c********\n        vm-name: yc-action-demo\n        vm-service-account-id: ajeqnasj95o7********\n        vm-cores: 2\n        vm-memory: 2Gb\n        vm-core-fraction: 100\n        vm-subnet-id: e9b*********\n        user-data-path: './user-data.yaml'\n        docker-compose-path: './docker-compose.yaml'\n```\n\nData from files `user-data.yaml` and `docker-compose.yaml` will be passed to the Mustache template renderer, so the there\ncould be used environment variables substitution via `{{ env.VARIABLE }}` syntax.  \n\nSee [action.yml](action.yml) for the full documentation for this action's inputs and outputs.\n\n## Permissions\n\n### Deploy time permissions\nTo perform this action, the service account on behalf of which we are acting must have\nthe `compute.admin` role or higher.\n\n### Runtime permissions\n\nThe service account provided to virtual machine must have the `container-registry.images.puller` role or higher, if images\nprovided in the `docker-compose` metadata key are stored in the Yandex.Cloud Container Registry and are private.\n\n\n## Debug\n\n### Conflict between `docker-compose` and `docker-container-declaration` metadata keys\nThere are two ways to provide info about container to deploy to the `yc-container-daemon` installed inside COI image:\n1. Pass container declaration via `docker-container-declaration` metadata key.\n2. Pass docker-compose.yaml via `docker-compose` metadata key.\n\nBut if both of these keys defined in the VM metadata deamon doesn't know what config it should use and fail with following exception:\n```json\n{\n  \"level\":\"ERROR\",\n  \"ts\":\"2023-06-01T01:23:45.000Z\",\n  \"caller\":\"mdtracking/checker.go:135\",\n  \"msg\": \"OnChange callback failed: both 'docker-compose' and 'docker-container-declaration' are found in metadata, only one should be specified\"\n}\n```\nSo the action detects the conflict and fails if there is `'docker-container-declaration'` in the metadata of the provided pre-created VM.\n\nTo fix the issue you should either let the action to create new VM by removing `name` param or recreate VM using\n`'docker-compose'` method.\n\n### Network configuration\n\nIf the VM does not have a [public IP address](https://yandex.cloud/en/docs/compute/operations/vm-control/vm-attach-public-ip)\nthat allows data exchange over the Internet, it won't be able to access the Yandex.Cloud Container Registry to pull the image.\n\nIn this case, there are several ways to give the virtual machine access to the registry without assigning an address:\n- Use a [NAT gateway](https://yandex.cloud/en/docs/vpc/concepts/gateways).\n- Set up traffic routing to the Internet using a [NAT instance](https://yandex.cloud/en/docs/vpc/tutorials/nat-instance/).\n\n## License Summary\n\nThis code is made available under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyc-actions%2Fyc-coi-deploy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyc-actions%2Fyc-coi-deploy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyc-actions%2Fyc-coi-deploy/lists"}