Deployment

Distributing your apps to others can be done in different ways, but the short of it is that you need:

  1. Ensure users have installed the coraline package;
  2. To get users to install your app;
  3. To allow users to launch your app.

Installing coraline should be relatively straightforward, and it may already be available on the target system.  Short version: point them to the coraline setup/downloads page for that.

Prepare and Deploy your App

How to distribute your application.

The easy way

Update: a new, much easier way to prepare apps for deployment is available.  If you’re using cordova or ionic, then it’s only a matter of installing the cordova-linux platform (check the requirements on the platform page–basically you need cmake, coraline and some way to make deb/rpm or both).

From the top level project directory, you can now add the platform and build it with two simple commands:

$ cordova platform add \
   https://github.com/psychogenic/cordova-linux.git
$ cordova build cordova-linux

or, with ionic:

$ ionic cordova platform add \
   https://github.com/psychogenic/cordova-linux.git
$ ionic cordova build cordova-linux

which will transpile the project.

By the end you should have some deb, rpm and/or zip files in platforms/cordova-linux/packages

Manual Style

You don’t need to have cordova or use the linux platform system, as all we really need is a bundle (deb or rpm or zip) with the appropriate content in the right spots.

A walk-through of bundling an app for distribution:

What to bundle

Coraline handles everything but your custom code, so all you actually need to distribute is your HTML, JS and associated resources.

If, say, you’ve created an ionic project and transpiled it, you wind up with a self-contained www/ directory.  This is what you will distribute.

In addition to your actual content, it’s a nice touch to customize the experience a bit and to allow your users to launch the app from the system menu or the command line.

Softlinks to coraline

Coraline implements a feature that simplifies launching and keeps the GUI layers of the OS happy.

If you have an application, say “My Super App” and you have bundled your content into a directory called mysuperapp, then (when installed in the right place, see below), creating a softlink with the same name:

$ ln -s /usr/local/bin/coraline mysuperapp

will allow you to launch coraline using your custom name, without any additional arguments.  Thus

$ ./mysuperapp

will be equivalent to typing

$ coraline /usr/local/share/coraline/mysuperapp/index.html

with the added benefit that you’ll be able to associate your own custom icon to display in the task bar.

Where to install

In theory, these files could be installed anywhere on the system, but you are encouraged to give the parent directory a unique name, and have it installed in the coraline content directory–see the “softlinks” section, above, to know why this is a good idea.

This is probably /usr/local/share/coraline/content but can be found on the system using pkg-config:

$ pkg-config --variable=contentdir coraline

How to bundle

Though you can distribute everything as a plain tarball, using a packaging system will allow you to specify dependencies, like coraline or any of the optional plugins, and make sure users have everything they need before launching your app.

See the video above for a look at that.

How to launch

If you’ve setup a softlink to coraline in your bundle then, in addition to getting a custom icon, you get the opportunity to launch you app with a unique name, and no parameters:

$ myapp

Even without going through the trouble of softlinks, launching your app is as simple as running coraline with a parameter to point it to the right startup file.  If you’ve installed under the coraline content directory, as described above, then you can omit the full path and just issue:

$ coraline myapp/index.html

(assuming your parent dir is “myapp“, of course).  This is great for testing, but an even better approach is to provide a suitable desktop link for your application.

For instance, on ubuntu this would be a .desktop file installed somewhere like /usr/share/applications that looks like:

[Desktop Entry]
Name=MyApp
Exec=myapp
Terminal=false
Type=Application
X-Ubuntu-Touch=true
Icon=/usr/local/share/coraline/content/myapp/path/to/icon.png

I stuck this in that applications directory, and now searches for “MyApp” yield this:

cool.

Creating the package

Once you’ve got the entirety of your app under a single directory and ready to deploy, along with any additional resources like desktop shortcut, system icons etc, package it up as a deb (for Debian/Ubuntu), rpm or whatever is appropriate for your platform.

The most important, and useful, part of this process is that you can specify that your package depends on Coraline and any optional plugins, so that you’ll be certain your users are all setup prior to trying to launch the app (and sending spurious bug reports).

Exactly how you go about creating these bundles is left to other, better equipped, resources but the video at the top of this page shows you an example procedure, using cmake/cpack.