Custom Applications

If there is software you want to run which does not have a provided one-click installer but can respond to HTTP requests by listening to a specific port, you can use a Custom app (listening on port) application.

Creating a Custom Application

A Custom app (listening on port) application assigns a specific port number and creates a subdirectory in ~/webapps for your use. To create a custom application:

  1. Log in to the control panel.

  2. Click Domains / websites ‣ Applications. The list of applications appears.

  3. Click the Add new application button. The Create a new application form appears.

  4. In the Name field, enter a name for the application.

  5. In the App Category menu, click to select Custom.

  6. In the App Type menu, click to select Custom app (listening on port).

    Note

    If you plan on using WebSockets with the application, click to select Custom websockets app (listening on port) instead.

  7. If applicable, in the Machine menu, click to select a server to host the application.

  8. Click the Save button. The application is added to the list of applications. The application’s Port field contains the port number assigned to your application.

To use the application, create or modify a website entry that points to your custom application. Requests to that application’s URL will be proxied by your server to the port number provided. Your application can then listen and respond to requests on that port.

Automatically Restarting a Custom Application

On occasion, your custom application may stop running. There are a number of potential causes for this, such as:

  • a bug in your application has caused it to crash
  • your application consumed too much memory and was terminated
  • the server was restarted

Since you probably won’t be watching the application constantly, it’s advisable to set up a cron job which will automatically restart your application if it is no longer running.

While some applications may gracefully restart by running the same command used to launch the program in the first place, others may have unexpected or unpleasant side-effects, such as starting numerous copies of the same program, quickly consuming your memory allotment. For such applications, we recommend wrapping your command in a script which verifies the application is not already running beforehand.