Setup

Tip
The easiest way to run RESTHeart and MongoDB is with Docker, please go to Setup with Docker

Download

Download the ZIP or TAR archive.

zip tgz

Un-zip or un-tar

$ # if you downloaded the tar.gz
$ tar -xzf restheart.tar.gz && cd restheart
$ # if you downloaded the tar.gz
$ tar -xzf restheart.tar.gz && cd restheart

Run

To run RESTHeart 6.x connected to a local instance of MongoDB you need:

  • Java 17+;

  • MongoDB running on localhost on port 27017.

Note
RESTHeart supports MongoDB from version 3 throughout 5 and it is extensively tested with MongoDB 3.6, 4.2, 4.4 and v5.0
$ # start MongoDB as single instance Replica Set
$ mkdir -p /tmp/db && mongod --fork --syslog --replSet=foo -dbpath=/tmp/db &&  mongo --eval 'if (!rs.status().ok) rs.initiate();'
$ # start RESTHeart
$ java -jar restheart.jar etc/restheart.yml -e etc/default.properties
$ http -b http://localhost:8080/ping

Greetings from RESTHeart!

Directory structure

restheart
├── LICENSE.txt
├── etc
│   ├── acl.yml
│   ├── default.properties
│   ├── restheart.yml
│   └── users.yml
├── plugins
│   ├── restheart-graphql.jar
│   ├── restheart-mongodb.jar
│   ├── restheart-polyglot.jar
│   └── restheart-security.jar
└── restheart.jar

Run as a daemon

To run RESTHeart as a daemon (i.e. fork) add the --fork parameter:

$ java -jar restheart.jar --fork etc/restheart.yml -e etc/default.properties

To see the logs you first need to enable file logging and set an absolute path to a log file. For example, check that /usr/local/var/log/restheart.log is writeable and then edit etc/default.properties like this:

enable-log-file = true
log-file-path = /usr/local/var/log/restheart.log

CLI parameters

To know the available CLI parameters, run RESTHeart with --help:

$ java -jar restheart.jar --help

Usage: java -Dfile.encoding=UTF-8 -jar -server restheart.jar [-hv] [--fork]
       [-e=<envFile>] FILE
      FILE        Main configuration file
  -e, --envFile, --envfile=<envFile>
                  Environment file name
      --fork      Fork the process in background
  -h, --help      This help message
  -v, --version   Print product version to the output stream and exit

What’s next