Logo Decentralized Social Network

Configuration File

Moera node configuration file is a YAML file containing configuration options. The file should be placed in the moera-node working directory and named application-prod.yml for the production server or application-dev.yml for the development server.

Configuration options have names like node.registrar.domain. In the configuration file they may be set in two forms:

node.registrar.domain: moera.blog

Or

node:
  registrar:
    domain: moera.blog

Minimal configuration

Here is a minimal configuration file you may use as a basis for your configuration:

server:
  port: 8081

spring:
  datasource:
    url: jdbc:postgresql:<DB name>?characterEncoding=UTF-8
    username: <DB username>
    password: <DB password>

  flyway:
    user: <DB username>
    password: <DB password>

node:
  root-secret: <secret>
  mail:
    reply-to-address: <mailrobot e-mail address>
    root-address: <admin e-mail address>
  media:
    path: media/

See the explanation of these and other options below.

Server

All server properties are listed in Spring Boot documentation. The built-in web server used by moera-node is Tomcat.

server.port: 8080

Server HTTP port.

server.tomcat.max-swallow-size: 2MB

Maximum amount of request body to swallow. Increase this number to support uploading large files.

Database

All data properties are listed in Spring Boot documentation. You need to set data migration properties as well to allow moera-node to create the database structure automatically.

spring.datasource.url: jdbc:postgresql:<DB name>?characterEncoding=UTF-8

JDBC URL of the database.

spring.datasource.username: <DB username>

Login username of the database.

spring.datasource.password: <DB password>

Login password of the database.

spring.flyway.user: <DB username>

Login user of the database to migrate.

spring.flyway.password: <DB password>

Login password of the database to migrate.

Authentication

node.root-secret: <secret>

A long random sequence of characters that is used to authenticate as a topmost administrator (root admin) of the server.

node.address: <IP address>

IP address of the server visible to the clients. In most cases, there is no need to configure it, since the address is detected automatically. But on servers having several uplinks, it may be necessary to set the address explicitly.

Media files

node.media.path: media/

Location of the directory where media files are stored. The directory must be readable and writable by moera-node process. The path is relative to moera-node working directory.

node.media.serve: stream

This option defines how media files are served to the client. The possible values are:

  • stream — the file is streamed to the client directly;
  • sendfile — the file’s location is passed back to the proxying web server in X-Sendfile header (used by Apache);
  • accel — the file’s location is passed back to the proxying web server in X-Accel-* headers (used by NGINX).
node.media.accel-prefix: /mediafile/

If node.media.serve is set to accel, this option sets a prefix added to the names of media files. This prefix is then used in NGINX configuration to configure serving media files from the media files directory.

Multiple domains

moera-node allows to run several nodes on a single server instance. Each node should have a separate domain name. Depending on the configuration, nodes may be created only by the server administrator, or by any user.

The node named _default_ is created automatically during the installation. If you have no plans to run several nodes, the default node is all you need.

node.multi: none

Activates the multi-node mode. The possible values are:

  • none — single node mode (you also need to set node.domain);
  • private — multi-node mode, only the server administrator may create new nodes (you also need to set node.registrar.domain);
  • public — multi-node mode, any user may create a node (you also need to set node.registrar.host and node.registrar.domain).
node.domain: <domain name>

If node.multi is set to none, this option defines domain name of the single node.

node.registrar.host: <host name>

If node.multi is set to public, this option defines the host name of the built-in web interface for creating nodes. If a user opens a subdomain that has no node defined for it, they are redirected automatically to the web interface for creating the node.

node.registrar.domain: <domain name>

If node.multi is set to private or public, this option defines the name of the domain where subdomains are created for the new nodes. Note that moera-node cannot register subdomains in DNS by itself, so you need to have a wildcard subdomain defined on the DNS server. Or you can add subdomains manually for every node.

Mail

All mail properties are listed in Spring Boot documentation. In addition, there are several properties specific to moera-node.

spring.mail.host: localhost

SMTP server host.

spring.mail.port: 2525

SMTP server port.

spring.mail.username: <username>

Login user of the SMTP server.

spring.mail.password: <password>

Login password of the SMTP server.

spring.mail.properties.*

Additional JavaMail properties.

spring.mail.properties.mail.smtp.auth: false

If true, attempt to authenticate the user using the AUTH command.

spring.mail.properties.mail.smtp.starttls.enable: false

If true, enables the use of the STARTTLS command (if supported by the server) to switch the connection to a TLS-protected connection before issuing any login commands.

node.mail.send-limit: 10
node.mail.send-period: 10

Limit the rate of outbound mail to node.mail.send-limit mails in node.mail.send-period minutes.

node.mail.reply-to-address: mailrobot@myblog.com

The e-mail address that is put to the Reply-To: header in outgoing mails.

node.mail.root-address: myblog-admin@gmail.com

E-mail address of the server’s administrator.

Settings

It is possible to use the configuration file to override the built-in default values of the node settings. This will affect all nodes in the server.

The settings are given as a list of name-value pairs:

node:
  options:
    - name: posting.max-size
      defaultValue: 65536
    - name: posting.subject.present
      defaultValue: true

Thread pools

These options set the number of threads in the thread pools used by moera-node for various purposes. Larger number increases memory usage and the peak load on the server, but allows to run more tasks in parallel.

node.pools.naming: 16

The pool used to resolve node names with Moera naming service.

node.pools.notification-sender: 64

The pool used to send notifications to other nodes.

node.pools.picker: 12

The pool used to fetch posts from other nodes.

node.pools.push: 64

The pool used to push notifications to clients.

node.pools.remote-task: 16

The pool used for unspecified background tasks.

Logging

logging.file.max-history: 10

Number of old log files that are preserved.

Debugging

node.mock-network-latency: false

If set to true, a random delay is added before answering to any request, to simulate network latency.