#AzureIoT – Mapping a local ☁ Azure IoT Edge folder module with an Edge device folder 📁

Buy Me A Coffee

Hi !

Another quick post in [Brain backup mode]. This one for a very simple scenario when working with Azure IoT modules:

Mapping a local folder in an Azure IoT Edge module with an Edge device folder

There is a full post on Azure IoT Documentation (see references). And I’ll resume the post here.

Add this configuration to

{
    "HostConfig": {
        "Binds": [
            "[EdgeDeviceFolder]:[AzureIoTModuleFolder]"
        ]
    }
}

Where:

  • EdgeDeviceFolder is the folder on the edge device
  • AzureIoTModuleFolder is the folder on the module, defined the docker image

Of course, you need to grant access to the EdgeDeviceFolder. 2 commands for this

sudo chown 1000 <EdgeDeviceFolder>
sudo chmod 700 <EdgeDeviceFolder>

And that’s it! super easy!

Happy coding!

Greetings

El Bruno


References

My posts on Raspberry Pi ⚡🐲⚡

Dev posts for Raspberry Pi
Tools and Apps for Raspberry Pi
Setup the device
Hardware
Azure IoT


¿Con ganas de ponerte al día?

En Lemoncode te ofrecemos formación online impartida por profesionales que se baten el cobre en consultoría:

#Event – “NTN Podcast” Live from the @netcoreconf tomorrow ! all day 🎤🎤🎤

Buy Me A Coffee

Hi !

Less than 24 hours to be part of an amazing event NetCoreConf. This time, not as a attendee or speaker, we will do something different:

Live recording for the NTN podcast at the NetCoreConf

2 amazing days, great agenda, dozens of amazing speakers, and topic. We will hangout on Discord at the Virtual Bar, and if we find a 15 min nice topic, let’s record !

See you there !

Happy coding!

Greetings

El Bruno



¿Con ganas de ponerte al día?

En Lemoncode te ofrecemos formación online impartida por profesionales que se baten el cobre en consultoría:

#Event – “ML.Net and AutoML” at the MVP Fusion and Friends 2021 . Session Resources

Buy Me A Coffee

Hi !

I had a great time early in the day with some my friends from Europe.

As usual, time for slides and code:

Slides

Code

https://github.com/elbruno/events/tree/main/2021%2002%2023%20MVP%20Fussion%20MLNet

Resources

Happy coding!

Greetings

El Bruno



¿Con ganas de ponerte al día?

En Lemoncode te ofrecemos formación online impartida por profesionales que se baten el cobre en consultoría:

#Net6 – Single file apps improved for Windows and Mac !

Buy Me A Coffee

Hi !

Some time ago I wrote about how to package a .Net Winform application in a one-self contained file. I also tested how was to migrated a Net 4.8 project to Net 5 and it was super easy. I was reading the notes about the new .Net 6. Preview 1 and I got stuck in this sentence.

In .NET 6, single file apps have been enabled for Windows and macOS. In .NET 5, single files apps were limited to Linux. In .NET 6, for all supported operating systems, you can publish a single-file binary that has exactly one file on disk and does not need to extract any of the core runtime assemblies to temporary directories.

This is super cool, now we have this feature available for Windows!

So, I went back to my test project and made a few changes

1st change, set the target framework to use Net 6

vs2019 project target framework net 6 preview 1

Then I created a publish profile using folder as destination location.

publish profile to local folder

And I set the following values in the Profile Settings

publish profile settings for single file

Now it was time to publish, and I find my single file ready to use !

This is super cool, however the previous configuration is Framework Dependent. Let’s change the settings for Self Contained.

I got more files !

And it makes sense. The official doc explains this.

There are cases where a single file app will have more than one file. WPF native dependencies are not part of the superhost, resulting in additional files beside the single file app. The same is true for any other native binaries that you happen to depend on.

Happy coding!

Greetings

El Bruno


References


¿Con ganas de ponerte al día?

En Lemoncode te ofrecemos formación online impartida por profesionales que se baten el cobre en consultoría:

#Personal – A HDMI Audio Video Capture Card for less $20 will help you with screen sharing, #raspberrypi, phones and more !

