Skip to content

Commit

Permalink
Merge pull request #253 from 1iveowl/main
Browse files Browse the repository at this point in the history
Upgrading to .NET 8 - adding Apple Silicon Fixes and dependency fixes
  • Loading branch information
1iveowl committed Dec 26, 2023
2 parents 17e7d47 + b5ac372 commit 8405fa5
Show file tree
Hide file tree
Showing 35 changed files with 151 additions and 65 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/admin-service-api-deploy.yml
Expand Up @@ -9,9 +9,9 @@ permissions:
contents: read

env:
AZURE_WEBAPP_NAME: 'admin-api-asdk-test-83sx' # set this to your application's name
AZURE_WEBAPP_NAME: 'admin-api-asdk-test-v23y' # set this to your application's name
AZURE_WEBAPP_PACKAGE_PATH: . # set this to the path to your web app project, defaults to the repository root
DOTNET_VERSION: 7.x.x
DOTNET_VERSION: 8.x.x
PROJECT_DIR: ./src/Saas.Admin/Saas.Admin.Service
PROJECT_PATH: ./src/Saas.Admin/Saas.Admin.Service/Saas.Admin.Service.csproj
OUTPUT_PATH: ./publish/admin-api
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/permissions-api-deploy.yml
Expand Up @@ -9,9 +9,9 @@ permissions:
contents: read

env:
AZURE_WEBAPP_NAME: 'api-permission-asdk-test-83sx' # set this to your application's name
AZURE_WEBAPP_NAME: 'api-permission-asdk-test-v23y' # set this to your application's name
AZURE_WEBAPP_PACKAGE_PATH: . # set this to the path to your web app project, defaults to the repository root
DOTNET_VERSION: 7.x.x
DOTNET_VERSION: 8.x.x
PROJECT_DIR: ./src/Saas.Identity/Saas.Permissions/Saas.Permissions.Service_v1.1
PROJECT_PATH: ./src/Saas.Identity/Saas.Permissions/Saas.Permissions.Service_v1.1/Saas.Permissions.Service.csproj
OUTPUT_PATH: ./publish/api-permission
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/saas-app-deploy.yml
Expand Up @@ -9,9 +9,9 @@ permissions:
contents: read

env:
AZURE_WEBAPP_NAME: 'saas-app-asdk-test-83sx' # set this to your application's name
AZURE_WEBAPP_NAME: 'saas-app-asdk-test-v23y' # set this to your application's name
AZURE_WEBAPP_PACKAGE_PATH: . # set this to the path to your web app project, defaults to the repository root
DOTNET_VERSION: 7.x.x
DOTNET_VERSION: 8.x.x
PROJECT_DIR: ./src/Saas.Application/Saas.Application.Web
PROJECT_PATH: ./src/Saas.Application/Saas.Application.Web/Saas.Application.Web.csproj
OUTPUT_PATH: ./publish/saas-app
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/signup-administration-deploy.yml
Expand Up @@ -9,9 +9,9 @@ permissions:
contents: read

env:
AZURE_WEBAPP_NAME: 'signupadmin-app-asdk-test-83sx' # set this to your application's name
AZURE_WEBAPP_NAME: 'signupadmin-app-asdk-test-v23y' # set this to your application's name
AZURE_WEBAPP_PACKAGE_PATH: . # set this to the path to your web app project, defaults to the repository root
DOTNET_VERSION: 7.x.x
DOTNET_VERSION: 8.x.x
PROJECT_DIR: ./src/Saas.SignupAdministration/Saas.SignupAdministration.Web
PROJECT_PATH: ./src/Saas.SignupAdministration/Saas.SignupAdministration.Web/Saas.SignupAdministration.Web.csproj
OUTPUT_PATH: ./publish/signupadmin
Expand Down
4 changes: 2 additions & 2 deletions src/Saas.Admin/Saas.Admin.Client/Saas.Admin.Client.csproj
@@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Configurations>Debug;Release;Multi Debug</Configurations>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Identity.Web" Version="2.15.3" />
<PackageReference Include="Microsoft.Identity.Web" Version="2.16.0" />
</ItemGroup>

