Coder Social home page Coder Social logo

pjbgf-archives / container_webapp_netcore Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 2.0 39 KB

A walking skeleton starter kit for a .Net Core 2.1 Web API, deployed as a docker container on Azure Web App with CircleCI.

License: MIT License

C# 33.14% Shell 63.91% Dockerfile 2.95%
docker azure starter-template skeleton-application netcore2 webapi arm-templates appservice circleci webapp pipelines-as-code infrastructure-as-code starter-kit

container_webapp_netcore's Introduction

CircleCI License

What's in the box?

This is a sample of a walking skeleton .Net Core 2.1 web API, deployed as a docker container on Azure App Service.

  • Language: C#
  • Platform: .Net Core 2.1
  • Compute: Docker Container running on Azure App Service
  • Telemetry: AppInsights
  • Container Registry: Azure Container Registry

The infrastructure required is defined as code, using ARM templates. The deployment pipeline is also defined as code using yml with CircleCI.

CI Pipeline

The setup also includes a CircleCI pipeline with the following steps:

  1. Build
    1. Restore
    2. Build
    3. Run unit tests
    4. Generate Docker Image
    5. Push Docker Image to Azure Private Registry
  2. Provision CI Environment
    2. Deploy ARM template
    2. Forces Container-mode on AppService (not fully compatible with ARM at the moment)
  3. Smoke Test CI
    3. Http Request onto health check end-point
  4. Delete CI Environment

Requirements

  • Azure Subscription
  • Azure Container Registry
  • Service Principal for the Azure Subscription
  • Github account (free)
  • CircleCI account (free)

CI Variables

In order for this example to work, your circle CI project will require the following variables:

Name Description Example
DEPLOY_CI_RESOURCE_GROUP Name for resource group ci-myapp-euw
DEPLOY_CI_LOCATION Location to create the resource group West Europe
DEPLOY_CI_SUBSCRIPTION_ID Azure subscription id < GUID >
DEPLOY_CI_WEBAPP_NAME CI name of your web app. ci-myapp-euw.azurewebsites.net
DOCKER_REGISTRY_URI Uri for your Azure Container Registry https://name-goes-here.azurecr.io
DOCKER_IMAGE_NAME_WITH_REGISTRY Fully qualified image name. name-goes-here.azurecr.io/foldername/imagename:tag
DOCKER_REGISTRY_SERVER_USERNAME User name to login onto the registry Generally it is the same name as the registry.
DOCKER_REGISTRY_SERVER_PASSWORD Password to login onto the registry Be creative. ;)
SERVICE_PRINCIPAL Name of your service principal account circleci_deployment_account
SERVICE_PRINCIPAL_PASS Password for your service principal account <Some random, big and complex string.>
SERVICE_TENANT Tenant Id of your azure active directory < GUID >

To setup the variables more easily use the script tools/circleci.sh.

Testing it locally

Deploying ARM template

./deploy.sh -i SUBSCRIPTION_ID -g ci-container-appservice -n manual -l northeurope

Running the container locally

docker run -d -p 8000:80 YOUR_CR_NAME.azurecr.io/sample/container-appservice

Once the command finishes you should be able to access it through the URL: http://localhost:8000/health

Roadmap

  • BDD framework to replace curl smoke test with Gherkin spec and prepare the project for ATDD approach.
  • Secret Management for development environments.
  • KeyVault for non-dev environments.
  • Paired-regions.
  • Traffic Manager.

container_webapp_netcore's People

Contributors

pjbgf avatar

Stargazers

Patrick Palmer avatar Lucas Gomes avatar Juanjo Guerrero Cerezuela avatar

Watchers

James Cloos avatar  avatar

Forkers

pliyo ifmorrison

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.