Live reload apps

Hello everyone

Can we discuss some architectures to enable live reloading apps while developing? This would be a huge productivity boost (instead of doing save => deploy => start cycle).

@vjoao There is a system in place that we’ve been using locally. It requires you to download the matrix-os repo to your local computer and work within the apps folder there.

First, find the ip of your device and map it to m in your /etc/hosts/ file/.

Then run npm run watch from inside the matrix-os folder and work from your app within the apps directory. Make sure the app folder name is suffixed with .matrix so. appName.matrix should be the folder name. For administrative purposes, you still need to deploy the first time to make the app record.

This is until we can make a watch function for the cli that auto-deploys in a clean way. It’s not the same as working on a file locally, there are more access limitations, and we need to support devices outside the local network and interoperate with the running device. So it’s something we’ve talked about, and I agree, it would be a very nice workflow. It takes quite a bit of polish to ensure it works properly every time.

Alternative to that mess above you can do the following from your working dir.

nodemon --exec rsync -e ssh --progress -u app.js pi@m:matrix-os/apps/appName.matrix/app.js

Make sure to adjust appName accordingly. That will upload your app code on save.

1 Like

Yea, I was doing something like that with scp

nodemon --exec scp app.js pi@

The problem I’m facing is that for the changes to happen (like if I change the LED color from red to green) I still need to restart the app with matrix stop testApp && matrix start testApp which requires internet and takes a bit of time. Can I restart the app from within the Pi?

@vjoao that is something we haven’t considered, is watching the apps filesystem for changes and restarting the application on change. right now, we’re looking at virtualization for apps, so they are isolated from Raspbian. after this is done, we can look at improving the developer workflow.

we’re all developers, and we know how we’d want to develop apps for it, but every feature has to come at the right time, otherwise we risk having to undo and redo work.

you’re right tho, saving on my machine and live-reloading on the device would be an amazing workflow.