Sign inSign up

spidasoftware/mongodb

By spidasoftware

•Updated about 3 years ago

Our mongodb image

Image
0

10K+

spidasoftware/mongodb repository overview

⁠mongodb

Our mongodb docker image

⁠Notes on adding logging volumes and configuration to existing deployments

To add logging for mongo for a redepoloyed mongo container that adds the mongod.conf the docker-compose.yml must be edited to add the volume and an updated google-fluentd spidamin.conf needs to be installed. The fluentd conf should be installed and restarted before updating the docker-compose to pick-up logs as they are written.

caa@test:~$ wget https://raw.githubusercontent.com/spidasoftware/installer/master/config/fluentd/spidamin.conf
caa@test:~$ sudo cp spidamin.conf /etc/google-fluentd/config.d
caa@test:~$ sudo service google-fluentd status
caa@test:~$ sudo service google-fluentd restart
caa@test:~$ sudo service google-fluentd status

or the following lines may be added to the /etc/google-fluentd/config.d/spidamin.conf

<source>
  @type tail
  format none
  path /apps/spidamin/logs/mongodb/mongodb.log
  pos_file /var/lib/google-fluentd/pos/spida-mongodb.pos
  tag mongodb
</source>

<source>
  @type tail
  format none
  path /apps/spidamin/logs/mongodb/mongod.log
  pos_file /var/lib/google-fluentd/pos/spida-mongod.pos
  tag mongod
</source>

To verify the updated docker container has been deployed, it can be checked by inspecting the image and checking for the log volume and --config in the Cmd. sudo docker inspect <name|image id>

caa@test:~$ sudo docker inspect -f '{{.Config.Volumes}}' spida_mongodb_1
map[/backups:{} /data/db:{} /var/log/mongodb:{}]
caa@test:~$ sudo docker inspect -f '{{.Config.Cmd}}' spida_mongodb_1
[mongod --config /etc/mongod.conf]

or without the -f format look for the Cmd & Volumes in the Config section of inspect output.

            "Cmd": [
                "mongod",
                "--config",
                "/etc/mongod.conf"
            ]
            "Volumes": {
                "/backups": {},
                "/data/db": {},
                "/var/log/mongodb": {}
            }

Add mongodb log volume to the docker-compose.yml file and restart.

mongodb:
  image: spidasoftware/mongodb:TAG-with-log-volume-and-entrypoint-config-change
  restart: always
  hostname: mongodb.test-standard.spidastudio.com
  volumes:
    - /apps/spidamin/mongoBackups:/backups
    - /apps/spidamin/mongoData:/data/db
    - /apps/spidamin/logs/mongodb:/var/log/mongodb
  env_file: /apps/spidamin/spida/.docker-common.env

mkdir -p /apps/spidamin/logs/mongodb

sudo docker-compose -f docker-compose.yml stop

sudo docker-compose -f docker-compose.yml up -d

Tag summary

Content type

Image

Digest

sha256:528b31bac…

Size

329 MB

Last updated

about 3 years ago

docker pull spidasoftware/mongodb