The silk hosting service is replacing the app server used for applications written with some programming languages. The following documentation is considered early-release and will be clarified over time.

Long-term support (LTS) versions of Node.js and utilities are available. This currently includes the current releases of Node.js 8, 10, and 12.

Choosing a version of Node.js

You can choose among multiple versions of Node.js:

Node.js version Command-line path Sunset Date
8.x (default) /opt/nodejs/v8/bin/node December 31, 2019
10.x /opt/nodejs/v10/bin/node April 30, 2021
12.x /opt/nodejs/v12/bin/node April 30, 2022

If you need to switch Node.js versions for command-line usage, you can do so by creating or editing your site's .silk.ini file (for example ~/www-root/.silk.ini) and adding the version to the [nodejs] section:

version = 10

Valid version choices are default, any of the versions listed in the table above, or newest (which provides the newest available on the system). Changes will take effect when you next log in.

Configuring web applications

Web applications use NGINX Unit as an application server. This will automatically take care of starting up your code when someone tries to access it with a web browser; you will not launch it directly with node. For this to work, do the following:

  1. Edit the .silk.ini file in your site root. Add a section similar to the following.

    type = nodejs
    document-root = public
    startup-script = app.js

    The .silk.ini section name should be either "app" or any descriptive name you wish for your application that starts with "app: ". This could be useful if you wish to configure multiple apps.

    root is an optional directory under your site root containing all your application files.

    document-root is the directory under your app root in which static files will be located.

    startup-script is the name of the script launching your application, which should have executable permissions (chmod u+x app.js).

  2. Notify SAA that you have made these changes, so that an app server can be configured for you and the web server can be set up to speak with it.

  3. Make the following tweaks to your application:

    1. From inside your site root directory, run npm link unit-http.

    2. Since your app is launched as a script by the app server, make sure your startup script is executable (chmod u+x app.js) and begins with a script "shebang" line pointing to your desired version of Node.js, such as #!/opt/nodejs/v10/bin/node.

    3. Your app will use the unit-http module instead of http for receiving and responding to requests. Replace the line that requires http with one for unit-http, such as:

      var http = require('unit-http');
    4. Your app will not directly listen on a network port, so make sure your listen() line does not referene one. You can just say something such as:

  4. Load your application with silk-app app load <hostname>. If you have multiple sites and/or multiple apps, <hostname> is followed by the URI path of your app, such as If you see an error, check the app server log for details.

Reloading applications

An application needs to be restarted for code changes to take effect. You can do this the same way you originally loaded your application:

[myusername@silk21 ~]$ silk-app app load <hostname>

Console logs

App server logs are available at /usr/lib/unit-user-<mynetid>/unit.log.

npm packages

You can install packages for your application with npm. If you need to install something "globally" rather than inside your application's directory, you can change npm's default directory to another directory.