<ItemGroup>
Expand Down
10 changes: 5 additions & 5 deletions src/Saas.Admin/Saas.Admin.Service/Saas.Admin.Service.csproj
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>aspnet-Saas.Admin.Service-5358E0C3-EA51-44EA-B381-CA2F9D9710D3</UserSecretsId>
Expand All @@ -11,11 +11,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.2.2" />
<PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.3.0" />
<PackageReference Include="Dawn.Guard" Version="1.12.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.21.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.AzureAppConfiguration" Version="6.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.13" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.AzureAppConfiguration" Version="7.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0" />
</ItemGroup>
<ItemGroup>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
Expand Down
1 change: 1 addition & 0 deletions src/Saas.Admin/deployment/act/deploy.sh
Expand Up @@ -17,6 +17,7 @@ container_deployment_dir="/asdk/src/Saas.Admin/deployment"

# running the './act/script/patch-app-name.sh' script using our ASDK deployment script container - i.e., not the act container
docker run \
--platform linux/amd64 \
--interactive \
--tty \
--rm \
Expand Down
Expand Up @@ -10,9 +10,9 @@ permissions:

env:
APP_NAME: admin-api
AZURE_WEBAPP_NAME: admin-api-asdk-test-83sx # set this to your application's name
AZURE_WEBAPP_NAME: admin-api-asdk-test-v23y # set this to your application's name
AZURE_WEBAPP_PACKAGE_PATH: . # set this to the path to your web app project, defaults to the repository root
DOTNET_VERSION: 7.x.x
DOTNET_VERSION: 8.x.x
PROJECT_DIR: ./src/Saas.Admin/Saas.Admin.Service
PROJECT_PATH: ${{ env.PROJECT_DIR }}/Saas.Admin.Service.csproj
PUBLISH_PATH: ./publish
Expand Down
1 change: 1 addition & 0 deletions src/Saas.Admin/deployment/run.sh
Expand Up @@ -11,6 +11,7 @@ container_deployment_dir="/asdk/src/Saas.Admin/deployment"
# using volumes '--volume' to mount only the needed directories to the container.
# using ':ro' to make scrip directories etc. read-only. Only config and log directories are writable.
docker run \
--platform linux/amd64 \
--interactive \
--tty \
--rm \
Expand Down
@@ -1,18 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>a45ad9f7-37e3-4dc7-bf2c-9f1f3e449cba</UserSecretsId>
<Configurations>Debug;Release;Multi Debug</Configurations>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.AzureAppConfiguration" Version="6.1.1" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.21.0" />
<PackageReference Include="Microsoft.Identity.Web.UI" Version="2.15.3" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="7.0.11" />
<PackageReference Include="Microsoft.Extensions.Configuration.AzureAppConfiguration" Version="7.0.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" />
<PackageReference Include="Microsoft.Identity.Web.UI" Version="2.16.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/Saas.Application/deployment/act/deploy.sh
Expand Up @@ -17,6 +17,7 @@ container_deployment_dir="/asdk/src/Saas.Application/deployment"

# running the './act/script/patch-app-name.sh' script using our ASDK deployment script container - i.e., not the act container
docker run \
--platform linux/amd64 \
--interactive \
--tty \
--rm \
Expand Down
Expand Up @@ -10,9 +10,9 @@ permissions:

env:
APP_NAME: saas-app
AZURE_WEBAPP_NAME: saas-app-asdk-test-83sx # set this to your application's name
AZURE_WEBAPP_NAME: saas-app-asdk-test-v23y # set this to your application's name
AZURE_WEBAPP_PACKAGE_PATH: . # set this to the path to your web app project, defaults to the repository root
DOTNET_VERSION: 7.x.x
DOTNET_VERSION: 8.x.x
PROJECT_DIR: ./src/Saas.Application/Saas.Application.Web
PROJECT_PATH: ${{ env.PROJECT_DIR }}/Saas.Application.Web.csproj
PUBLISH_PATH: ./publish
Expand Down
1 change: 1 addition & 0 deletions src/Saas.Application/deployment/run.sh
Expand Up @@ -11,6 +11,7 @@ container_deployment_dir="/asdk/src/Saas.Application/deployment"
# using volumes '--volume' to mount only the needed directories to the container.
# using ':ro' to make scrip directories etc. read-only. Only config and log directories are writable.
docker run \
--platform linux/amd64 \
--interactive \
--tty \
--rm \
Expand Down
@@ -0,0 +1 @@
deployStorage.json
1 change: 1 addition & 0 deletions src/Saas.Identity/Saas.IdentityProvider/deployment/run.sh
Expand Up @@ -15,6 +15,7 @@ fi
# using volumes '--volume' to mount only the needed directories to the container.
# using ':ro' to make scrip directories etc. read-only. Only config and log directories are writable.
docker run \
--platform linux/amd64 \
--interactive \
--tty \
--rm \
Expand Down
Expand Up @@ -46,7 +46,7 @@ for app in "${app_reg_array[@]}"; do

