Blog posts

Category: Tutorial

Testing all the pixels

The Cockpit integration tests can now contain “pixel tests”. Such a test will take a screenshot with the browser and compare it with a reference. The idea is that we can catch visual regressions much easier this way than if we would hunt for them in a purely manual fashion.<h2...

Creating Plugins for the Cockpit User Interface

Note: This post was updated in May 2020 to adjust to reflect Cockpit UI and development best practices.Cockpit is a web-based graphical interface for servers. You can easily add your own custom pages to the navigation.For this tutorial you need to install your distribution’s cockpit packages or build it from...

Make your Cockpit page easily installable

Since version 152, Cockpit can discover and install packages that addpages to Cockpit. We call them “Applications” and as of now, only twoof them exist: We have Fleet Commander and Cockpit’s own DiagnosticReports in Fedora. You might have seen them on the Applications page:If you want your own page to...

Using Cockpit test VMs with your own test framework

The Cockpit Starter Kit provides the scaffolding for your own Cockpitextensions: a simple page (in React), build system (webpack, babel, eslint, etc.), and an integration test usingCockpit’s own Python test API on top of theChromium DevTools Protocol. See the recentintroduction for details.But in some cases you want to use a...

Using Vagrant to Develop Cockpit

Starting with Cockpit release 0.79 you can use Vagrant to bring up a VM in whichyou can test or develop Cockpit. The VM is isolated from your main system so any system configurationyou change via Cockpit will only happen in the VM.The Vagrant VM mounts the Cockpit package assets from...

Making REST calls from Javascript in Cockpit

Not all of the system APIs use DBus. So sometimes we find ourselves in a situation where we have to use REST (which is often just treated as another word for HTTP) to talk to certain parts of the system. For example Docker has a REST API.For this tutorial you’ll...

Protocol for Web access to System APIs

A Linux system today has a lot of local system configuration APIs. I’m not talking about library APIs here, but things like DBus services, command/scripts to be executed, or files placed in various locations. All of these constitute the API by which we configure a Linux system. In Cockpit we...

Using DBus from Javascript in Cockpit

Much of Cockpit interacts with the server using DBus. We have a powerful yet simple API for doing that, and you should use DBus too when building your own Cockpit user interfaces. For this tutorial you’ll need at least Cockpit 0.41. A few tweaks landed in that release to solve...