https://github.com/postman721/Azure_examples
From the above link, you will find a new repository, which contains material related to Azure.
https://github.com/postman721/Azure_examples
From the above link, you will find a new repository, which contains material related to Azure.
1. Required tools: az and kubectl.
My host is Debian 11. First thing I need to do is to install az tool to it. According to: https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt , I chose my installation method to be the bash command below:
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
After the installation is complete, I have the az command available to use. I also need kubectl to access my deployed cluster from my local workstation. This is again just few commands. Some good instructions can be found from: https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/ As I love one-liners, here is the command I used to get kubectl installed and ready to go on my Debian 11:
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" && chmod +x ./kubectl && sudo mv ./kubectl /usr/local/bin/kubectl
2.Beginning to make AKS cluster with the az tool.
Azure docs are great reference here: https://docs.microsoft.com/en-us/azure/aks/learn/quick-kubernetes-deploy-cli Before going any further, the login to the Azure using az tool needs to happen.
az login
“A web browser has been opened at https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize. Please continue the login in the web browser. If no web browser is available or if the web browser fails to open, use device code flow with az login --use-device-code
.”
…
If I would not want to open a browser to login, I could use the -u flag
az login -u your_user@outlook.com
At the end of part 1 of this tutorial I had my nodejs application pushed into Azure container registry. Next, it is time to get this application deployed to use.
Create a resource -> Web app -> Create.
On a Basics section you will be greeted with many choices. Azure, like other cloud providers, is smart here and helps you with easy to understand Ui. Subscription is the most critical one. If you have multiple subscriptions then you can easily choose from the drop-down menus the one you want.
Resource Group is the next big thing. This is basically just grouping your related resources into identifiable structures that can be managed according to the resource lifecycle needs and policies.
On Instance Details my entries were as follows: I chose a descriptive name and since I was publishing a Docker container, I chose that as an option under the Publish section. My operation system of choice was Linux and my region of choice was North Europe. Personally, I always tend to choose regions close to my actual home. There would be nothing preventing me from choosing something else – especially since I am just creating my Instance and the App Service Plan that goes with it.
App Service Plan in Azure is all about SKU (Stock Keeping Units) and ACU decisions(Azure Compute Unit). SKU is basically telling you that something like Basic B1 is an identifier of a service plan. In other words: It acts as an unique identifier for any given plan of choice. ACU’s on the other hand are the CPU specs of the SKU. More about ACU here: https://docs.microsoft.com/en-us/azure/virtual-machines/acu
As the memory requirements for my nodejs app go: The smaller the better. I highly recommend checking out additional options from the Sku and size section. This can be done by clicking the Change size option. It might just be that the default is good for you but then again there might be something even better on the list of choices that Azure gives you.
In the end I chose Basic B1
Please note here that Subscription can be Free(meaning subscription is not billing you) but App Service Plan can cost money. App Service Plan is all about renting or reserving capacity from Azure and capacity costs money. How much you want to pay(or don’t want to pay) is entirely up to your preferences. Also note that if you are going to deploy multiple apps into Azure you can use the existing App Service Plan to do so. However, you might need to consider updating your SKU plan if the resource demands get higher than you initially expected.
At the end of the Basics screen, you see Zone Redundancy, you do not need to worry about this unless you are building a critical highly available application that needs to spread across multiple geolocations to guarantee 24/7 uptime. And also, like Azure notes, all regions do not support this feature. If you need Zone Redundancy then create your app in the zone that supports this feature.
Once you are done with the Basics switch to Docker tab/section. There you should choose:
Continue readingIn this tutorial I use sudo in front of Docker. My user of choice is not in docker group. If you want to omit sudo then please add your user to docker group.
1. Cloning the project from Github:
Make a directory to host the git clone:
mkdir search_app
cd search_app
Actual cloning:
git clone https://github.com/postman721/Search_engines.git
Get the binary and rename it to be a bit nicer:
mv Search_engines/executables/Search\ engines-linux.zip .
unzip ‘Search engines-linux.zip’
mv ‘Search engines-linux’ search_app
2. Making a Dockerfile
echo “
FROM debian:11-slim
RUN apt update && apt upgrade -y && apt-get clean
COPY search_app /
RUN chmod +x /search_app
CMD /search_app” > Dockerfile
3.Testing the Docker image on a local machine
sudo docker build -t test .
sudo docker run test
4.Create Azure Container registry
Continue reading