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

demonstrate how to cp source tarballs to add in rspm #283

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,5 @@ services:
volumes:
- ./package-manager/rstudio-pm.gcfg:/etc/rstudio-pm/rstudio-pm.gcfg
- ./data/rspm:/data
- ./data/rspm_mnt:/mnt

44 changes: 44 additions & 0 deletions package-manager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,50 @@ docker exec -it {container-id} /bin/bash
Then please refer to the [RSPM guide](https://docs.rstudio.com/rspm/admin/) on how
to [create and manage](https://docs.rstudio.com/rspm/admin/getting-started/configuration/) your repositories.

#### example of adding a local tarball

For this example, a package, `demo1` was created with version 0.0.0.9000 and a
tarball was created using `devtools::build()`

Copy the tarball into the rspm_mnt dir:

```bash
# will need sudo as otherwise will get permission denied as the rspm_mnt will
# be owned by root
sudo cp demo1_0.0.0.9000.tar.gz /<path/to>/rstudio-docker-products/da
ta/rspm_mnt/
```

within the docker container, the tarball will be available
under `/mnt` you can now add the tarball as a source,
then create/subscribe a repo to the source

```bash
root@fe7d3b816983:/# rspm create source --name=demopkgs
Source 'demopkgs':
Type: Local
root@fe7d3b816983:/# rspm add --source=demopkgs --path='/mnt/demo1_0.0.0.9000.tar.gz'
Added package '/mnt/demo1_0.0.0.9000.tar.gz'.
root@fe7d3b816983:/# rspm create repo --name=demopkgs --description="demo package repo"
Repository: demopkgs - demo package repo - R
root@fe7d3b816983:/# rspm subscribe --repo=demopkgs --source=demopkgs
Repository: demopkgs
Sources:
--demopkgs (Local)
```

It can then be installed from R on the local machine:

```R
> options(repos = c(DEMOPKGS = "http://localhost:4242/demopkgs/latest"))
> install.packages("demo1")
installing the source package ‘demo1’

trying URL 'http://localhost:4242/demopkgs/latest/src/contrib/demo1_0.0.0.9000.tar.gz'
Content type 'application/x-gzip' length 919 bytes
downloaded 919 bytes
```

# 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).
Expand Down