Code Monkey home page Code Monkey logo

entref-spring-boot's Introduction

Containerized Java REST Services on Azure App Service with a CosmosDB backend

Project Health

API Build Status: Build Status

UI Build Status: Build Status

Infrastructure Build Status: Build Status

Contents:

Introduction

This project was created to demonstrate end-to-end best practices building and running "enterprise-class" applications on Azure. This document explains what the project provides and why, and it provides instructions for getting started.

Enterprise-Class Applications Defined

We are using the term "enterprise-class app" to refer to an end-to-end solution that delivers the following capabilities:

  • Horizontal scalability: Add capacity by adding additional containers and/or VMs
  • Infrastructure as code: Create and manage Azure environments using template code that is under source control
  • Agile engineering and rapid updates: Use CI/CD for automated builds, tests and deployments, safe code check-ins, and frequent updates to the production environment and application.
  • High Availability: Design and deploy robust applications and infrastructure, so that the application continues to run normally even when some components fail or go offline.
  • Blue/Green (aka Canary Deployments): Rollout updates to a "green" application instance, while the existing deployment continues to run on the "blue" instance. The green instance is intially exposed to only a small number of users. Monitoring is performed to look for any degradations in service related to the green instance. If everything looks good, traffic is gradually diverted to the green instance. Should the service quality degrade, the deployment is rolled back by returning all traffic to the blue instance.
  • Testable: Continuously test the application in production to validate scalability, resilience, and security.
  • Hardened: Assure that the application and infrastructure is instrinsically resistant to attacks from bad actors, such as Distributed Denial of Service (DDoS) attacks.
  • Networking compliance: Comply with enterprise network security requirements, such as the use of ExpressRoute to communicate with enterprise data-centers and/or on-premises networks, and private IPs for all but public endpoints.
  • Monitoring and Analytics: Capture telemetry to enable operations dashboards and automatic alerting of critical issues.
  • Service Authentication: Allow only authorized access to services via token- or certificate-based service authentication.
  • Simulated Traffic:
  • Chaos Testing:

OSS Technology Choices

Our team, Commercial Software Engineering (CSE), collaboratively codes with Microsoft's biggest and most important customers. We see a huge spectrum of technology choices at different customers, ranging from all-Microsoft to all-OSS. More commonly, we see a mix.

Given the wide range of technology choices, it's difficult to create a one-size-fits-all solution. For this project, we selected a set of technologies that are of interest to many of our customers.

This OSS solution uses the following OSS technologies:

  • GitHub: Publishing this project to GitHub indicates our desire to share it widely and to encourage community contributions.
  • Docker: Though there are other container technologies out there, Docker/Moby is pretty much synonymous with the idea.
  • Java Version 8 (1.8.x): A very common choice of programming langauages by many enterpises.
  • Spring Boot: One of the most widely used and capable Java frameworks.
  • Spring Data REST: A simple way to build REST APIs in a Spring Boot application that are backed by a persistent data repository.
  • Maven: A commonly used tool for building and managing Java projects.
  • React: Popular JavaScript framework for building UI. (Additional OSS tools used in the UI sample include TypeScript, webpack, and Jest.)

Azure Technologies & Services

As with our OSS technology choices, we intentionally selected a set of Azure technologies and services that support common enterprise requirements, including:

  • Azure DevOps: Microsoft's CI/CD solution, which is the Azure-branded version of Microsoft's mature and widely used VSTS solution.
  • Azure Resource Manager (ARM): Azure's solution for deploying and managing Azure resources via JSON-based templates.
  • App Services: A robust platform-as-a-service (PaaS) solution for application hosting. App Services hides the complexity of provisioning and managing VMs, auto-scaling, creating public IPs, etc.

Note: App Services is appropriate for a wide range of enterprise apps, including certain highly scaled apps, though we often recommend Azure Kubernetes Service (AKS) for apps that require certain advanced capabilities.

  • Cosmos DB: Cosmos DB is perhaps the fastest and most reliable NoSQL data storage service in the world. It is an excellent choice when performance and reliability are a must, and when enterprises require multi-region write capabilities, which are essential for both application/service performance and for HA/DR scenarios.
  • Azure Traffic Manager: DNS-based routing service to connect users to the nearest data center. Redirects traffic to healthy location when another region goes offline. Also enables recommended method blue-green (aka canary) deployments with Azure App Services.
  • Application Gateway: Provides a single public end-point (public IP) and acts as a reverse proxy (based on URI path) to send requests to the correct App Service instance.
  • App Insights: Enterprise developers use App Insights to monitor and detect performance anomalies in production applications.

