Skip to content

Commit 549d2af

Browse files
committed
Add some extra ideas cribbed from Matt's demo
1 parent aaecb95 commit 549d2af

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

cosmos-todo-list/README.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,13 @@ You can monitor their progress with:
5252
```sh
5353
watch kubectl get -n cosmosdb resourcegroup,databaseaccount,sqldatabase,sqldatabasecontainer
5454
```
55-
5655
You can also find the resource group in the [Azure portal](https://portal.azure.com) and watch the Cosmos DB resources being created there.
5756

57+
It could take a few minutes for the Cosmos DB resources to be provisioned.
58+
In that time you might see some `ResourceNotFound` errors, or messages indicating that the database account isn't ready, on the SQL database or container.
59+
This is OK!
60+
The operator will keep creating them once the account is available and the errors should eventually resolve themselves.
61+
5862
## Create the `cosmos-settings` secret
5963

6064
We need to provide the web application with access to the database.
@@ -64,6 +68,9 @@ COSMOS_DB_ACCOUNT="$(az cosmosdb show --resource-group aso-cosmos-demo --name sa
6468
COSMOS_DB_KEY="$(az cosmosdb keys list --resource-group aso-cosmos-demo --name sampledbaccount -otsv --query 'primaryMasterKey')"
6569
```
6670

71+
Another option is to get the account URI and key from the [portal](https://portal.azure.com).
72+
You can find them on the Keys page of the Cosmos DB account.
73+
6774
Then create the secret the pod will use with:
6875
```sh
6976
kubectl --namespace cosmosdb create secret generic cosmos-settings \
@@ -73,7 +80,7 @@ kubectl --namespace cosmosdb create secret generic cosmos-settings \
7380
--from-literal=ContainerName="sample-sql-container"
7481
```
7582

76-
(Secret handling is an area we're still working on in ASO - in the future the operator should automatically get these details from Azure and create the secret itself once the database account is ready.)
83+
(Secret handling is an area we're still working on in ASO - in the future the operator should automatically get these details from Azure and create the secret itself once the database account is ready. See [#1471](https://github.com/Azure/azure-service-operator/issues/1471) for more details.)
7784

7885
## Deploy the web application
7986

@@ -95,5 +102,18 @@ kubectl port-forward -n cosmosdb service/cosmos-todo-service 8080:80
95102
```
96103

97104
Now visiting [http://localhost:8080](http://localhost:8080) in your browser will hit the Cosmos DB application.
105+
You can create todo items and mark them as complete!
106+
107+
Use the Cosmos DB account Data Explorer on the portal to expand the database and container, and you can see the todo-list items stored by the web app.
98108

99109
If you're interested in how the todo application uses the Cosmos DB API, the code is available [here](https://github.com/Azure-Samples/cosmos-dotnet-core-todo-app/tree/main/src).
110+
111+
## Clean up
112+
113+
When you're finished with the sample application you can clean all of the Kubernetes and Azure resources up by deleting the `cosmosdb` namespace in your cluster.
114+
```sh
115+
kubectl delete namespace cosmosdb
116+
```
117+
118+
Kubernetes will delete the web application pod and the operator will delete the Azure resource group and all the Cosmos DB resources.
119+
(Deleting a Cosmos DB account can take several minutes.)

0 commit comments

Comments
 (0)