Isolating the Jetstream server process (Linux only)

In addition to sandboxing, the Jetstream server process can be completely isolated from the host operating system. In order to run the Jetstream server like this, you have two options:

  • the classic chroot(2) environment
  • a lightweight namespace container

This guide will cover integration and control of Jetstream running in chroot or a lightweight container, but setup of each container system is out of scope of this guide. To create the chroot and container environments, please refer to your OS documentation, or the guides below:

Note

You should not modify the Jetstream Systemd unit files directly, as future updates may replace them.

When you customize the unit files, use the systemctl edit jetstream-server. It will open an editor with an override file, where you can override or add any parameters necessary. This override will remain persistent over Jetstream server updates.

To see the whole unit file as processed by the system, execute systemctl cat jetstream-server.

Start Jetstream in a chroot environment

Using this method, you will need to install Jetstream in the chroot, but all the Jetstream configuration (in /etc/) will be done on the host system. To use triggers, you will need to install all dependencies in the chroot environment.

  1. Create a chroot environment. For this example, we’ll assume it was created in /srv/chroot/jetstream-server.

  2. Update the systemd unit file with the configuration below (see note at the top of this document: use systemctl edit jetstream-server).

    [Service]
    RootDirectory=/srv/chroot/jetstream
    
  3. Update systemd daemon files: systemctl daemon-reload

  4. Restart the Jetsream server from chroot: systemctl restart jetstream-server. Jetstream should now be running from the chroot environment in /srv/chroot/jetstream-server.

Start Jetstream in a lightweight container

There are two ways of doing this: booting the lightweight container, or running Jetstream server as a standalone process in the container. The configuration differences are outlined in step 2 below.

Note

The below examples will not work on CentOS 6, as it doesn’t come with systemd installed.

Please note that Jetstream will need to be fully installed in the lightweight container. Additionally, the host system will require the systemd unit files, which you can either copy from the container (/lib/systemd/system/jetstream-server.service), or you can install Jetstream server on the host system as well.

Warning

If you choose to run Jetstream as a standalone process, you will not be able to use the jetstream-server.env (Editing Configuration) for configuration, as the environment inside of the container is separate. For license configuration, you’ll need to use the --license-password argument in the server’s response file.

  1. Create a lightweight container. For this example, we’ll assume it was created in /var/lib/machines/jetstream-server.

  2. Update the systemd unit file with the configuration below (see note at the top of this document: use systemctl edit jetstream-server). This example assumes you want to map the /home directory into the container.

    For booting a lightweight container, use the following systemd override:

    [Service]
    ExecStart=
    ExecStart=/usr/bin/systemd-nspawn -jbD /var/lib/machines/jetstream-server -bind=/home:/home --machine-name jetstream-server
    KillMode=process
    

    For running jetstream as a standalone process in a container, use the following systemd override:

    [Service]
    ExecStart=
    ExecStart=/usr/bin/systemd-nspawn -jD /var/lib/machines/jetstream-server -bind=/home:/home --machine-name jetstream-server /usr/bin/stdbuf -oL -eL /usr/local/bin/jetstream server @/etc/jetstream-server.rsp
    KillMode=process
    
  3. Update systemd daemon files: systemctl daemon-reload

  4. Restart Jetsream server from chroot: systemctl restart jetstream-server. Jetstream should now be running from the container in /var/lib/machines/jetstream-server.