This repository has been archived by the owner on Mar 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #223 from jldeen/feature/net5andbridge2k8s
+ Support for .NET 5 and Bridge to Kubernetes
- Loading branch information
Showing
24 changed files
with
463 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#------------------------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. | ||
#------------------------------------------------------------------------------------------------------------- | ||
|
||
FROM mcr.microsoft.com/dotnet/core/sdk:2.1 | ||
|
||
# Avoid warnings by switching to noninteractive | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
ENV ASPNETCORE_URLS=http://0.0.0.0:5000 | ||
|
||
# This Dockerfile adds a non-root 'vscode' user with sudo access. However, for Linux, | ||
# this user's GID/UID must match your local user UID/GID to avoid permission issues | ||
# with bind mounts. Update USER_UID / USER_GID if yours is not 1000. See | ||
# https://aka.ms/vscode-remote/containers/non-root-user for details. | ||
ARG USERNAME=vscode | ||
ARG USER_UID=1000 | ||
ARG USER_GID=$USER_UID | ||
|
||
# Configure apt and install packages | ||
RUN apt-get update \ | ||
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \ | ||
# | ||
# Verify git, process tools, lsb-release (common in install instructions for CLIs) installed | ||
&& apt-get -y install git iproute2 procps lsb-release \ | ||
# | ||
# Install node | ||
&& apt-get -y install curl gnupg build-essential \ | ||
&& curl -sL https://deb.nodesource.com/setup_10.x | bash - \ | ||
&& apt-get -y install nodejs \ | ||
# | ||
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user. | ||
&& groupadd --gid $USER_GID $USERNAME \ | ||
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \ | ||
# [Optional] Add sudo support for the non-root user | ||
&& apt-get install -y sudo \ | ||
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\ | ||
&& chmod 0440 /etc/sudoers.d/$USERNAME \ | ||
# | ||
# Clean up | ||
&& apt-get autoremove -y \ | ||
&& apt-get clean -y \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Switch back to dialog for any ad-hoc use of apt-get | ||
ENV DEBIAN_FRONTEND= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or the definition README at | ||
// https://github.com/microsoft/vscode-dev-containers/tree/master/containers/dotnetcore-2.1 | ||
{ | ||
"name": "TailwindTraders-Website", | ||
"dockerComposeFile": "docker-compose.yml", | ||
"service": "web", | ||
"workspaceFolder": "/workspace", | ||
|
||
// Use 'settings' to set *default* container specific settings.json values on container create. | ||
// You can edit these settings after create using File > Preferences > Settings > Remote. | ||
"settings": { | ||
"terminal.integrated.shell.linux": "/bin/bash" | ||
}, | ||
|
||
// Uncomment the next line if you want to publish any ports. | ||
// "appPort": [], | ||
|
||
// Uncomment the next line to run commands after the container is created. | ||
// "postCreateCommand": "dotnet restore" | ||
|
||
// Uncomment the next line to use a non-root user. On Linux, this will prevent | ||
// new files getting created as root, but you may need to update the USER_UID | ||
// and USER_GID in .devcontainer/Dockerfile to match your user if not 1000. | ||
// "runArgs": [ "-u", "vscode" ], | ||
|
||
// Add the IDs of extensions you want installed when the container is created in the array below. | ||
"extensions": [ | ||
"ms-vscode.csharp" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#------------------------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. | ||
#------------------------------------------------------------------------------------------------------------- | ||
|
||
version: '3' | ||
services: | ||
web: | ||
# Uncomment the next line to use a non-root user. On Linux, this will prevent | ||
# new files getting created as root, but you may need to update the USER_UID | ||
# and USER_GID in .devcontainer/Dockerfile to match your user if not 1000. | ||
# user: node | ||
|
||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
volumes: | ||
- ..:/workspace | ||
ports: | ||
- 5000:5000 | ||
|
||
# Overrides default command so things don't shut down after the process ends. | ||
command: sleep infinity | ||
|
||
links: | ||
- mongo | ||
- sql | ||
|
||
mongo: | ||
image: mongo | ||
restart: unless-stopped | ||
|
||
sql: | ||
image: mcr.microsoft.com/mssql/server:2017-latest | ||
restart: unless-stopped | ||
environment: | ||
- ACCEPT_EULA=Y | ||
- SA_PASSWORD=Twtraders123456! | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
// Use IntelliSense to find out which attributes exist for C# debugging | ||
// Use hover for the description of the existing attributes | ||
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": ".NET Core Launch (web)", | ||
"type": "coreclr", | ||
"request": "launch", | ||
"preLaunchTask": "build", | ||
"program": "${workspaceFolder}/Source/Tailwind.Traders.Web/bin/Debug/netcoreapp2.1/Tailwind.Traders.Web.dll", | ||
"args": [], | ||
"cwd": "${workspaceFolder}/Source/Tailwind.Traders.Web", | ||
"stopAtEntry": false, | ||
"serverReadyAction": { | ||
"action": "openExternally", | ||
"pattern": "^\\s*Now listening on:\\s+(https?://\\S+)" | ||
}, | ||
"env": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
}, | ||
"sourceFileMap": { | ||
"/Views": "${workspaceFolder}/Views" | ||
} | ||
}, | ||
{ | ||
"name": ".NET Core Attach", | ||
"type": "coreclr", | ||
"request": "attach", | ||
"processId": "${command:pickProcess}" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "build", | ||
"command": "dotnet", | ||
"type": "process", | ||
"args": [ | ||
"build", | ||
"${workspaceFolder}/Source/Tailwind.Traders.Web/Tailwind.Traders.Web.csproj", | ||
"/property:GenerateFullPaths=true", | ||
"/consoleloggerparameters:NoSummary" | ||
], | ||
"problemMatcher": "$msCompile" | ||
}, | ||
{ | ||
"label": "publish", | ||
"command": "dotnet", | ||
"type": "process", | ||
"args": [ | ||
"publish", | ||
"${workspaceFolder}/Source/Tailwind.Traders.Web/Tailwind.Traders.Web.csproj", | ||
"/property:GenerateFullPaths=true", | ||
"/consoleloggerparameters:NoSummary" | ||
], | ||
"problemMatcher": "$msCompile" | ||
}, | ||
{ | ||
"label": "watch", | ||
"command": "dotnet", | ||
"type": "process", | ||
"args": [ | ||
"watch", | ||
"run", | ||
"${workspaceFolder}/Source/Tailwind.Traders.Web/Tailwind.Traders.Web.csproj", | ||
"/property:GenerateFullPaths=true", | ||
"/consoleloggerparameters:NoSummary" | ||
], | ||
"problemMatcher": "$msCompile" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# Apps 30 Demo Commands | ||
|
||
### Environment Variables Used | ||
|
||
``` | ||
resourceGroup=live-igniteapps30 | ||
location=eastus | ||
subName="Ignite The Tour" | ||
cosmosDBName=liveapps30twtnosqlge | ||
sqlDBName=liveapps30twtsql | ||
webappName=liveigniteapps30 | ||
acrName=liveigniteapps30acr | ||
adminUser=twtadmin | ||
adminPassword=twtapps30pD | ||
``` | ||
|
||
### Resource Group Creation | ||
|
||
`az group create --subscription "$subName" --name $resourceGroup --location $location` | ||
|
||
### VNet Creation | ||
|
||
`az network vnet create --name igniteapps30vnet --subscription "$subName" --resource-group $resourceGroup --subnet-name default` | ||
|
||
### CosmosDB Creation | ||
|
||
`az cosmosdb create --name $cosmosDBName --resource-group $resourceGroup --kind MongoDB --subscription "$subName"` | ||
|
||
# SQL Server Creation | ||
|
||
`az sql server create --location $location --resource-group $resourceGroup --name $sqlDBName --admin-user $adminUser --admin-password $adminPassword --subscription "$subName"` | ||
|
||
# SQL Server Firewall Rule | ||
|
||
`az sql server firewall-rule create --resource-group $resourceGroup --server $sqlDBName --name azure --start-ip-address 0.0.0.0 --end-ip-address 0.0.0.0 --subscription "$subName"` | ||
|
||
# SQL Server DB Creation | ||
|
||
`az sql db create --resource-group $resourceGroup --server $sqlDBName --name tailwind --subscription "$subName"` | ||
|
||
# Azure Container Registry Creation | ||
|
||
`az acr create --resource-group $resourceGroup --name $acrName --sku Basic --subscription "$subName" --admin-enabled true` | ||
|
||
`az appservice plan create -g $resourceGroup -n $webappName --is-linux --sku S1` | ||
|
||
# Build our image | ||
|
||
``` | ||
cd igniteapps30/TailwindTraders-Website/Source/Tailwind.Traders.Web/ | ||
az acr build --subscription "Ignite The Tour" --registry $acrName --image $webappName . | ||
``` | ||
|
||
# Create our App Service Service Plan | ||
|
||
`az appservice plan create -g $resourceGroup -n $webappName --is-linux --sku S1` | ||
|
||
# Create our App Service Container Web App | ||
|
||
`az webapp create --resource-group $resourceGroup --plan $webappName --name $webappName --deployment-container-image-name $acrName.azurecr.io/$webappName:ca1` | ||
|
||
# Configure loggin on our web app | ||
|
||
`az webapp log config -n $webappName -g $resourceGroup --web-server-logging filesystem` | ||
|
||
# Speficy which image to use for our web app | ||
|
||
`REGISTRY_PASSWORD=$(az acr credential show -n $acrName -o tsv --query 'passwords[0].value')` | ||
|
||
`az webapp config container set --name $webappName --resource-group $resourceGroup --docker-custom-image-name liveigniteapps30acr.azurecr.io/$webappName:ca1 --docker-registry-server-url https://liveigniteapps30acr.azurecr.io --docker-registry-server-user liveigniteapps30acr --docker-registry-server-password $REGISTRY_PASSWORD` | ||
|
||
# Get our Cosmos and SQL Connection strings | ||
|
||
`cosmosConnectionString=$(az cosmosdb list-connection-strings --name $cosmosDBName --resource-group $resourceGroup --query 'connectionStrings[0].connectionString' -o tsv --subscription "$subName")` | ||
|
||
`sqlConnectionString=$(az sql db show-connection-string --server $sqlDBName --name tailwind -c ado.net --subscription "$subName" | jq -r .)` | ||
|
||
**Note:** Be sure to update the sqlConnection String with your | ||
|
||
# Configure environment variables for our webapp to work properly | ||
|
||
`az webapp config appsettings set --resource-group $resourceGroup --name $webappName --settings apiUrl=/api/v1 ApiUrlShoppingCart=/api/v1 productImagesUrl=https://raw.githubusercontent.com/microsoft/TailwindTraders-Backend/master/Deploy/tailwindtraders-images/product-detail SqlConnectionString="sqlConnectionString" MongoConnectionString="$cosmosConnectionString"` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.