{"id":16624441,"url":"https://github.com/bruno-garcia/hub-like-docker-compose","last_synced_at":"2026-04-06T21:32:46.473Z","repository":{"id":151444543,"uuid":"100168338","full_name":"bruno-garcia/hub-like-docker-compose","owner":"bruno-garcia","description":"Wiring up through docker-compose a test environment for the Hub project","archived":false,"fork":false,"pushed_at":"2017-08-14T22:20:41.000Z","size":27,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-09-29T11:48:36.506Z","etag":null,"topics":["angular-cli","angular4","asp-net-core","docker","docker-compose","mongodb","mssql","redis"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/bruno-garcia.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":"2017-08-13T10:07:15.000Z","updated_at":"2018-12-10T07:27:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"a5bc8542-09eb-4b86-9096-b61e68f10dad","html_url":"https://github.com/bruno-garcia/hub-like-docker-compose","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bruno-garcia/hub-like-docker-compose","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bruno-garcia%2Fhub-like-docker-compose","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bruno-garcia%2Fhub-like-docker-compose/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bruno-garcia%2Fhub-like-docker-compose/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bruno-garcia%2Fhub-like-docker-compose/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bruno-garcia","download_url":"https://codeload.github.com/bruno-garcia/hub-like-docker-compose/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bruno-garcia%2Fhub-like-docker-compose/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31491097,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-06T17:22:55.647Z","status":"ssl_error","status_checked_at":"2026-04-06T17:22:54.741Z","response_time":112,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["angular-cli","angular4","asp-net-core","docker","docker-compose","mongodb","mssql","redis"],"created_at":"2024-10-12T03:46:31.925Z","updated_at":"2026-04-06T21:32:46.453Z","avatar_url":"https://github.com/bruno-garcia.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PoC for a docker-compose containing all dependencies of the Hub project\n\nThe objective of this repo is to serve as a PoC for a set of Dockerfile/compose that could aid \nin bootstrapping an integration environment for automated tests for a non public project called Hub.\nFor this PoC, a simplified version of this project will be recreated. The goal is simply to reach \nall dependencies. In other words: it's all dummy code.\n\nThe repo is composed of an Angular 4 SPA, backed by a web API written \nin C# and .NET Core 2.0. This API backend has 3 external dependencies: MongoDB, Redis and yet \nanother web API called Envoy. Envoy is backed by a SQL Server database.\n\n        +--------------------+\n        | SPA                |\n        | Angular CLI 1.3.0  |\n        | Docker: nginx      |\n        +----------+---------+\n                   |\n                   |                  +---------------------+\n    +--------------v--------------+--\u003e+ Redis               |\n    | API                         |   | Docker: redis:alpine|\n    | .NET Core 2.0 Preview 2     |   +---------------------+\n    | Docker: dotnet:2.0-runtime  |   +---------------------+\n    +--------------+--------------+--\u003e+ MongoDB             |\n                   |                  | Docker: mongo:3.4.7 |\n                   |                  +---------------------+\n    +--------------v--------------+\n    | Envoy                       |\n    | .NET Core 1.1               |\n    | Docker: dotnet:1.1-runtime  |\n    +--------------+--------------+\n                   |\n                   |\n    +--------------v--------------+\n    | SQL Server                  |\n    | mssql on Linux              |\n    | Docker: mssql-server-linux  |\n    +-----------------------------+\n\n### A few findings while settings this up:\n\n#### StackExchange.Redis on .NET Core 1.1:\nThe Api project could not be done with .NET Core 1.1 due to [StackExchange.Redis not supporting DNS \nresolution on Linux](https://github.com/StackExchange/StackExchange.Redis/issues/463).\nThat's an issue due to the container linking by name. It will fail with:\n\n`This platform does not support connecting sockets to DNS endpoints via the instance Connect and ConnectAsync methods, due to the potential for a host name to map to multiple IP addresses and sockets becoming invalid for use after a failed connect attempt. Use the static ConnectAsync method, or provide to the instance methods the specific IPAddress desired.`\n\n.NET Core 2.0 solves this problem but it's still Preview 2. \n\n#### Angular CLI 1.3.0 environment configuration\nBeen able to set environment variables on docker-compose.yml or at Dockerfile or finally directly on \nthe shell before running something is extremely powerful. With the .NET Core apps one could even override \nthose settings with command-line arguments. \n\nUnfortunately, Angular CLI 1.3.0 doesn't support accessing environment variables.\nIdeally, access to `process.env` at build time from `environment.ts` would do the job.\nThere's [a discussion going on](https://github.com/angular/angular-cli/issues/4318) on Angular CLI repo, hopefully support will\nbe added soon.\nUntil that, one of the work around proposed could be used. For this PoC I decided to add a `docker` environment.\nThis way, before running `docker-compose up`, the configuration file `environment.docker.ts` can be patched \nwith the desired external api endpoint (e.g: http://docker-host-address:5000)\n\n#### Exposing containers\nNotice all containers listed on `docker-compose.yml` have a `ports:` section. That is simply to ease\ntestability from outside of the docker network. It allows hitting any of those services through the \ndocker host address.\n\n\n#### Dockerfile: Empty array on CMD\nFor the .NET Core applications, it's possible to override the configuration by passing arguments to the \nexecutable. For example, the 'api' project could run from a development machine while using all \ndependencies bootstrapped through `docker-compose up`:\n\n`C:\\\u003edotnet run -- Redis=athens.lan:6379 Envoy=http://athens.lan:5001 Mongo=mongodb://athens.lan:27017/^?connectTimeoutMS=2000`\n\n- `athens.lan` is the hostname of the Docker host.\n- ^ is the escape character for the Windows cmd\n\nTo achieve that, the .NET application has to take command line arguments into its ConfigurationBuilder:\n\n`.AddCommandLine(args)` from `Microsoft.Extensions.Configuration.CommandLine` package.\n- [See example](https://github.com/bruno-garcia/hub-like-docker-compose/blob/master/api/Program.cs)\n\nIn order to pass arguments to a container, after the `ENTRYPOINT`, it's required to define a `CMD`.\nWith an empty array:\n\n`CMD []`\n- [See example](https://github.com/bruno-garcia/hub-like-docker-compose/blob/master/api/Dockerfile)\n\nNothing is provided to the executable by default. While still able to change configuration without\nthe need to rebuild the image:\n\n`$ docker run -ti hublike_api Redis=athens.lan:6379 Envoy=http://athens.lan:5001 Mongo=mongodb://athens.lan:27017/\\?connectTimeoutMS=2000`\n- \\ is the escape character in bash\n\n  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbruno-garcia%2Fhub-like-docker-compose","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbruno-garcia%2Fhub-like-docker-compose","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbruno-garcia%2Fhub-like-docker-compose/lists"}