Senior Software Developer and Linux Fanatic
How to change mongodb location in devilbox
It is possible to specify a different location for the MongoDB data files when using the Devilbox. This can be done by modifying the MYSQL_DATADIR
and MONGODB_DATADIR
environment variables in the .env
file.
For example, to specify a different location for the MongoDB data files, you can add the following lines to the .env
file:
MONGODB_DATADIR=/path/to/mongodb/data
Replace /path/to/mongodb/data
with the actual path to the directory where you want to store the MongoDB data files.
Once you have made this change, you will need to restart the Devilbox for the changes to take effect. You can do this by running the following command from the root of the Devilbox directory:
docker-compose down && docker-compose up -d
This will shut down the existing Devilbox containers and start them back up with the updated configuration. You can then verify that the MongoDB data files are being stored in the location you specified by checking the contents of the directory you specified in the MONGODB_DATADIR
environment variable.