Instances

Ozone Home is the default Ozone Shell with all the default applications that expects you to use multiple suites of applications.

But if you are building a suite of applications and want to ship them entirely on your domain, or ship your own set of default apps, you can build an Ozone instance, and they are surprisingly easy to setup.

📘

If i can ship an instance, why should i ship for an Ozone Home?

  • Ozone Home is for general distribution and integration to the larger Ozone ecosystem.
  • Instances are for controlled, product-specific use-cases where you have to define the entire user experience.
Ozone HomeOzone Instance
  • Uses Ozone default apps
  • No duplication of apps and files, you can directly integrate.
  • Already installed. No initial setup required.
  • Installation of apps are straightforward through default Store app index.
  • Makes its own copies of applications
  • Duplicated apps if you distribute Home Default apps.
  • Users and developer has to configure the initial setup.
  • if developer didn't provide, no straightforward app installation support.

How to make an Instance

Grab ozone.js and sw.js from the official repo's dist directory. This is the entire Ozone Shell.

These scripts can be stored anywhere in your project. You just have to initialize ozone (step 1, given below) using the ozone.js script. Both these scripts must be in the same directory level.

/
	index.html			inital page of the instance
	versions.json 	versioning file
  /[source]				this default app directory path can be configured during initialization
  	/app_1	
    	manifest.json
  /[ozone]
  	ozone.js
    sw.js

Initial page

Initial

  1. initialization

    import { Ozone } from "./ozone/ozone.js" // path to imported ozone.js
    
    const ozone = new Ozone({
      defaultApps: ["app_1", "app_2"],
      sourceURL: "/source"
    })

    The Ozone class needs to be initialized with an instance configuration object which tells ozone how to configure your Instance.

    DefaultApps and sourceURL together decide the URL of every default app. For example, if sourceURL is /source and defaultApps is ["app_1"], the URL /source/app_1/ will be installed.

    📘

    Version File

    The key, versionURL should have a URL of a JSON file as value. This JSON file is used to update the service worker remotely for every user of your Ozone instance.

    The SW will update if the osware key in the JSON file is updated. The key can have any value, though an incrementing number is recommended.

    List of keys for the instance configuration object

    keyvalue typedescription
    defaultAppsarray of stringslist of all default application directories located inside the sourceURL to install during Ozone install
    sourceURLstringprovides a source URL for applications to be installed as default apps.
    sharedAssetsarray of stringslist of all files required to be installed in the /sharedAssets folder.
    swKeystringa name for the service worker version tracking variable
    dbNamestringa name for the VFS database
    versionURLstringURL for the service worker version provider JSON file.
  2. Ensuring service worker exists

    ozone.ensureServiceWorker()
  3. Installation

    ozone.install()
  4. Update default apps

    ozone.update()
  5. Reset / empty Ozone

    ozone.reset()

Debugging an Ozone Instance

There are multiple ways to debug your ozone instance, this can be done by using the official system application package, even without installing or shipping them in your instance.

Using LiveReload

You can use liveReload query param in order to load an Ozone Home system app on your Instance. Given below is a liveReload URL that lets you load Files App.

YOUR_OZONE_URL/apps/anything/anything/?livereload=https://ozoneshell.github.io/defaultSource/files/

You can also use other apps like settings, store , menu or text