Skip to content

New code layout for SUSI application #481

@hongquan

Description

@hongquan

Sorry I don't have enough time to think carefully to give a proper proposal, so I just give brief of my thinking here and we will discuss about new project layout for SUSI.

Why we need it?

  • To help easier upgrade.
  • Reset feature: Reset configuration and reset the whole code files (factory reset).
  • To avoid hardcoding "sudo" in our code.

My suggestion:

  • Object is to transform SUSI Server, SUSI Linux, so that it can be packaged to *.deb. We then setup a repo to distribute the updates in form of deb. Other than deb, recently there are new packaging mechanism like snap, flatpak. The later try to isolate the application in a sandbox environment. This sounds secure, but in fact, that isolated environment causes many bugs that prevent the app from accessing other system's resource. So I decide to stay with deb. We also deliver the RaspberryPi box with just enough software and don't want user to install more to it, so we don't really need an isolated environment for our SUSI apps in that box.

  • When packaged in deb, our app will be installed in system folders (/etc, /usr/share, /var/lib) where normall user cannot overwrite. That prevents user from modifying our code (and break the app) by accident.

  • With deb package, the factory reset is easy: Just reinstall the app with apt install --reinstall. Resetting configuration is also easy: dpkg-reconfigure.

  • Being installed to system folder, our app needs a dedicated user for it. I suggest to create a user susi with home folder in /var/lib/susi to run our app. This user can be created by postinst script of deb package. Other than that, we will add this user to gpio group so that it can access GPIO without "sudo". That "adding user to group" step can also be done automatically with postinst script.

  • To be simple, we let both SUSI Server and SUSI Linux run in susi user.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions