Skip to content

Commit

Permalink
Refactor start in production (#69)
Browse files Browse the repository at this point in the history
* Script for local server start (#67)

* test commit

* test commit 2

* removed test files

* test commit 4

* test2

* test3c

* remove unnassesary files

* fixed missing parantheses

* results folder in .gitignore

* Local server (#1)

* accepeted changes

* fixed bug through missing conversion of crs

* added helper function

* fixed wrong change

* remove unused file

* remove unused line

* added file to run server locally

* updated Readme for local server

---------

Co-authored-by: mreiner1 <[email protected]>
Co-authored-by: Maximilian Reiner <[email protected]>
Co-authored-by: Brian Pϕndi <[email protected]>

* Refactor start in production

---------

Co-authored-by: Michael Brüggemann <[email protected]>
Co-authored-by: mreiner1 <[email protected]>
Co-authored-by: Maximilian Reiner <[email protected]>
  • Loading branch information
4 people authored Dec 14, 2023
1 parent da9c6d4 commit 63e519d
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 30 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ COPY ./ /opt/dockerfiles/
RUN Rscript -e "remotes::install_local('/opt/dockerfiles',dependencies=TRUE)"

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

EXPOSE 8000
17 changes: 0 additions & 17 deletions Dockerfiles/start.R

This file was deleted.

4 changes: 2 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
version: "3.3"

services:
openeocube:
openeocubes:
build: .
environment:
- TZ=Etc/UTC
- DEBIAN_FRONTEND=noninteractive
container_name: openeocube
container_name: openeocubes
ports:
- "8000:8000"
restart: always
19 changes: 9 additions & 10 deletions startLocal.R
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
# build and install package locally (use for development)
remotes::install_local('./',dependencies=TRUE, force=TRUE)
remotes::install_local("./", dependencies = TRUE, force = TRUE)

# Start service
library(openeocubes)

aws.host <- Sys.getenv("AWSHOST")

aws.host <-Sys.getenv("AWSHOST")

if (aws.host == ""){
aws.host = NULL
if (aws.host == "") {
aws.host <- NULL
} else {
message("AWS host port id is: ", aws.host)
}

message("AWS host port id is:")
message(aws.host)

config = SessionConfig(api.port = 8000, host = "0.0.0.0", aws.ipv4 = aws.host)
config$workspace.path = "/var/openeo/workspace"
config <- SessionConfig(api.port = 8000, host = "0.0.0.0", aws.ipv4 = aws.host)
config$workspace.path <- "/var/openeo/workspace"
createSessionInstance(config)
Session$startSession()
Session$startSession()
17 changes: 17 additions & 0 deletions startProduction.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Start service
library(openeocubes)


aws.host <- Sys.getenv("AWSHOST")

if (aws.host == "") {
aws.host <- NULL
} else {
message("AWS host port id is: ", aws.host)
}


config <- SessionConfig(api.port = 8000, host = "0.0.0.0", aws.ipv4 = aws.host)
config$workspace.path <- "/var/openeo/workspace"
createSessionInstance(config)
Session$startSession()

0 comments on commit 63e519d

Please sign in to comment.