{"id":19906605,"url":"https://github.com/dstockhammer/todo-backend-aspnetcore","last_synced_at":"2025-06-16T02:35:02.375Z","repository":{"id":79548228,"uuid":"73003771","full_name":"dstockhammer/todo-backend-aspnetcore","owner":"dstockhammer","description":null,"archived":false,"fork":false,"pushed_at":"2017-06-27T11:40:58.000Z","size":60,"stargazers_count":15,"open_issues_count":2,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-07T09:27:49.430Z","etag":null,"topics":["asp-net-core","brighter","darker","docker","dotnet-core","todo-mvc"],"latest_commit_sha":null,"homepage":null,"language":"C#","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/dstockhammer.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-06T16:32:54.000Z","updated_at":"2023-01-16T17:53:56.000Z","dependencies_parsed_at":"2023-03-12T08:35:34.589Z","dependency_job_id":null,"html_url":"https://github.com/dstockhammer/todo-backend-aspnetcore","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/dstockhammer%2Ftodo-backend-aspnetcore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dstockhammer%2Ftodo-backend-aspnetcore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dstockhammer%2Ftodo-backend-aspnetcore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dstockhammer%2Ftodo-backend-aspnetcore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dstockhammer","download_url":"https://codeload.github.com/dstockhammer/todo-backend-aspnetcore/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252133645,"owners_count":21699569,"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":["asp-net-core","brighter","darker","docker","dotnet-core","todo-mvc"],"created_at":"2024-11-12T20:36:57.993Z","updated_at":"2025-05-03T02:30:35.500Z","avatar_url":"https://github.com/dstockhammer.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# todo-backend-aspnetcore\nThis is an implementation of the [Todo-Backend](http://todobackend.com) API in C# on [ASP.NET Core](https://www.asp.net/core).\n\n## Infrastructure\n* [Docker](https://www.docker.com)\n* [Docker Compose](https://docs.docker.com/compose) for local deployment\n* [NGINX](https://nginx.org) for load balancing the api\n* [Consul](https://www.consul.io) for service discovery and configuration management\n* [ELK Stack](https://www.elastic.co) for log visualisation\n\n## Getting started\n* Install the latest version of [.NET Core](https://www.microsoft.com/net/core) and [Docker](https://www.docker.com/products/docker) for your platform\n* From the project root dir, use [compose](https://docs.docker.com/compose) to build the app, download all infrastructure containers and run the entire stack:\n```\n\u003e docker-compose up -d\n```\n* If everything works, start scaling the API:\n```\n\u003e docker-compose scale api=5\n```\n\n## URIs\n* Local Docker (full stack on one VM)\n  * API: [http://localhost:8080](http://localhost:8080)\n  * Consul UI: [http://localhost:8500/ui](http://localhost:8500/ui)\n  * Run ToDo Backend tests [http://todobackend.com/specs/index.html?http://localhost:8080](http://todobackend.com/specs/index.html?http://localhost:8080)\n\n* Azure (full stack on one VM)\n  * API: [http://todo-backend-aspnetcore.westeurope.cloudapp.azure.com](http://todo-backend-aspnetcore.westeurope.cloudapp.azure.com/)\n  * Kibana (ELK): [http://localhost:5601/app/kibana#/discover/Default](http://localhost:5601/app/kibana#/discover/Default])\n  * Consul UI: [http://todo-backend-aspnetcore.westeurope.cloudapp.azure.com:8500/ui](http://todo-backend-aspnetcore.westeurope.cloudapp.azure.com:8500/ui)\n\n* Heroku (only one API instance)\n  * API: [https://todo-backend-aspnetcore.herokuapp.com](https://todo-backend-aspnetcore.herokuapp.com)\n\n\n# Deployment using Docker\n(using Terminal in OSX, starting directory is project root)\n\n## Local\n* Build and run just the API, printing all stdout from the container:\n```\n$ cd src/TodoBackend.Api/\n$ docker build -t todo-backend-aspnetcore:latest .\n$ docker run -p 80:5000 todo-backend-aspnetcore\n```\n\n* **OR** run the entire stack in the backgroud and scale the API to 5 containers:\n```\n$ docker-machine up -d\n$ docker-machine scale api=5\n```\n\n## Azure\nSee [https://docs.docker.com/machine/drivers/azure](https://docs.docker.com/machine/drivers/azure)\n\n* Create resource group with virtual machine\n```\n$ docker-machine create -d azure \\\n  --azure-ssh-user ops \\\n  --azure-subscription-id \u003csubscription id\u003e \\\n  --azure-location westeurope \\\n  --azure-open-port 80 \\\n  --azure-open-port 8500 \\\n  --azure-open-port 5601 \\\n  machine\n```\n\n* Use `docker-machine` to ssh into the VM in Azure, if required\n```\n$ docker-machine ssh machine\n```\n\n* Use `docker-machine` to get the VM's public IP address, if required\n```\n$ docker-machine ip machine\n```\n\n* We're using version 5 of the ELK stack, which requires at least 2GB of memory. So let's ssh into the VM and once connected, increase the limit (see [Elastic Search documentation](https://www.elastic.co/guide/en/elasticsearch/reference/5.0/vm-max-map-count.html) for details)\n```\nops@machine:~$ sysctl -w vm.max_map_count=262144\n```\n\n* Set the newly created machine as default. This makes all `docker` commands go to the machine in Azure\n```\n$ docker-machine env machine\n$ eval $(docker-machine env machine)\n```\n\n* Use the regular `docker` or `docker-compose` CLI to start the entire stack or an individual container. Note that this is **NOT** how one would start and scale an infrastructure stack in a real production scenario.\n```\n$ docker-compose up -d\n```\n\n### Optional: Azure CLI\n* Install Azure CLI, login, an set mode to Azure Resource Manager (ARM)\n```\n$ npm install -g azure-cli\n$ azure login\n$ azure config mode arm\n```\n\n* If you have multiple subscriptions, use the CLI to show your subscriptions and select a default\n```\n$ azure account list\n$ azure account set \u003csubscription id\u003e\n```\n\n* Display details of the VM\n```\n$ azure vm show -g docker-machine -n machine\n```\n\n* Show public IP and DNS configuration; add a DNS name to the public IP. The VM is now available as http://todo-backend-aspnetcore.westeurope.cloudapp.azure.com\n```\n$ azure network public-ip list -g docker-machine\n$ azure network public-ip show -g docker-machine -n machine-ip\n$ azure network public-ip create -g docker-machine -n machine-ip -l westeurope -d \"todo-backend-aspnetcore\" -a \"Dynamic\"\n```\n\n## Heroku\n* Create a Heroku account and create an app (in this example, the app is called `todo-backend-aspnetcore`\n* Install the Heroku toolbelt: https://devcenter.heroku.com/articles/heroku-command-line\n\n```\n$ cd src/TodoBackend.Api/\n$ docker build -t todo-backend-aspnetcore:latest -f Dockerfile.heroku -e ASPNETCORE_ENVIRONMENT=heroku .\n$ docker tag todo-backend-aspnetcore registry.heroku.com/todo-backend-aspnetcore/web\n$ docker push registry.heroku.com/todo-backend-aspnetcore/web\n$ heroku open --app todo-backend-aspnetcore\n```\n\nAlternatively, if the directory contains a Heroku-compatible dockerfile (no `EXPOSE` and listening on `$PORT`)\n```\n$ heroku plugins:install heroku-container-registry\n$ heroku heroku container:login\n$ heroku container:push web --app todo-backend-aspnetcore\n$ heroku open --app todo-backend-aspnetcore\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdstockhammer%2Ftodo-backend-aspnetcore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdstockhammer%2Ftodo-backend-aspnetcore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdstockhammer%2Ftodo-backend-aspnetcore/lists"}