Skip to content

Commit 5195ad5

Browse files
updated to rocker/tidyverse:3.6.0 and modified project template
1 parent 85a589f commit 5195ad5

File tree

9 files changed

+112
-44
lines changed

9 files changed

+112
-44
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
certs/localhost
2+
.Rproj.user

README.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ RStudio
33

44
A containerized RStudio instance from the rocker base image:
55

6-
rocker/tidyverse:3.5.3
6+
rocker/tidyverse:3.6.0
77

88
This container comes with a `nginx` reverse proxy (access via. port 80)
99
and the Tidyverse collection of packages pre-installed by default.
@@ -19,11 +19,21 @@ The projects directory is pre-configured with a project template (00_next_projec
1919
that is useful for projects that conform to the principles of reproducible research
2020
and "project-as-a-package".
2121

22-
### Default login
22+
### Suggested R Packages
23+
24+
`install.packages(c("lubridate", "ProjectTemplate"))`
25+
26+
### Default R Studio login
2327

2428
username: rstudio
29+
password: rstudio1
30+
31+
Update password in `docker-compose.yml` at the following location:
2532

26-
Default password: rstudio1
33+
```
34+
environment:
35+
- PASSWORD=rstudio1
36+
```
2737

2838
## Docker Ubuntu Server Installation/Set-up
2939

@@ -53,7 +63,7 @@ Default password: rstudio1
5363
## HTTPS encryption
5464

5565
[These instructions](https://medium.com/@pentacent/nginx-and-lets-encrypt-with-docker-in-less-than-5-minutes-b4b8a60d3a71)
56-
were used to set up a secure HTTPS connection to RStuido with Certbot SSL
66+
were used to set up a secure HTTPS connection to RStudio with Certbot SSL
5767
certificates. Also see [here](https://github.com/wmnnd/nginx-certbot).
5868

5969
This will not work out of the box, the NGINX configuration file will need to be

docker-compose.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services:
66
container_name: nginx
77
restart: on-failure
88
networks:
9-
- tki-net
9+
- net
1010
volumes:
1111
- ./nginx.conf:/etc/nginx/nginx.conf
1212
- ./data/certbot/conf:/etc/letsencrypt
@@ -26,7 +26,7 @@ services:
2626
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
2727

2828
rstudio:
29-
image: rocker/tidyverse:3.5.3
29+
image: rocker/tidyverse:3.6.0
3030
container_name: rstudio
3131
restart: on-failure
3232
volumes:
@@ -44,15 +44,15 @@ services:
4444
volume:
4545
no-copy: true
4646
networks:
47-
- tki-net
47+
- net
4848
environment:
4949
- PASSWORD=rstudio1
5050
expose:
5151
- 8787
5252

5353
networks:
5454
tki-net:
55-
name: tki-net
55+
name: net
5656

5757
volumes:
5858
r_libs:

nginx.conf

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,33 @@ http {
77
server rstudio:8787;
88
}
99

10-
#### START REMOVE - remove this block of code if SSL certification is not wanted ####
11-
server {
12-
listen 80;
13-
server_name example.org; #### UPDATE example.org to your domain name ####
14-
server_tokens off;
15-
16-
location /.well-known/acme-challenge/ {
17-
root /var/www/certbot;
18-
}
19-
20-
location / {
21-
return 301 https://$host$request_uri;
22-
}
23-
}
24-
#### END REMOVE ####
10+
# #### START BLOCK - uncomment this block to enable SSL encryption ####
11+
# server {
12+
# listen 80;
13+
# server_name example.org; #### UPDATE example.org to your domain name ####
14+
# server_tokens off;
15+
#
16+
# location /.well-known/acme-challenge/ {
17+
# root /var/www/certbot;
18+
# }
19+
#
20+
# location / {
21+
# return 301 https://$host$request_uri;
22+
# }
23+
# }
24+
# #### END BLOCK ####
2525

2626
server {
27-
listen 443 SSL; # listen 80; #### remove "listen 443 SSL; #" statement if SSL certification is not wanted ####
27+
listen 80; #### remove this line if SSL certification is enabled ####
28+
# listen 443 SSL; #### uncomment this line if SSL certification is enabled ####
2829
server_name example.org; #### UPDATE example.org to your domain name ####
2930

30-
#### START REMOVE - remove this block of code if SSL certification is not wanted ####
31-
ssl_certificate /etc/letsencrypt/live/example.org/fullchain.pem; #### UPDATE example.org to your domain name ####
32-
ssl_certificate_key /etc/letsencrypt/live/example.org/privkey.pem; #### UPDATE example.org to your domain name ####
33-
include /etc/letsencrypt/options-ssl-nginx.conf;
34-
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
35-
#### END REMOVE ####
31+
# #### START BLOCK - uncomment this block to enable SSL encryption ####
32+
# ssl_certificate /etc/letsencrypt/live/example.org/fullchain.pem; #### UPDATE example.org to your domain name ####
33+
# ssl_certificate_key /etc/letsencrypt/live/example.org/privkey.pem; #### UPDATE example.org to your domain name ####
34+
# include /etc/letsencrypt/options-ssl-nginx.conf;
35+
# ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
36+
# #### END BLOCK ####
3637

3738
location / {
3839
proxy_pass http://rstudio;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
^.*\.Rproj$
2+
^\.Rproj\.user$
Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
1-
# Reads raw delimited data and saves as RDS files in data folder
2-
# created 25-May-2018 by Paul Stevenson
1+
#' Reads raw delimited data and saves as RDS files in data folder
2+
#' created 25-May-2018 by Paul Stevenson
3+
#' updated 27-May-2019 by Paul Stevenson
34

5+
#### libraries ----
6+
7+
library(dplyr)
48
library(readr)
59
library(readstata13)
610

11+
#### helper functions ----
12+
13+
source("R/99-helper.R")
14+
15+
#### load data ----
16+
717
dat <- read_csv("data-raw/file.csv")
818

9-
devtools::use_data("var_name", overwrite = T)
19+
#### Data cleaning ----
20+
21+
22+
#### save data ----
23+
24+
save(dat, file = "data/dat.RData")

projects/00_next_project/R/01-main.R

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,27 @@
1-
# This is the starting point for the project. load.project will load the
2-
# data and run any scripts in the munge directory.
3-
# Created by Paul Stevenson 17-May-2018
1+
#' This is the starting point for the project. load.project will load the
2+
#' data and run any scripts in the munge directory.
3+
#' Created by Paul Stevenson 17-May-2018
4+
#' Updated 27-May-2019 by Paul Stevenson
45

5-
library('repmis')
6+
#### libraries ----
67

7-
LoadandCite(pkgs = c("tidyverse", "lubridate", "ProjectTemplate", "repmis", "biometrics"),
8-
file = "report/assets/bib/packages.bib")
8+
library(ProjectTemplate)
9+
library(dplyr)
10+
11+
#### Project automation with Project Template ----
912

1013
load.project(munging = TRUE, data_loading = TRUE)
14+
15+
#### load data ----
16+
17+
# load("data/dat.RData")
18+
# load("cache/dat.RData")
19+
20+
#### helper functions ----
21+
22+
source("R/99-helper.R")
23+
24+
#### Data wrangling/cleaning ----
25+
26+
27+
#### Analysis ----
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: 0.8.2
1+
version: 0.9.0
22
data_loading: TRUE
33
data_loading_header: TRUE
44
data_ignore:
@@ -9,8 +9,8 @@ logging: FALSE
99
logging_level: INFO
1010
load_libraries: FALSE
1111
libraries: stats, reshape2, plyr, tidyverse
12-
as_factors: TRUE
13-
data_tables: FALSE
12+
as_factors: FALSE
1413
attach_internal_libraries: FALSE
15-
cache_loaded_data: FALSE
14+
cache_loaded_data: FALSE
1615
sticky_variables: NONE
16+
tables_type: tibble
Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,23 @@
1-
# Example preprocessing script.
1+
#' Example preprocessing script.
2+
#' Created 21-May-2019 by Paul Stevenson
3+
#' Updated 27-May-2019 by Paul Stevenson
4+
5+
#### libraries ----
6+
7+
library(ProjectTemplate)
8+
library(dplyr)
9+
10+
#### helper functions ----
11+
12+
source("R/99-helper.R")
13+
14+
#### load data ----
15+
16+
load("data/dat.RData")
17+
18+
#### Data wrangling ----
19+
20+
21+
#### save data ----
22+
23+
cache("dat")

0 commit comments

Comments
 (0)