Buy Me A Coffee

Hi!

Today I want to share a small device that literally change the way I do demos, check screens and other scenarios. A simple HDMI Audio Video Capture Card for less than 20$.

HDMI Audio Video Capture Card: High Definition 1080p 30fps – HDMI to USB2.0 – Video Recording via DSLR & Camcorder to Live Streaming | Gaming | Teaching | Live Broadcasting | Video Conference

Somehow in my mind these devices were supposed to be super expensive (and I know they are!). Last year, I decided to try a cheap one and it was a great surprise.

How this works? You connect a HDMI input into the USB device and you have a new camera available. Then you can use any camera app to check or share this screen. The following image shows the boot of a raspberry pi with the camera recorded as a video.

usb camera raspberry pi

This is not remote desktop, so you won’t have keyboard and mouse remote control. I’ll blog on hyot to do this in other post.

The main idea of connection is this one

I’m my day to day, I use this to

  • Share screen of some devices like raspberry pi.
  • Share screen of other laptops. I know, remote desktop is an option, however this is SO MUCH FASTER!
  • Share screen of smartphones, when they have the feature of USB to HDMI
  • Record demos from smartphones to have backup videos, just in case!
  • And more !

Final sample, this how a smartphone screen looks

And finally, my cheap device

Happy coding!

Greetings

El Bruno



¿Con ganas de ponerte al día?

En Lemoncode te ofrecemos formación online impartida por profesionales que se baten el cobre en consultoría:

#Podcast – NTN 79 – Proyecto Anaire 🌫, Monitorización del nivel de CO2 🫁 en las aulas en COVID times

Buy Me A Coffee

Buenas!

Juan me pillo desprevenido con una frase que siempre ilusiona, “tengo unos invitados buenísimos para el podcast”. Y poco después estábamos hablando con Antonio y Pablo sobre el proyecto Anaire.

En el episodio comentan un poco la historia detrás del proyecto. Como surgió la idea y como lo han llevado adelante. En la parte técnica es una maravilla, usando muchas tecnologías que no conocía, en un modo plug and play, en poco tiempo pudieron montar una solución que escala, se adapta y es útil ! Todo esto con sensores, arduinos, mensajería MQTT, AWS y mucho más!

Happy Coding !

Speakers

  • Antonio López Gracia es Technological Expert at telefonica I+D (LinkedIn)
  • Pablo Montes es Telco Cloud Expert at Telefonica (LinkedIn)
  • Juan Carlos Quijano Abad es Microsoft Certified Trainer, Arquitecto de Soluciones en Azure, Consultor independiente en implantación de DevOps (LinkedIn)
  • Bruno Capuano es Canada Innovation Lead at Avanade and Microsoft AI MVP (LinkedIn)

References

Proyecto Anaire

Mosquitto, Prometheus, Grafana

Ir a descargar

Happy coding!

Greetings

El Bruno



¿Con ganas de ponerte al día?

En Lemoncode te ofrecemos formación online impartida por profesionales que se baten el cobre en consultoría:

#AzureIoT – ☁ Azure IoT Edge 1.1.0 release is now GA, experiences upgrading #Ubuntu

Buy Me A Coffee

Hi !

There is a new version of the Azure IoT Edge module: 1.1.0 (see references). So, I decided to upgrade my 2 test devices and maybe share some lessons learned in the process.

Upgrade on Ubuntu 18.04 on a Raspberry Pi 4

As usual I’ll start with a full update

# Update
sudo -- sh -c 'apt-get update; apt-get upgrade -y; apt-get dist-upgrade -y; apt-get autoremove -y; apt-get autoclean -y'

Similar to the Raspberry Pi OS upgrade process, I found a nice surprise on the update log.

Setting up iotedge (1.1.0-1) ...
===============================================================================

                              Azure IoT Edge

  IMPORTANT: Please update the configuration file located at:

    /etc/iotedge/config.yaml

  with your device's provisioning information. You will need to restart the
  'iotedge' service for these changes to take effect.

  To restart the 'iotedge' service, use:

    'systemctl restart iotedge'

    - OR -

    /etc/init.d/iotedge restart

  These commands may need to be run with sudo depending on your environment.

