Spotfire® Service for R Installation and Administration

Configuring a custom Docker image on a node with internet access

If you have access to the internet, then you can build a Docker image for your Spotfire Service for R, referencing it by its name and tag.

About this task

Perform this task from the command line on the computer where your Spotfire Server is installed. Some steps are performed on the computer where the node manager is installed. (This can be a different computer.)

You can create the custom configuration before installing the Spotfire Service for R.

Before you begin

  • You must have Docker installed on the computer running the node manager. If you install and start the service before you install Docker, then exceptions are written to the log.
  • You must have a Linux computer where the node manager installed. (Your node manager and Spotfire Server can be on different computers).
  • If you are using the script to build the base Docker image, you must have a connection to the internet. (A connection to the internet is not required if you are using a locally-available Docker image.)

Procedure

  1. If you have already installed the service from the Spotfire Server Nodes & Services administration page, and if it is running, then stop the service.
  2. On the node manager computer, create a new directory called docker. Inside that directory, create your Dockerfile.
    Important: Remember that for any script you write, the line endings must be appropriate for the operating system where the service runs. Many text editors can perform end-of-line (EOL) conversion.
    #############################################
    # A sample Dockerfile for installing JDK. #
    #############################################
    FROM debian:12-slim
    #  install openjdk
    RUN apt-get install openjdk-17-jdk && apt-get clean
    #  set JAVA_HOME variable
    ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
  3. Install open-source R
    # Install required packages
    RUN apt update -y \
      && apt upgrade -y \
      && apt install -y  \
      ca-certificates \
      gnupg \
      && gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-key '95C0FAF38DB3CCAD0C080A7BDC78B2DDEABC47B7' \
      && gpg --armor --export '95C0FAF38DB3CCAD0C080A7BDC78B2DDEABC47B7'   | tee /etc/apt/trusted.gpg.d/cran_debian_key.asc \
      && echo deb http://cloud.r-project.org/bin/linux/debian bullseye-cran40/ > /etc/apt/sources.list.d/r-project.list \
      && apt update -y \
      && apt install -y --no-install-recommends \
      openjdk-17-jdk \
      r-base-core=4.3.* \
      r-base-dev=4.3.* \
      r-recommended=4.3.* \
      && apt clean all 
  4. On the computer running the node manager, build the image with the name and tag.
    The name and tag are comprised as <name:version>, as follows.
    docker build -t rsrv:258 .
  5. On the computer running Spotfire Server, export the custom.properties.
  6. Edit the settings in the file custom.properties, specifying the name and tag of your custom image.
    use.engine.containers: TRUE
    docker.image.name: <name:version>
    
  7. On the computer running Spotfire Server, import the custom.properties.
  8. From the Spotfire Server Nodes & Services administration page, install the service, specifying the configuration to use, and then start the service.

    If you have already installed the service, then in the node manager, select the service and click Edit. From the Configuration drop-down list, select the new configuration.

If problems occur, troubleshoot by examining the Dockerfile that the service writes. After the service runs, this Dockerfile is available at the root service directory on the computer running the node manager. For example, /opt/nodemanager/<version>/nm/services/<language>-service-linux-<version_#_ID>/dockerfile/Dockerfile.