Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using mongodb with username/password #1428

Closed
biren opened this issue Mar 16, 2018 · 3 comments
Closed

Using mongodb with username/password #1428

biren opened this issue Mar 16, 2018 · 3 comments

Comments

@biren
Copy link

biren commented Mar 16, 2018

Info:

  • Docker version ($ docker --version): Docker version 17.12.1-ce, build 7390fc6
  • Laradock commit ($ git rev-parse HEAD): c5c4d19
  • System info (Mac, PC, Linux): Linux
  • System info disto/version: Ubuntu 16.04

Issue:

There doesn't seem to be a way to run mongo container with authentication. Initial user creation functionality is missing (unlike postgres).


Expected behavior:

Mongo container to take care of user creation at the time of install. May be using a script approach like: http://blog.bejanalex.com/2017/03/running-mongodb-in-a-docker-container-with-authentication/


Reproduce:

  • Follow all the setup/config instructions for jenssegers/mongodb and composer.
    php artisan tinker
$user = DB::connection('mongodb')->collection('users')->get();
MongoDB\Driver\Exception\AuthenticationException with message 'Authentication failed.'
  • Verify there is no --auth for mongo command line inside the container
mongodb      1     0  0 00:39 ?        00:00:12 mongod --bind_ip_all
  • Connecting to mongodb from an external UI (like Robo 3T) without user/pass works too.

  • For running mongodb inside a docker container, may be we can drop an initial user creation script inside docker-entrypoint-initdb.d.

Relevant Code:

  • app/config/database.php:
        'mongodb' => [
            'driver' => 'mongodb',
            'host' => env('MONGODB_HOST', '127.0.0.1'),
            'port' => env('MONGODB_PORT', '27017'),
            'database' => env('MONGODBDB_DATABASE', ''),
            'username' => env('MONGODB_USERNAME', ''),
            'password' => env('MONGODB_PASSWORD', ''),
            'options'  => [
                'database' => 'admin',
            ],
        ],

@stale
Copy link

stale bot commented Feb 2, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Stale label Feb 2, 2020
@stale
Copy link

stale bot commented Feb 23, 2020

Hi again 👋 we would like to inform you that this issue has been automatically closed 🔒 because it had not recent activity during the stale period. We really really appreciate your contributions, and looking forward for more in the future 🎈.

@stale stale bot closed this as completed Feb 23, 2020
@fadighattas100
Copy link

is their some updated on this or it just closed and we need to reopen a new issue ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants