Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused Workbench Components #624

Draft
wants to merge 8 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions r-session-complete/Dockerfile.centos7
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ARG PYTHON_VERSION_ALT=3.8.15
ARG SRC_IMAGE_NAME=product-base-pro
ARG REGISTRY=ghcr.io
FROM ${REGISTRY}/rstudio/${SRC_IMAGE_NAME}:centos7-r${R_VERSION}_${R_VERSION_ALT}-py${PYTHON_VERSION}_${PYTHON_VERSION_ALT}
LABEL maintainer="RStudio Docker <[email protected]>"`
LABEL maintainer="RStudio Docker <[email protected]>"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind changing this to "@posit.co" while we're at it?


ARG R_VERSION=4.2.3
ARG R_VERSION_ALT=4.1.3
Expand All @@ -15,6 +15,8 @@ ARG RSW_VERSION=2023.06.1+524.pro1
ARG RSW_NAME=rstudio-workbench-rhel
ARG RSW_DOWNLOAD_URL=https://s3.amazonaws.com/rstudio-ide-build/server/centos7/x86_64

COPY ./remove-workbench-extras.sh /tmp/remove-workbench-extras.sh

SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN yum install -y subversion \
&& RSW_VERSION_URL=$(echo -n "${RSW_VERSION}" | sed 's/+/-/g') \
Expand All @@ -31,7 +33,7 @@ RUN yum install -y subversion \
&& yum install -y rstudio-workbench.rpm \
&& rm rstudio-workbench.rpm \
&& yum clean all \
&& rm -rf /var/lib/rstudio-server/r-versions
&& /tmp/remove-workbench-extras.sh

RUN /opt/python/"${PYTHON_VERSION}"/bin/pip3 install \
jupyter \
Expand Down
4 changes: 3 additions & 1 deletion r-session-complete/Dockerfile.ubuntu2204
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ ARG RSW_DOWNLOAD_URL=https://download2.rstudio.org/server/jammy/amd64

ENV WORKBENCH_JUPYTER_PATH=/usr/local/bin/jupyter

COPY ./remove-workbench-extras.sh /tmp/remove-workbench-extras.sh

SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
Expand All @@ -40,7 +42,7 @@ RUN apt-get update \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/lib/rstudio-server/r-versions
&& /tmp/remove-workbench-extras.sh

RUN /opt/python/"${PYTHON_VERSION}"/bin/pip install \
jupyter \
Expand Down
4 changes: 4 additions & 0 deletions r-session-complete/Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ build OS=IMAGE_OS VERSION=RSW_VERSION *TAGS="":
tag_array+=("-t" $tag)
done

cp ../shared/remove-workbench-extras.sh ./

docker buildx --builder="{{ BUILDX_PATH }}" build --load ${BUILDX_ARGS} \
${tag_array[@]} \
--build-arg RSW_VERSION="{{ VERSION }}" \
Expand All @@ -57,6 +59,8 @@ build OS=IMAGE_OS VERSION=RSW_VERSION *TAGS="":
--build-arg PYTHON_VERSION_ALT="{{ PYTHON_VERSION_ALT }}" \
--file=./Dockerfile.$(just -f ../Justfile _parse-os {{OS}}) .

rm remove-workbench-extras.sh

# Test r-session-complete image - just test rstudio/r-session-complete:ubuntu1804-2022.07.2-576.pro12 2022.07.2+576.pro12
test TAG=`just _make-default-tag` VERSION=RSW_VERSION CMD="":
#!/usr/bin/env bash
Expand Down
35 changes: 35 additions & 0 deletions shared/remove-workbench-extras.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

rm -f /var/lib/rstudio-server/r-versions
rm /usr/lib/rstudio-server/bin/rserver-saml
rm /usr/lib/rstudio-server/bin/rserver-openid
rm /usr/lib/rstudio-server/bin/librclient.so
rm /usr/lib/rstudio-server/bin/librserver.so
rm /usr/lib/rstudio-server/bin/license-manager
rm /usr/lib/rstudio-server/bin/license-manager.conf
rm /usr/lib/rstudio-server/bin/locktester
rm /usr/lib/rstudio-server/bin/migrate.sh
rm /usr/lib/rstudio-server/bin/pamtester
rm /usr/lib/rstudio-server/bin/rpcsend
rm /usr/lib/rstudio-server/bin/rserver
rm /usr/lib/rstudio-server/bin/rserver-acls
rm /usr/lib/rstudio-server/bin/rserver-admin
rm /usr/lib/rstudio-server/bin/rserver-db
rm /usr/lib/rstudio-server/bin/rserver-encrypt
rm /usr/lib/rstudio-server/bin/rserver-http
rm /usr/lib/rstudio-server/bin/rserver-monitor
rm /usr/lib/rstudio-server/bin/rserver-pam
rm /usr/lib/rstudio-server/bin/rserver-session-reaper
rm /usr/lib/rstudio-server/bin/rstudio-kubernetes-launcher
rm /usr/lib/rstudio-server/bin/rstudio-launcher
rm /usr/lib/rstudio-server/bin/rstudio-launcher.sh
rm /usr/lib/rstudio-server/bin/rstudio-local-launcher
rm /usr/lib/rstudio-server/bin/rstudio-server
rm /usr/lib/rstudio-server/bin/rstudio-slurm-launcher
rm /usr/lib/rstudio-server/bin/run-diagnostics
Comment on lines +4 to +29
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these also have -f?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to change it, but for some reason only the r-versions file had trouble

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's strange. Is it the only one present at the time this runs perhaps?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I'm guessing is a permissions thing. The other ones are definitely present before this runs

rm -rf /usr/lib/rstudio-server/www-admin
rm -rf /usr/lib/rstudio-server/www-launcher
rm -rf /usr/lib/rstudio-server/www-workspaces
rm -rf /usr/lib/rstudio-server/db
rm -rf /usr/lib/rstudio-server/conf
rm -rf /usr/lib/rstudio-server/extras
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: extra line at end of file

42 changes: 42 additions & 0 deletions workbench-session-rstudio-pro/Dockerfile.centos7
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
ARG R_VERSION=4.2.3
ARG R_VERSION_ALT=4.1.3
ARG PYTHON_VERSION=3.9.14
ARG PYTHON_VERSION_ALT=3.8.15
ARG SRC_IMAGE_NAME=product-base-pro
ARG REGISTRY=ghcr.io
FROM ${REGISTRY}/rstudio/${SRC_IMAGE_NAME}:centos7-r${R_VERSION}_${R_VERSION_ALT}-py${PYTHON_VERSION}_${PYTHON_VERSION_ALT}
LABEL maintainer="RStudio Docker <[email protected]>"

ARG R_VERSION=4.2.3
ARG R_VERSION_ALT=4.1.3
ARG PYTHON_VERSION=3.9.14
ARG PYTHON_VERSION_ALT=3.8.15
ARG RSW_VERSION=2023.03.2+454.pro2
ARG RSW_NAME=rstudio-workbench-rhel
ARG RSW_DOWNLOAD_URL=https://s3.amazonaws.com/rstudio-ide-build/server/centos7/x86_64

COPY ./remove-workbench-extras.sh /tmp/remove-workbench-extras.sh
COPY ./remove-other-sessions.sh /tmp/remove-other-sessions.sh

SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN yum install -y subversion \
&& RSW_VERSION_URL=$(echo -n "${RSW_VERSION}" | sed 's/+/-/g') \
&& curl -o rstudio-workbench.rpm "${RSW_DOWNLOAD_URL}/${RSW_NAME}-${RSW_VERSION_URL}-x86_64.rpm" \
# Pre 7/25/23 packages
&& gpg --keyserver keyserver.ubuntu.com --recv-keys 3F32EE77E331692F \
&& gpg --export --armor 3F32EE77E331692F > rstudio-signing.key \
&& rpm --import rstudio-signing.key \
# Post 7/25 packages
&& gpg --keyserver hkps://keys.openpgp.org --recv-keys 51C0B5BB19F92D60 \
&& gpg --export --armor 51C0B5BB19F92D60 > rstudio-signing.key \
&& rpm --import rstudio-signing.key \
&& rpm -K rstudio-workbench.rpm \
&& yum install -y rstudio-workbench.rpm \
&& rm rstudio-workbench.rpm \
&& yum clean all \
&& /tmp/remove-workbench-extras.sh \
&& /tmp/remove-other-sessions.sh

ENV PATH="/opt/python/${PYTHON_VERSION}/bin:${PATH}"

EXPOSE 8788/tcp
49 changes: 49 additions & 0 deletions workbench-session-rstudio-pro/Dockerfile.ubuntu2204
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
ARG R_VERSION=4.2.3
ARG R_VERSION_ALT=4.1.3
ARG PYTHON_VERSION=3.9.17
ARG PYTHON_VERSION_ALT=3.8.17
ARG SRC_IMAGE_NAME=product-base-pro
ARG REGISTRY=ghcr.io
FROM ${REGISTRY}/rstudio/${SRC_IMAGE_NAME}:ubuntu2204-r${R_VERSION}_${R_VERSION_ALT}-py${PYTHON_VERSION}_${PYTHON_VERSION_ALT}
LABEL maintainer="RStudio Docker <[email protected]>"

ARG DEBIAN_FRONTEND=noninteractive
ARG R_VERSION=4.2.3
ARG R_VERSION_ALT=4.1.3
ARG PYTHON_VERSION=3.9.17
ARG PYTHON_VERSION_ALT=3.8.17
ARG RSW_VERSION=2023.06.2+454.pro2
ARG RSW_NAME=rstudio-workbench
ARG RSW_DOWNLOAD_URL=https://download2.rstudio.org/server/jammy/amd64

COPY ./remove-workbench-extras.sh /tmp/remove-workbench-extras.sh
COPY ./remove-other-sessions.sh /tmp/remove-other-sessions.sh

SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
krb5-user \
libcurl4-gnutls-dev \
libuser \
libuser1-dev \
libpq-dev \
rrdtool \
subversion \
&& RSW_VERSION_URL=$(echo -n "${RSW_VERSION}" | sed 's/+/-/g') \
&& curl -o rstudio-workbench.deb "${RSW_DOWNLOAD_URL}/${RSW_NAME}-${RSW_VERSION_URL}-amd64.deb" \
# Pre 7/25/23 packages
&& gpg --keyserver keyserver.ubuntu.com --recv-keys 3F32EE77E331692F \
# Post 7/25 packages
&& gpg --keyserver keys.openpgp.org --recv-keys 51C0B5BB19F92D60 \
&& dpkg-sig --verify ./rstudio-workbench.deb \
&& apt-get install -yq --no-install-recommends ./rstudio-workbench.deb \
&& rm ./rstudio-workbench.deb \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& /tmp/remove-workbench-extras.sh \
&& /tmp/remove-other-sessions.sh

ENV PATH="/opt/python/${PYTHON_VERSION}/bin:${PATH}"

EXPOSE 8788/tcp
91 changes: 91 additions & 0 deletions workbench-session-rstudio-pro/Justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
set positional-arguments

BUILDX_PATH := ""

IMAGE_PREFIX := ""
PRODUCT := "workbench-session-rstudio-pro"
IMAGE_OS := "ubuntu2204"

RSW_VERSION := "2023.03.2+454.pro2"
RSW_LICENSE := ""

DRIVERS_VERSION := "2023.05.0"
DRIVERS_VERSION_RHEL := DRIVERS_VERSION + "-1"

R_VERSION := "4.2.3"
R_VERSION_ALT := "4.1.3"

PYTHON_VERSION := "3.9.14"
PYTHON_VERSION_ALT := "3.8.15"

_make-default-tag OS=IMAGE_OS:
echo "{{IMAGE_PREFIX}}{{PRODUCT}}:{{OS}}-$(just -f ../Justfile _get-tag-safe-version {{RSW_VERSION}})"

# Build r-session-complete image - just build ubuntu1804 2022.07.2+576.pro12 rstudio/r-session-complete:ubuntu1804-2022.07.2-576.pro12
build OS=IMAGE_OS VERSION=RSW_VERSION *TAGS="":
#!/usr/bin/env bash
set -euxo pipefail
BUILDX_ARGS=""
if [[ "{{BUILDX_PATH}}" != "" ]]; then
BUILDX_ARGS="--cache-from=type=local,src=/tmp/.buildx-cache --cache-to=type=local,dest=/tmp/.buildx-cache"
fi
if [[ "{{ OS }}" == "centos7" ]]; then
_DRIVERS_VERSION="{{ DRIVERS_VERSION_RHEL }}"
else
_DRIVERS_VERSION="{{ DRIVERS_VERSION }}"
fi

if [[ "{{TAGS}}" == "" ]]; then
raw_tag_array=($(just _make-default-tag {{OS}}))
else
raw_tag_array=("{{TAGS}}")
fi

tag_array=()
for tag in $raw_tag_array
do
tag_array+=("-t" $tag)
done

cp ../shared/remove-workbench-extras.sh ./

docker buildx --builder="{{ BUILDX_PATH }}" build --load ${BUILDX_ARGS} \
${tag_array[@]} \
--build-arg RSW_VERSION="{{ VERSION }}" \
--build-arg DRIVERS_VERSION="${_DRIVERS_VERSION}" \
--build-arg R_VERSION="{{ R_VERSION }}" \
--build-arg R_VERSION_ALT="{{ R_VERSION_ALT }}" \
--build-arg PYTHON_VERSION="{{ PYTHON_VERSION }}" \
--build-arg PYTHON_VERSION_ALT="{{ PYTHON_VERSION_ALT }}" \
--file=./Dockerfile.$(just -f ../Justfile _parse-os {{OS}}) .

rm remove-workbench-extras.sh

# Test r-session-complete image - just test rstudio/r-session-complete:ubuntu1804-2022.07.2-576.pro12 2022.07.2+576.pro12
test TAG=`just _make-default-tag` VERSION=RSW_VERSION CMD="":
#!/usr/bin/env bash
set -euxo pipefail
IMAGE_NAME="{{ TAG }}" \
RSW_VERSION="{{ VERSION }}" \
R_VERSION="{{ R_VERSION }}" \
R_VERSION_ALT="{{ R_VERSION_ALT }}" \
PYTHON_VERSION="{{ PYTHON_VERSION }}" \
PYTHON_VERSION_ALT="{{ PYTHON_VERSION_ALT }}" \
docker-compose -f ./docker-compose.test.yml run sut {{ CMD }}

# Test r-session-complete image interactively - just test-i rstudio/r-session-complete:ubuntu1804-2022.07.2-576.pro12 2022.07.2+576.pro12
test-i TAG=`just _make-default-tag` VERSION=RSW_VERSION:
just test {{ TAG }} {{ VERSION }} bash

# Run r-session-complete - just run rstudio/r-session-complete:ubuntu1804-2022.07.2-576.pro12
run TAG=`just _make-default-tag` CMD="":
#!/usr/bin/env bash
set -euxo pipefail
if [ -z "{{ RSW_LICENSE }}" ]; then
echo "Please set RSW_LICENSE to a valid RStudio Workbench license before running."
exit 1
fi
docker run -it --privileged \
-p 8788:8788 \
-e RSW_LICENSE="{{ RSW_LICENSE }}" \
"{{ TAG }}" {{ CMD }}
3 changes: 3 additions & 0 deletions workbench-session-rstudio-pro/NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 2023.03.2
- Initial release

78 changes: 78 additions & 0 deletions workbench-session-rstudio-pro/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Quick reference

* Maintained by: [the Posit Docker team](https://github.com/rstudio/rstudio-docker-products)
* Where to get help: [our Github Issues page](https://github.com/rstudio/rstudio-docker-products/issues)
* RStudio Workbench image: [Docker Hub](https://hub.docker.com/r/rstudio/rstudio-workbench)
* RStudio r-session-complete image: [Docker Hub](https://hub.docker.com/r/rstudio/r-session-complete)

# Supported tags and respective Dockerfile links

* [`jammy`, `ubuntu2204`, `jammy-2023.06.1`, `ubuntu2204-2023.06.1`](https://github.com/rstudio/rstudio-docker-products/blob/main/r-session-complete/Dockerfile.ubuntu2204)

# What are the workbench-session-rstudio-pro images?

Images for R and Python sessions and jobs to be used RStudio Workbench, Launcher, and Kubernetes.

# Notice for support

1. This image may introduce **BREAKING** changes; as such we recommend:
- Avoid using the `{operating-system}` tags to avoid unexpected version changes, and
- Always read through the [NEWS](./NEWS.md) to understand the changes before updating.
1. Outdated images will be removed periodically from DockerHub as product version updates are made. Please make plans to
update at times or use your own build of the images.
1. These images are meant as a starting point for your needs. Consider creating a fork of this repo, where you can
continue to merge in changes we make while having your own security scanning, base OS in use, or other custom
changes. We
provide [instructions for how to build and use](#how-to-use-these-docker-images)
for these cases.
1. **Security Note:** These images are provided AS IS based on the build environment at the time their product version was released/updated. They should be reviewed and updated before production use. If your organization has a specific set of security requirements related to CVE/Vulnerability severity levels, you should plan to use the [instructions for building](https://github.com/rstudio/rstudio-docker-products#instructions-for-building) to clone this repository, and rebuild these images to your specific internal security standards.

# How to use these images

The Docker images built from these Dockerfiles are intended to be used for R and
Jupyter sessions and jobs with RStudio Workbench (RSW), Launcher, and
Kubernetes.

Note: These Docker images are not equipped or intended to be used to run RStudio
Workbench within a Docker container. Visit the
[rstudio/rstudio-worbench Docker Hub page](https://hub.docker.com/r/rstudio/rstudio-workbench)
for images built for that purpose.

For more information about RStudio Workbench and Launcher, refer to the
[Launcher Overview](https://solutions.rstudio.com/launcher/overview/) on the
RStudio Solutions website.

For more information about how to use these images with RStudio Workbench and
Launcher, refer to the RStudio support article on [Using Docker images with
RStudio Workbench, Launcher, and
Kubernetes](https://support.rstudio.com/hc/en-us/articles/360019253393-Using-Docker-images-with-RStudio-Server-Pro-Launcher-and-Kubernetes).

We provide simple ways to extend and build the Dockerfiles. After you have cloned the repo, you can create your own
containers fairly simply with the provided Justfile.

## Overview

Built images are available from the
[rstudio/r-session-complete](https://hub.docker.com/r/rstudio/r-session-complete)
repository on Docker Hub.

These images include the following layers:

* Base OS
* RSW session components
* System packages required for R, R packages, and RStudio Professional Drivers
* One version of R
* One version of Python
* Jupyter Notebooks, JupyterLab, and RSW/RSC notebook extensions
* RStudio Professional Drivers

# Licensing

The license associated with the RStudio Docker Products repository is located [in LICENSE.md](https://github.com/rstudio/rstudio-docker-products/blob/main/LICENSE.md).

As is the case with all container images, the images themselves also contain other software which may be under other
licenses (i.e. bash, linux, system libraries, etc., along with any other direct or indirect dependencies of the primary
software being contained).

It is an image user's responsibility to ensure that use of this image (and any of its dependent layers) complies with
all relevant licenses for the software contained in the image.
16 changes: 16 additions & 0 deletions workbench-session-rstudio-pro/docker-compose.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: '2.3'
services:

sut:
image: $IMAGE_NAME
command: /run_tests.sh
entrypoint: []
environment:
# uses .env by default
- RSW_VERSION
- R_VERSION
- PYTHON_VERSION
volumes:
- "./test/run_tests.sh:/run_tests.sh"
- "./test/goss.yaml:/tmp/goss.yaml"
- "./test/goss_vars.yaml:/tmp/goss_vars.yaml"
6 changes: 6 additions & 0 deletions workbench-session-rstudio-pro/remove-other-sessions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

rm -rf /usr/lib/rstudio-server/bin/code-server
rm -rf /usr/lib/rstudio-server/bin/vscode-workbench-ext
rm /usr/lib/rstudio-server/bin/jupyter-session-run
rm /usr/lib/rstudio-server/bin/vscode-session-run
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: no extra line

Loading