Azure / awesome-azd

An awesome list that curates content (articles, videos, tutorials and docs) and templates (ready to use) for the Azure Developer CLI (`azd`). Plus a hosted azd-templates Gallery to simplify search & discovery
https://aka.ms/awesome-azd
MIT License
160 stars 81 forks source link

[New azd-template] Flask container with CDN #89

Closed pamelafox closed 1 year ago

pamelafox commented 1 year ago

New azd-template Submission

Fill in the sections below to populate a new gallery card for your template. All fields are mandatory unless explicitly identified as optional

1. Description

1-2 sentence description of the architecture or solution that is defined by the template. If this is a requested template, please tag the GitHub issue containing the request.

A simple photos website written with Python Flask and Bootstrap. Can be run locally with Docker and then deployed to Azure Container Apps with an Azure CDN in front.

2. Author Information

Name: Pamela Fox

Link: https://github.com/pamelafox

3. Template Repo

The GitHub repo containing the template being contributed-- must be a valid, complete template

https://github.com/pamelafox/flask-gallery-container-app

4. Link to PR where you made your repo azd compatible

To allow us to provide feedback on your template, please include a link to the PR where you added azd compatibility

Sorry, there's not one particular PR, but you can check azure.yaml, the infra/ folder, and .github/workflows.

5. Tags

Standard: One or more tags representing the template. Look at the currently available tags on the Gallery page. Provide at least 1 tag for programming language used and at least 1 tag for Azure services integrated. Also tag the IaC provider (Bicep or Terraform)

Python, Flask, Web Apps, Azure Container Apps

Additional: Don't see a relevant tag for your template? Suggest tags to be added and used for your template. These could be new languages, services, or application domains.

Azure CDN

6. Architecture Diagram or Application Screenshot

Used as display image for gallery card-- should include all services and their connections. Example

readme_diagram

7. Related Issues (optional)

Is this a template that was requested in a separate issue? If so, please tag the related issue here.

Next Steps

Once submitted, the issue will be reviewed - we plan to do reviews on a rolling basis at regular intervals. The process will include verifying all information required for the template gallery is provided and the template works (i.e., successfully deploys to Azure with azd up).

rajeshkamal5050 commented 1 year ago

@v-xuto can you do a dry-run on this template and update here for any issues/feedback?

v-xuto commented 1 year ago

@pamelafox We have finished testing this template. There is only one small issue, the discussion link in README is unavailable, please update README. image

pamelafox commented 1 year ago

Thanks! I've removed the link and just bolded the word (it's a tab on the Github page, so fairly easy to find).

jongio commented 1 year ago

@pamelafox - Can you get your new resources in azure-dev/core?

pamelafox commented 1 year ago

Do you mean the CDN stuff? The most reusable bit is the CDN profile: https://github.com/pamelafox/flask-gallery-container-app/blob/main/infra/cdn-profile.bicep

The endpoint is a lot more variable since it depends what rules you want: https://github.com/pamelafox/flask-gallery-container-app/blob/main/infra/cdn-endpoint.bicep

If I made the CDN endpoint into a module, devs would still need to pass in their lengthy rules (and possibly other customizations). But maybe it's still useful?

v-xuto commented 1 year ago

@pamelafox Please add expected results for try '/hello?name=yourname' on the Readme.

image

pamelafox commented 1 year ago

I've updated the readme step to say "Confirm the photos load on the index page and click a photo to see the order page." Good catch!

v-xuto commented 1 year ago

@jongio We have run this template without any issues. Please review it.

pamelafox commented 1 year ago

After a discussion with some App Service and ACA PMs last week, I've realized that websites aren't the most appropriate use of ACA. A website should be hosted as a BYOC Web App, which azd does not yet support (https://github.com/Azure/azure-dev/issues/1608). This article goes more into optimal uses of ACA: https://learn.microsoft.com/en-us/azure/container-apps/compare-options

So my proposal is to table this template until azd supports BYOC, and I will submit another template instead that's more of a service than a website. It's nearly done, will send today. The infrastructure will be the same.

@jongio I'll also send a PR for cdn modules in azure-dev infra.

pamelafox commented 1 year ago

Another option: I could also turn this into an App Service template, since App Service + CDN would be a standard combo.

pamelafox commented 1 year ago

Here's my API-oriented version of this architecture: https://github.com/Azure/awesome-azd/issues/98

pamelafox commented 1 year ago

Update: I ran the numbers today on my personal websites, and hosting on ACA with a CDN in front is actually much more cost effective than App Service + CDN, due the way ACA pricing is done. My ACA is $3 ($0 for the CDN at my traffic level), whereas App Service is $12. So another reason for ACA plus CDN being a viable option.

jongio commented 1 year ago

:shipit:

rajeshkamal5050 commented 1 year ago

@hemarina please add it to the gallery