Questions about development under torizon

Hello, in the last few day, I’m reading through Torizon articles to evaluate wether to move from yocto built linux system to Torizon system in my project. I have a few questions to be explained.

  1. In the production stage, how to write the final image to the SOM. The easy installer can only install TorizonCore image on the SOM, but how about the docker container?

  2. I’m using python in my project, so everythin goes well using the python container provided by Toradex except that if I’m going to develop a shared library for python. Can you provide some articles about cross compiling shared library for python using visual studio code with container?

  3. In production, python code should be protected. One way of protecting them is to compile them into Binaries using cython and etc. Can you provide some articles about doing this using visual studio with container?

Greetings @airpumpkin,

This will be a rather lengthy answer but let me go through each of your points one by one.

In the production stage, how to write the final image to the SOM. The easy installer can only install TorizonCore image on the SOM, but how about the docker container?

Probably the simplest way to provision a docker image would be to create a simple systemd service for TorizonCore that pulls/runs your target container on boot. That being said we are working on ways to make this more seamless. For example in the future we hope to be able to use the OTA feature of Torizon to update containers. So the theoretical workflow would be to use the easy installer to flash TorizonCore then push a OTA update to the device with your production image and containers.

I’m using python in my project, so everythin goes well using the python container provided by Toradex except that if I’m going to develop a shared library for python. Can you provide some articles about cross compiling shared library for python using visual studio code with container?

We don’t have any documentation on this at the moment, but this should be rather simple to do. The base python container we use is running in a containerized Debian environment. So for the cross compiling one could use the arm32v7 compiler available from the Debian package manager (assuming your shared library doesn’t need anything special). Then to get this in the container you would take your compiled library and copy it to the /app directory of your Visual Studio Code project. By default our dockerfile copies everything from this directory into the container during the build. NOTE: You will also probably need to then edit the dockerfile to move your library into an appropriate place in the container file system so your application can find it.

In production, python code should be protected. One way of protecting them is to compile them into Binaries using cython and etc. Can you provide some articles about doing this using visual studio with container?

There are a couple of ways to do this. You could compile your application with cython in your visual studio code project. Then as stated above anything in the /app folder gets copied to the container, don’t forget to remove any non-related python source so only the cython binary is copied. Finally you’ll also need to edit the dockerfile so the command launching your application works for cython as right now it just calls the python interpreter on a file that is expected to be pure python source.

I hope this helps clarify some of your questions. I kept my answers brief and rather open for the sake of brevity (though this answer still ended up quite long). I’d be happy to go more in depth on any of these points or other questions you may have.

Best Regards,
Jeremias

Thank you for your answers, Jeremias.

I will do some further study about using Torizon.

I really appreciate the nice work on Torizon from Toradex’s team.

You are welcome.

Best regards,
Jaski