if [[ "${has_secret}" == true || "${has_secret}" == "true" ]]; then
app_name=$(jq --raw-output '.name' <<<"${app}")
secret_path=$(jq --raw-output '.secretPath' <<<"${app}")
secret_path=$(jq --raw-output '.secretPath' <<< "${app}")

if [[ -s "${secret_path}" ]]; then

Expand Down
Expand Up @@ -20,7 +20,7 @@ function check-prerequisites() {
--header "Checking prerequisites"

what_os="$(get-os)" ||
echo "Unsupported OS: ${what_os}. This script support linux and macos." |
echo "Unsupported OS: ${what_os}. This script support linux (WSL 2.0 on Windows) and MacOS." |
log-output \
--level error \
--header "Critical Error" ||
Expand Down
4 changes: 3 additions & 1 deletion src/Saas.Identity/Saas.IdentityProvider/readme.md
Expand Up @@ -20,7 +20,7 @@ For more details please read the [FAQ](./faq.md):

Running the deployment script requires utilizing a container and Docker.

### Prerequisites
### Prerequisites

The following platforms are supported:

Expand Down Expand Up @@ -85,6 +85,8 @@ To run the script you must first setup of the deployment environment and build t
./setup.sh
```

> *Tip#1: On MacOS, you may need to run `chmod +x setup.sh` first, to make the script executable.*
![Screenshot of a Linux console window after initial setup.sh execution](.assets/readme/image-20230221115203497-1683889385776-2.png)

This will take a few minutes to complete and you will only need to do it once. The container will be named `asdk-script-deployment`.
Expand Down
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Configurations>Debug;Release;Multi Debug</Configurations>
Expand Down
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>2f007af4-43b5-4316-903b-03340f0999e4</UserSecretsId>
Expand All @@ -16,11 +16,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.21.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.13" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.13" />
<PackageReference Include="Microsoft.Extensions.Configuration.AzureAppConfiguration" Version="6.1.1" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="7.0.13" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.AzureAppConfiguration" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Expand Up @@ -17,6 +17,7 @@ container_deployment_dir="/asdk/src/Saas.Identity/Saas.Permissions/deployment"

# running the './act/script/patch-app-name.sh' script using our ASDK deployment script container - i.e., not the act container
docker run \
--platform linux/amd64 \
--interactive \
--tty \
--rm \
Expand Down
Expand Up @@ -10,9 +10,9 @@ permissions:

env:
APP_NAME: permissions-api
AZURE_WEBAPP_NAME: api-permission-asdk-test-83sx # set this to your application's name
AZURE_WEBAPP_NAME: api-permission-asdk-test-v23y # set this to your application's name
AZURE_WEBAPP_PACKAGE_PATH: "." # set this to the path to your web app project, defaults to the repository root
DOTNET_VERSION: 7.x.x
DOTNET_VERSION: 8.x.x
PROJECT_DIR: ./src/Saas.Identity/Saas.Permissions/Saas.Permissions.Service_v1.1
PROJECT_PATH: ${{ env.PROJECT_DIR }}/Saas.Permissions.Service.csproj
PUBLISH_PATH: ./publish
Expand Down
1 change: 1 addition & 0 deletions src/Saas.Identity/Saas.Permissions/deployment/run.sh
Expand Up @@ -11,6 +11,7 @@ container_deployment_dir="/asdk/src/Saas.Identity/Saas.Permissions/deployment"
# using volumes '--volume' to mount only the needed directories to the container.
# using ':ro' to make scrip directories etc. read-only. Only config and log directories are writable.
docker run \
--platform linux/amd64 \
--interactive \
--tty \
--rm \
Expand Down
1 change: 1 addition & 0 deletions src/Saas.Lib/Act.Container/build.sh
Expand Up @@ -26,3 +26,4 @@ else
docker build --no-cache --file "${ACT_CONTAINER_DIR}/Dockerfile" --tag "${tag_name}" .
fi

gh extension install https://github.com/nektos/gh-act
36 changes: 36 additions & 0 deletions src/Saas.Lib/Deployment.Container/Dockerfile.AppleSilicon
@@ -0,0 +1,36 @@
FROM --platform=linux/amd64 ubuntu:22.04

RUN apt-get update && apt-get install -y \
curl \
dnsutils \
python3-pip \
jq \
sudo \
libicu-dev \
uuid-runtime \
zip \
dos2unix \
python3-ruamel.yaml \
&& curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash

# Install latest GitHub cli (gh)
# https://github.com/cli/cli/blob/trunk/docs/install_linux.md
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y

RUN pip3 install PyYaml

# Install Azure Cli extension 'Storage-preview'
# RUN az extension add --name storage-preview

WORKDIR /asdk

# Workaround for the dotnet 7 execution with rosetta2 emulation
# https://github.com/Azure/bicep/issues/10245#issuecomment-1816816017
ENV DOTNET_EnableWriteXorExecute=0

# trust repository in container
RUN git config --global --add safe.directory /asdk
49 changes: 37 additions & 12 deletions src/Saas.Lib/Deployment.Container/build.sh
@@ -1,33 +1,58 @@
#!/usr/bin/env bash

# shellcheck disable=SC1091
source "./constants.sh"
source "$SHARED_MODULE_DIR/util-module.sh"

force_update=false

while getopts f flag
do
while getopts f flag; do
case "${flag}" in
f) force_update=true;;
*) force_update=false;;
f) force_update=true ;;
*) force_update=false ;;
esac
done

repo_base="$( git rev-parse --show-toplevel )"
repo_base="$(git rev-parse --show-toplevel)"
docker_file_folder="${repo_base}/src/Saas.Lib/Deployment.Container"

architecture="$( uname -a )"
architecture="$(uname -a)"

what_os="$(get-os)" ||
echo "Unsupported OS: ${what_os}. This script support linux (ubxl.WSL 2.0 on Windows) and MacOS." |
log-output \
--level error \
--header "Critical Error" ||
exit 1

if [[ "${force_update}" == false ]]; then
if [[ "${force_update}" == false ]]; then
if [[ "${architecture}" == *"ARM64"* ]]; then
echo "Building for ARM64 (including Apple Sillicon)..."
docker build --file "${docker_file_folder}/Dockerfile.ARM" --tag asdk-script-deployment:latest .
if [[ "${what_os}" == "linux" ]]; then
echo "Building for Linux on Arm)..."
docker build --file "${docker_file_folder}/Dockerfile.ARM" --tag asdk-script-deployment:latest .
elif [[ "${what_os}" == "macos" ]]; then
echo "Building for MacOS on Apple Silicon"
docker build --file "${docker_file_folder}/Dockerfile.AppleSilicon" --tag asdk-script-deployment:latest .
else
exit 1
fi
else
echo "Building for Linux (incl. WSL 2.0 on Windows) on x86_64)..."
docker build --file "${docker_file_folder}/Dockerfile" --tag asdk-script-deployment:latest .
fi
else
if [[ "${architecture}" == *"ARM64"* ]]; then
echo "Building for ARM64 (including Apple Sillicon)..."
docker build --no-cache --file "${docker_file_folder}/Dockerfile.ARM" --tag asdk-script-deployment:latest .
if [[ "${what_os}" == "linux" ]]; then
echo "Force building for Linux on Arm)..."
docker build --no-cache --file "${docker_file_folder}/Dockerfile.ARM" --tag asdk-script-deployment:latest .
elif [[ "${what_os}" == "macos" ]]; then
echo "Force building for MacOS on Apple Silicon"
docker build --no-cache --file "${docker_file_folder}/Dockerfile.AppleSilicon" --tag asdk-script-deployment:latest .
else
exit 1
fi
else
echo "Force building for Linux (incl. WSL 2.0 on Windows) on x86_64)..."
docker build --no-cache --file "${docker_file_folder}/Dockerfile" --tag asdk-script-deployment:latest .
fi
fi

0 comments on commit 8405fa5

Please sign in to comment.