mirror of https://git.sr.ht/~hrbrmstr/splashr
boB Rudis
7 years ago
10 changed files with 164 additions and 14 deletions
@ -0,0 +1,45 @@ |
|||||
|
#' Retrieve the Docker image for Splash |
||||
|
#' |
||||
|
#' @return `harbor` `host` object |
||||
|
#' @export |
||||
|
#' @examples \dontrun{ |
||||
|
#' install_splash() |
||||
|
#' splash_container <- start_splash() |
||||
|
#' stop_splash(splash_container) |
||||
|
#' } |
||||
|
install_splash <- function() { |
||||
|
harbor::docker_pull(localhost, "scrapinghub/splash") |
||||
|
} |
||||
|
|
||||
|
#' Start a Splash server Docker container |
||||
|
#' |
||||
|
#' @note you need Docker running on your system and have pulled the container with |
||||
|
#' [install_spash] for this to work. You should save the resultant `host` |
||||
|
#' object for use in [stop_splash]. |
||||
|
#' @return `harbor` `container` object |
||||
|
#' @export |
||||
|
#' @examples \dontrun{ |
||||
|
#' install_splash() |
||||
|
#' splash_container <- start_splash() |
||||
|
#' stop_splash(splash_container) |
||||
|
#' } |
||||
|
start_splash <- function() { |
||||
|
harbor::docker_run(localhost, image = "scrapinghub/splash", detach = TRUE, |
||||
|
docker_opts = "-p 5023:5023 -p 8050:8050 -p 8051:8051") |
||||
|
} |
||||
|
|
||||
|
#' Stop a running a Splash server Docker container |
||||
|
#' |
||||
|
#' @param splash_container Docker `container` object created by [start_splash] |
||||
|
#' @note you need Docker running on your system and have pulled the container with |
||||
|
#' [install_spash] and started the Splash container with [start_splash] for this |
||||
|
#' to work. You will need the `container` object from [start_splash] for this to work. |
||||
|
#' @export |
||||
|
#' @examples \dontrun{ |
||||
|
#' install_splash() |
||||
|
#' splash_container <- start_splash() |
||||
|
#' stop_splash(splash_container) |
||||
|
#' } |
||||
|
stop_splash <- function(splash_container) { |
||||
|
harbor::container_rm(splash_container, force=TRUE) |
||||
|
} |
Before Width: | Height: | Size: 123 KiB After Width: | Height: | Size: 118 KiB |
Before Width: | Height: | Size: 433 KiB After Width: | Height: | Size: 433 KiB |
@ -0,0 +1,21 @@ |
|||||
|
% Generated by roxygen2: do not edit by hand |
||||
|
% Please edit documentation in R/docker.r |
||||
|
\name{install_splash} |
||||
|
\alias{install_splash} |
||||
|
\title{Retrieve the Docker image for Splash} |
||||
|
\usage{ |
||||
|
install_splash() |
||||
|
} |
||||
|
\value{ |
||||
|
`harbor` `host` object |
||||
|
} |
||||
|
\description{ |
||||
|
Retrieve the Docker image for Splash |
||||
|
} |
||||
|
\examples{ |
||||
|
\dontrun{ |
||||
|
install_splash() |
||||
|
splash_container <- start_splash() |
||||
|
stop_splash(splash_container) |
||||
|
} |
||||
|
} |
@ -0,0 +1,26 @@ |
|||||
|
% Generated by roxygen2: do not edit by hand |
||||
|
% Please edit documentation in R/docker.r |
||||
|
\name{start_splash} |
||||
|
\alias{start_splash} |
||||
|
\title{Start a Splash server Docker container} |
||||
|
\usage{ |
||||
|
start_splash() |
||||
|
} |
||||
|
\value{ |
||||
|
`harbor` `container` object |
||||
|
} |
||||
|
\description{ |
||||
|
Start a Splash server Docker container |
||||
|
} |
||||
|
\note{ |
||||
|
you need Docker running on your system and have pulled the container with |
||||
|
[install_spash] for this to work. You should save the resultant `host` |
||||
|
object for use in [stop_splash]. |
||||
|
} |
||||
|
\examples{ |
||||
|
\dontrun{ |
||||
|
install_splash() |
||||
|
splash_container <- start_splash() |
||||
|
stop_splash(splash_container) |
||||
|
} |
||||
|
} |
@ -0,0 +1,26 @@ |
|||||
|
% Generated by roxygen2: do not edit by hand |
||||
|
% Please edit documentation in R/docker.r |
||||
|
\name{stop_splash} |
||||
|
\alias{stop_splash} |
||||
|
\title{Stop a running a Splash server Docker container} |
||||
|
\usage{ |
||||
|
stop_splash(splash_container) |
||||
|
} |
||||
|
\arguments{ |
||||
|
\item{splash_container}{Docker `container` object created by [start_splash]} |
||||
|
} |
||||
|
\description{ |
||||
|
Stop a running a Splash server Docker container |
||||
|
} |
||||
|
\note{ |
||||
|
you need Docker running on your system and have pulled the container with |
||||
|
[install_spash] and started the Splash container with [start_splash] for this |
||||
|
to work. You will need the `container` object from [start_splash] for this to work. |
||||
|
} |
||||
|
\examples{ |
||||
|
\dontrun{ |
||||
|
install_splash() |
||||
|
splash_container <- start_splash() |
||||
|
stop_splash(splash_container) |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue