microsoft / azure-spring-apps-training

Guides and tutorials to make the most out of Azure Spring Apps
MIT License
431 stars 284 forks source link

the following arguments are required: --service/-s #147

Closed javaHelper closed 2 years ago

javaHelper commented 2 years ago

I'm trying to deploy code through command line, it's asking me to create the Cluster, but neither your step suggest to

C:\Users\pc\simple-microservice>az spring-cloud app deploy -n simple-microservice --artifact-path target/demo-0.0.1-SNAPSHOT.jar -g spring-cloud-lab
the following arguments are required: --service/-s

Examples from AI knowledge base:
az spring-cloud app deploy -n MyApp -s MyCluster -g MyResourceGroup
Deploy source code to an app. This will pack current directory, build binary with Pivotal Build Service and then deploy to the app.

az spring-cloud app deploy -n MyApp -s MyCluster -g MyResourceGroup -d green-deployment
Deploy source code to a specific deployment of an app.

az spring-cloud app deploy -n MyApp -s MyCluster -g MyResourceGroup --container-image contoso/your-app:v1
Deploy a container image on Docker Hub to an app.

https://aka.ms/cli_ref
Read more about the command in reference docs
jdubois commented 2 years ago

Hi @javaHelper! To setup the cluster, did you follow https://github.com/microsoft/azure-spring-cloud-training/blob/master/01-create-an-azure-spring-cloud-instance/README.md ? This is step 1, "01 - Create an Azure Spring Cloud instance".

javaHelper commented 2 years ago

Yes I followed steps mentioned here - "01 - Create an Azure Spring Cloud instance". If you see the readme, I specifically dont see any instructions to create the cluster. Does cluster word refers to kubernates cluster? <I'm fairly new to Azure>

jdubois commented 2 years ago

The cluster is a Spring Cloud cluster - to answer your other question, it's indeed a Kubernetes cluster underneath, but you don't have direct access to it. You create it at the end of step 1, when you run the az spring-cloud create command line near the end. You then configure it to be the default cluster, that's why you won't need to refer to it in the next steps.

javaHelper commented 2 years ago

Thanks for the details, this is what I've tried and still no luck

C:\Users\pc\simple-microservice>set AZ_RESOURCE_GROUP=spring-cloud-lab

C:\Users\pc\simple-microservice>set AZ_SPRING_CLOUD_NAME=azure-spring-cloud-lab-prateek

C:\Users\pc\simple-microservice>az spring-cloud create -g "$AZ_RESOURCE_GROUP" -n "$AZ_SPRING_CLOUD_NAME" --sku standard
Parameter 'resource_group_name' must conform to the following pattern: '^[-\\w\\._\\(\\)]+$'.

C:\Users\pc\simple-microservice>az spring-cloud create -g spring-cloud-lab -n azure-spring-cloud-lab-prateek --sku standard
 - Creating Service ..
jdubois commented 2 years ago

It seems you're not using Git Bash (which is in the prerequisites at https://github.com/microsoft/azure-spring-cloud-training/blob/master/00-setup-your-environment/README.md ), so your "$AZ_RESOURCE_GROUP" isn't being extrapolated. That would explain why you have the error Parameter 'resource_group_name' must conform to the following pattern: '^[-\\w\\._\\(\\)]+$'(as you now have $in the name of your resource group. As the resource group isn't correct, then the cluster isn't created.

jdubois commented 2 years ago

I can't guarantee that the rest of the training will work if you don't use Git Bash, it hasn't been tested with another shell and there is quite a lot of commands in the next units. Anyway, it still seems that the way you configure your resource group isn't good, as the name should have a length that is greater than 1. I'm not sure how to do this outside of Bash, I believe you need to use something like %AZ_RESOURCE_GROUP%, but I haven't done this for something like 15 years so again I can't guarantee it will work.

javaHelper commented 2 years ago

Thanks, great help, things are working fine. I had to create the Resource Group manually and now things have worked via command line - git bash

image

jdubois commented 2 years ago

Awesome! And congrats :-)