Build cog from scratch

If I want to rebuild Cog to add a feature to it, what would be the steps to make it compatible with a verdin module? A push in the right direction would be greatly appreciated! Thanks in advance.

Merijn

Greetings @mvandenabeele,

The most straightforward way to rebuild Cog would probably be via Yocto. A meta-layer and recipe is provided for Cog here: meta-webkit/recipes-browser/cog at main · Igalia/meta-webkit · GitHub

This way the compilation and dependencies would be handled cleanly and Cog would be integrated into your final image.

However, I see you are using TorizonCore. In this case it would be possible to create a container an arm64-based container to build Cog. Though you’ll need to manage the dependencies and such yourself. There’s some guidance on building Cog from the command-line in the official Cog repository here: GitHub - Igalia/cog: WPE launcher and webapp container

May I ask for what purpose you are trying to re-build Cog?

Best Regards,
Jeremias

Thanks for your reply Jeremias

Our device will run around 8 containers. Cog is rather fast to boot, but the webserver that serves our application takes a good amount of time to boot. If Cog can’t connect to the server because it’s not ready yet, it displays a page load error and the UI is stuck. I wanted to replace that errorpage with a custom html page that shows a loading message and checks the availability of the webserver through javascript. Once available, the browser would be redirected to the application UI.

As an easy solution, I created an extra container based on nginx:stable-alpine to serve this loader page. I think/hope this container will be fast enough so it’ll always be ready before Cog comes to life. Rebuilding Cog is still an option because we’re running out of memory and every MB counts, but for now, I think I’ll leave it at that. Nginx runs at 6.3MB

Another option was to add a healthcheck to the docker-compose file, but for some reason, it didn’t work reliably. I think the webserver just takes way too long to boot, which is a bit strange as it’s a really simple node.js webserver with some sqlite databases and serving an angular application. I wouldn’t think that would be so slow.

I see that makes sense. Just to give some options there is a utility called wait-for-it: GitHub - vishnubob/wait-for-it: Pure bash script to test and wait on the availability of a TCP host and port

It should be available as a Debian package. You could use this as part of your solution so that Cog only starts after your webserver is up and ready. Though from your description it sounds like it takes a while to get going. In which case I guess you still need to show something while waiting for the webserver to come up.

Best Regards,
Jeremias

Hi @mvandenabeele !

Were you able to solve the issue?

Best regards,

Yes and no. We decided to use the Verdin with more processing power to overcome the 8-container-limit and because the UI is noticeably more responsive. This, combined with wait-for-it, made it work for us.

Hi @mvandenabeele !

Ok. Thanks for the information.

Best regards,