зеркало из https://github.com/microsoft/AMBROSIA.git
wrap up documentation. Add --silent-coord flag to runAmbrosiaService.sh. Move/replace helloworld aks script
This commit is contained in:
Родитель
f050bdaa89
Коммит
df3982af86
|
@ -0,0 +1,92 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
# This example uses PerformanceTestInterruptable.
|
||||
# See also the HelloWorld directory for a simpler example.
|
||||
|
||||
if [ ! -e Defs/AmbrosiaAKSConf.sh ]; then
|
||||
echo "You're not ready yet! (Defs/AmbrosiaAKSConf.sh does not exist)"
|
||||
echo
|
||||
echo "This script demonstrates the full process of provisioning and deploying AMBROSIA on K8s."
|
||||
echo "The only configuration needed is to fill out Defs/AmbrosiaAKSConf.sh.template"
|
||||
echo
|
||||
echo "Please follow the instructions in README.md and in that template file."
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
while [ $# -ge 1 ]; do
|
||||
case $1 in
|
||||
--deploy-only) DEPLOY_ONLY=1; shift ;;
|
||||
*)
|
||||
echo "Unrecognized command line argument: $1"
|
||||
exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
echo "$0: Provision and run an AMBROSIA app on Azure Kubernetes Service"
|
||||
echo "Running with these user settings:"
|
||||
( export ECHO_CORE_DEFS=1; source `dirname $0`/Defs/Common-Defs.sh)
|
||||
echo
|
||||
|
||||
source Defs/Common-Defs.sh # For PUBLIC_CONTAINER_NAME
|
||||
if [ ${PUBLIC_CONTAINER_NAME:+defined} ]; then
|
||||
echo "Error: Don't set PUBLIC_CONTAINER_NAME in your AmbrosiaAKSConf.sh."
|
||||
echo "This particular script expects to set that itself."
|
||||
exit 1
|
||||
fi
|
||||
export PUBLIC_CONTAINER_NAME=ambrosia/ambrosia-hello
|
||||
|
||||
# This should perform IDEMPOTENT OPERATIONS
|
||||
#------------------------------------------
|
||||
|
||||
if ! [ ${DEPLOY_ONLY:+defined} ]; then
|
||||
|
||||
# STEP 0: Create Azure resources.
|
||||
./Provision-Resources.sh
|
||||
|
||||
# STEPs 1-3: Secrets and Authentication
|
||||
if [ ${PUBLIC_CONTAINER_NAME:+defined} ]; then
|
||||
echo "---------PUBLIC_CONTAINER_NAME set, not creating AKS/ACR auth setup---------"
|
||||
else
|
||||
./Grant-AKS-access-ACR.sh
|
||||
./Create-AKS-ServicePrincipal-Secret.sh # TODO: bypass if $servicePrincipalId/$servicePrincipalKey are set
|
||||
fi
|
||||
./Create-AKS-SMBFileShare-Secret.sh
|
||||
|
||||
# STEP 4: Building and pushing Docker.
|
||||
if [ ${PUBLIC_CONTAINER_NAME:+defined} ]; then
|
||||
echo "---------PUBLIC_CONTAINER_NAME set, NOT building Docker container locally---------"
|
||||
else
|
||||
./Build-AKS.sh "../../InternalImmortals/PerformanceTestInterruptible/"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# STEP 5: Deploy two pods.
|
||||
echo "-----------Pre-deploy cleanup-----------"
|
||||
echo "These are the secrets Kubernetes will use to access files/containers:"
|
||||
$KUBE get secrets
|
||||
echo
|
||||
echo "Deleting all pods in this test Kubernetes instance before redeploying"
|
||||
$KUBE get pods
|
||||
time $KUBE delete pods,deployments -l app=generated-helloclient
|
||||
time $KUBE delete pods,deployments -l app=generated-helloserver
|
||||
$KUBE get pods
|
||||
|
||||
export LOCALPORT1=2000
|
||||
export LOCALPORT2=2001
|
||||
./Deploy-AKS.sh helloserver 'runAmbrosiaService.sh --verbose dotnet Server/publish/Server.dll helloserver'
|
||||
|
||||
export LOCALPORT1=1000
|
||||
export LOCALPORT2=1001
|
||||
./Deploy-AKS.sh helloclient 'runAmbrosiaService.sh --verbose dotnet Client1/publish/Client1.dll helloclient helloserver'
|
||||
|
||||
set +x
|
||||
echo "-----------------------------------------------------------------------"
|
||||
echo " ** End-to-end AKS / Kubernetes test script completed successfully. ** "
|
||||
echo
|
||||
source `dirname $0`/Defs/Common-Defs.sh
|
||||
echo "P.S. If you want to delete the ENTIRE resource group, and thus everything touched by this script, run:"
|
||||
echo " az group delete --name $AZURE_RESOURCE_GROUP"
|
||||
echo
|
|
@ -30,6 +30,12 @@ echo "Running with these user settings:"
|
|||
echo
|
||||
|
||||
source Defs/Common-Defs.sh # For PUBLIC_CONTAINER_NAME
|
||||
if [ ${PUBLIC_CONTAINER_NAME:+defined} ]; then
|
||||
echo "Error: Don't set PUBLIC_CONTAINER_NAME in your AmbrosiaAKSConf.sh."
|
||||
echo "This particular script expects to set that itself."
|
||||
exit 1
|
||||
fi
|
||||
export PUBLIC_CONTAINER_NAME=ambrosia/ambrosia-perftest
|
||||
|
||||
# This should perform IDEMPOTENT OPERATIONS
|
||||
#------------------------------------------
|
||||
|
@ -68,19 +74,10 @@ time $KUBE delete pods,deployments -l app=generated-perftestclient
|
|||
time $KUBE delete pods,deployments -l app=generated-perftestserver
|
||||
$KUBE get pods
|
||||
|
||||
# ./Deploy-AKS.sh perftestserver \
|
||||
# 'runAmbrosiaService.sh Server --sp '$LOCALPORT1' --rp '$LOCALPORT2' -j perftestclient -s perftestserver -n 1 -c'
|
||||
# ./Deploy-AKS.sh perftestclient \
|
||||
# 'runAmbrosiaService.sh Job --sp '$LOCALPORT1' --rp '$LOCALPORT2' -j perftestclient -s perftestserver --mms 65536 -n 13 -c'
|
||||
|
||||
export LOCALPORT1=2000
|
||||
export LOCALPORT2=2001
|
||||
./Deploy-AKS.sh helloserver 'runAmbrosiaService.sh dotnet Server/publish/Server.dll helloserver'
|
||||
|
||||
export LOCALPORT1=1000
|
||||
export LOCALPORT2=1001
|
||||
./Deploy-AKS.sh helloclient 'runAmbrosiaService.sh dotnet Client1/publish/Client1.dll helloclient helloserver'
|
||||
|
||||
./Deploy-AKS.sh perftestserver \
|
||||
'runAmbrosiaService.sh Server --sp '$LOCALPORT1' --rp '$LOCALPORT2' -j perftestclient -s perftestserver -n 1 -c'
|
||||
./Deploy-AKS.sh perftestclient \
|
||||
'runAmbrosiaService.sh Job --sp '$LOCALPORT1' --rp '$LOCALPORT2' -j perftestclient -s perftestserver --mms 65536 -n 13 -c'
|
||||
|
||||
set +x
|
||||
echo "-----------------------------------------------------------------------"
|
||||
|
|
|
@ -73,7 +73,14 @@ within the AKS-scripts directory. Within that config file, set:
|
|||
|
||||
AMBROSIA_SERVICE_NAME=hello
|
||||
|
||||
And now:
|
||||
And change any other parameters you like. After that, run this script
|
||||
from the AKS-scripts directory:
|
||||
|
||||
./run_helloworld_aks.sh
|
||||
./run-end-to-end-helloworld-example.sh
|
||||
|
||||
After it completes successfully, you should see two pods deploying:
|
||||
|
||||
kubectl get pods
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
cd `dirname $0`
|
||||
HELLOTOP=`pwd`
|
||||
cd ../../AKS-scripts
|
||||
|
||||
if [ ! -e Defs/AmbrosiaAKSConf.sh ]; then
|
||||
echo "You're not ready yet! (Defs/AmbrosiaAKSConf.sh does not exist)"
|
||||
echo
|
||||
echo "This script demonstrates the full process of provisioning and deploying AMBROSIA on K8s."
|
||||
echo "The only configuration needed is to fill out Defs/AmbrosiaAKSConf.sh.template"
|
||||
echo
|
||||
echo "Please follow the instructions in README.md and in that template file."
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "$0: Provision and run an AMBROSIA app on Azure Kubernetes Service"
|
||||
echo "Running with these user settings:"
|
||||
( export ECHO_CORE_DEFS=1; source `dirname $0`/Defs/Common-Defs.sh)
|
||||
echo
|
||||
|
||||
# This should perform IDEMPOTENT OPERATIONS
|
||||
#------------------------------------------
|
||||
|
||||
# STEP 0: Create Azure resources.
|
||||
./Provision-Resources.sh
|
||||
|
||||
# STEPs 1-3: Secrets and Authentication
|
||||
./Grant-AKS-access-ACR.sh
|
||||
./Create-AKS-ServicePrincipal-Secret.sh # TODO: bypass if $servicePrincipalId/$servicePrincipalKey are set
|
||||
./Create-AKS-SMBFileShare-Secret.sh
|
||||
|
||||
# STEP 4: Building and pushing Docker.
|
||||
./Build-AKS.sh "."
|
||||
|
||||
# STEP 5: Deploy two pods.
|
||||
echo "-----------Pre-deploy cleanup-----------"
|
||||
source Defs/Common-Defs.sh
|
||||
echo "These are the secrets Kubernetes will use to access files/containers:"
|
||||
$KUBE get secrets
|
||||
echo
|
||||
echo "Deleting all pods in this test Kubernetes instance before redeploying"
|
||||
$KUBE get pods
|
||||
time $KUBE delete pods,deployments -l app=generated-helloclient
|
||||
time $KUBE delete pods,deployments -l app=generated-helloserver
|
||||
$KUBE get pods
|
||||
|
||||
export LOCALPORT1=2000
|
||||
export LOCALPORT2=2001
|
||||
./Deploy-AKS.sh helloserver 'runAmbrosiaService.sh dotnet Client1/publish/Client1.dll helloclient helloserver'
|
||||
|
||||
export LOCALPORT1=1000
|
||||
export LOCALPORT2=1001
|
||||
./Deploy-AKS.sh helloclient 'runAmbrosiaService.sh dotnet Server/publish/Server.dll helloserver'
|
||||
|
||||
set +x
|
||||
echo "-----------------------------------------------------------------------"
|
||||
echo " ** End-to-end AKS / Kubernetes test script completed successfully. ** "
|
||||
echo
|
||||
source `dirname $0`/Defs/Common-Defs.sh
|
||||
echo "P.S. If you want to delete the ENTIRE resource group, and thus everything touched by this script, run:"
|
||||
echo " az group delete --name $AZURE_RESOURCE_GROUP"
|
||||
echo
|
|
@ -28,7 +28,7 @@ then COORDTAG="ImmortalCoord"
|
|||
fi
|
||||
|
||||
function print_usage() {
|
||||
echo "USAGE: $0 [--quiet] <service-binary> <service-args>*"
|
||||
echo "USAGE: $0 [--silent-coord] [--verbose] <service-binary> <service-args>*"
|
||||
echo
|
||||
echo "This script takes a command (and arguments) that runs the application binary."
|
||||
echo "The script launches the ImmortalCoordinator in the background before launching"
|
||||
|
@ -50,7 +50,8 @@ function print_usage() {
|
|||
|
||||
while [ $# -ge 1 ]; do
|
||||
case $1 in
|
||||
--quiet) shift; RUNAMBROSIA_QUIET=1 ;;
|
||||
--silent-coord) shift; AMBROSIA_SILENT_COORDINATOR=1 ;;
|
||||
--verbose) shift; RUNAMBROSIA_VERBOSE=1 ;;
|
||||
*) break ;;
|
||||
esac
|
||||
done
|
||||
|
@ -66,10 +67,9 @@ if ! [[ ${AMBROSIA_INSTANCE_NAME:+defined} ]]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ${RUNAMBROSIA_QUIET:+defined} ]];
|
||||
then AMBROSIA_SILENT_COORDINATOR=1
|
||||
function tag() { return; }
|
||||
else function tag() { echo " $TAG $*"; }
|
||||
if [[ ${RUNAMBROSIA_VERBOSE:+defined} ]];
|
||||
then function tag() { echo " $TAG $*"; }
|
||||
else function tag() { return; }
|
||||
fi
|
||||
|
||||
if [[ ${AMBROSIA_IMMORTALCOORDINATOR_PORT:+defined} ]];
|
||||
|
|
Загрузка…
Ссылка в новой задаче