Azure / Azure/Azure-Spring-Apps

New Spring Boot (blue/green) deployment with database access fails to start

オープン
#52 コメント 4 件 リアクション 0 件 担当者 1 名 @LGDoor が担当を希望しています GitHub で見る
Tracking
主要言語
言語のデータがありません
スター
9
フォーク
11
PR マージ指標
30日以内にマージされた PR はありません

説明

**Describe the bug**
Initial (blue) deployment of a Spring Boot 3.1.x app accessing an existing MySQL db in Azure using a Service Connector works. Creating a second (green) deployment and Service Connector results in a failed application start, complaining that it can't find the database.

**To Reproduce**
Steps to reproduce the behavior:

1. Clone the repo at https://github.com/mkheck/azure-spring-apps-training
2. Complete the code in chapter 7 for weather-service and build it with ./mvnw clean package -DskipTests
3. Deploy it per chapter 7
4. Follow these steps to get the required MySQL details for use in creating the Service Connector for the new (green) deployment:

export AZ_RESOURCE_GROUP=
export AZ_SPRING_APPS_NAME=
export MYSQL_TARGET_ID="$(az mysql server list --query '[0].id' -g $AZ_RESOURCE_GROUP)"
export MYSQL_SERVERNAME=$(az mysql server list -g $AZ_RESOURCE_GROUP --query '[0].name' -o tsv)
export MYSQL_USERNAME="$(az mysql server list -g $AZ_RESOURCE_GROUP --query '[0].administratorLogin' -o tsv)@${MYSQL_SERVERNAME}"
export MYSQL_HOST="$(az mysql server list -g $AZ_RESOURCE_GROUP --query '[0].fullyQualifiedDomainName' -o tsv)"
env | grep MYSQL

The last command above just verifies the env vars were successfully populated, of course.

Configure the Service Connector for the green deployment:

az spring connection create mysql --app weather-service --deployment green --client-type springBoot --database $MYSQL_SERVERNAME --server $MYSQL_HOST --tg $AZ_RESOURCE_GROUP -g $AZ_RESOURCE_GROUP --service $AZ_SPRING_APPS_NAME

az spring connection create mysql --app weather-service --deployment green --client-type springBoot --database $MYSQL_SERVERNAME --server $MYSQL_HOST --tg $AZ_RESOURCE_GROUP -g $AZ_RESOURCE_GROUP --service $AZ_SPRING_APPS_NAME

az spring app deploy -n weather-service -d green --artifact-path target/demo-0.0.1-SNAPSHOT.jar -s $AZ_SPRING_APPS_NAME -g $AZ_RESOURCE_GROUP

**Expected behavior**
Preferably, a Service Connector should work for _all_ deployments unless a particular deployment is specified. That would have eliminated the need to define a second Service Connector and should have avoided this issue entirely. That seems to have been the case in earlier versions of ASC/ASA.

Failing that, performing the above steps should result in successful startup of the new (green) deployment.

**Screenshots**
Please contact if you need any screenshots, but visually there isn't much to see: only a failed startup in the Azure Portal.

**Additional context**

**Can we contact you for additional details?** Y/N

Absolutely, always happy to help.

If yes, please send us your contact information to AzureSpringCloud-Talk@service.microsoft.com and include the issue number in the email title.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。