3 Licensing & Activation

When RStudio Connect is first installed on a system it operates in an evaluation mode for a period of time and then subsequently requires activation for continued use.

To determine the current license status of your system, you can use the following command:

$ sudo /opt/rstudio-connect/bin/license-manager status

After purchasing a license to RStudio Connect, you will receive a product key that is used to activate the license on a given system. Each product key given limits usage of RStudio Connect in the following ways…

  • Number of user accounts that have signed into RStudio Connect. Once this limit is reached, additional users will not be permitted to sign into RStudio Connect. This limit is enforced the first time each user logs in. Locked users are not counted against this quota. Additionally, users that have not recently been active on the server are not counted against this quota. Users are deemed “inactive” after 365 days without visiting RStudio Connect, though this value may vary for certain licenses.
  • Number of users that can access Shiny applications at one moment in time. If this number is exceeded, new anonymous users will be unable to view the Shiny application requested. This limitation does not affect logged in users.
  • Whether or not API hosting is supported.

How many are allowed of each metric depends on the license purchased from RStudio.

You can activate your license key with the command:

$ sudo /opt/rstudio-connect/bin/license-manager activate <product-key>

After activation, we recommend restarting the RStudio Connect server. A change in license status will eventually be detected by the product; a forced restart ensures that change is seen immediately.

$ sudo stop rstudio-connect
$ sudo start rstudio-connect

Your platform may need alternate commands to restart RStudio Connect. Please see Section 5.1 for instructions specific to your operating system version.

If you want to move your license of RStudio Connect to another system, you should first deactivate it on the old system.

$ sudo /opt/rstudio-connect/bin/license-manager deactivate

3.1 Proxy Servers

If your server is behind an internet proxy, you may need to add an additional command line flag indicating the address and credentials required to communicate through the proxy. This may not be necessary if either the http_proxy or all_proxy environment variable is defined (these are read and used by the license manager when available).

If you do need to specify a proxy server explicitly you can do so using the --proxy command line parameter. For example:

$ sudo /opt/rstudio-connect/bin/license-manager \
    --proxy=http://127.0.0.1/ activate <product-key>

Proxy settings can include a host-name, port, and username/password if necessary. The following are all valid proxy configurations:

http://127.0.0.1/
http://127.0.0.1:8080/
http://user:pass@127.0.0.1:8080/

If the port is not specified, the license manager will default to using port 1080.

3.2 Offline Activation

If your system has no connection to the internet it’s also possible to perform an offline activation. To do this, we recommend using our offline activation app which will walk you through the process: RStudio Offline Activation

You first generate an offline activation request as follows:

$ sudo /opt/rstudio-connect/bin/license-manager activate-offline-request <product-key>

Executing this command will print an offline activation request to the terminal which you should copy and paste into our offline activation application or send to RStudio customer support (support@rstudio.com). You will receive a reply with a file attachment that can be used to activate offline as follows:

$ sudo /opt/rstudio-connect/bin/license-manager activate-offline <activation-file>

After activation, we recommend restarting the RStudio Connect server. A change in license status will eventually be detected by the product; a forced restart ensures that change is seen immediately.

$ sudo stop rstudio-connect
$ sudo start rstudio-connect

Your platform may need alternate commands to restart RStudio Connect. Please see Section 5.1 for instructions specific to your operating system version.

If you want to renew your license of RStudio Connect or move it to another system you can also perform license deactivation offline. You can do this as follows:

$ sudo /opt/rstudio-connect/bin/license-manager deactivate-offline

Executing this command will print an offline deactivation request to the terminal which you should copy and paste into our offline activation application or send to RStudio customer support (support@rstudio.com).

You can also perform an offline check of your current license status using the following command:

$ sudo /opt/rstudio-connect/bin/license-manager status-offline

3.3 Licensing errors

Connect uses the license-manager to determine if a valid license is available. Should an error occur when interacting with the license manager, Connect indicates that problem in its the /var/log/rstudio-connect.log log. The license manager sends details about the error to the system messages (syslog). You should consult both locations should Connect be unable to obtain license status.

3.4 Floating Licensing

If you stop and start the RStudio Connect server frequently, for instance because it’s running inside a virtual machine or container, you may wish to use floating licensing instead of traditional licensing.

To use floating licensing, you run a small, lightweight server, which holds the licenses and distributes leases. When a RStudio Connect server starts, it will connect to the license server and obtain a temporary lease on a license, releasing it when the RStudio Connect server is stopped. Using this method, you can have more RStudio Connect servers than licenses, so long as you do not run more instances at once than you have licenses.

3.4.1 The RStudio Connect License Server

The RStudio License Server site contains license server downloads for all RStudio products. Download and install the license server for RStudio Connect on a machine in your network. You then activate the license server with your license key, using a command like the following:

