Skip to content
This repository was archived by the owner on Oct 11, 2023. It is now read-only.

Commit 2a0be60

Browse files
committed
Merge branch 'master' of https://github.com/Azure/dev-spaces into s-tuli/AddTemplate
2 parents 72df1c5 + b4e49c3 commit 2a0be60

File tree

4 files changed

+49
-19
lines changed

4 files changed

+49
-19
lines changed

.github/workflows/bikes.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,11 @@ jobs:
4848

4949
- name: Helm Install PR
5050
run: |
51+
helm init --upgrade --wait
5152
helm upgrade --install --namespace $GITHUB_HEAD_REF bikesharing-$GITHUB_HEAD_REF samples/BikeSharingApp/Bikes/charts/bikes \
5253
--set image.repository=${{ secrets.CONTAINER_REGISTRY }}/bikes \
5354
--set image.tag=$GITHUB_SHA \
54-
--set imagePullSecrets[0].name=${{ secrets.IMAGE_PULL_SECRET }} \
55-
--set ingress.hosts[0]=$GITHUB_HEAD_REF.s.${{ secrets.MASTER_SPACE }}.bikesharing.${{ secrets.HOST_SUFFIX }} \
56-
--set ingress.annotations.kubernetes\\.io/ingress\\.class=traefik-azds
55+
--set imagePullSecrets[0].name=${{ secrets.IMAGE_PULL_SECRET }}
5756
5857
- uses: azure/dev-spaces/actions/add-review-url@Releases/v1
5958
with:

.github/workflows/bikesharing.yml

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches:
66
- master
77
paths:
8-
- samples/BikeSharingApp/**/*
8+
- samples/BikeSharingApp/**
99
- "!**/*.md"
1010

1111
jobs:
@@ -48,18 +48,43 @@ jobs:
4848
creds: '${{ secrets.AZURE_CREDENTIALS }}'
4949
cluster-name: ${{ secrets.CLUSTER_NAME }}
5050
resource-group: ${{ secrets.RESOURCE_GROUP }}
51-
51+
- uses: azure/k8s-actions/k8s-create-secret@master
52+
with:
53+
namespace: ${{ secrets.MASTER_SPACE }}
54+
container-registry-url: ${{ secrets.CONTAINER_REGISTRY }}
55+
container-registry-username: ${{ secrets.REGISTRY_USERNAME }}
56+
container-registry-password: ${{ secrets.REGISTRY_PASSWORD }}
57+
secret-name: ${{ secrets.IMAGE_PULL_SECRET }}
58+
5259
- name: Helm Install Master
5360
run: |
5461
cd samples/BikeSharingApp/charts
5562
helm init --client-only
5663
helm dependency update
64+
helm init --upgrade --wait
5765
helm upgrade --install --namespace ${{ secrets.MASTER_SPACE }} bikesharing . \
5866
--set bikes.image.repository=${{ secrets.CONTAINER_REGISTRY }}/bikes \
59-
--set bikesharingweb.image.repository=${{ secrets.CONTAINER_REGISTRY }}/bikesharingweb\
67+
--set bikes.imagePullSecrets[0].name=${{ secrets.IMAGE_PULL_SECRET }} \
68+
--set bikes.image.tag=$GITHUB_SHA \
69+
--set bikesharingweb.image.repository=${{ secrets.CONTAINER_REGISTRY }}/bikesharingweb \
70+
--set bikesharingweb.imagePullSecrets[0].name=${{ secrets.IMAGE_PULL_SECRET }} \
71+
--set bikesharingweb.image.tag=$GITHUB_SHA \
72+
--set bikesharingweb.ingress.hosts[0]=${{ secrets.HOST }} \
73+
--set bikesharingweb.ingress.annotations.kubernetes\\.io/ingress\\.class=traefik-azds \
6074
--set billing.image.repository=${{ secrets.CONTAINER_REGISTRY }}/billing \
75+
--set billing.imagePullSecrets[0].name=${{ secrets.IMAGE_PULL_SECRET }} \
76+
--set billing.image.tag=$GITHUB_SHA \
6177
--set gateway.image.repository=${{ secrets.CONTAINER_REGISTRY }}/gateway \
78+
--set gateway.imagePullSecrets[0].name=${{ secrets.IMAGE_PULL_SECRET }} \
79+
--set gateway.image.tag=$GITHUB_SHA \
80+
--set gateway.ingress.hosts[0]=${{ secrets.MASTER_SPACE }}.gateway.${{ secrets.HOST_SUFFIX }} \
81+
--set gateway.ingress.annotations.kubernetes\\.io/ingress\\.class=traefik-azds \
6282
--set reservation.image.repository=${{ secrets.CONTAINER_REGISTRY }}/reservation \
83+
--set reservation.imagePullSecrets[0].name=${{ secrets.IMAGE_PULL_SECRET }} \
84+
--set reservation.image.tag=$GITHUB_SHA \
6385
--set reservationengine.image.repository=${{ secrets.CONTAINER_REGISTRY }}/reservationengine \
86+
--set reservationengine.imagePullSecrets[0].name=${{ secrets.IMAGE_PULL_SECRET }} \
87+
--set reservationengine.image.tag=$GITHUB_SHA \
6488
--set users.image.repository=${{ secrets.CONTAINER_REGISTRY }}/users \
65-
--set image.tag=$GITHUB_SHA
89+
--set users.imagePullSecrets[0].name=${{ secrets.IMAGE_PULL_SECRET }} \
90+
--set users.image.tag=$GITHUB_SHA

