Guide: Local development workflow

When doing development with the autopi, it is possible to do it all through the cloud.

  1. Make changes
  2. Push changes to device
  3. Restart services
  4. Execute module
  5. Go to 1.

But while this process can be used, it is much too slow to be used for actual development.
So the cloud should be used for management, and to push out code when the development has finished, and not in the actual development workflow.

Fortunately there is other much faster alternatives, here is a few ways to do it.

1. Development on RPI with screen+keyboard or SSH

You could instead SSH into the device and edit the files directly.
When syncing from the cloud, the modules will be put in the following directories, based on the type.

  • /opt/autopi/modules
  • /opt/autopi/returners
  • /opt/autopi/utils
  • /opt/autopi/engines
  • /opt/autopi/states

So you can simply edit/create the files directly, but make sure to avoid clashes with the cloud synced modules, to prevent losing work if you sync the module from the cloud, as that will, without asking, overwrite the file on the device, even if you have made local changes to it.

When you make changes to the files, to make sure that the minion process picks up on the change, you can either restart the salt-minion service, or run this command saltutil.refresh_modules which reloads the external modules, ie. your code.

2. Remote development on dev machine

Alternatively, another workflow can be to have a script on your development machine that copies the files to the device via SCP, that way you can make the changes in your favorite editor. (Remember to have the script also either restart the minion service or run the refresh_modules command as noted above).
Doing development on the local machine is preferable for many, and is also the way we do development as it has the benefit of the above solution, but also allows the user to be as productive as possible by in his/her preferred dev environment.

We hope this helps you get started developing with our device and platform.

Remember that we also offer additional more in-depth paid support to get you started with your project.
https://shop.autopi.io/products/development-support-voucher-16/

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.