Skip to content

App porting guide

Boris Rybalkin edited this page Jan 21, 2022 · 25 revisions

We run a modified Snapd instance on device (https://github.com/syncloud/snapd)

Syncloud Snapd differences

  • Syncloud store support
  • More systemd parameters
  • No restrictions (confine, apparmor)

Syncloud Snap package building differences

  • No confine/apparmor definitions needed
  • We try to take binaries from corresponding docker images for complex dependencies like languages or databases
  • We do not use snapcraft tool and just a plain build.sh to download/compile needed dependencies.

Apps are usual snaps plus Syncloud specific configuration snap hooks.

Before porting

Ideally app should have a web interface and a way to authenticate against LDAP. LDAP authentication can be implemented by Syncloud for an app project if they are ready to accept it upstream.

Examples

Any Syncloud app can be used as an example for building a new one.

App directory structure:

  • bin: service start scripts
  • config: app configs
  • hooks: app lifecycle events, currently we have a python library for interaction (it is http based so any language can be used). Hooks include snap events (install, configure, post refresh) and Syncloud platform events (access change, storage change)
  • snap: snap package definition (name, services, commands)
  • integration: app integration and ui tests
  • build.sh: build script
  • .drone.jsonnet: CI build pipeline

What to include into an app

According to snap and to common sense you need to include everything app needs to run and it should not depend on anything except kernel API. This includes databases, web servers, caches etc. This allows us to safely update apps anytime we want for a fix or a newer version. In future all Linux distributions will be organized like this.

Building a package locally

Build script brings all the dependent services (database, language ...) into the right places and creates a single archive using a squashfs (app-[version].snap) which you can install later on the device or publish to our store for everyone to use.

Build

We use Drone CI build server for automated builds with high level steps (pipeline) defined in .drone.jsonnet It is possible to run done pipeline locally by using drone cli

sudo /path/to/cli/drone exec --pipeline=[amd64|arm|arm64] --trusted

Install a package on a device

snap install --devmode /path/to/package.snap

Update version

Over time you need to update versions of the upstream app and repackage Syncloud snaps, you can do this by doing the following:

  1. change VERSION variable in build.sh
  2. build package which will run all the needed tests
  3. install package on your device
  4. create a PR (pull request) so we can review it and accept for the store publishing

Request publishing to Syncloud store

Create an issue. You can link to your repository in the respective issue. It's functionality and compatibility will be reviewed, and to fit our guidelines (open source). If yes, it will then be published.

Add badges to your website

If you are the owner of an app, you can refer from your website to Syncloud store.

Bright version

Dark version