Skip to content
This repository has been archived by the owner on Nov 27, 2018. It is now read-only.
Frank Rousseau edited this page Jan 8, 2015 · 19 revisions

Welcome to the Cozy Light wiki! You will find here assistance and explanation on how to augment your Cozy Light via plugins or apps.

Apps

Classic Application

It's a client/server app that uses PouchDB as a database storage. There the application used the database given by the platform to store data. They are more complex than HTML5 apps, but it can provide more capabilities like sending email or indexation. It supports only Node.js applications.

Build your Classic App tutorial

Port your Cozy App to Cozy Light

HTML5 Applications

They are serverless applications. They are only made of static files (HTML, JS, images, etc.). It can be games or app embedding a PouchDB instance that replicates data from the Cozy Light main database. They are the easiest application to develop.

Build your HTML5 App tutorial

Port you Cozy App to Cozy Light

Docker Applications (WIP, coming soon)

They are apps running via a Docker container. It requires that your Cozy Light has enough rights to use your Docker instance. That apps can be written with any language and use any database you want. The drawbacks are that they do not share a database and that this configuration is not lightweight anymore.

Build your Docker App tutorial

Plugins

Plugins allow to extend your Cozy Light capabilities by adding feature like authentication, REST API to access to the PouchDB instance, etc. The aim is to make Cozy Light highly customisable, so it could fit with many needs. Usage exemple:

  • Simple reverse proxy for your apps.
  • Light Personal cloud
  • Video games console
  • File storage
  • ...

Build your Plugin

Resources

Raspberry Pi installation of Node.js

Install Node.js on the Raspberry Pi Tutorial

To make it short:

sudo su -
cd /opt
wget http://nodejs.org/dist/v0.10.26/node-v0.10.26-linux-arm-pi.tar.gz
tar xvzf node-v0.10.26-linux-arm-pi.tar.gz
ln -s node-v0.10.26-linux-arm-pi node
chmod a+rw /opt/node/lib/node_modules
chmod a+rw /opt/node/bin
echo 'PATH=$PATH:/opt/node/bin' > /etc/profile.d/node.sh

Architecture

Apps

Following information are only true for classical apps.

Installation / Uninstallation

Actions performed on app installation:

  • Clone of the Github repository via NPM
  • Fetch of dependencies via NPM
  • Module is located in ~/.cozy-light/node_modules
  • Update of the configuration file by adding an entry for the app with the manifest information

Actions performed on app uninstallation:

  • Deletion of the module repository via NPM uninstall command.
  • Removal of the app information from the configuration file.

Start and Stop

An app is started via its index.start method. Here are the given parameters:

  • db: It's the PouchDB database, that way apps share the same datastore.
  • port: the port on which app will listen (generated automatically by the platform with simple incrementation).
  • silent: Set to true to make the app logging silent if the app supports that option.

Plugins

Install / Uninstall

Actions performed on plugin installation:

  • Clone of the Github repository via NPM
  • Fetch of dependencies via NPM
  • Module is located in ~/.cozy-light/node_modules
  • Update of the configuration file by adding an entry for the plugin with the manifest information

Actions performed on app uninstallation:

  • Deletion of the module repository via NPM uninstall command.
  • Removal of the plugin information from the configuration file.

Loading

TODO

Configuration changes

TODO

Configuration file

Example

Configuration got entries for apps, plugins and attributes. Here is an exemple of configuration file with one app, one plugin and one attribute:

{
  "port": 80,
  "apps": {
    "cozy-labs/webmail": {
      "name": "webmail",
      "displayName": "Webmail",
      "version": "0.6.8",
      "description": "Emails Web Client based on Node.js and React.js",
      "type": "classic"
    }
  },
  "plugins": {
    "cozy-labs/cozy-light-simple-dashboard": {
      "name": "cozy-light-simple-dashboard",
      "displayName": "Simple Dashboard",
      "version": "0.1.0",
      "description": "Minimalist dashboard for Cozy Light."
    }
  }
}

Changes

On a configuration file change (detected via fs.watch), the platform is restarted.

Clone this wiki locally