world war two - REMMONT.COM

Acheter, vendre ou échanger son aile, sa barre, ses lignes ou tout accessoire situé au dessus du chicken-loop, c'est içi que ça se passe. Merci de lire et de respecter les conditions d'utilisation.

Modérateurs : kenny la kenelle, Froggy, Bidib'

world war two - REMMONT.COM

Message par DAVIDMi » 18 Mai 2021, 10:42

Iot devops - Eduard Kabrinskiy


<h1>Iot devops</h1>
<p>[youtube]</p>
Iot devops <a href="http://remmont.com">News headlines of the day</a> Iot devops
<h1>Home Grown IoT - Automated DevOps</h1>
<p>Having had a look at some tools for deploying IoT applications there was one piece of the puzzle that was missing, <em>automation</em>. After all, one of my goals is to be able to deploy updates to my project without really any effort, I want the idea of doing a git push and then it just deploying.</p>
<p>And that brings us to this post, a look at how we can do automated deployments of IoT projects using IoT Edge and Azure Pipelines.</p>
<p>Before we dive in, it?s worth noting that the IoT Edge team have guidance on how to do this on Microsoft Docs already, but it?ll generate you a sample project, which means you?d need to retrofit your project into it. <strong>That</strong> is what we?ll cover in this post, so I?d advise you to have a skim of the documentation first.</p>
<h2>Defining Our Process
<p>As we get started we should look at the process that we?ll go through to build and deploy the project. I?m going to split this into clearly defined Build and Release phases using the YAML Azure Pipelines component for building and then the GUI-based Release for deploying to the Pi. The primary reason I?m going down this route is, <strong>at the time of writing</strong>, the YAML Releases preview announced at //Build doesn?t support approvals, which is something I want (I?ll explain why later in this post).</p>
<h3>Build Phase
<p>Within the Build phase our pipeline is going to be responsible for compiling the application, generating the IoT Edge deployment templates and creating the Docker images for IoT Edge to use.</p>
<p>I also decided that I wanted to have this phase responsible for preparing some of the Azure infrastructure that I would need using Resource Manager Templates. The goal here was to be able to provision everything 100% from scratch using the pipeline, and so that you, dear reader, could see exactly what is being used.</p>
<h3>Release Phase
<p>The Release phase will be triggered by a successful Build phase completion and responsible for creating the IoT Edge deployment and for deploying my Azure Functions to process the data as it comes in.</p>
<p>To do this I created separate ?environments? for the Pi and Azure Functions, since I may deploy one and not the other, and also run these in parallel.</p>
<h2>Getting The Build On
<p>Let?s take a look at what is required to build the application ready for release. Since I?m using the YAML schema I?ll start with the triggers and variables needed:</p>
<p>I only care about the master branch, so I?m only triggering code on that branch itself and I?m turning off pull request builds, since I don?t want to automatically build and release PR?s (hey, this is <em>my</em> house! СЂ???). There are a few variables we?ll need, mainly related to the Azure resources that we?ll generate, so let?s define them rather than having magic strings around the place.</p>
<h2>Optimising Builds with Jobs
<p>When it comes to running builds in Azure Pipelines it?s important to think about how to do this efficiently. Normally we?ll create a build definition which is a series of sequential tasks that are executed, we compile, package, prepare environments, etc. but this isn?t always the most efficient approach to our build. After all, we want results from our build as fast as we can.</p>
<p>To do this we can use Jobs in Azure Pipelines. A Job is a collection of steps to be undertaken to complete part of our pipeline, and the really nice thing about Jobs is that you can run them in parallel (depending on your licensing, I?ve made my pipeline public meaning I get 10 parallel jobs) and with a pipeline that generates a lot of Docker images, being able to do them in parallel is a great time saver!</p>
<p>Also, with different Jobs you can specify different agent pools, so you can run some of your pipeline on Linux and some of it on Windows. You can even define dependencies between Jobs so that you don?t try and push a Docker image to a container registry before the registry has been created.</p>
<p>With all of this in mind, it?s time to start creating our pipeline.</p>
<h3>Building the Application
<p>What?s the simplest thing we need to do in our pipeline? Compile our .NET code, so let?s start there:</p>
<p>The Build job is your standard .NET Core pipeline template, we run the dotnet build using the configuration we define in the variables (defaulted to Release ), then do a dotnet publish to generate the deployable bundle and then zip each project as artifacts for the pipeline. The reason I publish all the projects as artifacts, even though the IoT component will be Dockerised, is so I can download and inspect the package in the future if I want to.</p>
<p>Onto creating our IoT Edge deployment packages.</p>
<h3>Build IoT Edge Deployment Packages
<p>To create the IoT Edge deployment packages we need to do three things, create the Docker image, push it to a container registry and create our deployment template (which we looked at in the last post).</p>
<h4>Creating a Container Registry
<p>But this means we?ll need a container registry to push to. I?m going to use Azure Container Registry (ACR) as it integrates easily from a security standpoint across my pipeline and IoT Hub, but you can use any registry you wish. And since I?m using ACR I need it to exist. You could do this by clicking through the portal, but instead, I want this scripted and part of my git repo so I could rebuild if needed, and for that, we?ll use a Resource Manager template:</p>
<p>Which we can run from the pipeline with this task:</p>
<p>Notice here I?m using the variables defined early on for the -name and -location parameters. This helps me have consistency naming of resources. I?m also putting this into a resource group called $(azureResourceNamePrefix)-shared because if I wanted to have the images used in both production and non-production scenario (which I could be doing if I had more than just my house that I was building against). The last piece to note in the task is that the templateLocation is set to Linked artifact , which tells the task that the file exists on disk at the location defined in csmFile , rather than pulling it from a URL. This caught me out for a while, so remember, if you want to keep your Resource Manager templates in source control and use the version in the clone, set the templateLocation to Linked artifact and set a csmFile path.</p>
<p>When it comes to creating the IoT Edge deployment template I?m going to need some information about the registry that?s just been created, I?ll need the name of the registry and the URL of it. To get those I?ve created some output variables from the template:</p>
<p>But how do we use those? Well initially the task will dump them out as a JSON string in a variable, defined using deploymentOutputs: ResourceGroupDeploymentOutputs , but now we need to unpack that and set the variables we?ll use in other tasks. I do this with a PowerShell script:</p>
<p>Executed with a task:</p>
<p>Now in other tasks I can access CONTAINER_REGISTRY_SERVER as a variable.</p>
<h4>Preparing the IoT Edge Deployment
<p>I want to create three Docker images, the ARM32 image which will be deployed to the Raspberry Pi, but also an x64 image for local testing and an x64 image with the debugger components. And this is where our use of Jobs will be highly beneficial, from my testing each of these takes at least 7 minutes to run, so running them in parallel drastically reduces our build time.</p>
<p>To generate the three images I need to execute the same set of tasks three times, so to simplify that process we can use Step Templates (side note, this is where I came across the issue I described here on templates and parameters).</p>
<p>We?ll need a number of bits of information for the tasks within our template, so we?ll start by defining a bunch of parameters. Next, let?s define the Job:</p>
<p>To access a template parameter you need to use $<< parameters.</p>
<p>>> . I?m providing the template with a unique name in the name parameter and then creating a display name using the architecture (AMD64, ARM32, etc.).</p>
<p>Next, the Job defines a few dependencies, the Build and PrepareAzureACR Jobs we?ve seen above and I?ll touch on the PrepareArtifactStorage shortly. Finally, this sets the pool as a Linux VM and converts some parameters to environment variables in the Job.</p>
<p>Let?s start looking at the tasks:</p>
<p>Since the Job that?s running here isn?t on the same agent that did the original build of our .NET application we need to get the files, thankfully we published them as an artifact so it?s just a matter of downloading it and unpacking it into the right location. I?m unpacking it back to where the publish originally happened, because the Job does do a git clone initially (I need that to get the module.json and deployment.template.json for IoT Edge) I may as well pretend as I am using the normal structure.</p>
<p>Code? РІ??. Deployment JSON? РІ??. Time to use the IoT Edge tools to create some deployment files. Thankfully, there?s an IoT Edge task for Azure Pipelines, and that will do nicely.</p>
<p>The first task will use the deployment.template.json file to build the Docker image for the platform that we?ve specified. As I noted in the last post if you?ll need to have the CONTAINER_REGISTRY_USERNAME , CONTAINER_REGISTRY_PASSWORD and CONTAINER_REGISTRY_SERVER environment variables set so they can be substituted into the template. We get CONTAINER_REGISTRY_SERVER from the parameters passed in (unpacked as a variable) but what about the other two? They are provided by the integration between Azure and Azure Pipelines, so you don?t need to set them explicitly.</p>
<p>Once the image is built we execute the Push module images command on the task which will push the image to our container registry. Since I?m using ACR I need to provide a JSON object which contains the URL for the ACR and the id for it. The id is a little tricky, you need to generate the full resource identifier which means you need to join each segment together, resulting in this $(SUBSCRIPTION_ID)/resourceGroups/$<< parameters.azureResourceNamePrefix >>-shared/providers/Microsoft.ContainerRegistry/registries/$(CONTAINER_REGISTRY_SERVER_NAME) which would become /resourceGroups/sunshine-shared/providers/Microsoft.ContainerRegistry/registries/sunshinecr .</p>
<p>Finally, we need to publish our deployment.platform.json file that the Release phase will execute to deploy a release to a device, but there?s something to be careful about here. When the deployment is generated the container registry information is replaced with the credentials needed to talk to the registry. This is so the deployment, when pulled to the device, is able to log into your registry. But there?s a downside to this, you have your credentials stored in a file that needs to be attached to the build. The standard template generated in the docs will attach this as a build artifact, just like our compiled application, and this works really well for most scenarios. There is a downside to this though, anyone who has access to your build artifacts will have access to your container registry credentials, which is something that you may not want. This bit me when I realised that, because my pipeline is public, <strong>everyone</strong> had access to my container registry credentials! I then quickly deleted that ACR as the credentials were now compromised! СЂ???РІ??РІ??РїС‘?</p>
<h4>Securing Deployments
<p>We want to secure the deployment so that our build server isn?t a vector into our infrastructure and that means that we can?t attach the deployment files as build artifacts.</p>
<p>This is where the other dependency on this Job, PrepareArtifactStorage , comes in. Instead of pushing the deployment file as an artifact I push it to an Azure storage account:</p>
<p>This uses a Resource Manager template that just creates the storage account:</p>
<h2>Iot devops</h2>

<h3>Iot devops</h3>
<p>[youtube]</p>
Iot devops <a href="http://remmont.com">Headlines</a> Iot devops
<h4>Iot devops</h4>
Moving from manual DevOps to automated DevOps
<h5>Iot devops</h5>
Iot devops <a href="http://remmont.com">Iot devops</a> Iot devops
SOURCE: <h6>Iot devops</h6> <a href="https://dev-ops.engineer/">Iot devops</a> Iot devops
#tags#[replace: -,-Iot devops] Iot devops#tags#
https://ssylki.info/?who=life-insurance.remmont.com https://ssylki.info/?who=new-york-real- ... emmont.com https://ssylki.info/?who=oreilly-auto-parts.remmont.com https://ssylki.info/?who=annual-credit- ... emmont.com https://ssylki.info/?who=real-estate-agent.remmont.com
Facts: pr et Fresh News.
DAVIDMi
 
Message(s) : 234
Inscription : 26 Juil 2019, 09:36
Localisation : USA

Retour vers Petites annonces ailes d'occasion (réservé aux particuliers)

Qui est en ligne ?

Utilisateur(s) parcourant ce forum : Aucun utilisateur inscrit et 6 invité(s)

cron