===============================================================================
Setting up friendly-recovery (0.2.38ubuntu1.2) ...
Setting up moby-engine (20.10.3+azure-1) ...
Processing triggers for systemd (237-3ubuntu10.44) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for ureadahead (0.100.0-21) ...
ureadahead will be reprofiled on next reboot
Processing triggers for libc-bin (2.27-3ubuntu1.4) ...
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  u-boot-tools
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 139 kB of archives.
After this operation, 7168 B of additional disk space will be used.
Get:1 http://ports.ubuntu.com/ubuntu-ports bionic-updates/main arm64 u-boot-tools arm64 2020.10+dfsg-1ubuntu0~18.04.2 [139 kB]

So, the module is updated. However I need to setup the device provisioning information again and restart the service. In the references section I shared the officials docs for these steps.

Let’s edit the provisioning information

# Update provisioning information (if necessary)
sudo nano /etc/iotedge/config.yaml

My file still have all the valid information (again, like the Raspberry Pi upgrade process)

No changes here, let’s restart IoT Edge

# restart iotedge service
systemctl restart iotedge

Important, authentication is required in this step:

So, I may missed something here. I run the update command for the module, and it’s already on the 1.1 version. However the iotedge list of modules is still using the 1.0

Update runtime settings on Azure IoT Portal

I now I can fix this in the Azure IoT Portal. In the device definition, I need to update the Runtime settings to use the version 1.1. (image is just for reference)

A couple of seconds later, everything works as expected !

iotedge module updated to v1.1.0

Recap

So, the steps to update were these commands

# Update
sudo -- sh -c 'apt-get update; apt-get upgrade -y; apt-get dist-upgrade -y; apt-get autoremove -y; apt-get autoclean -y'

# Update provisioning information (if necessary)
sudo nano /etc/iotedge/config.yaml

# restart iotedge service
systemctl restart iotedge

Then update the Runtime Settings on the Azure IoT Portal.

And restart iotedge one more time !

Happy coding!

Greetings

El Bruno


References

My posts on Raspberry Pi ⚡🐲⚡

Dev posts for Raspberry Pi
Tools and Apps for Raspberry Pi
Setup the device
Hardware
Azure IoT


¿Con ganas de ponerte al día?

En Lemoncode te ofrecemos formación online impartida por profesionales que se baten el cobre en consultoría:

#AzureIoT – ☁ Azure IoT Edge 1.1.0 release is now GA, experiences upgrading #RaspberryPi OS

Buy Me A Coffee

Hi !

There is a new version of the Azure IoT Edge module: 1.1.0 (see references). So, I decided to upgrade my 2 test devices and maybe share some lessons learned in the process.

Upgrade on Raspberry Pi OS

As usual I’ll start with a full update

# Update
sudo -- sh -c 'apt-get update; apt-get upgrade -y; apt-get dist-upgrade -y; apt-get autoremove -y; apt-get autoclean -y'

And I found a nice surprise on the update log.

Setting up iotedge (1.1.0-1) ...
===============================================================================

                              Azure IoT Edge

  IMPORTANT: Please update the configuration file located at:

    /etc/iotedge/config.yaml

  with your device's provisioning information. You will need to restart the
  'iotedge' service for these changes to take effect.

  To restart the 'iotedge' service, use:

    'systemctl restart iotedge'

    - OR -

    /etc/init.d/iotedge restart

  These commands may need to be run with sudo depending on your environment.

===============================================================================

So, the module is updated. However I need to setup the device provisioning information again and restart the service. In the references section I shared the officials docs for these steps.

Let’s edit the provisioning information

# Update provisioning information (if necessary)
sudo nano /etc/iotedge/config.yaml

My file still have all the valid information

No changes here, let’s restart IoT Edge

# restart iotedge service
systemctl restart iotedge

Important, authentication is required in this step

So, I may missed something here. I run the update command for the module, and it’s already on the 1.1 version. However the iotedge list of modules is still using the 1.0

Update runtime settings on Azure IoT Portal

