benmarwick / rrtools

rrtools: Tools for Writing Reproducible Research in R
Other
670 stars 85 forks source link

HOW TO "add environment variables to enable push of the Docker container to the Docker Hub"? #77

Closed DrAndiLowe closed 5 years ago

DrAndiLowe commented 5 years ago

Hi! Could you provide clarification in the README in section 7 (rrtools::use_travis()) on how to "add environment variables to enable push of the Docker container to the Docker Hub"? This isn't clear. Thanks!

DrAndiLowe commented 5 years ago

OK, so since I want my GitHub repo to be private until publication, I tried to setup with circleci instead:

> rrtools::use_circleci(docker_hub = FALSE)
✔ Creating 'circle.yml' from template.
✔ Adding 'circle.yml' to `.Rbuildignore`.
Next: 
 * Add a circleci shield to your README.Rmd:
[![Circle-CI Build Status](https://circleci.com/gh/andrewjohnlowe/qvgjets.svg?style=shield&circle-token=:circle-token)](https://circleci.com/gh/andrewjohnlowe/qvgjets)
 * Turn on circleci for your repo at https://circleci.com/gh//andrewjohnlowe
   and add your environment variables: DOCKER_EMAIL, 
   DOCKER_USER, DOCKER_PASS.
 * Your Docker container will be kept private and NOT be pushed to the Docker Hub
benmarwick commented 5 years ago

Yes, that is a bit of a grey area in our documentation!

To enter env. variables into Travis, go to https://travis-ci.org/yourusername/yourreponame/settings and scroll down to 'Environment Variables'. In the 'Name' field put DOCKER_USER, DOCKER_PASS, etc, and in the 'Value' field put in your Docker username, etc.

Here's a screenshot of how it looks right now on one of my projects with Travis-CI, the page where we enter those env. variables:

image

For circle-ci it is similar, go to https://circleci.com/gh/yourusername/yourreponame/edit#env-vars (or from the circle-ci repo page, click the gear icon, then look on the left for 'Build Settings' and under that heading, "Environment Variables", and click on that.

Here's a screenshot of how it looks right now on one of my projects with Circle-CI, the page where we enter those env. variables:

image

Does that help?

DrAndiLowe commented 5 years ago

Thanks, but I'm still confused. I don't know what those values are. I want to execute my RMarkdown using Binder, just as Carl Boettiger has done here: https://github.com/cboettig/noise-phenomena

I'd like to add that I believe most of us in my field -- including myself -- are not familiar with Docker and other tools that would be useful for reproducible research, which may be why I haven't seen a single example of a research compendium in my field. Lack of technical knowledge is a huge impediment; surely my colleagues would be doing it if it were easier to get started. Your package could go a long way to solving that -- thanks! I'm hoping that my paper can serve as a roadmap for my colleagues, but I don't understand the whole process myself yet, so I'm nowhere near having a step-by-step guide yet.

benmarwick commented 5 years ago

If you want to execute your Rmd in Binder, that is different from your original question about environment variables on Travis and Circle at the start of this thread. The environment variables that you originally asked about are a way to give Travis and Circle your secret details (e.g. username and password) so Travis and Circle can use them to log in on your behalf and do things for you (like update the docker hub with you most current docker container, or update your GitHub repository).

By the way, next time could you please start a new issue for a different question? That's more helpful for other people who have similar questions, and makes it easier for us to help you better by minimizing confusion.

All of these things, travis, circle, binder, docker, etc. are very new in most research communities, so most people are seeing them here for the first time. It's highly likely you will one of first people to use these tools in your field because they are so new. It's an exciting time!

We assume that if you are using the Travis or Circle-CI services, then you have already familiarised yourself about them by reading the papers in our reference list. Have you read those? They are short, clear and concise on how these services fit in making research reproducible. That will help you to understand how those parts fit it, and whether or not they make sense for your research.

About your new question on using Binder with your Rmd:

If you want to use Binder as @cboettig has done, you need to:

[![Binder](http://mybinder.org/badge.svg)](http://beta.mybinder.org/v2/gh/yourusername/yourreponame/master?urlpath=rstudio)

And change yourusername/yourreponame to your actual names. You can see a working example in the raw markdown of Carl's repo that you mention: https://raw.githubusercontent.com/cboettig/noise-phenomena/master/README.md

That will add the Binder button to your README on GitHub. You click on the button, and that starts Binder in a new tab. No further configuration required.

I'll close this thread now, but please don't hesitate to ask questions about rrtools or the related services by starting a new discussion (and after you've done the required reading 😉 )

DrAndiLowe commented 5 years ago

Thanks for the clarification! That's very helpful. Sorry for the newbie questions. I'm working my way through the papers. Never used CI tools before, so this concept is unfamiliar to me and still a bit confusing. I'll look for a dummies guide to CI, travis, circle. Cheers!