Deployment

This page provides an overview of approaches to deploy RDepot.

It is recommended to have a look at the Architecture page first to familiarize yourself with the RDepot components and their role.

Docker

Images

Docker images maintained by Open Analytics are available on Docker Hub:

The manager app and repo server images are based on adoptopenjdk images. The web UI image is based on NGINX.

All RDepot images are available under several tagging strategies:

  • versioned (e.g. 2.4.1): Recommended for production.
  • snapshots (e.g. 2.5.0-SNAPSHOT): Bleeding edge. Not recommended for production.

Example (Docker Compose)

The following prerequisites are needed:

  • docker (https://www.docker.com/)

  • docker-compose (https://docs.docker.com/compose/)

    While not a strict requirement, docker-compose will help you better manage the multiple containers that are involved. This guide will continue to use docker-compose, but you should be able to convert the example to standard docker.

  • port ${RDEPOT_PORT} (80 by default, if the environment variable is not set) is available on your localhost, check for nginx or apache services

Please see the demo deployment on GitHub.

Alternatively, an example docker-compose YAML file:

services:
  proxy:
    image: nginx:alpine
    container_name: oa-rdepot-proxy
    restart: unless-stopped
    volumes:
    - ./docker/compose/proxy/nginx.conf:/etc/nginx/nginx.conf:ro
    - ./docker/compose/proxy/rdepot.conf:/etc/nginx/sites-enabled/rdepot:ro
    - repository:/opt/rdepot/repo/:ro
    - logs:/var/log/nginx/
    ports:
    - ${RDEPOT_PORT:-80}:80
    depends_on:
    - backend
    - repo
    - frontend
    networks:
    - oa-rdepot
  db:
    image: postgres:alpine
    restart: unless-stopped
    hostname: oa-rdepot-db
    container_name: oa-rdepot-db
    environment:
    - POSTGRES_DB=rdepot
    - POSTGRES_USER=rdepot
    - POSTGRES_PASSWORD=mysecretpassword
    networks:
    - oa-rdepot
  backend:
    image: openanalytics/rdepot-app:2.4.1
    restart: unless-stopped
    hostname: oa-rdepot-backend
    container_name: oa-rdepot-backend
    volumes:
    - repositories:/opt/rdepot/repositories/
    - snapshots:/opt/rdepot/generated/
    - queue:/opt/rdepot/new/
    - ./docker/compose/backend/application.yaml:/opt/rdepot/application.yml
    networks:
    - oa-rdepot
    depends_on:
    - db
    environment:
    - DB_URL=jdbc:postgresql://oa-rdepot-db:5432/rdepot
    - DB_USERNAME=rdepot
    - DB_PASSWORD=mysecretpassword
    - ALLOWED-ORIGIN=http://localhost:${RDEPOT_PORT:-80}
    healthcheck:
      test: ["CMD-SHELL", "if [ \"$$(curl -I localhost:8080 2>/dev/null | grep HTTP/1.1 | cut -d\" \" -f2)\" != \"302\" ]; then exit 1; else exit 0; fi;"]
      interval: 10s
      timeout: 10s
      retries: 10
  repo:
    image: openanalytics/rdepot-repo:2.4.1
    restart: unless-stopped
    hostname: oa-rdepot-repo
    container_name: oa-rdepot-repo
    volumes:
    - repository:/opt/rdepot/
    - ./docker/compose/repo/application.yaml:/opt/repo/application.yml
    networks:
    - oa-rdepot
  frontend:
    container_name: oa-rdepot-frontend
    image: openanalytics/rdepot-client:2.4.1
    restart: unless-stopped
    networks:
    - oa-rdepot
    environment:
    - VITE_LOGIN_SIMPLE=true
    - VITE_LOGIN_OIDC=false
    - VITE_URL_PREFIX=/
    - VITE_SERVER_ADDRESS=http://localhost:${RDEPOT_PORT:-80}/backend
networks:
  oa-rdepot:
volumes:
  repository:
  repositories:
  snapshots:
  queue:
  logs:

The missing files (for volume mapping) can be found in our Git repository:

The final step is to launch the Docker containers using docker-compose:

docker-compose up -d

After RDepot is ready, one can then browse to http://localhost:${RDEPOT_PORT} to log in (where ${RDEPOT_PORT} is the value of the environment variable defined above, or 80 if not set).

There is an admin user with username einstein and password testpassword.

See the RDepot manager application.yml for the included configuration which specifies the user credentials. One can override these parameters using environment variables.

To complete an end-to-end flow, which consists of:

  1. upload R or Python package via the RDepot UI
  2. publish the package to the RDepot Repository server
  3. install the R or Python package

the following steps are needed:

  1. go to the repositories page (see http://localhost:${RDEPOT_PORT}/repositories)
  2. create a repository with:
    • a name: in this demo deployment, Python repository names should use a py prefix, for example: pyDemoRepo (R repositories have no such restrictions)
    • a publication URI: http://localhost:${RDEPOT_PORT}/repo/repositoryName (again, replace ${RDEPOT_PORT} with the above defined port, or 80 if not set)
    • a server address: http://oa-rdepot-repo:8080/repositoryName
    • a technology: R or Python
  3. make sure the repository is shown in the UI by toggling the Published filter toggle in the UI, above the Repositories table
  4. publish the repository using the Published checkbox on the repositories list page
  5. submit one or more packages to that repository via the RDepot UI (see http://localhost:${RDEPOT_PORT}/upload-packages)
  6. go to the package details page: from the packages view at http://localhost:${RDEPOT_PORT}/packages, click on a package name and then on the details button
  7. use the install command shown on the package details page to install the package in R or Python:

R:

install.packages("somePackage", repos = c("http://localhost:${RDEPOT_PORT}/repo/repositoryName", getOption("repos")))

or

Python:

pip install --index-url http://localhost:${RDEPOT_PORT}/repo/repositoryName somePackage

To (re)start with fresh database:

  • remove the containers via docker-compose down -v
  • start up again using docker-compose up -d

Kubernetes

Kustomize

Kustomize is a tool for template-free configuration of applications running in Kubernetes. It offers a purely declarative approach to configuration customization.

Base recipes and a number of overlays are available for RDepot here.

Bases

The recipes are tagged according to the compatible RDepot release version and should be stable to use as a remote base:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
  - github.com/openanalytics/rdepot-kubernetes/base/app-stateful?ref=2.4.1
  - github.com/openanalytics/rdepot-kubernetes/base/repo?ref=2.4.1

You can also clone the bases locally, copy the recipes or use a tool like kpt depending on the amount of independence you want to have w.r.t. the Open Analytics upstream.

Overlays

Next to the base recipes you can find a number of overlays which range from simple extensions on top of the base recipes to complete demo deployments. The example below uses one of these overlays.

Helm

There are currently no plans to maintain RDepot helm charts from Open Analytics.

Example (Minikube)

The following prerequisites are needed:

  • kustomize (https://kustomize.io).

    The standalone kustomize binary is recommended as some features are used which are not available in the version included with kubectl

  • minikube (https://minikube.sigs.k8s.io/docs/start/)

    minikube is a distribution of Kubernetes that can easily run on a single machine with moderate resources.

To deploy the demo, please refer to the documentation.

The demo includes:

  • an instance of the RDepot repository server
  • an instance of RDepot manager, preconfigured with a demo repository on the repository server and protected with simple authentication
  • a single-node postgres deployment

All volumes are provided through the dynamic provisioning in minikube

You can port-forward the manager app:

kubectl -n rdepot-demo port-forward svc/rdepot-app 8080:80

and visit the app in your browser at http://localhost:8080 (login einstein/testpassword)

Similarly, you can port-forward the repository:

kubectl -n rdepot-demo port-forward svc/rdepot-repo 8081:80

and point your browser to http://localhost:8081/repo/demo to browse your uploaded packages.

You can tear down the demo with:

kubectl delete namespace rdepot-demo

Refer to the README for more info.

WAR & JAR

The latest versions of RDepot are available on our downloads page in WAR and JAR format (except for the web UI application).

This is currently not the recommended approach to deploy RDepot. This route is only relevant in the following cases:

  • you wish to develop and/or extend RDepot
  • you are not able to run Docker on your platform of choice

Download both rdepot-app-2.4.1.war (sha1, md5) and rdepot-repo-2.4.1.jar (sha1, md5) and start them by executing java -jar rdepot-app-2.4.1.war and java -jar rdepot-repo-2.4.1.jar respectively.