- Notifications
You must be signed in to change notification settings - Fork0
daniloarcidiacono/remark42-mongodb
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
StoreRemark42 comments, images and avatars on MongoDB.
Tested withRemark42 v1.10.1.
WarningThe fix for the following issues on Remark42 are required for Remark42 MongoDB Server to work:
Until version v1.10.2 is released it's mandatory to build Remark42 from its
masterbranch.
Initialize the server withremark42-mongodb.js init:
A configuration fileremark42-mongodb.json is created:
{"port":9000,"hostname":"localhost","database":"mongodb://localhost:27017/remark42-mongodb","avatars":"remark_avatars","bodyLimit":"8mb","dynamicPosts":true,"logDir":"logs","logMaxSize":"8m","logMaxFiles":30}The following options are available:
port: the TCP port on which the Remark42 MongoDB Server listens for client connections;hostname: the hostname where to listen for client connections;database: the MongoDB connection URI;avatars: Remark42 can be configured to store avatars in a GridFS bucket. This optional setting is the name of the GridFS bucket; once configured, remark42-mongodb periodically cleans up unused avatars;bodyLimit: maximum size of request bodies, should be calibrated accordingly to the maximum image size accepted by Remark42 (IMAGE_MAX_SIZE);dynamicPosts: iftrue, any post referenced by comments is created if not existing; iffalse, comments referencing a non-existing post are rejected: in that case, available sites/posts must be initialized either by hand or by usingsites createandposts createcommands;logDir: logs folder path;logMaxSize: the maximum size for each log file (e.g.32k,8m,2g).logMaxFiles(optional): maximum number of days the logs are kept; if omitted, logs are kept indefinitely;
All options can be overridden viaREMARK42_MONGODB_XXX environment variables, for exampleREMARK42_MONGODB_DATABASEorREMARK42_MONGODB_LOG_MAX_SIZE.
Start the server withremark42-mongodb.js serve.
Three log files are created:
access-YYYY-MM-DD.log: collecting information about served requests;error-YYYY-MM-DD.log: collecting errors;main-YYYY-MM-DD.log: collecting general information;
Log files are rotated daily and are limited both in size (logMaxSize) and number (logMaxFiles).
Service health can be checked by sending aGET /health request, that will respond with200 OK or503 Service Unavailable depending on the state of the server and database connection.
New sites can be created withremark42-mongodb.js sites create [name]:
Sitesmust be created regardless of whetherdynamicPosts is set totrue orfalse.
The encryption key and email are described onRemark42 documentation,respectivelySECRET andADMIN_SHARED_EMAIL. \Note that Remark42 MongoDB Server handles different values for each site (i.e. they are not "shared").
Current sites can be listed withremark42-mongodb.js sites list:
New posts can be created withremark42-mongodb.js posts create [site] [url]:
This is useful for initializing the database whendynamicPosts is set tofalse.
The posts on a specific site can be listed withremark42-mongodb.js posts list [site]:
Set the following environment variables in Remark42 to enable integration with Remark42 MongoDB Server (adjust values according to your configuration):
STORE_TYPE=rpcSTORE_RPC_API=http://localhost:9000ADMIN_TYPE=rpcADMIN_RPC_API=http://localhost:9000IMAGE_TYPE=rpcIMAGE_RPC_API=http://localhost:9000
Remark42 can also store avatars in a GridFS bucket with the following configuration:
AVATAR_TYPE=uriAVATAR_URI=mongodb://localhost:27017/remark42-mongodb?ava_db=remark42-mongodb&ava_coll=remark_avatars
WarningAt the moment
mongodb+srvURIs (used by MongoDB Atlas) are not handled correctly (open issue).
Remark42 MongoDB Server can periodically clean up unused avatars by configuringavatars toremark_avatars.
More information on how to configure Remark42 available atRemark42 documentation.
About
Remark42 MongoDB Server
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.