$ sudo connect-license-server activate <product-key>
$ sudo connect-license-server start

A license key which distributes floating licenses is not the same as a traditional license key, and the two cannot be used interchangeably. If you have purchased traditional license keys and wish to exchange them for a floating license key, or vice versa, please get in touch with RStudio customer support.

The file /etc/connect-license-server.conf contains configuration settings for the RStudio Connect License server, including the network port to listen on and any proxy settings required for connecting to the Internet.

3.4.2 License Server Offline Activation

The connect-license-server activate command requires an internet connection. If your license server has no connection to the internet it’s also possible to perform an offline activation. The process for doing this on the license server is identical to the process used to activate RStudio Connect offline. Generate an offline activation request as follows:

$ sudo connect-license-server activate-offline-request <product-key>

Executing this command will print an offline activation request to the terminal which you should copy and paste and then send to RStudio customer support (support@rstudio.com). You will receive a reply with a file attachment that can be used to activate offline as follows:

$ sudo connect-license-server activate-offline <activation-file>
$ sudo connect-license-server restart

3.4.3 Using Floating Licensing

Once your license server is up and running, you need to tell RStudio Connect to use floating licensing instead of traditional licensing.

/etc/rstudio-connect/rstudio-connect.gcfg

[Licensing]
LicenseType = remote

The value remote indicates that RStudio Connect should connect to a remote licensing server to obtain a license; the value local can be used to explicitly specify traditional (local) activation.

Then, tell RStudio Connect which licensing server to connect to:

$ sudo /opt/rstudio-connect/bin/license-manager license-server <server-hostname-or-ip>

Restart the RStudio Connect server so that the license changes can be detected by the product.

You only need to run the license-server command once; RStudio Connect saves the server name and will use it on each subsequent startup.

By default, the RStudio Connect License Server listens on port 8999. If you wish to use a different port, you will need to specify the port in /etc/connect-license-server.conf, and specify license-server to RStudio Connect as <server-hostname-or-ip:port>.

3.4.4 Configuring License Leases

When using floating licenses, you can optionally determine how long the license leases last by setting the lease length value on the licensing server. This value is in seconds, so for instance to make license leases last 30 minutes you would use the following syntax:

/etc/connect-license-server.conf

<lease length="1800"/>

The lease length controls how frequently a RStudio Connect server needs to contact the licensing server to renew its license lease in order for the lease to remain valid.

A shorter lease length will increase tolerance to failures by making leases available for reuse more quickly. RStudio Connect will release its lease immediately if shut down normally, but if abnormally terminated, the lease will not be released until it expires.

A longer lease length will increase tolerance to transient failures on the network. Any such issues that can be resolved before the lease is due for renewal won’t interrupt use of RStudio Connect.

We generally recommend using a longer lease length. Use a short lease length only if your environment routinely encounters abnormal terminations of the container/instance on which RStudio Connect runs.

3.4.5 Lease Expiration and Renewal

Under normal conditions RStudio Connect will automatically renew its license lease in a configurable interval as described above. However, there are situations in which it will be unable to do so, such as a network problem, or an issue on the host running the license server.

When RStudio Connect cannot obtain a license lease, either because there are no leases currently available or because it can’t reach the licensing server, it will begin automatically attempting to acquire a lease every 10 seconds. This interval is configurable; for instance, to retry every 30 seconds instead you would set the following value:

/etc/rstudio-connect/rstudio-connect.gcfg

[Licensing]
RemoteRetryFrequency = 30s

If you don’t want RStudio Connect to attempt to reestablish a license lease automatically, set the value to 0 to disable retries. In this case you will need to manually restart RStudio Connect in order to reestablish the lease. This can be useful if you often run more RStudio Connect servers than you have keys for, and wish to have more control over which RStudio Connect servers receive license leases from the limited pool on the license server.

3.4.6 Troubleshooting Floating Licensing

To validate that the license server has been successfully activated, run the activation-status command. This will report the version of the server as well as the license key and the number of available slots.

$ sudo connect-license-server activation-status

If your server is activated but you’re still having trouble with floating licensing, you can tell the RStudio Connect License Server to emit more detailed logs. Change the log level to notification:

/etc/connect-license-server.conf

<log file="/var/log/rstudio-licensing.log" level="notification"/>

Then, restart the license server, tail the licensing log, and start your RStudio Connect server.

$ sudo connect-license-server restart
$ tail -f /var/log/rstudio-licensing.log

At the notification level, the licensing log will tell you the total number of licenses associated with your key, and how many are currently in use. It will also notify you when a RStudio Connect server acquires a lease, and when that lease is released, renewed, or expired. No rotation is done for this log, so it’s recommended to use the warning level in production.