The solution leverages Azure Dev Ops for Continuous Integration and Delivery (CI/CD), and it deploys complete Azure environments via Azure Resource Manager (ARM) templates.

Key Benefits

Key technologies and concepts demonstrated:

Benefit Supporting Solution
Common, standard technologies
  • Java programming language
  • Spring Boot Framework, one of the most widely used frameworks for Java
  • MongoDB NoSQL API (via Azure Cosmos DB)
  • Redis Cache
  • Containerization Microservices implemented in Docker containers, hosted by the Azure App Service for Containers PaaS service.
    CI/CD pipeline Continuous integration/continuous delivery (CI/CD) is implemented using Azure DevOps with a pipeline of environments that support dev, testing and production
    Automated deployment
  • Azure ARM templates
  • App Service for Containers
  • Azure container registry
  • High Availability/Disaster Recovery (HA/DR) Full geo-replication of microservices and data, with automatic failover in the event of an issue in any region:

  • Cosmos DB deployed to multiple regions with active-active read/write
  • Session consistency to assure that user experience is consistent across failover
  • Stateless microservices deployed to multiple regions
  • Health monitoring to detect errors that require failover
  • Azure Traffic Manager redirects traffic to healthy region
  • Demonstrates insfrastructure best practices
  • Application auto-scaling
  • Minimize network latency through geo-based DNS routing
  • API authentication
  • Distributed denial of service (DDoS) protection & mitigation
  • Load and performance testing The solution includes an integrated traffic simulator to demonstrate that the solution auto-scales properly, maintaining application performance as scale increases
    Proves application resiliency through chaos testing A Chaos Monkey-style solution to shut down different portions of the architecture in order to validate that resilience measures keep everything running in the event of any single failure

    Contribute

    See CONTRIBUTING.md for more information.

    entref-spring-boot's People

    Contributors

    allydurks avatar bartr avatar bengreenier avatar billpratt avatar code4clouds avatar day-jeff avatar ethan-arrowood avatar focusthenflex avatar ivan-shaporov avatar manojvazirani avatar microsoftopensource avatar mindlessroman avatar msftgits avatar sarasp avatar

    Stargazers

     avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

    Watchers

     avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

    entref-spring-boot's Issues

    Require AAD and API env variables to be set on production build of UI

    Do you have a feature request?

    Complete the following items then submit your issue:

    • Detailed description of feature
      We should modify the code within the webpack configs so that the env variables WEBPACK_PROP_* are required when building for production. This way we can prevent shipping Client builds that are not properly configured with an AAD provider or an API url.
    • What value will this bring to this project?
      This will allow developers to catch bad builds before shipping them to production. It is not 100% full proof as someone may not use our webpack configs or package.json commands.
    • Whether you plan on adding this feature yourself or not
      I'll be happy to work on this after I finish the rest of P0 items. If I don't get a chance to complete it, it will be a good-first-contributor task.

    Split into two projects with new names

    Refactor this project into two separate projects:

    1. entref-appservice-containers - deploys enterprise-ready infrastructure
    2. entref-spring-boot - application code including CI/CD pipelines

    Deployment Documentation Review

    Hi all,

    I've been asked to review deployment documentation. I will use this issue to track any feedback. If there is more appropriate formatting for this issue please let me know. I will continue to update as I progress through the documentation.

    Sections referenced:

    Issues:

    1. Section A should not include the instruction "Open the data/importdata.sh" file. This happens later on in the section "Import the sample IMDb data to Cosmos DB"

    Recommendations:

    Add A simple shopping cart app

    As a user, I can create and save a shopping cart for a person. A shopping cart is associated with one person. A shopping cart may have 0 or more items in it, and can include one or more of an individual item. A person may have 0 or 1 live shopping carts. When a person purchases a shopping cart, an order that includes the items in the shopping cart is created and saved.

    As a user, I can see a list of the orders for each person.

    Value: Provide example app to illustrate services and capacity.

    I'm working on this, but need lots of help!
    Open questions:
    how to handle abandoned shopping carts?
    anonymous shopping carts?

    Cleanup Readme

    After the migration to GitHub, we want to make our README a bit more open source friendly. It isn't that we don't have the correct information, it's more about how we present it and make it clear, quick, and easy for folks to get going.

    Infrastructure Script Deployment Error

    I am working on deploying the infrastructure using /infrastructure/deploy.sh since the deploy to Azure button cannot be used due to the repository being private.

    Lines 36 - 65 do not have a prompt for entering a deploymentName so the script fails with:

    Starting deployment...
    + az group deployment create --name '' --resource-group jackson-doc-review --template-file azuredeploy.json
    Parameter 'deployment_name' must have length greater than 1.
    

    Walkthrough of how to deploy with azure cli

    We should document the steps required to deploy the entire solution, from 0 to production, using only local commands (no pipeline approach). Here is what i did for reference:

    Note: missing tm global endpoint final az group deployment

    commands
    COSMOS_AT=cosmos access token
    DOCKER_AT=docker access token
    SUBSCRIPTION_ID=azure subscription id
    
    λ az --version
    azure-cli (2.0.53)
    
    acr (2.1.11)
    acs (2.3.13)
    advisor (2.0.0)
    ams (0.3.1)
    appservice (0.2.9)
    backup (1.2.1)
    batch (3.4.1)
    batchai (0.4.5)
    billing (0.2.0)
    botservice (0.1.3)
    cdn (0.2.0)
    cloud (2.1.0)
    cognitiveservices (0.2.4)
    command-modules-nspkg (2.0.2)
    configure (2.0.19)
    consumption (0.4.1)
    container (0.3.9)
    core (2.0.53)
    cosmosdb (0.2.6)
    dla (0.2.3)
    dls (0.1.6)
    dms (0.1.1)
    eventgrid (0.2.0)
    eventhubs (0.3.1)
    extension (0.2.3)
    feedback (2.1.4)
    find (0.2.12)
    hdinsight (0.1.0)
    interactive (0.4.1)
    iot (0.3.4)
    iotcentral (0.1.4)
    keyvault (2.2.8)
    lab (0.1.4)
    maps (0.3.3)
    monitor (0.2.7)
    network (2.2.11)
    nspkg (3.0.3)
    policyinsights (0.1.0)
    profile (2.1.2)
    rdbms (0.3.5)
    redis (0.3.2)
    relay (0.1.2)
    reservations (0.4.1)
    resource (2.1.7)
    role (2.1.11)
    search (0.1.1)
    servicebus (0.3.2)
    servicefabric (0.1.9)
    signalr (1.0.0)
    sql (2.1.6)
    storage (2.2.7)
    telemetry (1.0.0)
    vm (2.2.10)
    
    Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
    Extensions directory 'C:\Users\begreen\.azure\cliextensions'
    
    Python (Windows) 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 02:47:15) [MSC v.1900 32 bit (Intel)]
    
    Legal docs and information: aka.ms/AzureCliLegal
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\infrastructure\global-resources (master)
    λ az login
    Note, we have launched a browser for you to login. For old experience with device code, use "az login --use-device-code"
    You have logged in. Now let us find all the subscriptions to which you have access...
    [
      ...
      "name": "CSE Americas Dev Crews",
    ]
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\infrastructure\global-resources (master)
    λ az account set --subscription "CSE Americas Dev Crews"
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\infrastructure\global-resources (master)
    λ az group create --name "brgj-global" --location eastus
    {
      "id": "/subscriptions/SUBSCRIPTION_ID/resourceGroups/brgj-global",
      "location": "eastus",
      "managedBy": null,
      "name": "brgj-global",
      "properties": {
        "provisioningState": "Succeeded"
      },
      "tags": null
    }
    
    λ az group deployment create --resource-group "brgj-global" --template-file azuredeploy.json
    {
      "id": "/subscriptions/SUBSCRIPTION_ID/resourceGroups/brgj-global/providers/Microsoft.Resources/deployments/azuredeploy",
      "location": null,
      "name": "azuredeploy",
      "properties": {
        "correlationId": "8158bb6d-2988-4c3e-94b2-1cf36c65d6d6",
        "debugSetting": null,
        "dependencies": [],
        "duration": "PT7M37.9171294S",
        "mode": "Incremental",
        "onErrorDeployment": null,
        "outputResources": [
          {
            "id": "/subscriptions/SUBSCRIPTION_ID/resourceGroups/brgj-global/providers/Microsoft.ContainerRegistry/registries/acrImages",
            "resourceGroup": "brgj-global"
          },
          {
            "id": "/subscriptions/SUBSCRIPTION_ID/resourceGroups/brgj-global/providers/Microsoft.DocumentDB/databaseAccounts/wyoqegu7arweacosmos-instance",
            "resourceGroup": "brgj-global"
          },
          {
            "id": "/subscriptions/SUBSCRIPTION_ID/resourceGroups/brgj-global/providers/Microsoft.Network/trafficManagerProfiles/tm-profiles",
            "resourceGroup": "brgj-global"
          }
        ],
        "outputs": null,
        "parameters": {
          "container_registry_name": {
            "type": "String",
            "value": "acrImages"
          },
          "database-name": {
            "type": "String",
            "value": "data"
          },
          "database_account_name": {
            "type": "String",
            "value": "wyoqegu7arweacosmos-instance"
          },
          "traffic_manager_profiles_name": {
            "type": "String",
            "value": "tm-profiles"
          }
        },
        "parametersLink": null,
        "providers": [
          {
            "id": null,
            "namespace": "Microsoft.DocumentDB",
            "registrationState": null,
            "resourceTypes": [
              {
                "aliases": null,
                "apiVersions": null,
                "locations": [
                  "eastus"
                ],
                "properties": null,
                "resourceType": "databaseAccounts"
              }
            ]
          },
          {
            "id": null,
            "namespace": "Microsoft.ContainerRegistry",
            "registrationState": null,
            "resourceTypes": [
              {
                "aliases": null,
                "apiVersions": null,
                "locations": [
                  "eastus"
                ],
                "properties": null,
                "resourceType": "registries"
              }
            ]
          },
          {
            "id": null,
            "namespace": "Microsoft.Network",
            "registrationState": null,
            "resourceTypes": [
              {
                "aliases": null,
                "apiVersions": null,
                "locations": [
                  "global"
                ],
                "properties": null,
                "resourceType": "trafficManagerProfiles"
              }
            ]
          }
        ],
        "provisioningState": "Succeeded",
        "template": null,
        "templateHash": "9709172472397773744",
        "templateLink": null,
        "timestamp": "2019-01-02T15:37:03.086351+00:00"
      },
      "resourceGroup": "brgj-global"
    }
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\api (master)
    λ set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_181\
    
    λ c:\bin\maven\bin\mvn package
    ...
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 01:13 min
    [INFO] Finished at: 2019-01-02T10:45:37-05:00
    [INFO] ------------------------------------------------------------------------
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\api (master)
    λ docker build .
    Sending build context to Docker daemon  80.46MB
    Step 1/6 : FROM openjdk:8-jdk-alpine
     ---> 04060a9dfc39
    Step 2/6 : VOLUME /tmp
     ---> Using cache
     ---> d6535295ff50
    Step 3/6 : EXPOSE 8080
     ---> Using cache
     ---> 92189c40eb21
    Step 4/6 : ARG JAR_FILE=target/spring-dal-0.0.1-SNAPSHOT.jar
     ---> Using cache
     ---> 8a8b04986396
    Step 5/6 : ADD ${JAR_FILE} spring-dal.jar
     ---> 833565f20850
    Step 6/6 : ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/spring-dal.jar"]
     ---> Running in 48b4cca8eab9
    Removing intermediate container 48b4cca8eab9
     ---> d228f816362a
    Successfully built d228f816362a
    SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\api (master)
    λ docker login acrimages.azurecr.io -u acrImages -p DOCKER_AT
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\api (master)
    λ docker tag d228f816362a acrimages.azurecr.io/api:v1.0
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\api (master)
    λ docker push acrimages.azurecr.io/api
    The push refers to repository [acrimages.azurecr.io/api]
    0a6a26bed14d: Pushed
    ac1faac0988e: Pushed
    dbc783c89851: Pushed
    7bff100f35cb: Pushed
    v1.0: digest: sha256:1ddef34574788e7cdce32791e0003df106330682c295d89d28344041d4e9da54 size: 1159
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\ui (master) ([email protected])
    λ npm install
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\ui (master) ([email protected])
    λ npm run build
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\ui (master) ([email protected])
    λ npm run build
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\ui (master) ([email protected])                 
    λ docker build .                                                                                                     
    Sending build context to Docker daemon  141.3MB                                                                      
    Step 1/6 : FROM nginx:1.14.0-alpine                                                                                  
    1.14.0-alpine: Pulling from library/nginx                                                                            
    c67f3896b22c: Pull complete                                                                                          
    428de5b8d58a: Pull complete                                                                                          
    7efd417f3e28: Pull complete                                                                                          
    61a56b170416: Pull complete                                                                                          
    Digest: sha256:8976218be775f4244df2a60a169d44606b6978bac4375192074cefc0c7824ddf                                      
    Status: Downloaded newer image for nginx:1.14.0-alpine                                                               
     ---> 14d4a58e0d2e                                                                                                   
    Step 2/6 : EXPOSE 8080                                                                                               
     ---> Running in 339935f8f7bb                                                                                        
    Removing intermediate container 339935f8f7bb                                                                         
     ---> 050fd4df6880                                                                                                   
    Step 3/6 : RUN rm -rv /etc/nginx/conf.d                                                                              
     ---> Running in 35599c72b94d                                                                                        
    removed '/etc/nginx/conf.d/default.conf'                                                                             
    removed directory: '/etc/nginx/conf.d'                                                                               
    Removing intermediate container 35599c72b94d                                                                         
     ---> 50013d1d467a                                                                                                   
    Step 4/6 : COPY conf /etc/nginx                                                                                      
     ---> 67a9ccbd18a7                                                                                                   
    Step 5/6 : WORKDIR /usr/share/nginx/html                                                                             
    Removing intermediate container 815b510b076a                                                                         
     ---> e93f8998bba2                                                                                                   
    Step 6/6 : COPY ./dist/ /usr/share/nginx/html                                                                        
     ---> 8ba4fdc0425f                                                                                                   
    Successfully built 8ba4fdc0425f                                                                                      
    SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and direc
    tories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permiss
    ions for sensitive files and directories.                                                                            
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\ui (master) ([email protected])
    λ docker tag 8ba4fdc0425f acrimages.azurecr.io/ui:v1.0
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\ui (master) ([email protected])
    λ docker push acrimages.azurecr.io/ui
    The push refers to repository [acrimages.azurecr.io/ui]
    94601a480036: Pushed
    578d0edcd27f: Pushed
    7cffa3c956c5: Pushed
    9a07ffbe3d7d: Pushed
    955e7d7f7300: Pushed
    95bb4e754f2d: Pushed
    ebf12965380b: Pushed
    v1.0: digest: sha256:27b078181780ea1c9d6c29a74150cffb4b184c482a7ffb7d96868cc7f900f116 size: 1777
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\infrastructure (master)             
    λ az group create --name "brgj-eastus-single" --location eastus                                 
    {                                                                                               
      "id": "/subscriptions/SUBSCRIPTION_ID/resourceGroups/brgj-eastus-single",
      "location": "eastus",                                                                         
      "managedBy": null,                                                                            
      "name": "brgj-eastus-single",                                                                 
      "properties": {                                                                               
        "provisioningState": "Succeeded"                                                            
      },                                                                                            
      "tags": null                                                                                  
    }                                                                                               
                                                                                                    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\infrastructure (master)             
    λ az group create --name "brgj-westus-single" --location westus                                 
    {                                                                                               
      "id": "/subscriptions/SUBSCRIPTION_ID/resourceGroups/brgj-westus-single",
      "location": "westus",                                                                         
      "managedBy": null,                                                                            
      "name": "brgj-westus-single",                                                                 
      "properties": {                                                                               
        "provisioningState": "Succeeded"                                                            
      },                                                                                            
      "tags": null                                                                                  
    }                                                                                               
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\infrastructure (hotfix/arm-custom-image)                    
    λ az group deployment create --resource-group "brgj-eastus-single" --template-file azuredeploy.json --parameters docker_registry_username=acrImages docker_registry_password=DOCKER_AT docker_title_url=acrimages.azurecr.io/api docker_person_url=acrimages.azurecr.io/api docker_ui_url=acrimages.azurecr.io/ui database_connection_string=mongodb://wyoqegu7arweacosmos-instance:[email protected]:10255/?ssl=true
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\infrastructure (hotfix/arm-custom-image)
    λ az group deployment create --resource-group "brgj-westus-single" --template-file azuredeploy.json --parameters docker_registry_username=acrImages docker_registry_password=DOCKER_AT docker_title_url=acrimages.azurecr.io/api docker_person_url=acrimages.azurecr.io/api docker_ui_url=acrimages.azurecr.io/ui database_connection_string=mongodb://wyoqegu7arweacosmos-instance:[email protected]:10255/?ssl=true
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\infrastructure (hotfix/arm-custom-image)
    λ az ad app create --display-name brgj-single --reply-urls http://tm-profiles.trafficmanager.net/ui --identifier-uris http://tm-profiles.trafficmanager.net/ui --available-to-other-tenants true
    ...
    appId: "88e84b81-d1a7-4286-a70b-ce753a986a98"
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\infrastructure (hotfix/arm-custom-image)
    λ az group deployment create --resource-group "brgj-eastus-single" --template-file azuredeploy.json --parameters docker_registry_username=acrImages docker_registry_password=DOCKER_AT docker_title_url=acrimages.azurecr.io/api docker_person_url=acrimages.azurecr.io/api docker_ui_url=acrimages.azurecr.io/ui database_connection_string=mongodb://wyoqegu7arweacosmos-instance:[email protected]:10255/?ssl=true oauth_id=88e84b81-d1a7-4286-a70b-ce753a986a98
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\infrastructure (hotfix/arm-custom-image)
    λ az group deployment create --resource-group "brgj-westus-single" --template-file azuredeploy.json --parameters docker_registry_username=acrImages docker_registry_password=DOCKER_AT docker_title_url=acrimages.azurecr.io/api docker_person_url=acrimages.azurecr.io/api docker_ui_url=acrimages.azurecr.io/ui database_connection_string=mongodb://wyoqegu7arweacosmos-instance:[email protected]:10255/?ssl=true oauth_id=88e84b81-d1a7-4286-a70b-ce753a986a98
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\ui (hotfix/arm-custom-image) ([email protected])
    
    λ set WEBPACK_PROP_AAD_CLIENT_ID=88e84b81-d1a7-4286-a70b-ce753a986a98
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\ui (hotfix/arm-custom-image) ([email protected])
    
    λ set WEBPACK_PROP_API_BASE_URL=http://tm-profiles.trafficmanager.net
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\ui (hotfix/arm-custom-image) ([email protected])
    
    λ set WEBPACK_PROP_UI_BASEPATH=ui
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\ui (hotfix/arm-custom-image) ([email protected])
    
    λ npm run build
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\ui (hotfix/arm-custom-image) ([email protected])
    
    λ docker build .
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\ui (hotfix/arm-custom-image) ([email protected])
    
    λ docker push acrimages.azurecr.io/ui
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\ui (hotfix/arm-custom-image) ([email protected])
    λ az group deployment create --resource-group "brgj-westus-single" --template-file azuredeploy.json --parameters docker_registry_username=acrImages docker_registry_password=DOCKER_AT docker_title_url=acrimages.azurecr.io/api docker_person_url=acrimages.azurecr.io/api docker_ui_url=acrimages.azurecr.io/ui docker_ui_tag=v1.1 database_connection_string=mongodb://wyoqegu7arweacosmos-instance:[email protected]:10255/?ssl=true oauth_id=88e84b81-d1a7-4286-a70b-ce753a986a98
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\ui (hotfix/arm-custom-image) ([email protected])
    λ az group deployment create --resource-group "brgj-eastus-single" --template-file azuredeploy.json --parameters docker_registry_username=acrImages docker_registry_password=DOCKER_AT docker_title_url=acrimages.azurecr.io/api docker_person_url=acrimages.azurecr.io/api docker_ui_url=acrimages.azurecr.io/ui docker_ui_tag=v1.1 database_connection_string=mongodb://wyoqegu7arweacosmos-instance:[email protected]:10255/?ssl=true oauth_id=88e84b81-d1a7-4286-a70b-ce753a986a98
    
    manually set the aad app id uri (tenant/appid): https://microsoft.onmicrosoft.com/88e84b81-d1a7-4286-a70b-ce753a986a98
    
    switch to bash
    giving up on bash, running importdata.sh steps manually
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\data (hotfix/arm-custom-image)
    curl --remote-name-all https://datasets.imdbws.com/{name.basics.tsv.gz,title.basics.tsv.gz,title.principals.tsv.gz}
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\data (hotfix/arm-custom-image)
    7z e *.tsv.gz -o*
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\data (hotfix/arm-custom-image)
    λ az cosmosdb database create -g "brgj-global" -n "wyoqegu7arweacosmos-instance" --db-name "IMDb"
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\data (hotfix/arm-custom-image)
    λ az cosmosdb collection create -g "brgj-global" -n "wyoqegu7arweacosmos-instance" --db-name "IMDb" --collection-name titles --partition-key-path "/'$v'/tconst/'$v'" --throughput 100000
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\data (hotfix/arm-custom-image)
    λ az cosmosdb collection create -g "brgj-global" -n "wyoqegu7arweacosmos-instance" --db-name "IMDb" --collection-name names --partition-key-path "/'$v'/nconst/'$v'" --throughput 100000
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\data (hotfix/arm-custom-image)
    λ az cosmosdb collection create -g "brgj-global" -n "wyoqegu7arweacosmos-instance" --db-name "IMDb" --collection-name principals_mapping --partition-key-path "/'$v'/tconst/'$v'" --throughput 100000
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\data (hotfix/arm-custom-image)
    λ mongoimport --uri "mongodb://wyoqegu7arweacosmos-instance:[email protected]:10255/IMDb?ssl=true&replicaSet=globaldb" --type tsv title.basics.tsv\data.tsv --headerline --collection titles --numInsertionWorkers 100 --sslAllowInvalidCertificates --ignoreBlanks
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\data (hotfix/arm-custom-image)
    λ mongoimport --uri "mongodb://wyoqegu7arweacosmos-instance:[email protected]:10255/IMDb?ssl=true&replicaSet=globaldb" --type tsv name.basics.tsv\data.tsv --headerline --collection names --numInsertionWorkers 100 --sslAllowInvalidCertificates --ignoreBlanks
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\data (hotfix/arm-custom-image)
    λ mongoimport --uri "mongodb://wyoqegu7arweacosmos-instance:[email protected]:10255/IMDb?ssl=true&replicaSet=globaldb" --type tsv title.principals.tsv\data.tsv --headerline --collection principals_mapping --numInsertionWorkers 40 --sslAllowInvalidCertificates --ignoreBlanks
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\data (hotfix/arm-custom-image)
    λ az cosmosdb collection update -g "brgj-global" -n "wyoqegu7arweacosmos-instance" --db-name "IMDb" --collection-name names --throughput 10000
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\data (hotfix/arm-custom-image)
    λ az cosmosdb collection update -g "brgj-global" -n "wyoqegu7arweacosmos-instance" --db-name "IMDb" --collection-name titles --throughput 10000
    
    C:\Users\begreen\git\containers-rest-cosmos-appservice-java\data (hotfix/arm-custom-image)
    λ az cosmosdb collection update -g "brgj-global" -n "wyoqegu7arweacosmos-instance" --db-name "IMDb" --collection-name principals_mapping --throughput 10000
    

    Need to provide guidance to backup database.

    The reference application uses Cosmos DB. We need to provide best practice guidance for backing up data. This should also be related to the guidance for recommendations for DR.

    Make API url an env variable

    Similar to how we interpret the AAD Client ID on build process (with Webpack) we want to do the same to the API url. Files Person.tsx and Titles.tsx both contain a line const base = 'https://<api_url>'. We need to replace that as well as define a global type for the variable. It should be prepended by WEBPACK_PROP_ and added to the webpack.common.js webpack.DefinePlugin({}) function arg object.

    Create dev environment OAuth solution

    Currently, in order to develop the UI, you must provide an AAD Client Id in order to authenticate. We should provide either a dev AAD id that can be used for development purposes, instructions how to set up your own AAD, or some sort of local OAuth alternative.

    The API base url can already be configured to hit locally.

    Script imports sample foods data downloaded from Department of Agriculture

    Copied from Azure Dev Ops Backlog

    Use import script to get sample data from the following location to populate CosmosDB. This will be accessed using SQL like queries from DocumentDB.

    https://data.nal.usda.gov/dataset/usda-branded-food-products-database

    Tasks:

    • Import data to CosmosDB collection with SQL API
    • Convert default column names to camelCase (dashes must be removed)
      • Spring Boot auto linking doesn't support dashes
      • "This may not be relevant currently based on the current sprint. This was for when the scripts needed to be changed for DocDB uploading which hasn't been rescoped since that previous PR before the break for winter holidays."
    • Convert ingredients list to JSON array
      • Answer: "There is no explicit need to put it in an array--it's simply a JSON best-practice. Totally ok to break this out into a separate user-story that we prioritize low."
      • Question: "I currently have extracted it as a string with commas within it. Separating it out would be it's own thing most likely. Is this for a filterable search or something else in particular?"

    Add Dockerfile for UI developers

    Do you have a feature request?

    Complete the following items then submit your issue:

    • Detailed description of feature

    • This is a multi-stage Docker file needed to facilitate the work of developers working on the UI.

    • What value will this bring to this project?

    • It provide all the node js components for building, linting and testing the ui.

    • Whether you plan on adding this feature yourself or not

    • Feature has already been developed and was already submitted as a PR

    Prod env are not configured with AAD

    Current production environments are not configured with the production AAD service. The API requires oauth tokens at an application level so the prod apis are currently broken.

    Add Spring Boot Actuator

    The Spring Boot Actuator library, which we attempted to incorporate with this PR, cannot be tested in our integration test suite until the 2.1.0.M4 release of Spring Boot due to this issue. When that release occurs, we should remove the custom health endpoint we have created and instead use the functionality of the Spring Boot Actuator library.

    Enable Rollback

    Rollback allows the production environment to pull the latest runtime if the new update fails to work.
    It provides reliability in case of a miss-configuration doesn't work in production
    Feature consist of several issue that need to be resolved to make sure it works as intended.

    • SSL
    • AAD
    • AppGateway Health Probes Configuration and adding configuration to ARM templates.
    • AppService must add the AAD APPID Key into the AppServic Env deployment from KeyVault
    • JTests execution complete without issues.
    • Update to Azure DevOps

    Consider AAD Client ID env variable as a build error versus a runtime error

    Copied from Azure Dev Ops Backlog

    Currently, the user can optionally pass in the WEBPACK_PROP_AAD_CLIENT_ID env variable. The app will build and run without error. When the user tries to login the app will throw an error if this is not set. This improves the dev experience because if the dev is not working on a feature within the auth pipeline then they don't need to worry about this env var. However, if the project was deployed without this env variable then the user would experience this error and it would have to be fixed by the project developers.

    There are user & developer experiences to consider with how to handle this.

    Should we throw a build error (or warning) if it is not passed in? Should we improve the UI design to reflect if auth has been configured or not. etc...

    Autoscale should scale down the resources when usage is low

    Do you have a feature request?

    Autoscale should scale down the resources when usage is low

    Complete the following items then submit your issue:

    • Detailed description of feature
      Autoscale should be able to scale down the resources
      Scale Up: When memory/CPU > 90
      Scale Down: When memory/CPU < 70
    • What value will this bring to this project?
      Cost savings for the customer
    • Whether you plan on adding this feature yourself or not
      yes

    null reference

    In the getDatabaseName method of the MongoConfig.java file, when appConfig.getDatabaseInformation() reports an error, the 56 parameter may be a null pointer exception.
    default

    Consider shortening the repo title

    The title is pretty long. Here's a name that could work: microservice-example.

    The tags provide enough details to cover the other key words like containers, rest, cosmos, etc.

    CosmosDB Data Deployment Script Errors

    Hi all,

    I've been going through the instructions for deploying data to CosmosDB and ran into a couple snags.

    1. The following scripts are missing the executable flag on Linux:
    ./load_env.sh
    ./data/getdata.sh
    ./data/importdata.sh
    ./infrastructure/deploy.sh
    

    These can be fixed with chmod -x. If there are any other scripts in this repo, I haven't checked them and they may be worth a look.

    1. ./load_env.sh disallows resource groups with hyphens
    Existing resource groups:
    
    ... jackson, jackson-doc-review, jackson-eastus-dev, jackson-eastus-prod, ...
    
    
    Enter a resource group name: jackson-doc-review
    'jackson-doc-review' is not valid. Only letters, numbers and underscores are allowed.
    

    I will continue to update this issue if I run into any other bugs in the scripts. I have also created an issue for documentation review in #29.

    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.