|||

Video Transcript

X

Electron on Heroku

As maintainers of the open source framework Electron, we try to be diligent about the work we take on. Apps like Visual Studio Code, Slack, Notion, or 1Password are built on top of Electron and make use of our unique mix of native code and web technologies to make their users happy. That requires focus: There’s always more work to be done than we have time and resources for. In practice, that means that we don’t want to spend time thinking about the server infrastructure for the project‌ — ‌and we’re grateful for the support we receive from Heroku, where we can host load-intensive apps without worrying about managing the underlying infrastructure. In this blog post, we’ll take a look at some of the ways in which we use Heroku.

1-electron-on-heroku

A sip from the fire hose: Electron’s update service

Updating desktop software is tricky: Unlike websites, which you can update simply by pushing new code to your server — or mobile apps, which you can update using the app stores, desktop apps usually need to update themselves. This process requires a cloud service that serves information about the latest versions as well as the actual binaries themselves.

To make that easier, Electron offers a free update service powered by Heroku and GitHub Releases. You can add it to your app by visiting update.electronjs.org. The underlying Heroku service is a humble little Node.js app, hosted inside a single web Dyno, but serves consistently more than ‌100 requests per second in less than 1ms response time, using less than 100MB of memory. In other words, we’re serving at peak almost half a million requests per hour with nothing but the default Procfile.

2-electron-heroku-redis

We’re using a simple staging/production pipeline and Heroku Data for Redis as a lightweight data store. In other words, we’re benefiting from sensible defaults — the fact that Heroku doesn’t have us setup or manage keeping this service online means that we didn’t really have to look at it in 2024. It works, allowing us to focus on the things that don’t.

Making Slack a little better for us

Like most open source projects, Electron needs to be constantly mindful of its most limited resource: The time of its maintainers. To make our work easier, we’re making heavy use of bots and automation wherever possible. Those bots run on Heroku, since we ideally want to set them up and never think about them again.

Take the slack-chromium-helper as an example: If you send a URL to a Chromium Developer Resource in Slack, this bot will fetch the content of that resource and automatically unfurl it.

3-slack-chromium-helper

To build this bot, we used Slack’s own @slack/bolt framework. On the Heroku side, no custom configuration is necessary: We’re using a basic web dyno, which automatically runs npm install, npm build, and npm start. The attached data store is Heroku Postgres on the “essential” plan. In other words, we’re getting a persistent, fully-managed data store for cents.

Here too, the main feature of Heroku to us is that it “just works”: We can use the tools we’re familiar with, write an automation that saves us time when working in Slack, and don’t have to worry about long-term maintenance. We’re thankful that we never have to think about upgrading a server operating system.

GitHub, Automated

Many PRs opened against electron/electron are actually made by our bots — the most important one being electron/roller, which automatically attempts to update our major dependencies, Node.js and Chromium. So far, our bot has opened more than 400 PRs — like this one, bumping our Node.js version to v20.15, updating the release notes, and adding labels to power subsequent automation.

The bot is, once again, powered by a Node.js app running on a Heroku web dyno. It uses the popular GitHub Probot framework to automatically respond to closed pull requests and new issues comments. To make sure that it automatically attempts to perform updates, we’re using Heroku Scheduler, which calls scripts on our app daily.

4-heroku-scheduler-electron

Platform as a Service

If you’d ask the Electron maintainers about Heroku, we’d tell you that we don’t think about it that much. We organize our work by focusing on the features that need to be built the most, the bugs that need to be fixed first, and the tooling changes we need to make to make the lives of Electron app developers as easy as possible.

For us, Heroku just works. We can quickly spin up web services, bots, and automations using the tools we like the most — in our case, Node.js apps, developed on GitHub, paired with straightforward data stores. Thanks to easy SSO integration, the entire group has the access they need without giving anyone too much power.

That is what we like the most about Heroku: How it works. We like it as much as we like electricity coming out of our sockets: Essential to the work that we do, yet never a headache or a problem that needs to be solved.

We’d like to thank Heroku and Salesforce for being such ‌strong supporters of open source technologies, their contributions to the ecosystem, and in the case of Electron, their direct contribution towards delightful desktop software.

Originally published: September 30, 2024

Browse the archives for ecosystem or all blogs Subscribe to the RSS feed for ecosystem or all blogs.