Document toolboxDocument toolbox

MongoDB Installation

Optional Feature

Grid Indexing is an optional feature. If your organization does not require it, you can disable this functionality.

This change is made by adding a configuration option to the PCR-360 ini

constants.GRID_INDEXING_ENABLED = false

Requirements

  • Database Setup:

    • MongoDB is required to enable Grid Indexing.

    • It can be installed locally on the same machine as the application or hosted remotely on a separate server.

  • Security and Authentication

    • Authentication: MongoDB must be configured to require authentication to ensure security. This means users will need valid credentials to access the database.

    • Credentials

      • The application requires login credentials (username and password) to connect to MongoDB.

      • These credentials must have permissions to create and manage databases and tables.

Installation

Intalling the MongoDB server

https://www.mongodb.com/docs/manual/administration/install-on-linux/

Installing the MongoDB PHP Driver

https://www.mongodb.com/docs/drivers/php-drivers/

Securing the MongoDb Server

Setting up the Admin User

The password should be alphanumeric and can include hyphens - and underscores _ but should avoid special characters like ^#@%* and quotes ' “ because it can cause issues with the terminal login used by the MongoDb PHP Driver.

mongosh > use admin > db.createUser( { user: "pcr360", pwd: passwordPrompt(), roles: [ { role: "userAdminAnyDatabase", db: "admin" }, "readWriteAnyDatabase" ] } ) > exit

Enabling Secure Login

vi /etc/mongod.conf > # find #security: # and replace with security.authorization: enabled > :wq # Restart sudo systemctl restart mongod sudo systemctl status mongod

Testing Login

No Access

mongosh > show dbs > MongoServerError: command listDatabases requires authentication > exit

Admin Access

 

Configuring PCR-360

Encrypting a Password

PCR-360's CLI can be used to encrypt MongoDB passwords

Database Connection

  • PCR-360 configuration Options

    • Ooptions must be placed in the correct section for the environment. Usually, test or prod

    • the INI is usually located /var/www/pcr360/configs/pcr360.ini

Disabling the Index

Setting this constant to false will disable the indexing and prevent any attampted connection to MongoDB. This is intended to disable the index for customers whose hardware cannot support it.

Indexed grids use the Index, by default, for grid queries

To disable, set this config option to false

Related pages