Skip to content

About

Magento 2 (Open Source) on a Linux desktop inside one browser tab, via Linux in WebAssembly (Unkernel). Try it online: https://magento2-unkernel.pages.dev - or run it locally, also with your own Magento project and database: https://github.com/nemke82/magento2-unkernel/blob/main/docs/your-project.md. Experimental.

Topics

Resources

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

magento2-unkernel

A development sandbox for Magento® Open Source, running on Linux in WebAssembly.

MIT license Node.js 24 or newer Status: experimental

Try it online · Start here · What works · Test results · Roadmap · Desktop · Website · Your project · FAQ

Magento2unkernel.mp4

A full Magento Open Source 2.4.8-p5 store (nginx, PHP-FPM, MariaDB, Valkey and OpenSearch) running on a real Linux kernel compiled to WebAssembly. No virtual machine and no Docker on your computer. It can even run entirely inside one browser tab, on a Linux desktop with Chromium showing the store.

Start here

Try it online, with nothing to install: https://magento2-unkernel.pages.dev

Open it in desktop Chrome or Edge with about 5 GB of free memory, and choose Launch the desktop. That is the only click: the store comes ready installed and starts by itself, with a progress bar, and Chromium in the desktop turns into the shop when it is ready. On our older test laptop that took about 9 minutes, and a first visit downloads about 1.4 GB.

Or run it on your own computer. You need Linux, Node.js 24 or newer, Git and Chrome or Edge.

See Linux running in a browser tab (about a minute):

git clone https://github.com/nemke82/magento2-unkernel.git && cd magento2-unkernel && npm ci && npm run desktop:build && npm run desktop:linux

Install and start the Magento store (once installed, it starts in about 2.5 minutes):

git clone https://github.com/nemke82/magento2-unkernel.git && cd magento2-unkernel && npm ci && npm run store

Then open the link it prints. That's it. To get the store inside the browser-tab desktop too, see the store desktop.

Run your own Magento project (2.4.8), from a Git repository or a folder, with a fresh database or your own dump. It runs with its network off. See Your own Magento project.

npm run store -- --from git@github.com:you/shop.git

Note

How long the first install takes depends on your computer. On our older test laptop (Intel i7-4810MQ, 16 GB) it took about 30 minutes. On a modern laptop or desktop it should be much faster, roughly 5 minutes by our estimate, which has not been measured yet. Your results are very welcome.

A product page of the sandbox store in Chromium, after adding the product to the cart, which shows 1
Chromium, the store and its services, all running inside one browser tab

The live website in a browser tab: the Magento admin dashboard in Chromium inside the desktop, next to the Admin login app's terminal with the demo user, password and two-factor code
The admin on the live website. Admin login shows the public demo's login and a fresh two-factor code

Important

This is experimental. Use it for test data only, never for production or customer data. See Security.

It is built on Unkernel, which runs unmodified arm64 Linux programs in WebAssembly.

What works today

Part Tested Result
Installing a store Magento Open Source 2.4.8-p5 on a new disk, about 32 minutes ✅
Every service in one guest 3 GiB guest, 4 CPUs, about 650 MiB used ✅
Storefront Pages, styles and scripts, search, cart ✅
Checkout Guest order paid by check, over the REST API ✅ not by clicking through its pages
Admin Password and two-factor code. A wrong password or code is refused ✅
Cron, cache and sessions Jobs finish, and Valkey holds the data ✅
Restart Products, search, the order and admin login are still there ✅
Linux desktop in a browser tab Starts in about 3 seconds, with its own empty disk ✅ by hand, in headless Chrome, including installing a package with apt
Store desktop in a browser tab Start and stop the store. In Chromium: home page, search, product page, add to cart. Changes are kept after the browser closes ✅ by hand, in headless Chrome. The admin with two-factor login, by hand on the live website
Network, disk, host directories DNS, HTTPS, restarts, read-only and read-write mounts ✅
Docker Engine Ports, DNS, no HTTP between separate networks, volumes, restart ✅ memory limits not tested
Docker Compose, full sample data, production mode Not tested

The results come from one laptop (Intel i7-4810MQ, 16 GB, with little memory free). Times on other computers will differ. Every automated check, with its time and output. The desktop is not in there, because it was tested by hand: see what was checked.

Step by step

You need Linux, Node.js 24 or newer, Git, Chrome or Edge, and an internet connection for the setup. Allow about 10 GiB of free disk space for the store. It has been tested on Linux x86-64 with Node.js 24 and Chrome 156 only. No domain, certificate or hosting is needed: everything listens on your own computer only. Start with:

