Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing the Core Extra structure (DO NOT MERGE, yet) #506

Draft
wants to merge 78 commits into
base: 505-make-the-shortenertoolcore-a-completed-package
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
aede10a
ci: add Azure Static Web Apps workflow file
fboucheros Jun 16, 2023
ff180e1
Merge branch 'microsoft:main' into main
fboucheros Jun 23, 2023
8d206d8
Delete .github/workflows directory
fboucheros Jun 28, 2023
90a8526
move redirect to Core
FBoucher Jun 28, 2023
01bf1b3
Create Azure FuncTionsLight
FBoucher Jun 28, 2023
6415b1f
list done
FBoucher Jul 3, 2023
d9be5c7
adding FunctionLight to solution and fix errors
FBoucher Jul 7, 2023
4a27644
Create done
FBoucher Jul 7, 2023
40f8f57
Update done
FBoucher Jul 7, 2023
6b8738d
update implemented
FBoucher Jul 11, 2023
21a4678
Archive done
FBoucher Jul 11, 2023
d7add28
clickStats done
FBoucher Jul 14, 2023
5207be3
wrapthe request validation in a func
FBoucher Jul 14, 2023
d34efff
conditional azure function deployment
fboucheros Aug 11, 2023
bca500f
ci: add Azure Static Web Apps workflow file
fboucheros Aug 11, 2023
dd5e12b
host.json file cannot specify a http.routePrefix value other than 'api'
FBoucher Aug 15, 2023
9c53fd8
cleaning to re test
FBoucher Aug 15, 2023
6b1da63
ci: add Azure Static Web Apps workflow file
fboucheros Aug 15, 2023
4cdc144
config DataStorage need to be injected into swa
FBoucher Aug 15, 2023
189c984
expecting one value not an array
FBoucher Aug 15, 2023
7f3a21a
Try with basic def of SWA
FBoucher Aug 18, 2023
1244120
ci: add Azure Static Web Apps workflow file
fboucheros Aug 18, 2023
7916548
remove old dependencies
FBoucher Aug 18, 2023
253ee7b
Merge remote-tracking branch 'origin/core-extra' into core-extra
FBoucher Aug 18, 2023
db7c062
adding SWA in the template
FBoucher Aug 18, 2023
264fd2b
need the full version
FBoucher Aug 18, 2023
597f447
let's try dynamic routePrefix
FBoucher Aug 18, 2023
e9928f3
ci: add Azure Static Web Apps workflow file
fboucheros Aug 18, 2023
6bde24a
removing trace of route
FBoucher Aug 18, 2023
3a52157
adding traces
FBoucher Aug 18, 2023
5d61c02
Change host file
fboucheros Nov 10, 2023
0244b1c
ci: add Azure Static Web Apps workflow file
fboucheros Nov 10, 2023
44e8d48
remove old workflow
fboucheros Nov 10, 2023
35b6b62
update path
fboucheros Nov 10, 2023
d5d92e6
moving out the redirect
fboucheros Nov 10, 2023
af3cf20
cleaning files
fboucheros Nov 13, 2023
3d32aef
more cleaning
fboucheros Nov 13, 2023
24049b8
swa cli update
FBoucher Nov 14, 2023
7765c1f
remove workflow for test
fboucheros Mar 3, 2024
e686db5
ci: add Azure Static Web Apps workflow file
fboucheros Mar 3, 2024
5ba3bd8
dummy test
FBoucher Mar 3, 2024
fd65cd8
ci: add Azure Static Web Apps workflow file
fboucheros Mar 3, 2024
f700816
test 2
FBoucher Mar 3, 2024
c92b78a
update from merge
fboucheros Mar 3, 2024
b7ec3e8
remove previous cicd
fboucheros Mar 3, 2024
40cc220
upgrade to dotnet 8
fboucheros Mar 16, 2024
a749e54
Merge branch 'core-extra-simpler' of github.com:fboucheros/AzUrlShort…
fboucheros Mar 16, 2024
68fc020
dotnet 8 and try catch
fboucheros Mar 16, 2024
a7b5b1d
upgrade to net 8.0
fboucheros Mar 16, 2024
bcd3781
ci: add Azure Static Web Apps workflow file
fboucheros Mar 16, 2024
766e186
update actions
fboucheros Mar 16, 2024
ad2c944
upgrade .NET 8 dependencies
fboucheros Mar 16, 2024
2c99ee7
Merge branch 'core-extra-simpler' into core-extra
fboucheros Mar 16, 2024
66425b1
fixing merge
fboucheros Mar 16, 2024
8257748
remove workflow to test new deployment
fboucheros Mar 17, 2024
6245d94
ci: add Azure Static Web Apps workflow file
fboucheros Mar 17, 2024
69e9dea
Update azure-static-web-apps-nice-forest-0ccb27a10.yml
fboucheros Mar 17, 2024
b8a1629
set template to net8 and linux
fboucheros Mar 17, 2024
acb71ae
remove workflow before testing
fboucheros Mar 18, 2024
96c46d6
ci: add Azure Static Web Apps workflow file
fboucheros Mar 18, 2024
04b6984
ci: add Azure Static Web Apps workflow file
fboucheros Mar 18, 2024
32feac0
removing extra flow
fboucheros Mar 18, 2024
f379cd9
clean before new test
fboucheros Mar 18, 2024
ac3c528
ci: add Azure Static Web Apps workflow file
fboucheros Mar 18, 2024
96e678e
test one shot deployment
fboucheros Mar 18, 2024
d5f6168
remove workflow
fboucheros Mar 18, 2024
f4242bb
add sku and dependencies
fboucheros Mar 18, 2024
0c48744
ci: add Azure Static Web Apps workflow file
fboucheros Mar 18, 2024
9819183
template upgrade and workflow delete
fboucheros Mar 18, 2024
a9496bd
ci: add Azure Static Web Apps workflow file
fboucheros Mar 18, 2024
6fab058
Add or update the Azure App Service build and deployment workflow config
fboucheros Mar 19, 2024
40ea8ca
Update core-extra_testtest5.yml
fboucheros Mar 19, 2024
ab26fbb
workflow test
fboucheros Mar 19, 2024
4d92ec9
clean flow
fboucheros Mar 19, 2024
8dfd311
Add or update the Azure App Service build and deployment workflow config
fboucheros Mar 19, 2024
246e8cf
set path to func
fboucheros Mar 19, 2024
d418073
test without SWA
fboucheros Mar 19, 2024
363129c
remove all trace of SWA in template
fboucheros Mar 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Find the Dockerfile at this URL
# https://github.com/Azure/azure-functions-docker/blob/dev/host/4/bullseye/amd64/python/python39/python39-core-tools.Dockerfile
FROM mcr.microsoft.com/azure-functions/python:4-python3.9-core-tools

