Charmed MongoDB

Channel Revision Published Runs on
6/stable 164 26 Mar 2024
Ubuntu 22.04
6/candidate 164 26 Mar 2024
Ubuntu 22.04
6/beta 164 26 Mar 2024
Ubuntu 22.04
6/edge 173 27 May 2024
Ubuntu 22.04
5/stable 117 20 Apr 2023
Ubuntu 22.04
5/candidate 117 20 Apr 2023
Ubuntu 22.04
5/edge 139 21 Nov 2023
Ubuntu 22.04 Ubuntu 20.04
5/edge 109 06 Mar 2023
Ubuntu 22.04 Ubuntu 20.04
3.6/stable 100 28 Apr 2023
Ubuntu 20.04 Ubuntu 18.04
3.6/candidate 100 13 Apr 2023
Ubuntu 20.04 Ubuntu 18.04
3.6/edge 100 03 Feb 2023
Ubuntu 20.04 Ubuntu 18.04
juju deploy mongodb --channel 6/stable
Show information

Platform:

Ubuntu
22.04 20.04 18.04

charms.mongodb.v1.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_mongos_args(
    config,
    snap_install: bool,
    config_server_db: str,
    external_connectivity: bool
)

Returns the arguments used for starting mongos on a config-server side application.

Returns

A string representing the arguments to be passed to mongos.

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

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

def copy_licenses_to_unit()

Description

Copies licenses packaged in the snap to the charm's licenses directory. None

def current_pbm_op(pbm_status: str)

Description

Parses pbm status for the operation that pbm is running. None

def process_pbm_status(pbm_status: str)

Description

Parses current pbm operation and returns unit status. None

def add_args_to_env(
    var: str,
    args: str
)

Description

Adds the provided arguments to the environment as the provided variable. None