.. program:: jetstream server

Configuration
=============

Administrators can configure startup options for a JetStream server such as creating :doc:`superuser </security/superuser>`, or setting network parameters. Although setting a :ref:`licensing <configuration#license-configuration>`, :doc:`sandboxing </sandboxing/index>`, and :doc:`bandwidth limits </using_jetstream/bandwidth>` may be set in the configuration file, these can be set more flexibly through the :doc:`Client Application <jetstream-client:locations/location-configure-server>` or the :ref:`API <interacting#api>`.

For the complete list of JetStream configuration options, please see :ref:`jetstream#server-options` and :ref:`jetstream#relay_server-options` command reference.

.. _configuration#editing_configuration:

Editing Configuration
---------------------

JetStream services use response files for configuration, which contain all arguments that would normally be given on the command line. The arguments can be specified on a single line or argument per line for better readability. For example :file:`/etc/jetstream-server.rsp`:

.. code-block:: none

    --api-allow-remote-control
    --trigger-dir=/var/lib/jetstream/triggers
    --persistent-state-dir=/var/lib/jetstream/state

After editing configuration response files for one of the services, you will need to :doc:`restart the service </setup/services>` in order for the changes to take effect.

.. seealso::
  - :ref:`jetstream#server-options` command options
  - :ref:`jetstream#relay_server-options` command options
  - Managing :doc:`/setup/services`

Linux (Rocky, Ubuntu)
~~~~~~~~~~~~~~~~~~~~~~

The ``jetstream-server`` startup arguments can be specified in the :file:`/etc/jetstream-server.rsp` file, and ``jetstream-relay`` startup arguments in the :file:`/etc/jetstream-relay.rsp` file. For example, setting a :doc:`superuser </security/superuser>` would involve the following:

.. code-block:: shell-session
   :emphasize-lines: 5

   # sudo vi /etc/jetstream-server.rsp
   --api-allow-remote-control
   --trigger-dir=/var/lib/jetstream/triggers
   --persistent-state-dir=/var/lib/jetstream/state
   --superuser=user
   # sudo systemctl restart jetstream-server


macOS
~~~~~

The ``jetstream-server`` startup arguments can be specified in the :file:`/usr/local/jetstream/etc/jetstream-server.rsp` file, and ``jetstream-relay`` startup arguments in the :file:`/usr/local/jetstream/etc/jetstream-relay.rsp` file. For example, setting a :doc:`superuser </security/superuser>` would involve the following:

.. code-block:: shell-session
   :emphasize-lines: 6

   # sudo vi /usr/local/jetstream/etc/jetstream-server.rsp
   --api-allow-remote-control
   --trigger-dir=/var/lib/jetstream/triggers
   --persistent-state-dir=/var/lib/jetstream/state
   --log=/var/log/jetstream-server.log
   --superuser=user
   # sudo launchctl kickstart -k system/io.gojetstream.jetstream-server


.. _configuration#license-configuration:

License Configuration
---------------------

JetStream server requires a license to send or receive transfers. You can set the server license key in several ways, such as:

Client Application
~~~~~~~~~~~~~~~~~~

Use the :doc:`Client Application <jetstream-client:locations/location-configure-server>` to configure the server using a graphical user interface. Requires setting up a Location with a user with :doc:`superusers </security/superuser>` privileges.

Command-line
~~~~~~~~~~~~

The license can be set on the command-line. Run the following command and enter your regular password when prompted (assumes that the current user has :doc:`administrator </security/superuser>` privileges; ``sudo`` is not required).

* Linux:

.. code-block:: shell-session

  # /usr/local/bin/jetstream api setLicenseKey --key=123456789

* macOS:

.. code-block:: shell-session

  # /usr/local/jetstream/bin/jetstream api setLicenseKey --key=123456789

API
~~~

The license can be set by using the :meth:`~jetstream.serverinterface.ServerInterface.setLicenseKeyAsync` API call (requires a user with :doc:`superusers </security/superuser>` privileges).

Configuration File
~~~~~~~~~~~~~~~~~~

The license can be set by adding the :option:`--license-password` argument to your startup configuration (see :ref:`configuration#editing_configuration` for the location of the configuration file on each platform). For instance, on Linux you could do the following:

.. code-block:: shell-session
   :emphasize-lines: 5

   # sudo vi /etc/jetstream-server.rsp
   --api-allow-remote-control
   --trigger-dir=/var/lib/jetstream/triggers
   --persistent-state-dir=/var/lib/jetstream/state
   --license-password=123456789


Please contact sales@gojetstream.io to obtain your license key.

.. seealso::
  - :doc:`Server Configuration <jetstream-client:locations/location-configure-server>` in the Client Application
  - :ref:`configuration#editing_configuration`
  - :ref:`jetstream#server-options` command options


License Configuration
---------------------

JetStream server requires a license to send or receive transfers. You can set the server license key in several ways, such as:
JetStream server can be configured to receive transfers from multiple ports. You can set the receiver ports within the configuration file:

Configuration File
~~~~~~~~~~~~~~~~~~

Set the receiver ports by adding the :option:`--recv-port` argument to your startup configuration (see :ref:`configuration#editing_configuration` for the location of the configuration file on each platform). For instance, on Linux you could do the following:

.. code-block:: shell-session
   :emphasize-lines: 5

   # sudo vi /etc/jetstream-server.rsp
   --api-allow-remote-control
   --trigger-dir=/var/lib/jetstream/triggers
   --persistent-state-dir=/var/lib/jetstream/state
   --license-password=123456789
   --recv-port=8886 8887 8888 8889