Passing config file using docker image PBM (Percona Backup for MongoDB)

Hi guys,

we have a setup of a plain MongoDB replica set with 3 nodes running in docker containers. I’m adding PBM to make backups of the databases. So far I have 3 images of PBM set up and running. I’m looking for a simple possibility to pass a config.yaml to the PBM to configure a local storage which is already mapped into the container instead of typing “pbm config --file /config/perconaConfig.yaml”. Once done the configuration is stored in the admin db in the pbmConfig collection. But our MongoDB set up is designed to start up empty on first use of the product in a new project.

Long story short: Is there a place to put the config.yaml that PBM container loads it automatically? If not, is there a docker compose way to this such like an environment variable?

Here is the docker compose.yaml of one PBM node of 3:

hostname: mongo-backup1
image: percona/percona-backup-mongodb:1.8.1
- mongo1
- “/etc/timezone:/etc/timezone:ro”
- “/etc/localtime:/etc/localtime:ro”
- “./…/mongo-volume/backupConfig:/config”
- “./…/mongo-volume/backup:/data/local_backups”

Many thanks, regards, Daniel

1 Like

Hi @dcamarena,

PBM agent does not support (auto)loading configs from a file system or env var. It’s designed to load config from MongoDB only. PBM CLI is the only way to set a new config for all agents at once.

It looks like a good idea. But for now, you need to use PBM CLI right after deployment.

1 Like

Hi @Dmytro_Zghoba,

thank you for the quick response. As we start our MongoDB cluster from scratch without any data and there I can’t put the config in the DB, I decided to overwrite the docker CMD (which only start pbm-agent) in my docker compose file to bring the config file with the CLI in the DB:

command: bash -c "
    pbm config --file /config/perconaConfig.yaml 

Just in case somebody looks for the same.

Cheers, Daniel

1 Like

also, take a look at [PBM-877] read config file from stdin - Percona JIRA.
could extend your setup options.

1 Like