git clone https://github.com/nemke82/magento2-unkernel.git
cd magento2-unkernel
npm ci
What you get First time Free memory
1. Linux desktop Linux in a browser tab, as on unkernel.dev about a minute about 3 GiB
2. Store desktop The desktop with the store and Chromium inside, in one tab about 50 minutes 5 GiB
3. Local store The store in your normal browser. The fastest to use about 35 minutes 5 GiB

The times are from our older test laptop. A faster computer should need a fraction of them. Building and downloading also depend on your connection.

1. Linux desktop in a browser tab

This is the quickest way to see it work. It needs no store:

npm run desktop:build     # once
npm run desktop:linux

Open the link it prints in Chrome or Edge. Linux starts in about 3 seconds. Try these in its terminal:

uname -a        # Linux, on a WebAssembly kernel
nproc           # 4 CPUs
sudo apt-get update && sudo apt-get install -y cowsay
/usr/games/cowsay "Hello from a browser tab"

The app launcher in the dock, or Ctrl-Shift-O, opens Unkernel's apps. The Magento folder there only works in the store desktop. What you change is kept in that browser.

Close the tab and press Ctrl-C in your own terminal before you open the store desktop. Both use port 8090.

This desktop has its own address (localhost:8090) and an empty disk. It cannot reach the store desktop's disk or saved changes. It has internet access through Unkernel's public proxy, which can read unencrypted traffic. Do not put passwords or private data in it.

The terminal in the desktop: Linux booted in 2.36 seconds on 4 CPUs, apt installed cowsay, and a cow says Hello from a browser tab

2. The store on the desktop

Install the store, if you have not yet. It takes about 32 minutes plus a first start:

npm run store

When it prints the store's address, press Ctrl-C and wait for stopped. Then prepare the desktop:

npm run desktop:build     # once, and after you update this project
npm run desktop:prepare   # about 17 minutes: copies the store, adds Chromium and makes its pages ready
npm run desktop

Open the link it prints in Chrome or Edge. Keep that link private. Then:

  1. Open the app launcher in the dock, and the Magento folder in it.
  2. Choose Start store and wait for The store is ready. This takes about 3 minutes.
  3. Choose Storefront. Chromium and the home page take up to about 2 minutes. Search for duffle, open the product, and choose Add to Cart. The cart then shows 1.
  4. When you are done, close Chromium and choose Stop store. Then you can close the tab.

Store admin opens the admin in the same way, and it works there. On your own desktop, the user, password and two-factor secret are the same as below. On the public website, Admin login shows them.

The Magento admin's Stores, Configuration, Advanced, System page in Chromium inside the desktop on the live website
Store configuration in the admin, on the live website

Make the one-time code just before you send it: the store accepts it for at most 59 seconds.

The Magento folder in the desktop's launcher: Start store, Storefront, Store admin and Stop store

This desktop uses its own copy of the store, and keeps your changes in that browser. Its network is off. How it works, and its limits.

3. The store in your own browser

npm run store

The first time, this installs the store in about 32 minutes. Later, it starts in about 2.5 minutes. When it prints the address, open http://localhost:8089 in a new tab. Ctrl-C saves everything and stops the store.

If the installation is interrupted, run it again. It skips the steps that are done, which was tested. It should repeat the step it was in, but stopping in the middle of a step was not tested.

Admin login

The admin is at http://localhost:8089/admin/. The user, password and two-factor secret are made for you. They are in ~/.local/share/magento2-unkernel/store/credentials.json, which only your user can read. Add totpSecret to an authenticator app. Never share that file or the disk images.

If something goes wrong

Problem What to do
locked by process ... If that process is gone, for example after a crash, delete the file the message names
EADDRINUSE Another program uses port 8089 or 8090. Stop it. These ports are fixed
The desktop says Open the desktop with the link... Use the newest link. Each start makes a new one, and the old ones stop working
desktop.localhost does not open Use Chrome or Edge, which need no setup for this name
Very slow, or the tab stops Free up memory. Close other programs and tabs, and do not run the store at the same time

Make it a website

The store desktop can also be a public website, as unkernel.dev is: visitors open one address, and Linux, the store and Chromium run in their browser tab, with nothing to install. The store comes ready installed on its disk, so visitors only wait for Start store. It uses its own public store, never yours, and runs on Cloudflare's free plans with no domain needed:

