diff --git a/.all-contributorsrc b/.all-contributorsrc index a19f6ba3..ad2b9a56 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -112,6 +112,16 @@ "contributions": [ "doc" ] + }, + { + "login": "jasonhand", + "name": "Jason Hand", + "avatar_url": "https://avatars0.githubusercontent.com/u/1173344?v=4", + "profile": "http://www.jasonhand.com", + "contributions": [ + "doc", + "infra" + ] } ] } diff --git a/.dependabot/config.yml b/.dependabot/config.yml deleted file mode 100644 index 6aab95d4..00000000 --- a/.dependabot/config.yml +++ /dev/null @@ -1,18 +0,0 @@ -version: 1 -update_configs: - - package_manager: "dotnet:nuget" - directory: "/src/shortenerTools" - update_schedule: "monthly" - default_assignees: - - "fboucher" - default_reviewers: - - "fboucher" - target_branch: "vnext" - - package_manager: "dotnet:nuget" - directory: "/src/adminTools/adminBlazorWebsite/src" - update_schedule: "monthly" - default_assignees: - - "fboucher" - default_reviewers: - - "fboucher" - target_branch: "vnext" \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..1d5e05f5 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,29 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "nuget" + directory: "/src/shortenerTools" + schedule: + interval: "monthly" + assignees: + - "fboucher" + reviewers: + - "fboucher" + labels: + - dependencies + - Serverless-Backend + - package-ecosystem: "nuget" + directory: "/src/adminTools/adminBlazorWebsite/src" + schedule: + interval: "monthly" + assignees: + - "fboucher" + reviewers: + - "fboucher" + labels: + - dependencies + - frontend diff --git a/README.md b/README.md index f3a1fa3e..c75d13ab 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![GLO Board](https://img.shields.io/badge/with-GLO_Board-orange/?color=05887F&logoWidth=15&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFgAAABMCAMAAADeDICLAAAABlBMVEX///8A/+Bm7Mx0AAAAAXRSTlMAQObYZgAAAXlJREFUeNrV2NGOwjAMRNH4/396X5Cm26twww5IrF9CXfvUSlskWPuYOUh4kJ25HzN3RsOBi+SrMolLINu7hFx2t5dROgicLVyRC1fkwgWssru9zJZzuXFd7l2/gT3MXndL+ZEw12VO+lg6OA5gcV3OkitNBxMiDNdk7oXsRLkXzcDswfJJeHVwkIgfhOfL4ZDXzzV8nRIwZHUdNtldhym7SzgZkdWNhokpu8uJvxRep7DLPvC/hte7YfnahOzu3Zr4m0KYXs+FdZCTRD3EbeGzn2MGr/fBkXCdAia034t5GY6HBGXePLgcUEfehw8cWGRxoWDXSQtLxEZ2WAxkHTaX6UEHHzeBJR94s5z0z/aMw3jZKGd1WFzZZofpAoasMN3kVXZ4bgObPGfwYJ69nE8Os8VlUlw2rsvzBJ6h63JoiDjn7v3GOcwel22rWaTy78ItjHIPlBKu/kCe2cKs+xNN2FmnBzCft5fpBN+MsB0dGGxt47AOwsvjB19NCt1bbfikAAAAAElFTkSuQmCC)](https://app.gitkraken.com/glo/board/XnI94exk8AARj-ph) [![Serverless Library](https://img.shields.io/badge/Serverless%20Library-%E2%9C%94%EF%B8%8Fyes-blue?style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAMAAADzN3VRAAACx1BMVEUAAAAAAAAAAP8Af38AVaoAf78AVaoAbbYAXLkAc7kAZqoAWqUAY7gAZrIAZa4AYKwAY7QAZ7YAZ7MAZ7UAZLMAY7MAZLUAZrIAZLcAY7QAZrIAZLMAZLYAZ7YAZLYAZrcAZbgAZLMAZ7YAZbIAZLQAYrMAY7UAZLUAZLYAZbQAZrcAZbMAZbgAZbQAZrQAZrgAZrcAZbgAaLkAZbUAZbYAZ7YAZbUAZrUAZ7YAZ7cAZbcAZrcAZ7cAZrcAZ7cAZrcAZrcAZbcAZ7YAZ7cAZrcAZrYAZrcAZbYAZrcAZ7cAZr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7rExbTOadUZNunCOj3UH3+6fF49NuZsC5xOT7SaOv3VcBCZSXpPRir3y2rIk1vx4YBS/ZHRh5SynMuBCP0wbE64jfl8clQrC3q39MJGGFno4dXlcqEPzqRmi4kp6yx4XT0UIpJAZgWe3QgMPbjn4M2nLk6hB65RdrDpHtRJu34dn8YMOj85cHgLyJ1gTF3jvTnxod5Trh0xQTKmZIjABh1MXzil30Y86Oc0CazGCWDcOy+OQBXp0JiNcZxbTpe1SVVRr9gmLoZV1df8SoRwOxebuhQRNLIXq8dVnCrGlklnfyVGjZpUD6vuP4DQn3cxeG842QAAAAASUVORK5CYII=)](https://serverlesslibrary.net/sample/1c809aa2-2d4f-4fee-bc27-0c2c36844ac8) -[![All Contributors](https://img.shields.io/badge/all_contributors-11-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-12-orange.svg?style=flat-square)](#contributors-) @@ -134,6 +134,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Erik Alsmyr

🐛 📖
Bernard Vander Beken

📖
IronManion

📖 +
Jason Hand

📖 🚇 diff --git a/medias/AddCustomDomain.png b/medias/AddCustomDomain.png new file mode 100644 index 00000000..87f172d3 Binary files /dev/null and b/medias/AddCustomDomain.png differ diff --git a/medias/AddCustomDomainDetails.png b/medias/AddCustomDomainDetails.png new file mode 100644 index 00000000..9ef83d61 Binary files /dev/null and b/medias/AddCustomDomainDetails.png differ diff --git a/medias/Rule1.png b/medias/Rule1.png new file mode 100644 index 00000000..191a19d8 Binary files /dev/null and b/medias/Rule1.png differ diff --git a/medias/cf_DNS_Rules.png b/medias/cf_DNS_Rules.png new file mode 100644 index 00000000..0a683aeb Binary files /dev/null and b/medias/cf_DNS_Rules.png differ diff --git a/medias/cf_addSite.png b/medias/cf_addSite.png new file mode 100644 index 00000000..5ec7117e Binary files /dev/null and b/medias/cf_addSite.png differ diff --git a/medias/cf_rules_details.png b/medias/cf_rules_details.png new file mode 100644 index 00000000..37e7c751 Binary files /dev/null and b/medias/cf_rules_details.png differ diff --git a/medias/cl_dns_details.png b/medias/cl_dns_details.png new file mode 100644 index 00000000..67338694 Binary files /dev/null and b/medias/cl_dns_details.png differ diff --git a/medias/domainProviderDNS.png b/medias/domainProviderDNS.png new file mode 100644 index 00000000..28ab6ed6 Binary files /dev/null and b/medias/domainProviderDNS.png differ diff --git a/medias/domainValidated.png b/medias/domainValidated.png new file mode 100644 index 00000000..399bc870 Binary files /dev/null and b/medias/domainValidated.png differ diff --git a/post-deployment-configuration.md b/post-deployment-configuration.md index 7daf297e..252f25c4 100644 --- a/post-deployment-configuration.md +++ b/post-deployment-configuration.md @@ -2,9 +2,97 @@ ## Add a Custom Domain -To know how to add a custom domain to your Azure Function. (coming soon) -(or check [Microsoft docs](https://docs.microsoft.com/en-ca/azure/app-service/app-service-web-tutorial-custom-domain?WT.mc_id=azurlshortener-github-frbouche)) +Of course the beauty of a URL shortener is to have short link and this is done the best by a naked domain (domain.com). To realized this you would need to by an expensive certificate with a wild card, and this doesn't fit in the goals of this project. We will achieve it nervertheless by having a secure www.domain.com and doing a dynamic forward of domain.com to www.domain.com. +### 1- Assign a Domain to the Azure Function + +Let`s start by Adding a domain to the App Service. + +![AddCustomDomain][AddCustomDomain] + +From the Azure portal (portal.azure.com), open the ShortnerTools App Service (Azure Function). From the left panel select *Custom domains*. Then Click the **Add custom domain** button in the middle of the screen. + +![AddCustomDomainDetails][AddCustomDomainDetails] + +This will open a tab where you will need to enter your domain with the `www` sub-domain. In our case it was www.07f.ca. + +You will now need to validate the domain with you proviver (in our case it's GoDaddy.com). Navigate to the domain provider and create two new DNS record (TXT + CNAME) like explained in the bottom of the panel in the Azure portal. + +Here an exemple from godaddy where: +- The CNAME was created with the URL of the Azure function. +- The TXT was created with the Custom Domain Verification ID provided on the Azure portal page. + +![domainProviderDNS][domainProviderDNS] + +Once all that is enter. Click the validate button on the Azure portal. If you don't have the green check beside Hostname availability and Domain ownership, be patient as it can take up to 48 hours. (You can always double check that you didn't do any typo any where ;P ) + +![domainValidated][domainValidated] + +When you have it gree you ready for the next step. + +### 2- Adding a certificate + +The custom domain has been added, we now first need to create a certificate before we can add the binding + +![4_AddBinding](https://user-images.githubusercontent.com/52791126/83807076-c81db100-a6b2-11ea-8cc4-1facc50d6dd4.png) + +Create a **free** App Service managed certificate as described in the documentation [Secure a custom DNS name with a TLS/SSL binding in Azure App Service](https://docs.microsoft.com/en-us/azure/app-service/configure-ssl-bindings?WT.mc_id=azurlshortener-github-frbouche) + + +From the left navigation of your Azure Function (same page as before), select **TLS/SSL settings**. Then from the top of the new panel, click on **Private Key Certificates (.pfx)** and then **Create App Service Managed Certificate**. + +![Create free certificate in App Service](https://docs.microsoft.com/en-us/azure/app-service/media/configure-ssl-certificate/create-free-cert.png) + +Select the custom domain to create a free certificate for and select Create. You can create only one certificate for each supported custom domain. + +When the operation completes, you see the certificate in the Private Key Certificates list. + +![Create free certificate finished](https://docs.microsoft.com/en-us/azure/app-service/media/configure-ssl-certificate/create-free-cert-finished.png) + +Go back to the **Custom domain** panel. Click the **Add binding** link beside the big red "Not Secure" label. + +Select your custom domain, the created certificate thumbprint which has been created in step 5 and "SNI SSL" as the SSL Binding + +![7_create_certificate_binding](https://user-images.githubusercontent.com/52791126/83808893-d5886a80-a6b5-11ea-9cf0-c3268b57d250.png) + +Voila! You can now call your azURLShortener from your custom domain! ✔ + +> If you are using Version 1, you need to change the URL in the App Service configuration (it's in the admin "App Service") so you can copy the URLs from the Blazor UI + +![8_change_azFunctionUrl](https://user-images.githubusercontent.com/52791126/83810560-9c9dc500-a6b8-11ea-9c1c-da2d99f2a79f.png) + + + +### 3- Remove the www sub-domain + +This next section is to "fake" a naked domain. + +![cf_addSite][cf_addSite] + +Create an account in cloudflare.com and add a site for your domain. We will need to customized the DNS and create some Page Rules. + +![cf_DNS_Rules][cf_DNS_Rules] + +On the cloudflare.com note the 2 nameservers adresses. Go to the origin name provider (in my case godaddy) and replace the nameservers names with the value found on cloudflare. + +![cl_dns_details][cl_dns_details] + +Now let's create a rules that will redirect all the incoming traffic from the naked-domain to www.domain. On the option on the top, click the **Pages Rules** (B). Then Click the Button **Create Page Rule** + +![Rule1][Rule1] + +In the field for **If the URL matches:** enter the naked-domain follow by `/*`. That will match everything coming from that URL + +For the **settings** select `Forwarding URL` and `301- Permanent Redirect`. Then the destination url should be `https://www.` with your domain and `/$1`. + +The URL shortener is now completly configured, and your users will be pleased. There only one last step to make YOUR experience more enjoyable. + + +### 4- Add A Page Rule for your Admin page (TinyBlazorAdmin) + +The TinyBlazorAdmin is the place to manage all your URLs. Create a new Page rule to redirect all call to your domain and the prefix of your choice. ( ex: admin.07f.ca, manager.07f.ca, new.07f.ca, etc) + +Congradulation, you are all set! --- @@ -39,3 +127,15 @@ And finally, click the **Copy** button to get the URL of your function _with the [getURL]: medias/getURL.png +[AddCustomDomain]: medias/AddCustomDomain.png +[AddCustomDomainDetails]: medias/AddCustomDomainDetails.png +[domainProviderDNS]: medias/domainProviderDNS.png +[domainValidated]: medias/domainValidated.png + + +[cf_addSite]: medias/cf_addSite.png +[cf_DNS_Rules]: medias/cf_DNS_Rules.png +[cl_dns_details]: medias/cl_dns_details.png +[cf_rules_details]: medias/cf_rules_details.png +[Rule1]: medias/Rule1.png +