Skip to main content

Pre-configuring the FDM Monster Server

warning

For the changes in the environment variables to take effect, your FDM Monster server must be restarted!

FDM Monster Server can be configured with environment variables. There are different ways to do this for each setup:

  • specify a .env file. This works for these setups:
    • Windows service setup with node-windows
    • Linux service setup with node-linux
    • Node.js with pm2
    • Node.js with nodemon
  • docker - specify each variable separately, this can become tedious:
    • docker: using the -e VARIABLE=value command repeatedly
  • docker - all at once

Required and optional variables

warning

Since FDM Monster Server v1.6.0+, a new database type was added named SQLite managed with the TypeORM library. The file-based database SQLite allows for a standalone FDM Monster setup without MongoDB. Hence, no running MongoDB database would be required, if this new mode is enabled. Enable this mode by setting ENABLE_EXPERIMENTAL_TYPEORM=true. You do not have to specify MONGO anymore in that case! The MONGO variable will be ignored by FDM Monster.

Also note that no data is migrated from MongoDB to SQLite. You can use YAML export & import for migrating most data.

This new mode is experimental, although it has been tested quite a bit. We hope you are in the position to provide feedback in case of errors or unexpected behaviour!

The following variables are read and used by FDM Monster at startup. Always restart your server after a change.

  • MONGO (Optional, required before 1.6.x) the connection to mongodb. For example:

MONGO=mongodb://127.0.0.1:27017/fdm-monster

  • ENABLE_EXPERIMENTAL_TYPEORM (Optional) a flag indicating SQLite should be used instead of MongoDB. Setting it to exactly true will enable this new mode.

  • ENABLE_EXPERIMENTAL_TYPEORM=true

  • SERVER_PORT (Optional, default=4000) the port of the local FDM Monster website. For example:

SERVER_PORT=4000

The .env file

A very simple text file with a variable per line. The following .env is often already enough to make sure FDM Monster works as you like:

MONGO=mongodb://127.0.0.1:27017/fdm-monster
SERVER_PORT=4000

Alternatively, the new SQLite (TypeORM) mode can be enabled as such:

ENABLE_EXPERIMENTAL_TYPEORM=true
SERVER_PORT=4000

Applying it to your setup

So, you understand the variables to configure FDM Monster now. How do I set this up for my environment? Read below for your specific scenario.

Node.js with node-linux, node-windows or pm2

Create a .env file in the fdm-monster/server folder with the required and/or optional variables by copying the .env.template file. Copy this and rename it to .env to get started quicker. The server will automatically create the .env file for you, and the server logs will show what is going wrong if something is missing.

Feel adventurous? Customize the file to your liking, but again ALWAYS make sure the required variables are correctly set.

Docker-compose

With docker-compose you have a great tool to pass environment variables use the environment section. Here is how the environment section in docker would look.

services:
fdm-monster:
# ... other sections here
environment:
# To use SQLite / TypeORM instead:
# - ENABLE_EXPERIMENTAL_TYPEORM=true
- MONGO: mongodb://127.0.0.1:27017/fdm-monster
- SERVER_PORT: 4000

Please continue by reading the Docker Compose section for more information on how to setup FDM Monster and MongoDB with docker-compose.