# Copy library scripts to execute
COPY library-scripts/*.sh library-scripts/*.env /tmp/library-scripts/

# Install Node.js, Azure Static Web Apps CLI and Azure Functions Core Tools
ARG NODE_VERSION="16"
ARG CORE_TOOLS_VERSION="4"
ENV NVM_DIR="/usr/local/share/nvm" \
NVM_SYMLINK_CURRENT=true \
PATH="${NVM_DIR}/current/bin:${PATH}"
RUN bash /tmp/library-scripts/node-debian.sh "${NVM_DIR}" "${NODE_VERSION}" "${USERNAME}" \
&& su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1" \
&& su vscode -c "umask 0002 && npm install --cache /tmp/empty-cache -g @azure/static-web-apps-cli" \
&& if [ $CORE_TOOLS_VERSION != "4" ]; then apt-get remove -y azure-functions-core-tools-4 && apt-get update && apt-get install -y "azure-functions-core-tools-${CORE_TOOLS_VERSION}"; fi \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*

# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>

# [Optional] Uncomment this line to install global node packages.
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
37 changes: 37 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "Azure Static Web Apps",
"build": {
"dockerfile": "Dockerfile",
"args": {
// Please look at runtime version support to make sure you're using compatible versions
// https://docs.microsoft.com/en-us/azure/azure-functions/supported-languages#languages-by-runtime-version
"NODE_VERSION": "16",
"CORE_TOOLS_VERSION": "4"
}
},
"forwardPorts": [ 7071, 4280 ],

// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-azuretools.vscode-azurefunctions",
"ms-azuretools.vscode-azurestaticwebapps",
"ms-dotnettools.csharp",
"ms-python.python",
"dbaeumer.vscode-eslint"
]
}
},

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "node --version",

// Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode",
"features": {
"ghcr.io/jlaundry/devcontainer-features/azure-functions-core-tools:1": {}
}
}
170 changes: 170 additions & 0 deletions .devcontainer/library-scripts/node-debian.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
#!/bin/bash
#-------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------
#
# Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/node.md
# Maintainer: The VS Code and Codespaces Teams
#
# Syntax: ./node-debian.sh [directory to install nvm] [node version to install (use "none" to skip)] [non-root user] [Update rc files flag] [install node-gyp deps]

export NVM_DIR=${1:-"/usr/local/share/nvm"}
export NODE_VERSION=${2:-"lts"}
USERNAME=${3:-"automatic"}
UPDATE_RC=${4:-"true"}
INSTALL_TOOLS_FOR_NODE_GYP="${5:-true}"
export NVM_VERSION="0.38.0"

set -e

if [ "$(id -u)" -ne 0 ]; then
echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
exit 1
fi

# Ensure that login shells get the correct path if the user updated the PATH using ENV.
rm -f /etc/profile.d/00-restore-env.sh
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
chmod +x /etc/profile.d/00-restore-env.sh

# Determine the appropriate non-root user
if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then
USERNAME=""
POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)")
for CURRENT_USER in ${POSSIBLE_USERS[@]}; do
if id -u ${CURRENT_USER} > /dev/null 2>&1; then
USERNAME=${CURRENT_USER}
break
fi
done
if [ "${USERNAME}" = "" ]; then
USERNAME=root
fi
elif [ "${USERNAME}" = "none" ] || ! id -u ${USERNAME} > /dev/null 2>&1; then
USERNAME=root
fi

updaterc() {
if [ "${UPDATE_RC}" = "true" ]; then
echo "Updating /etc/bash.bashrc and /etc/zsh/zshrc..."
if [[ "$(cat /etc/bash.bashrc)" != *"$1"* ]]; then
echo -e "$1" >> /etc/bash.bashrc
fi
if [ -f "/etc/zsh/zshrc" ] && [[ "$(cat /etc/zsh/zshrc)" != *"$1"* ]]; then
echo -e "$1" >> /etc/zsh/zshrc
fi
fi
}

# Function to run apt-get if needed
apt_get_update_if_needed()
{
if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
echo "Running apt-get update..."
apt-get update
else
echo "Skipping apt-get update."
fi
}

# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
apt_get_update_if_needed
apt-get -y install --no-install-recommends "$@"
fi
}

# Ensure apt is in non-interactive to avoid prompts
export DEBIAN_FRONTEND=noninteractive

# Install dependencies
check_packages apt-transport-https curl ca-certificates tar gnupg2 dirmngr

# Install yarn
if type yarn > /dev/null 2>&1; then
echo "Yarn already installed."
else
# Import key safely (new method rather than deprecated apt-key approach) and install
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor > /usr/share/keyrings/yarn-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/yarn-archive-keyring.gpg] https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list
apt-get update
apt-get -y install --no-install-recommends yarn
fi

# Adjust node version if required
if [ "${NODE_VERSION}" = "none" ]; then
export NODE_VERSION=
elif [ "${NODE_VERSION}" = "lts" ]; then
export NODE_VERSION="lts/*"
fi

# Create a symlink to the installed version for use in Dockerfile PATH statements
export NVM_SYMLINK_CURRENT=true

# Install the specified node version if NVM directory already exists, then exit
if [ -d "${NVM_DIR}" ]; then
echo "NVM already installed."
if [ "${NODE_VERSION}" != "" ]; then
su ${USERNAME} -c ". $NVM_DIR/nvm.sh && nvm install ${NODE_VERSION} && nvm clear-cache"
fi
exit 0
fi

# Create nvm group, nvm dir, and set sticky bit
if ! cat /etc/group | grep -e "^nvm:" > /dev/null 2>&1; then
groupadd -r nvm
fi
umask 0002
usermod -a -G nvm ${USERNAME}
mkdir -p ${NVM_DIR}
chown :nvm ${NVM_DIR}
chmod g+s ${NVM_DIR}
su ${USERNAME} -c "$(cat << EOF
set -e
umask 0002
# Do not update profile - we'll do this manually
export PROFILE=/dev/null
ls -lah /home/${USERNAME}/.nvs || :
curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh | bash
source ${NVM_DIR}/nvm.sh
if [ "${NODE_VERSION}" != "" ]; then
nvm alias default ${NODE_VERSION}
fi
nvm clear-cache
EOF
)" 2>&1
# Update rc files
if [ "${UPDATE_RC}" = "true" ]; then
updaterc "$(cat <<EOF
export NVM_DIR="${NVM_DIR}"
[ -s "\$NVM_DIR/nvm.sh" ] && . "\$NVM_DIR/nvm.sh"
[ -s "\$NVM_DIR/bash_completion" ] && . "\$NVM_DIR/bash_completion"
EOF
)"
fi

# If enabled, verify "python3", "make", "gcc", "g++" commands are available so node-gyp works - https://github.com/nodejs/node-gyp
if [ "${INSTALL_TOOLS_FOR_NODE_GYP}" = "true" ]; then
echo "Verifying node-gyp OS requirements..."
to_install=""
if ! type make > /dev/null 2>&1; then
to_install="${to_install} make"
fi
if ! type gcc > /dev/null 2>&1; then
to_install="${to_install} gcc"
fi
if ! type g++ > /dev/null 2>&1; then
to_install="${to_install} g++"
fi
if ! type python3 > /dev/null 2>&1; then
to_install="${to_install} python3-minimal"
fi
if [ ! -z "${to_install}" ]; then
apt_get_update_if_needed
apt-get -y install ${to_install}
fi
fi

echo "Done!"
6 changes: 0 additions & 6 deletions src/.vscode/extensions.json

This file was deleted.

32 changes: 0 additions & 32 deletions src/.vscode/launch.json

This file was deleted.

117 changes: 0 additions & 117 deletions src/.vscode/tasks.json

This file was deleted.

Loading