What product/components do you use and which version/fix level are you on?
Is your question related to the free trial, or to a production (customer) instance?
What are you trying to achieve? Please describe it in detail.
High level overview….customer has a requirement to monitor a directory for incoming XML files and then to parse those files and convert the contents to Cumulocity measurements. I managed to get this functionality built and running using both the watchdog-service-mapper and config2MQTT-watchdog repositories as examples. Basic approach was to create a Python script for all processing, a config file to set up changeable parameters, and a service file to automate the running of the script. Everything seems to be working as expected when I run it manually.
The next step is to package this solution to ease the distribution. The setup steps in the example repos that I used are all manual and we were hoping to minimize manual intervention as much as we can. I am new to Debian packaging and am struggling a bit. Not sure how to have the configuration file and the script put into the /etc/tedge/plugins/fileparser directory and the service to be installed in the usr/lib/systemd/system directory via the Debian package installation. Has anyone in the community done something similar?
Do you get any error messages? Please provide a full error message screenshot and log file.
Have you installed all the latest fixes for the products and systems you are using?
Not exactly product related.
First of all I feel your pain. It took me also quite some time to get debian packaging for python working. And to be honest even in the end I didn’t fully understand everything I did.
But I hope you can copy+paste+learn from my repository (GitHub - TyrManuZ/thin-edge-experiments: Playing around with thin-edge). If this doesn’t work let me know.
Thanks Tobias. Repo looks very promising. I will let you know how I progress.
Hey Tobias. I think I have made some progress. Final issue is that my configuration file won’t create during install. The final resting place directory gets created in /etc/ and I see a temp file gets created, but it never is renamed to the configuration files name and in the end it is removed. Have looked through logs and don’t see any errors and the package acts like it is installed, but without the configuration file in place, it won’t actually load. Did you experience this when you were working through packaging?
you can take a look at this python plugin: thin-edge-experiments/thin_edge_file_management at main · TyrManuZ/thin-edge-experiments · GitHub
I created the config file inside the package and then you have to create an .install file inside the debian folder. The file has to have the name of the python package that is generated. The .install file works like a copy instruction and inside I copy the config file from within my package into the /etc folder.
There is also some more generic packaging tools such as fpm and nfpm, which make it slightly easier to build multiple linux packages (e.g. alpine, debian, rpm).
I have a good experience with nfpm to build some linux packages using a yaml file, and it has a single binary install (as it is written in golang).
You can checkout the nfpm docs here: https://nfpm.goreleaser.com/
We (thin-edge.io) team created an example community plugin which then uses nfpm to build debian, alpine, rpm packages. The project also includes an example GitHub workflow etc.
The community plugin tedge-container-plugin can be viewed here (look at the
Though there is an alternative which is more flexible, however it does have more dependencies (e.g. ruby etc.), though it has the ability to convert an already built package format to another linux package format, which is super handy, so you can convert an existing debian package to alpine and/or rpm etc.
Checkout the fpm docs here:
This is the project that I was actually using as my guide initially. I did end up figuring out my issue with the configuration file. Had to do with the fact that conf files aren’t overwritten by installation of next versions. With this in mind, I ended up in a state where the system thought I had a previous version’s conf file installed (even though I had done apt remove on those packages) and so it was seeing this and not actually creating the file I was expecting. Came across a brief mention in some forum response to use the --purge option when doing the uninstall and it will clean up all configuration files. Once I did this, my package installed installed. A lot of time wasted I’m sure, but a lot learned. Thanks for the help!!
Thanks for this information Reuben. I am pretty far down the line at this point and have a working Debian package. I will keep this information in mind moving forward as this process was a bit cumbersome. If there are alternatives that are more streamlined and applicable for multiple architectures, I could see that being very valuable.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.