Charmed MongoDB

Channel Revision Published Runs on
5/edge 114 Yesterday
Ubuntu 22.04
3.6/stable 97 14 Feb 2023
3.6/candidate 97 12 Jan 2023
3.6/edge 100 03 Feb 2023
Ubuntu 20.04 Ubuntu 18.04
juju deploy mongodb --channel 3.6/stable
Show information

Platform:

charms.mongodb.v0.helpers

Simple functions, which can be used in both K8s and VM charms.


def get_create_user_cmd(
    config: MongoDBConfiguration,
    mongo_path
)

Creates initial admin user for MongoDB.

Description

Initial admin user can be created only through localhost connection. see https://www.mongodb.com/docs/manual/core/localhost-exception/ unfortunately, pymongo not able to create connection which considered as local connection by MongoDB, even if socket connection used. As result where are only hackish ways to create initial user. It is needed to install mongodb-clients inside charm container to make this function work correctly

def get_mongod_args(
    config: MongoDBConfiguration,
    auth: bool,
    snap_install: bool
)

Construct the MongoDB startup command line.

Returns

A string representing the command used to start MongoDB.

def generate_password()

Generate a random password string.

Returns

A random password string.

def generate_keyfile()

Key file used for authentication between replica set peers.

Returns

A maximum allowed random string.

def build_unit_status(
    mongodb_config: MongoDBConfiguration,
    unit_ip: str
)

Description

Generates the status of a unit based on its status reported by mongod. None