-
Notifications
You must be signed in to change notification settings - Fork 1
Setup instructions
- You are using IntelliJ or another similar IDE.
- You have forked a copy of the project locally.
- You have access to a command line terminal (Windows PowerShell is OK, but instructions will assume bash)
- You do not have R, Rserve, or Mongo installed. If you do, skip the appropriate steps.
Steps:
-
Create/modify an
application.properties
file atsrc/main/resources/application.properties
. Fields must include at least:
aws.access.key=... aws.secret.access.key=... aws.s3.bucketName=... aws.dynamo.endpoint=...
spring.data.mongodb.host=localhost spring.data.mongodb.port=27017 db.mongo.dbname=metaprot
task.scheduler.rserve.ports=... app.r.script.location=@r-script-location@ # from the Maven profile we set up
2. Create a Maven profile either in `pom.xml` (project root) or a `settings.xml` file located at `~/.m2/`, with the variable `r-script-location`. It should look something like:
```xml
<profile>
<id>profile-name</id>
<properties>
<r-script-location>src/main/resources/</r-script-location>
</properties>
</profile>
Activate the profile (if on IntelliJ, go to Maven Projects and click the checkbox.)
-
At this point you should be able to run the Metaprot application from your IDE; do so, and as a test, head over to
localhost:<port>/metabolite-analysis
to check that the Web application itself is working. -
Install Mongo (TEMPORARY). You can use Homebrew if on OSX, otherwise see the official mongo docs. Any version above 2.0 should work just fine.
-
Start a Mongo service. If you have not already, create a location for Mongo to store its data:
mkdir -p /data/db
. Also remember tochmod
as this directory to give the active user permission to read and write. This is documented in the official docs linked in step 4. To start the process on OSX or Linux, typemongod
, possibly withsudo
. -
Install R. Again, OSX users can use Homebrew, else consult the official R docs. Building from source is OK. If not already, add the path to R to your system PATH.
-
Install Rserve. If on Windows, you can simply run an R shell by typing
R
in the PowerShell, and using R's built in package manager to do so. Simply typeinstall.packages("Rserve")
. This method may work on OSX and Linux systems as well, but a guaranteed method is to build and install Rserve from source; see instructions. -
Run an Rserve server process. Rserve bypasses the single-threaded limitation of R by exposing R as a TCP service. This way, multiple "servers" can exist and you can use any of them to run arbitrary R commands. Open a R shell if you have not already (type
R
in terminal), and run:
library(Rserve) Rserve(args="--no-save --RS-port ")
where `<port>` refers to the port(s) you specified in `application.properties` in step 1.
9. Now both your Mongo and Rserve processes are running. Head over to your IDE and edit your run configurations. For IntelliJ, this is at `Run->Edit Configurations...`. We need to tell your local version of Metaprot about where to find R, so add as an Environment Variable: `R_HOME=</path/to/R>`. Usually the value of `</path/to/R>` can be found by executing `R.home()` in the R shell. However, this can be manually found by looking at where the R executable file is (e.g. in Windows this is usually in `.../bin`. Save your changes.
10. Now you should be able to run Metaprot in your IDE, via embedded Tomcat.