samples/BikeSharingApp/Bikes/server.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ app.get('/hello', function(req, res) {
349349
});
350350

351351
// start server ------------------------------------------------------------
352-
var port = 80;
352+
var port = process.env.PORT || 3000;
353353
var server = null;
354354

355355
process.on("SIGINT", () => {
@@ -403,4 +403,4 @@ async.retry({times: 10, interval: 1000}, tryMongoConnect, function(err, result)
403403
server = app.listen(port, function () {
404404
console.log('Listening on port ' + port);
405405
});
406-
});
406+
});

samples/BikeSharingApp/README.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Follow the steps below to deploy this sample app to Azure Kubernete Service (AKS
2121

2222
1. **Enable Azure Dev Spaces on the AKS cluster.**
2323
```bash
24-
az aks use-dev-spaces -g MyResourceGroup -n MyAKS --space master --yes
24+
az aks use-dev-spaces -g MyResourceGroup -n MyAKS --space dev --yes
2525
```
2626

2727
## Deploy the BikeSharing sample app
@@ -34,33 +34,33 @@ Follow the steps below to deploy this sample app to Azure Kubernete Service (AKS
3434
cd dev-spaces/samples/BikeSharingApp/
3535
```
3636
37-
1. **Retrieve the HostSuffix for the `master` dev space.**
37+
1. **Retrieve the HostSuffix for the `dev` dev space.**
3838
```bash
3939
azds show-context
4040
4141
Name ResourceGroup DevSpace HostSuffix
4242
------------------ ---------------- -------- -----------------------
43-
MyAKS MyResourceGroup master fedcab0987.eus.azds.io
43+
MyAKS MyResourceGroup dev fedcab0987.eus.azds.io
4444
```
4545
4646
1. **Update the Helm chart with your HostSuffix.** Open [`charts/values.yaml`](https://github.com/Azure/dev-spaces/blob/master/samples/BikeSharingApp/charts/values.yaml) and replace all instances of `<REPLACE_ME_WITH_HOST_SUFFIX>` with the HostSuffix value you retrieved earlier. Save your changes and close the file.
4747
48-
1. **Deploy the sample application to Kubernetes.** We'll use Helm to run this sample application, but other tooling could be used to run your entire application in a namespace within a cluster. The Helm commands are targeting the namespace named `master` you created earlier, and can take several minutes to complete.
48+
1. **Deploy the sample application to Kubernetes.** We'll use Helm to run this sample application, but other tooling could be used to run your entire application in a namespace within a cluster. The Helm commands are targeting the namespace named `dev` you created earlier, and can take several minutes to complete.
4949
```bash
5050
cd charts/
5151
helm init --wait
52-
helm install -n bikesharing . --dep-up --namespace master --atomic
52+
helm install -n bikesharing . --dep-up --namespace dev --atomic
5353
```
5454
Note: **If you are using an RBAC-enabled cluster**, be sure to configure [a service account for Tiller](https://helm.sh/docs/using_helm/#role-based-access-control). Otherwise, `helm` commands will fail.
5555

56-
1. **Open your browser to the app's website.** Run the `azds list-uris` command to see the public endpoints in the running app. Navigate to the `bikesharingweb` service - in the below example, the public URL for the `bikesharingweb` service is http://master.bikesharingweb.fedcab0987.eus.azds.io/. Select **Aurelia Briggs (customer)** as the user, then select a bike to rent.
56+
1. **Open your browser to the app's website.** Run the `azds list-uris` command to see the public endpoints in the running app. Navigate to the `bikesharingweb` service - in the below example, the public URL for the `bikesharingweb` service is http://dev.bikesharingweb.fedcab0987.eus.azds.io/. Select **Aurelia Briggs (customer)** as the user, then select a bike to rent.
5757
```bash
5858
azds list-uris
5959
60-
Uri Status
61-
-------------------------------------------------- ---------
62-
http://master.bikesharingweb.fedcab0987.eus.azds.io/ Available
63-
http://master.gateway.fedcab0987.eus.azds.io/ Available
60+
Uri Status
61+
----------------------------------------------- ---------
62+
http://dev.bikesharingweb.fedcab0987.eus.azds.io/ Available
63+
http://dev.gateway.fedcab0987.eus.azds.io/ Available
6464
```
6565
6666
1. **Commit and push to your forked repo.** This will ensure that feature branches you create going forward will also have the configuration changes you made earlier.
@@ -77,3 +77,9 @@ Now that you have the BikeSharing app deployed in AKS, try these walkthroughs to
7777
1. **[Debug and iterate code directly in AKS.](https://docs.microsoft.com/azure/dev-spaces/quickstart-netcore)** This is similar to the first scenario, except this mode enables a *higher fidelity development and testing experience* by running your code as a container directly in AKS. Dev Spaces can help you generate Docker and Kubernetes assets.
7878
7979
1. **[Combine GitHub Actions with Dev Spaces in a pull request review.](https://aka.ms/devspaces/pr-flow)** You can use GitHub Actions to automatically deploy to a new sandbox whenever a pull request is opened so that your team can review a live version of the app that includes your pull request changes – all before that code is merged into your main branch! As a bonus, team members such as product managers and designers can become part of the review process during early stages of development.
80+
81+
## Clean up
82+
This command deletes all Azure resources created for this sample:
83+
```bash
84+
az group delete --name MyResourceGroup --yes --no-wait
85+
```

0 commit comments

Comments
 (0)