Archive for October 8th, 2020

TWRAM

I currently own 3 domains, one of which you are visiting now.  Another domain I own is much less useful, and really was the result of a joke.

I have until now hosted it on a Windows Server, and wanted to move it to Azure.  It isn’t a very complicated as it is just a single page.  I had help building it many years ago, and the key element on the page was a (yuck) Flash image. 

So I started out the afternoon with the desire to move it to Azure, into a storage account, and serve it up as static web content.  Easy.  No problem.  Except…

The original home doesn’t have https.  Why would it?  It is around 15 years old and has a single static page.

It also has a Flash swf as the primary element.  Well, that isn’t good.

I also don’t like to do things the easy way, because I like to take easy things and  use them to understand more complicated concepts.

So… here goes:

First to fix the page, so that it isn’t using flash.  I could just put a static image, but in this case, that just feels wrong.  So in a ‘flash’ of brilliance, I asked my friend which tool he uses/recommends for creating gif files.  He said he uses ‘gifcam’ and then since I asked him he went and found another one in just a few minutes.  He now uses (and I used) ‘screentogif’.  You can find it with a quick search.

So I used screentogif to record the swf and then save it as a gif.  (Link to the results at the bottom).  One problem down, two (at least) to go.

Next I went through this tutorial (sort of) to figure out how to configure Blob Storage to host static web content. 

So I created the storage account, enabled Static website, and set the default document name.  I already had content, so I didn’t need the ‘hello world’ part.  I was going to work on integrating this deployment into a CI/CD pipeline, but bailed on it because I found a link on the page that needed to be updated (it wasn’t safe for work, though it had been originally).  I needed to get this deployed and replace the current site.

Using VS Code to deploy works very well per the tutorial.  I will work on the CI/CD part for one of the other sites I need to move.

Next problem, repointing my DNS.  Easy, just follow the next tutorial.  Which is where I hit the problem with HTTPS vs HTTP.  I could easily just not require a secure connection and get it to work, but I want to move my stuff to HTTPS because it is good practice.

But to do that you have to enable Azure CDN for your blob or web endpoint.  So on to the next article.  At least Microsoft is getting better with their documentation, and this part is pretty straight forward.  Once you follow a couple of steps, you get your content served up via CDN over HTTPS. 

Next, we need to add the custom domain to the CDN endpoint.  That article is here.  In the article, it talks about how to do a temporary mapping to avoid down time.  None of my sites are critical.  Downtime isn’t an issue, so I skipped that part.

Once I swapped over to the CDN location, the site was available via HTTPS, but there was a certificate error.  to fix this, click on the CDN Custom Domain, and turn on the custom domain HTTPS.  It is evidently free and managed by Azure.

image

That process takes a few minutes and you should have your CNAME in place before you kick it off, so that you don’t have to wait for an email to authorize it.

I know that this has been a long post, and if I wasn’t lazy, I would break it up into multiple posts, with more pictures.  But, I am lazy, so this is what you get.

https://www.theworldrevolvesaroundmichael.com/

What is this CI/CD thing? Let’s do a tutorial!

Well, according to Wikipedia, CI/CD is:

In software engineering, CI/CD or CICD generally refers to the combined practices of continuous integration and either continuous delivery or continuous deployment. CI/CD bridges the gaps between development and operation activities and teams by enforcing automation in building, testing and deployment of applications.

So, of course I get what that is, but frankly, I am not a developer.  If you came here for guidance from a developer, you really got lost.

I do write a decent amount of PowerShell scripts, but nothing on the order of actual development.  I spend a good deal of time trying to understand the weirdness that is the Dev mind, but never enough to get proficient.  In my quest to improve on this blog (and eventually a couple of other sites I have) I am going to work through the tutorial here:  https://docs.microsoft.com/en-us/azure/devops-project/azure-devops-project-github

First up, create the CI/CD pipeline.  You do this by signing into Azure, and adding the DevOps Starter.  As you create it, it gives you options to load a new web app with a variety of languages.  For our purposes, we are going to ‘Bring your own code’.

image

For this, I created a new Repo in DevOps.  When you are choosing your repository, you can select Git, BitBucket or Other Git.  I selected “Other Git, and entered the repository URL.  It is mine, not yours so it is private, and I need to enter credentials:
image

To get the URL and credentials, in Azure DevOps, go to Clone your repository, and copy the hyperlink and click on the ‘Generate Git Credentials’ button.  Copy all of that over to the Code repository screen.

I am going to chose a non-Dockerized ASP .NET Core Framework, and a Windows Web App.
image

image

For the create step, you can name everything.  If you click on additional settings, you can change the pricing tier.

image

Once you do that, it will deploy.  This creates a DevOps Project, an Azure Resource Group for the DevOps Starter and applicable resources in the Resource Group you gave it for the deployed solution. 

I actually went through this a few different times to fully understand what I was doing.  I don’t work in a development role, but I do enjoy building stuff.  It can be a bit much to understand/remember/follow if it isn’t something you either need or do often.  Don’t forget to remove any resources you create for this that you aren’t planning on continuing to use.  If you are new to Azure, you can get some free credits to help you learn.  It can get expensive if you aren’t paying attention to what you are doing.