Skip to content
This repository has been archived by the owner on Nov 28, 2019. It is now read-only.

uptake/cran-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

cran-server

This repository has been archived. This means it is no longer actively maintained (no further PRs or issues will be considered) but remains read-only for all users. See issue #77 for details on why this is archived. Contact [email protected] if need be.

A self hosted CRAN-like R package repository.

demo-gif

Quick Start

  1. Build the docker image
git clone https://github.com/UptakeOpenSource/cran-server
cd cran-server
docker build -t cran-server .
  1. Run the docker image
docker run --name cran --rm -d -p 8080:80 cran-server
  1. Visit in your browser
# On Mac
open http://localhost:8080

You're all set!

Features

  • Ready: supports AWS S3 and file system storage out of the box
  • Extensible: we made it really easy to support other storage backends
  • Web UI: allows you to see and search published packages

Installation

cran-server requires Python 3.5 or greater.

From source

git clone https://github.com/UptakeOpenSource/cran-server
cd cran-server
pip install .

Usage

Posting packages to cran-server

You can release a package to cran-server using a POST request.

# bash
tarball=<PATH-TO-TARBALL>
curl -X POST -F file=@$tarball http://localhost:8080

Installing packages from cran-server from R

Use the repos argument when using install.packages from R. For example, when running locally:

install.packages('uptasticsearch', repos = 'http://localhost:8080')

Configuration

Package storage

By default, cran-server uses file system storage, but in a production environment in most cases S3 or another object store is desirable. cran-server supports AWS S3 out of the box. The recommended way to set configuration options is using a .env file.

# .env
STORAGE_BACKEND='aws'
AWS_ACCESS_KEY_ID=<YOUR_AWS_ACCESS_KEY_ID_HERE>
AWS_SECRET_ACCESS_KEY=<YOUR_AWS_SECRET_ACCESS_KEY_HERE>
AWS_DEFAULT_REGION=<YOUR_PREFERED_REGION_HERE>
AWS_DEFAULT_BUCKET=<YOUR_PREFERRED_DEFAULT_BUCKET_HERE>

The environment file can then be sourced when running from docker:

docker run --name cran --rm -d -p 8080:80 --env-file=.env cran-server