This sample shows how to use temporary and persistent storage in Azure Spring Apps.
- Run
mvn clean package
understorage-sample
. - Install Azure CLI extension for Azure Spring Apps by running below command.
az extension add -y --source https://azureclitemp.blob.core.windows.net/spring-cloud/spring_cloud-0.1.0-py2.py3-none-any.whl
- Create an instance of Azure Spring Apps.
az spring-cloud create -n <resource name> -g <resource group name>
- Create an app with public domain assigned and persistent storage enabled.
az spring-cloud app create -n <app name> -s <resource name> -g <resource group name> --is-public true --enable-persistent-storage true
- Deploy app with jar
az spring-cloud app deploy -n <app name> -s <resource name> -g <resource group name> --jar-path ./target/storage-sample-1.0-SNAPSHOT.jar
- Verify app is running. Instances should have status
RUNNING
and discoveryStatusUP
.
az spring-cloud app show -n <app name> -s <resource name> -g <resource group name>
- Verify sample is working. The url is fetched from previous step.
# Write content of flie-name under temporary storage
curl -X PUT {url}/tmp/{file-name}?content={content}
# Get content of file-name
curl {url}/tmp/{file-name}
# return content you wrote before
# Write content of flie-name under persistent storage
curl -X PUT {url}/persistent/{file-name}?content={content}
# Get content of file-name
curl {url}/persistent/{file-name}
# return content you wrote before