I now I can fix this in the Azure IoT Portal. In the device definition, I need to update the Runtime settings to use the version 1.1.

A couple of seconds later, everything works as expected !

Recap

So, the steps to update were these commands

# Update
sudo -- sh -c 'apt-get update; apt-get upgrade -y; apt-get dist-upgrade -y; apt-get autoremove -y; apt-get autoclean -y'

# Update provisioning information (if necessary)
sudo nano /etc/iotedge/config.yaml

# restart iotedge service
systemctl restart iotedge

Then update the Runtime Settings on the Azure IoT Portal.

And restart iotedge one more time !

I’ll test this on Ubuntu and share my experiences also there.

Happy coding!

Greetings

El Bruno


References

My posts on Raspberry Pi ⚡🐲⚡

Dev posts for Raspberry Pi
Tools and Apps for Raspberry Pi
Setup the device
Hardware
Azure IoT


¿Con ganas de ponerte al día?

En Lemoncode te ofrecemos formación online impartida por profesionales que se baten el cobre en consultoría:

#Azure – Reading configuration values in Azure Functions

Buy Me A Coffee

Hi !

I was learning about Azure Vault and Azure Functions, and it’s been an interesting ride. This tweet summarizes this ride 😎😁😎

So while I a was using Functions, I realized that at the end, we are working with WebApps. So, we have access to standard App Configurations.

Note: I’ll call it standard, however this reveal how old I am, remembering Asp.Net apps and web.config files.

Moving On, in the Azure Portal, we can access the Function Configuration via Function // Settings // Configuration.

As the official documentation describes

In App Service, app settings are variables passed as environment variables to the application code.

So, it super easy to access this with a simple line of code. The next examples shows how to read an environment variable named “dbConnectionString” where I store a connection string.

var cnnString = Environment.GetEnvironmentVariable("dbConnectionString", EnvironmentVariableTarget.Process);

Super easy ! and it also have the checks for security:

App settings are always encrypted when stored (encrypted-at-rest).

My next step in my journey will be describe how to also do this with KeyVault. And share some insights on both scenarios.

References

Happy coding!

Greetings

El Bruno



¿Con ganas de ponerte al día?

En Lemoncode te ofrecemos formación online impartida por profesionales que se baten el cobre en consultoría:

#Windows10 – How to solve “#docker daemon is not running”. Extreme solutions like restart windows won’t work! 🙀🙀🙀

Buy Me A Coffee

Hi !

Time to share a weird experience on Windows 10 and Docker. Sometimes, usually after some Windows 10 update or even after a software installation, docker stop responding.

An typical error may look like this.

error during connect: This error may indicate that the docker daemon is not running.: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/build?buildargs=%7B%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile.amd64&labels=%7B%7D&memory=0&memswap=0&networkmode=default&rm=1&shmsize=0&t=noToday.azurecr.io%2FU%3A0.0.88-amd64&target=&ulimits=null&version=1: open //./pipe/docker_engine: The system cannot find the file specified.

From Visual Studio Code we get:

And it’s very weird. When I check the Docker desktop app, it’s stuck in the the STARTING state.

docker windows 10 for ever in starting mode

I can restart the docker desktop app, and I will still have the issue. As I said, weird.

I’m a handy man, so I decided to restart the docker service. Just 2 commands:

Net stop com.docker.service
Net start com.docker.service

However, this does not solve the problem. And sometimes, even restarting Windows won’t fix the problem.

After some time, I found the root cause:

Somehow WSL was set to version 1 instead of version 2.

I’m not sure why, however the solution is super easy. Just run a command to set WSL to version 2 and then restart docker service.

wsl --set-default-version 2
Net stop com.docker.service
Net start com.docker.service

If you are a visual person, this may look like this:

docker windows 10 set WSL2 as current version

Important: you need to run these commands with Administrator privileges. So in a Windows Terminal world, this may also look like this. Right click on the Windows Terminal App, and click on “Run as administrator”.

Happy coding!

Greetings

El Bruno



¿Con ganas de ponerte al día?

En Lemoncode te ofrecemos formación online impartida por profesionales que se baten el cobre en consultoría: