Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[openwrt] Convert into an OpenWRT package #6 #25

Merged

Conversation

devkapilbansal
Copy link
Member

@devkapilbansal devkapilbansal commented Apr 1, 2021

Closes #6

  • Create package NetJSON Monitoring and OpenWISP Monitoring.
  • Add a CI Workflow
  • Add directory structure with common files and docs as other OpenWISP modules
  • Add runbuild script to automatically compile packages

@devkapilbansal
Copy link
Member Author

Opened this WIP PR so that it becomes easy to stack all relevant conversation.

@devkapilbansal
Copy link
Member Author

devkapilbansal commented Apr 1, 2021

@nemesisdesign finally I am able to create an image but when I try to install it I got this error:-

* opkg_install_cmd: Cannot install package https://github.com/devkapilbansal/test-repo/blob/main/openwisp-openwrt-monitoring_0.0.1-1_all.ipk?raw=True.

P.S.:- I uploaded the image generated here
Update: Solved

Copy link
Member

@nemesifier nemesifier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@devkapilbansal I see that you're putting effort, but the makefile looks kinda wrong which is normal if you start copying things without really understanding what you're doing, so my suggestion is to start creating a very simple package for OpenWRT with something trivial (eg: a script in /usr/sbin which prints hello world, get it to work (eg: you can call it from openwrt and it prints hello world) and then gradually add things.

In this specific case, giving us that output will not help, always try to look if the program you're running has a verbose output and include the verbose output in your request for help. Check with opkg --help) and let me know what you can find.

VERSION Outdated Show resolved Hide resolved
openwisp-openwrt-monitoring/Makefile Outdated Show resolved Hide resolved
openwisp-openwrt-monitoring/Makefile Outdated Show resolved Hide resolved
openwisp-openwrt-monitoring/Makefile Outdated Show resolved Hide resolved
@devkapilbansal devkapilbansal marked this pull request as ready for review May 8, 2021 12:54
Copy link
Member

@nemesifier nemesifier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is on the right track, please read again the deliverable:

Convert lua-monitoring into two OpenWRT packages:

One package for the netjson-monitoring utility, which aims to simply return NetJSON DeviceMonitoring output

One package which provides the OpenWISP Monitoring deamon, which depends on netjson-monitoring and openwisp-config (it takes the server information from the openwisp config file).

We need two packages, one of them is a daemon (crontab was a quick way to implement it).

Also remove netjson-monitoring-wan.lua please.

openwisp-openwrt-monitoring/Makefile Outdated Show resolved Hide resolved
openwisp-openwrt-monitoring/files/cronjob Outdated Show resolved Hide resolved
openwisp-openwrt-monitoring/files/monitoring.config Outdated Show resolved Hide resolved
openwisp-openwrt-monitoring/files/post-reload-hook Outdated Show resolved Hide resolved
README.rst Outdated
@@ -0,0 +1 @@
WIP
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please start preparing a basic README

@devkapilbansal devkapilbansal force-pushed the openwisp-openwrt-monitoring branch 2 times, most recently from 63b7dfd to 397ced7 Compare May 15, 2021 20:41
Copy link
Member

@nemesifier nemesifier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please show the content of your feeds and commands to compile?

Ensure the feeds are correct and that this branch is being installed when you run ./scripts/feeds install -a && ./scripts/feeds update -a, you should see this repo and this branch being cloned and installed on the openwrt source directory (you will find it in ./feeds, if it's not there, something is wrong with the feeds).

Once you're sure the feeds are pulled correctly, ensure your .config contains:

CONFIG_PACKAGE_openwisp-monitoring=y
CONFIG_PACKAGE_netjson-monitoring=y

Although you should be able to see these packages from make menuconfig.

Then compile everything with make -j <number-of-cores> V=s where j <number-of-cores> stands for the number of cores your machine has available.

See also my comments below.

openwisp-openwrt-monitoring/Makefile Outdated Show resolved Hide resolved
openwisp-openwrt-monitoring/Makefile Outdated Show resolved Hide resolved
openwisp-openwrt-monitoring/files/monitoring.init Outdated Show resolved Hide resolved
openwisp-openwrt-monitoring/Makefile Outdated Show resolved Hide resolved
@devkapilbansal
Copy link
Member Author

Can you please show the content of your feeds and commands to compile?

Ensure the feeds are correct and that this branch is being installed when you run ./scripts/feeds install -a && ./scripts/feeds update -a, you should see this repo and this branch being cloned and installed on the openwrt source directory (you will find it in ./feeds, if it's not there, something is wrong with the feeds).

Once you're sure the feeds are pulled correctly, ensure your .config contains:

CONFIG_PACKAGE_openwisp-monitoring=y
CONFIG_PACKAGE_netjson-monitoring=y

Although you should be able to see these packages from make menuconfig.

Then compile everything with make -j <number-of-cores> V=s where j <number-of-cores> stands for the number of cores your machine has available.

See also my comments below.

I am not able to reproduce the error that I was encountoring yesterday and package too compiled successfully.

@devkapilbansal devkapilbansal force-pushed the openwisp-openwrt-monitoring branch 2 times, most recently from aa32816 to 8829e13 Compare May 16, 2021 19:06
@devkapilbansal
Copy link
Member Author

devkapilbansal commented May 16, 2021

Also remove netjson-monitoring-wan.lua please.

@nemesisdesign does #9 makes sense now? I think they are merged already

@devkapilbansal devkapilbansal moved this from In progress to Ready for review/testing in OpenWISP Priorities for next releases May 16, 2021
@mips171
Copy link

mips171 commented May 31, 2021

Can you please show the content of your feeds and commands to compile?

Ensure the feeds are correct and that this branch is being installed when you run ./scripts/feeds install -a && ./scripts/feeds update -a, you should see this repo and this branch being cloned and installed on the openwrt source directory (you will find it in ./feeds, if it's not there, something is wrong with the feeds).

Once you're sure the feeds are pulled correctly, ensure your .config contains:

CONFIG_PACKAGE_openwisp-monitoring=y
CONFIG_PACKAGE_netjson-monitoring=y

Although you should be able to see these packages from make menuconfig.

Then compile everything with make -j <number-of-cores> V=s where j <number-of-cores> stands for the number of cores your machine has available.

See also my comments below.

You can also do make -j$(nproc) or if you have a CPU with hyperthreading make -j$(($(nproc) * 2)). nproc shows the number of CPU cores on your system. More tips

@devkapilbansal
Copy link
Member Author

You can also do make -j$(nproc) or if you have a CPU with hyperthreading make -j$(($(nproc) * 2)). nproc shows the number of CPU cores on your system. More tips

Hi, the problem was solved already but thanks for this. I will remember this for future

Copy link
Member

@nemesifier nemesifier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great progress @devkapilbansal, see my comments below.

README.rst Outdated Show resolved Hide resolved
openwrt-openwisp-monitoring/Makefile Outdated Show resolved Hide resolved
openwrt-openwisp-monitoring/Makefile Show resolved Hide resolved
@nemesifier nemesifier changed the base branch from master to gsoc21 June 1, 2021 00:40
Copy link
Member

@nemesifier nemesifier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make sure of the following:

  • the packages compile
  • packages can be installed on a virgin OpenWRT installation and when this is done it pulls openwisp-config as a dependency (and its dependencies)
  • ensure it can successfully post data to OpenWISP monitoring

Then we have to double check this, once those are checked we can merge this and go ahead with the other work.

@devkapilbansal
Copy link
Member Author

devkapilbansal commented Jun 2, 2021

  • packages can be installed on a virgin OpenWRT installation and when this is done it pulls openwisp-config as a dependency (and its dependencies)

Hi, I tried it on fresh OpenWRT but as netjson-monitoring is a dependency of openwisp-monitoring and it is not available in openwrt feeds, I have to install it first.
Then openwisp-monitoring package was able to pull openwisp-config and its dependencies.

I tested and all 5 packages compile ( 1 netjson-monitoring and 4 variants of openwisp-monitoring). The data was sent successfully to the server and error was logged when there was no connection to server.

P.S.:- I use openssl variant for testing.

Update:- There was a minor error that I fixed in f7d3ad2

Copy link
Member

@nemesifier nemesifier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great progress, please specify in the README that the openwisp-monitoring openwrt package depends on openwisp-config (please also link "openwisp-config" to the URL of the repo) and that installing it will automatically install also openwisp-config and its dependencies.

README.rst Outdated Show resolved Hide resolved
README.rst Outdated Show resolved Hide resolved
README.rst Outdated Show resolved Hide resolved
openwrt-openwisp-monitoring/files/monitoring.agent Outdated Show resolved Hide resolved
openwrt-openwisp-monitoring/files/monitoring.agent Outdated Show resolved Hide resolved
@devkapilbansal devkapilbansal force-pushed the openwisp-openwrt-monitoring branch 2 times, most recently from 16812ca to 2e2e0ee Compare June 3, 2021 19:32
Copy link
Member

@nemesifier nemesifier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move on so you can test this with github actions CI.

@nemesifier nemesifier merged commit c9e3a0c into openwisp:gsoc21 Jun 6, 2021
OpenWISP Priorities for next releases automation moved this from In progress to Done Jun 6, 2021
[GSoC 2021] OpenWRT OpenWISP Monitoring Package automation moved this from Needs Review to Done Jun 6, 2021
@devkapilbansal devkapilbansal deleted the openwisp-openwrt-monitoring branch June 7, 2021 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Convert into OpenWRT package
4 participants