{"id":20485292,"url":"https://github.com/runnable/octobear","last_synced_at":"2026-06-07T15:31:15.863Z","repository":{"id":70965061,"uuid":"74503061","full_name":"Runnable/octobear","owner":"Runnable","description":"Docker Compose File parser for Runnable API Client","archived":false,"fork":false,"pushed_at":"2017-06-28T21:25:15.000Z","size":76,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-16T04:31:03.200Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/Runnable.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2016-11-22T18:46:36.000Z","updated_at":"2017-01-18T06:39:13.000Z","dependencies_parsed_at":"2023-05-31T16:31:08.723Z","dependency_job_id":null,"html_url":"https://github.com/Runnable/octobear","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Runnable%2Foctobear","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Runnable%2Foctobear/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Runnable%2Foctobear/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Runnable%2Foctobear/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Runnable","download_url":"https://codeload.github.com/Runnable/octobear/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242059033,"owners_count":20065212,"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-15T16:29:14.991Z","updated_at":"2026-06-07T15:31:15.833Z","avatar_url":"https://github.com/Runnable.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OctoBear\n\n_Docker Compose File parser for Runnable API Client_\n\n![http://1.bp.blogspot.com/-aEL7JOFG33A/UxyzFBJ0RXI/AAAAAAAADus/4jmeE4FR3_g/s1600/5455426064_fca9750514_o.jpg](http://1.bp.blogspot.com/-aEL7JOFG33A/UxyzFBJ0RXI/AAAAAAAADus/4jmeE4FR3_g/s1600/5455426064_fca9750514_o.jpg)\n\n## Usage\n\nThis module provides two functions:\n\n#### `parse`\n\n```\nconst octobear = require('@runnable/octobear')\n\noctobear.parse({\n  dockerComposeFileString: String, // String for `docker-compose.yml`\n  dockerComposeFilePath: String, // Path to the Compose file\n  repositoryName: String, // Name or repository. Used for naming the instances (Doesn't have to  correlate 1-to-1)\n  ownerUsername: String, // User's github username. Used for pre-instance creation hostname generation\n  userContentDomain: String // Runnable API user content domain. Used for pre-instance creation hostname generation\n})\n.then(results =\u003e )\n```\n\nThe response correspond to the following schema:\n\n```\n{\n  results: [{\n    metadata: {\n      name: String, // Name specified for service in `docker-compose.yml`\n    },\n    extends: {\n      service: 'String', // name to the service to extend\n      file: 'String' // path to the compose file where original service is registered\n    },\n    code: { // optional\n      repo: 'String', // repo full name\n      commitish: 'String' // Optional. Commit or branch\n    }),\n    build: {\n      dockerFilePath: String, // Optional. Path for Dockerfile used to build instance,\n      dockerBuildContext: String, // Optional. Path for Docker build context\n    },\n    files: { // Optional\n      '/Dockerfile': {\n      body: String // Body for Dockerfile to be used. Only specified if there is  no `buildDockerfilePath`\t\t\t}\n    },\n    instance: {\n      name: String, // Instance name. Different from name specified in `docker-compose.yml`,\n      containerStartCommand: String, // Optional. Command provided to start instance\n      ports: Array\u003cNumber\u003e, // Array of number for ports\n      env: Array\u003cString\u003e // Array of strings for env variables. Includes hostname substitution\n    } \n  }],\n  envFiles: [String] // Array of all ENV files that should be loaded,\n  mains: {\n    builds: { // includes all built main\n      {serviceName}: result {value in results for this}\n    },\n    externals: {\n      {serviceName}: results {value in results for this}\n    }\n  }\n}\n```\n\n#### `populateENVsFromFiles`\n\n```\nconst octobear = require('@runnable/octobear')\n\nconst composeFileAsString = '...'\noctobear.findExtendedFiles(composeFileAsString)\n.then((filesPathes) =\u003e {\n  const composeFiles = fethcAllComposeFiles(filesPathes)\n  return octobear.parseAndMergeMultiple({...}, composeFiles, envFiles)\n  .then(({ results: services, envFiles }) =\u003e  {\n    const envFiles = getAllTheseFilesAsHashTable(res.envFiles) // An object with filesnames as keys and strings as values\n    return populateENVsFromFiles(services, envFiles)\n  })\n})\n\n```\n\n## Tests\n\nIn order to run tests locally you also need to pull submodules. The easiest way to do that is cloning repo with\n` --recursive` flag:\n\n```\n  git clone --recursive git@github.com:Runnable/octobear.git\n```\n\nTo update them, use\n```\ngit submodule update --init --recursive\n```\n\nAlso, in order to run tests locally you'll need populate the environment variables in `configs/.env`. We suggest adding them to `configs/.env.test`.\n\nThere are three types of tests:\n\n1. Unit: Used to test individual functions\n2. Functional: Used to test the complete flow of a function. This should not use any external services.\n3. Integration: Used to test results of parsing against the Runnable API\n\n### Adding Submmodules\n\n1. Go into `test/repos/${NAME}`\n2. Run `git init`\n3. Run `git add -A`\n4. Run `git commit -m \"\"`\n5. Create repo in github\n6. Push changes to github\n7. `rm -rf test/repos/${NAME}` (It's in github, don't worry)\n8. git submodule add git@github.com:RunnableTest/${NAME}.git test/repos/${NAME}\n9. Run `git status` and make sure repo was added to `.gitmodules` and was added\n10. Add + Commit + Push octobear repo\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frunnable%2Foctobear","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frunnable%2Foctobear","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frunnable%2Foctobear/lists"}