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

OpenAnalytics-maintained Docker images 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.0.0): Recommended for production.
  • snapshots (e.g. 2.1.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.

    (Install i.e. by issuing pip install docker-compose)

  • port 80 is not used (localhost, check for nginx or apache service)

An example docker-compose YAML file:

version: '3'
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
    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.0.0
    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
    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.0.0
    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.0.0
    restart: unless-stopped
    networks:
    - oa-rdepot
    environment:
    - VITE_LOGIN_SIMPLE=true
    - VITE_LOGIN_OIDC=false
    - VITE_URL_PREFIX=/
    - VITE_SERVER_ADDRESS=http://localhost/backend
networks:
  oa-rdepot:
    ipam:
      config:
      - subnet: 192.168.49.0/24
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

One can then go to http://localhost to log in.

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: R or Python package to RDepot to Repository Server to R or Python client, the following steps are needed:

  • create a repository with (or edit)
  • submit one or more packages to that repository via the RDepot web interface
  • publish the repository using the published checkbox on the repositories list page (if needed)
  • go to the package details page (repositories list page, click on the repository name, click on the package name, then on the details button)
  • use the install command shown on the package details page to install the package in R or Python:
    install.packages("somePackage", repos = c("http://localhost/repo/repositoryName", getOption("repos")))
    
    or
    pip install --index-url http://localhost/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.0.0
  - github.com/openanalytics/rdepot-kubernetes/base/repo?ref=2.0.0

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 OpenAnalytics 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 OpenAnalytics.

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:

kubectl create namespace demo-rdepot
kustomize build github.com/openanalytics/rdepot-kubernetes/overlays/demo?ref=2.0.0 | kubectl apply -f -

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 demo-rdepot 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 demo-rdepot 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 demo-rdepot

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.0.0.war (sha1, md5) and rdepot-repo-2.0.0.jar (sha1, md5) and start them by executing java -jar rdepot-app-2.0.0.war and java -jar rdepot-repo-2.0.0.jar respectively.