Skip to content
This repository has been archived by the owner on Oct 1, 2020. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/v0.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
flahn committed Feb 19, 2018
2 parents 3b3cfe1 + 99eb5b7 commit 84f8dd4
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 29 deletions.
5 changes: 5 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
^.*\.Rproj$
^\.Rproj\.user$
^\.Rhistory$
^\.git$
^Dockerfiles$
^DOCKERFILE$
^README.md$
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: openEO.R.Backend
Title: Reference backend implementation for openEO conformant backend with a local filesystem
Version: 0.1
Version: 0.1.1
Authors@R: person("Florian", "Lahn", email = "[email protected]", role = c("aut", "cre"))
Description: The package contains a backend solution in compliance with the openEO API. In this demonstration
the file backend solution is the local file system containing some raster data collections.
Expand Down
24 changes: 24 additions & 0 deletions DOCKERFILE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM r-base:3.4.3
MAINTAINER Florian Lahn ([email protected])
LABEL version="0.1.1"
LABEL description="A simple openeo (almost) conformant backend for frontend development"

# create the path for the user files
RUN mkdir -p /opt/dockerfiles/
RUN mkdir -p /var/openeo/workspace/

COPY ./ /opt/dockerfiles/

# run commands to prepare the image
# install dependencies
RUN apt-get -y update
RUN apt-get -y install libgdal-dev libcurl4-gnutls-dev libssl-dev libssh2-1-dev libsodium-dev

# install R dependencies and install package
RUN R -f /opt/dockerfiles/Dockerfiles/install_package_dependencies.R


# cmd or entrypoint for startup
ENTRYPOINT ["R", "-q", "--no-save", "-f /opt/dockerfiles/Dockerfiles/server_start.R"]

EXPOSE 8000
7 changes: 7 additions & 0 deletions Dockerfiles/install_package_dependencies.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cran.mirror = "https://cran.uni-muenster.de/"

install.packages("devtools",repos=cran.mirror)
library(devtools)

install_deps("/opt/dockerfiles",repos=cran.mirror)
install("/opt/dockerfiles")
10 changes: 10 additions & 0 deletions Dockerfiles/server_start.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
library(openEO.R.Backend)
rm(openeo.server)
openeo.server$data.path = paste(system.file(package="openEO.R.Backend"),"extdata",sep="/")
openeo.server$workspaces.path = "/var/openeo/workspace"
openeo.server$initEnvironmentDefault()
openeo.server$initializeDatabase()

openeo.server$createUser(user_name="test", password="test") #only created if not exists
openeo.server$loadDemo()
openeo.server$startup(port = 8000,host="0.0.0.0")
56 changes: 28 additions & 28 deletions R/api.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@

openeo.server$api.version <- "0.0.1"

############################
#
# serverinformation endpoint
#
############################
# serverinformation endpoint ----
#
#

.version = function() {
list(version=openeo.server$api.version)
Expand All @@ -46,11 +46,11 @@ openeo.server$api.version <- "0.0.1"
)
}

############################
#
# data endpoint
#
############################
# data endpoint ----
#
#

# creates an overview on products available
#* @get /api/data
Expand All @@ -73,11 +73,11 @@ openeo.server$api.version <- "0.0.1"
}
}

############################
#
# processes endpoint
#
############################
# processes endpoint ----
#
#

# creates an overview on available processes
#* @get /api/processes
Expand All @@ -100,11 +100,11 @@ openeo.server$api.version <- "0.0.1"
}
}

############################
#
# jobs endpoint
#
############################
# jobs endpoint ----
#
#

#* @get /api/jobs/<jobid>
.describeJob = function(req,res,jobid) {
Expand All @@ -129,7 +129,7 @@ openeo.server$api.version <- "0.0.1"
#* @post /api/jobs
#* @serializer unboxedJSON
.createNewJob = function(req,res,evaluate) {
if (is.null(evaluate) || !evaluate %in% c("lazy","batch")) {
if (is.null(evaluate) || !evaluate %in% c("lazy","batch","sync")) {
return(error(res,400, "Missing query parameter \"evaluate\" or it contains a value other then \"lazy\" or \"batch\""))
}
# TODO check if postBody is valid
Expand Down Expand Up @@ -194,11 +194,11 @@ openeo.server$api.version <- "0.0.1"
}
}

############################
#
# user data and functions
#
############################
# user data and functions ----
#
#

#* @get /api/users/<userid>/files
#* @serializer unboxedJSON
Expand Down Expand Up @@ -347,11 +347,11 @@ openeo.server$api.version <- "0.0.1"
)
}

############################
#
# download endpoint
#
############################
# download endpoint ----
#
#

# those are not openeo specification, it is merely a test to execute the job and return data

Expand All @@ -378,11 +378,11 @@ openeo.server$api.version <- "0.0.1"
}
}

############################
#
# pipeline filter
#
############################
# pipeline filter ----
#
#

#* @filter checkAuth
.authorized = function(req, res){
Expand Down Expand Up @@ -426,11 +426,11 @@ openeo.server$api.version <- "0.0.1"
return(res)
}

############################
#
# utility functions
#
############################
# utility functions ----
#
#

ok = function(res) {
error(res,200,"OK")
Expand All @@ -457,11 +457,11 @@ sendFile = function(res, status, file.name = NA,file.ext=NA, contentType=NA, dat
return(res)
}

############################
#
# setup the routes
#
############################
# setup the routes ----
#
#

createAPI = function() {
root = plumber$new()
Expand Down

0 comments on commit 84f8dd4

Please sign in to comment.