MongoDB configuration

You will need a running MongoDB instance to use task object storage. It is recommended to use MongoDB Atlas https://www.mongodb.com/cloud/atlas.

If and when you need an on-premise MongoDB, you can read the following instructions.

Setting up on-prem Mongo for development

See installation instructions here: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/

To use MongoDB with authentication, set up the users first in Mongo shell (for more information, see MongoDB documentation: https://docs.mongodb.com/manual/tutorial/enable-authentication/)

First, start mongoDB

mongod

or, as a service:

sudo service mongod start

Then connect Mongo shell to the running instance

mongo

Create an admin user (if no admin exists):

use admin
db.createUser(
{
  user: "admin",
  pwd: "secret-password",
  roles: [ { role: "userAdminAnyDatabase", db: "admin" }, "readWriteAnyDatabase" ]
}
)

Exit and restart MongoDB with authentication enabled:

mongod --auth

Then connect with Mongo shell. Inside the shell authenticate with admin user:

use admin
db.auth("admin", "secret-password" )

Now you can create the robot user which authenticates via TOS:

use robot_process
db.createUser(
 {
   user: "robot-process-user",
   pwd: "super-secret",
   roles: [ { role: "readWrite", db: "robot_process" }]
 }
)

where authentication database robot_process is the same where task objects are stored.

Username and password should be passed to TOSLibrary as keyword arguments db_user and db_passw, respectively.

Setting up on-prem Mongo for production

Set up Mongo to always use authentication in /etc/mongod.conf:

security:
  authorization: enabled

and use Mongod as a service:

sudo systemctl enable mongod.service