Commit 04df5226 authored by Leonardo Menezes's avatar Leonardo Menezes
Browse files

split internal play settings and app settings into two different files

parent 4532fa1b
Loading
Loading
Loading
Loading
+9 −87
Original line number Diff line number Diff line
Cerebro
------------

cerebro is an open source(MIT License) elasticsearch web admin tool.
cerebro is an open source(MIT License) elasticsearch web admin tool built using Scala, Play Framework, AngularJS and Bootstrap.

## Requirements
### Requirements

cerebro needs Java 1.8 or newer to run.

##Installation
###Installation
- Download from [https://github.com/lmenezes/cerebro/releases](https://github.com/lmenezes/cerebro/releases)
- Extract files
- Run bin/cerebro(or bin/cerebro.bat if on Windows)
- Access on http://localhost:9000

##Configuration
###Configuration

Some settings in cerebro can be set by specifying them as Java System properties, while others need to be specified on the configuration file(conf/application.conf).
#### HTTP server address and port
You can run cerebro listening on a different host and port(defaults to 0.0.0.0:9000):

For an extensive list of Java System properties accepted, check https://www.playframework.com/documentation/2.5.x/ProductionConfiguration

### Secret
Play uses the value of play.crypto.secret to sign session cookies, CSRF tokens and other builtin encryption utilities. It is highly recommended to change this value before running cerebro in production.

### HTTP server address and port
You can run cerebro listening on a different port(9000) and host(0.0.0.0):
```
bin/cerebro -Dhttp.port=1234 -Dhttp.address=127.0.0.1
```

### Path of RUNNING_PID
By default, the RUNNING_PID is placed on the root directory of cerebro, but it is recommendable to place it somewhere that is cleared on restart(/var/run). Make sure the location exists and that cerebro has write permissions to it.

```
bin/cerebro -Dpidfile.path=/var/run/cerebro.pid
```

It is also possible to avoid the creation of the RUNNING_PID file by setting the path to /dev/null on the configuration file:
#### Other settings

```yaml
pidfile.path = "/dev/null"
```
### Using an alternate configuration file
It is possible to define an alternate configuration file(other than conf/application.conf). This can be achieved in two different ways:
Other settings are exposed through the **conf/application.conf** file found on the application directory.

#### -Dconfig.resource
This will pick the specified file from the classpath.
```
bin/cerebro -Dconfig.resource=alternate.conf 
```
It is also possible to use an alternate configuration file defined on a different location:

#### -Dconfig.file
This will pick the specified file from a directory other than the apps dir.
```
bin/cerebro -Dconfig.file=/some/other/dir/alternate.conf 
```


### List of known hosts
A list of predefined hosts can be defined for quicker access by editing conf/application.conf file. If host is password protected, authentication should be also set.

Example:

```yaml
hosts: [
	{
		host: http://localhost:9200
	},
	{
    	host = "http://some-authenticated-host:9200",
  		auth = {
       		username = "username"
			password = "secret-password"
	}
]
```

### User authentication
It is possible to control access to cerebro through authentication.

At the moment, there are no roles/permission level, and either an user is able to access or not.

There are two methods of authentication:

  - Basic: username and password on the configuration file
  - LDAP: connect to an external provider for authentication

Example for basic:
```yaml
auth {
  type: basic
  settings: {
    username = "admin"
    password = "1234"
  }
}
```

Example for LDAP:

```yaml
auth {
  type: ldap
  settings: {
    url = "ldap://host:port"
    base-dn = "ou=active,ou=Employee"
    method  = "simple"
    user-domain = "domain.com"
  }
}
```
+40 −44
Original line number Diff line number Diff line
# This is the main configuration file for the application.
# ~~~~~

# Secret key
# ~~~~~
# The secret key is used to secure cryptographics functions.
# If you deploy your application to several instances be sure to use the same key!
play.crypto.secret="ki:s:[[@=Ag?QI`W2jMwkY:eqvrJ]JqoJyi2axj3ZvOv^/KavOT4ViJSv?6YY4[N"

# The application languages
# ~~~~~
play.i18n.langs=["en"]

# The application base path
# ~~~~~
#play.http.context="/cerebro/"
# Secret will be used to sign session cookies, CSRF tokens and for other encryption utilities.
# It is highly recommended to change this value before running cerebro in production.
secret = "ki:s:[[@=Ag?QI`W2jMwkY:eqvrJ]JqoJyi2axj3ZvOv^/KavOT4ViJSv?6YY4[N"

# Application base path
basePath = "/"

# Defaults to RUNNING_PID at the root directory of the app.
# To avoid creating a PID file set this value to /dev/null
#pidfile.path = "/var/run/cerebro.pid"

# Rest request history max size per user
rest.history.size = 50 // defaults to 50 if not specified

# Path of local database file
data.path = "./cerebro.db"

# Authentication
auth = {
  # Example of LDAP authentication
  #type: ldap
    #settings: {
      #url = "ldap://host:port"
      #base-dn = "ou=active,ou=Employee"
      #method  = "simple"
      #user-domain = "domain.com"
    #}
  # Example of simple username/password authentication
  #type: basic
    #settings: {
      #username = "admin"
      #password = "1234"
    #}
}

# A list of known hosts
hosts = [
  #{
  #  host = "http://localhost:9200"
  #  name = "Some Cluster"
  #},
  # Example of host with authentication
  #{
  #  host = "http://some-authenticated-host:9200"
  #  name = "Secured Cluster"
@@ -23,33 +47,5 @@ hosts = [
  #    username = "username"
  #    password = "secret-password"
  #  }
  #},
  #{
  #  host = "http://localhost:9200"
  #  name = "Some Cluster"
  #}
]

auth {
//  type: ldap
//    settings: {
//      url = "ldap://host:port"
//      base-dn = "ou=active,ou=Employee"
//      method  = "simple"
//      user-domain = "domain.com"
//    }
//  type: basic
//  settings: {
//    username = "admin"
//    password = "1234"
//  }
}

rest.history.size: 50 // defaults to 50 if not specified
data.path: "./cerebro.db"

slick.dbs.default.driver="slick.driver.SQLiteDriver$"
slick.dbs.default.db.driver=org.sqlite.JDBC
slick.dbs.default.db.url="jdbc:sqlite:"${data.path}
play.evolutions.db.default.autoApply = true

conf/reference.conf

0 → 100644
+17 −0
Original line number Diff line number Diff line
# Secret key
secret = "changeme"
play.crypto.secret = ${secret}

# The application languages
play.i18n.langs = ["en"]

# The application base path
basePath = "/"
play.http.context = ${basePath}

# Database configuration
data.path = "./cerebro.db"
slick.dbs.default.driver = "slick.driver.SQLiteDriver$"
slick.dbs.default.db.driver = org.sqlite.JDBC
slick.dbs.default.db.url = "jdbc:sqlite:"${data.path}
play.evolutions.db.default.autoApply = true