npm run desktop:build
npm run public:store       # about 32 minutes. Ctrl-C when it prints the address, and wait for "stopped"
npm run public:prepare     # about 17 minutes
npm run public:site
npm run public:preview     # try it at http://localhost:8091
npm run public:publish -- --project <name>   # after npx wrangler login

It runs at https://magento2-unkernel.pages.dev. From there, on our test laptop, Linux started in 15 seconds and the store in 5.5 minutes, and a first visit downloads about 1.4 GB. How it works, costs and licenses.

How it works

A browser tab talks to a Node.js host, which runs a Debian guest with the services and keeps its data in a disk image

The diagram shows the local store. In the desktop, the Debian guest runs inside the browser tab, and Node.js only serves the desktop and the disk. npm run demo is a smaller check of only nginx and PHP, at http://localhost:8088.

What makes it faster

Measured on our test laptop. The whole-install, start and desktop rows compare single runs, so treat them as rough:

Step Before Now How
Whole installation 39 to 43 min 32 min Everything below
Choosing package versions about 280 s about 10 s A composer.lock with every package's exact version
Starting OpenSearch 372 s 147 s Java starts directly, with less compiling, only the modules the store uses, and an archive of loaded classes
Its memory 749 MiB 349 MiB The same
Starting the whole store 364 s 148 s OpenSearch starts first, in the background
First page after PHP restarts 21 s 6 s PHP keeps its compiled code on disk
Start store, in the desktop 8 to 9 min 3 min 18 s The same
First home page, in the desktop over 6 min under 2 min desktop:prepare makes the styles, scripts and main pages in advance

Most of the remaining time goes into running emulated arm64 programs. Faster disk writes for Debian's packages, and downloading OpenSearch at the same time, made no difference. OpenSearch's scripting module slows its start, but stays, because the store sorts search results with it. Two-factor login stays on.

Run the tests yourself

npm run probe          # list the probes
npm run probe -- a1    # run one
npm run probe -- d1    # install and test a whole store on a new disk: about an hour
npm run probe -- all   # run them all: allow about two hours and 5 GiB of free memory
npm run compat         # rebuild docs/compatibility.md from the results

Each probe starts a new guest, runs its checks and writes a result file to docs/evidence/. The compatibility page is generated from those files.

Good to know

  • A guest has at most 4 GiB of memory, because the kernel Unkernel ships has 32-bit memory.
  • CPU-heavy programs run much slower than on your computer, because their arm64 code is emulated. OpenSearch shows it most.
  • There is no IPv6 in the guest. nginx's default site listens on IPv6, so it fails to start. Remove that site, as the demo does.
  • Debian's nginx hides the port from PHP, as a security fix. The store needs it to recognise its admin address, so the installer sets that one fixed address. It does not pass on what the client sends.
  • Put disk images on a real disk. On many systems /tmp is in memory and takes the RAM the guest needs.
  • Debian packages start their services when installed and at every boot. Guest.install() prevents the first for everything it installs, and the second for the services you name.

Project layout

Path What it is
src/runtime/guest.ts Starts and stops guests, runs commands, installs packages, forwards ports
src/compat/ The probe runner
src/store.ts, src/store/ Installs, starts and stops the store
src/desktop/ Builds, prepares and serves the desktop
desktop/ The pinned Unkernel version, our small patch to it, and our apps
src/demo.ts The nginx and PHP demo
probes/ One file per tested capability
docs/evidence/ Test results, as JSON
docs/decisions/ Why things are the way they are

Contributing

Results from other computers are very welcome, failures included. See Contributing. Questions and ideas go in Discussions, and the FAQ answers the common ones. To change the sandbox itself, see Customizing.

License and credits

The code here is under the MIT license. Unkernel's SDK and desktop are MIT, and its kernel is GPL-2.0. They are downloaded when you run or build this. The repository holds only a small patch to the desktop. See third-party notices.

Thanks to Unkernel, which makes this possible, and to Undocker for exploring containers on it.

Magento is a trademark of Adobe. This is an independent project, not affiliated with or endorsed by Adobe or the Unkernel maintainers.

About

Magento 2 (Open Source) on a Linux desktop inside one browser tab, via Linux in WebAssembly (Unkernel). Try it online: https://magento2-unkernel.pages.dev - or run it locally, also with your own Magento project and database: https://github.com/nemke82/magento2-unkernel/blob/main/docs/your-project.md. Experimental.

Topics

Resources

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages