strider icon indicating copy to clipboard operation
strider copied to clipboard

CLI addUser requires db_uri if set for strider

Open Buddwa opened this issue 7 years ago • 10 comments

Hi, After installation I create a user with cli below:

[root@strider strider]# node bin/strider addUser Connecting to MongoDB URL: mongodb://localhost/strider-foss

Enter email []: [email protected] Enter password []: ******* Is admin? (y/n) [n]y

Email: [email protected] Password: **** isAdmin: y OK? (y/n) [y]y User created successfully! Enjoy.

And then I visit web site to login with this new user, but login failed as below:

Authentication failed, please supply a valid email/password.

Then I run command "db.users.find()" in strider db; however, there is no item.

So how to deal with this?

Buddwa avatar Jun 12 '18 05:06 Buddwa

Hi, Try running strider with DEBUG=strider* and paste the logs to check the problems. What happens if you try to add again another user?

xgalen avatar Jun 12 '18 09:06 xgalen

There is not a user after strider has been installed, so I want to add one. How to modify the mode debug?

Buddwa avatar Jun 12 '18 09:06 Buddwa

No users are installed with strider, it's supposed that the admin has to add it, as you did. Try it again after changing the debug mode. Just add DEBUG=strider* as an environment variable to the strider's run command.

xgalen avatar Jun 12 '18 09:06 xgalen

Below is the whole output:

[email protected] start /opt/strider bin/strider

strider:config { logging: strider:config { exitOnError: true, strider:config file_enabled: false, strider:config console: { level: 0, colorize: true, timestamp: true }, strider:config console_enabled: true }, strider:config viewpath: '/opt/strider/lib/views', strider:config host: '0.0.0.0', strider:config port: 3000, strider:config server_name: 'http://localhost:3000', strider:config db_uri: 'mongodb://strider:striderpw@localhost:27017/strider', strider:config smtp_host: '', strider:config smtp_port: 587, strider:config smtp_user: '', strider:config smtp_pass: '', strider:config smtp_from: 'Strider [email protected]', strider:config smtp_secure: '', strider:config enablePty: false, strider:config extpath: 'node_modules', strider:config session_secret: '8L8BudMkqBUqrz', strider:config github_app_id: '', strider:config github_secret: '', strider:config cors: false, strider:config body_parser_limit: false, strider:config ldap: false, strider:config _: [], strider:config smtp: undefined, strider:config stubSmtp: true, strider:config plugins: { github: { hostname: 'http://localhost:3000' } } } +0ms 29154 forked strider:config { logging: strider:config { exitOnError: true, strider:config file_enabled: false, strider:config console: { level: 0, colorize: true, timestamp: true }, strider:config console_enabled: true }, strider:config viewpath: '/opt/strider/lib/views', strider:config host: '0.0.0.0', strider:config port: 3000, strider:config server_name: 'http://localhost:3000', strider:config db_uri: 'mongodb://strider:striderpw@localhost:27017/strider', strider:config smtp_host: '', strider:config smtp_port: 587, strider:config smtp_user: '', strider:config smtp_pass: '', strider:config smtp_from: 'Strider [email protected]', strider:config smtp_secure: '', strider:config enablePty: false, strider:config extpath: 'node_modules', strider:config session_secret: '8L8BudMkqBUqrz', strider:config github_app_id: '', strider:config github_secret: '', strider:config cors: false, strider:config body_parser_limit: false, strider:config ldap: false, strider:config _: [], strider:config smtp: undefined, strider:config stubSmtp: true, strider:config plugins: { github: { hostname: 'http://localhost:3000' } } } +0ms strider-mailer stubbing smtp.. +0ms strider Using MongoDB URL: mongodb://strider:striderpw@localhost:27017/strider +0ms strider No SMTP creds - forgot password flow will not work +42ms 2018-06-12T17:29:03.673+0800 I NETWORK [listener] connection accepted from 127.0.0.1:50098 #51 (2 connections now open) 2018-06-12T17:29:03.682+0800 I NETWORK [conn51] received client metadata from 127.0.0.1:50098 conn51: { driver: { name: "nodejs", version: "2.2.34" }, os: { type: "Linux", name: "linux", architecture: "x64", version: "3.10.0-862.3.2.el7.x86_64" }, platform: "Node.js v6.14.2, LE, mongodb-core: 2.1.18" } 2018-06-12T17:29:03.708+0800 I ACCESS [conn51] Successfully authenticated as principal strider on strider 2018-06-12T17:29:03.733+0800 I NETWORK [listener] connection accepted from 127.0.0.1:50100 #52 (3 connections now open) 2018-06-12T17:29:03.735+0800 I ACCESS [conn52] Successfully authenticated as principal strider on strider 2018-06-12T17:29:03.738+0800 I NETWORK [listener] connection accepted from 127.0.0.1:50102 #53 (4 connections now open) 2018-06-12T17:29:03.740+0800 I ACCESS [conn53] Successfully authenticated as principal strider on strider 2018-06-12T17:29:03.753+0800 I NETWORK [listener] connection accepted from 127.0.0.1:50104 #54 (5 connections now open) 2018-06-12T17:29:03.754+0800 I ACCESS [conn54] Successfully authenticated as principal strider on strider 2018-06-12T17:29:03.764+0800 I NETWORK [listener] connection accepted from 127.0.0.1:50106 #55 (6 connections now open) strider-simple-runner RUNNER INIT +0ms strider:load-extensions loaded templates +0ms strider:load-extensions initalized webapps +184ms strider:load-extensions Found job plugins: +0ms strider:load-extensions - custom +0ms strider:load-extensions - emailnotifier +0ms strider:load-extensions - env +0ms strider:load-extensions - github-status +0ms strider:load-extensions - heroku +0ms strider:load-extensions - metadata +1ms strider:load-extensions - node +0ms strider:load-extensions - python +0ms strider:load-extensions - ruby +0ms strider:load-extensions - slack +0ms strider:load-extensions - ssh_deploy +0ms strider:load-extensions - webhooks +0ms strider:load-extensions Found runner plugins: +0ms strider:load-extensions - simple-runner +0ms strider:load-extensions Found provider plugins: +0ms strider:load-extensions - bitbucket +0ms strider:load-extensions - git +0ms strider:load-extensions - github +0ms strider:load-extensions - gitlab +0ms strider:load-extensions - hg +0ms strider:load-extensions Found basic plugins: +0ms strider:load-extensions - buildbadge +0ms strider:load-extensions initialized static directories +2ms 2018-06-12T17:29:04.704+0800 I ACCESS [conn55] Successfully authenticated as principal strider on strider strider:routes:api:config loaded config pages +0ms strider:routes:api:config loaded account config pages +5ms strider:routes:api:config loaded plugin status blocks +10ms strider:load-extensions loaded plugins +47ms 2018-06-12T09:29:04.763Z - info: Express server listening on port 3000 in development mode strider:kill-zombies Marking zombie jobs as finished... +0ms strider:kill-zombies 0 zombie jobs marked as finished +7ms

Buddwa avatar Jun 12 '18 09:06 Buddwa

Are there other databases in you mongo instance? The user create might have used a different database name..

knownasilya avatar Jul 25 '18 17:07 knownasilya

Might be related to #1055

knownasilya avatar Jul 25 '18 17:07 knownasilya

This DB is only for Strider.

Buddwa avatar Jul 31 '18 02:07 Buddwa

I experienced the similar case with a fresh install of Strider on AWS Linux 2. Problem was that by default MongoDB URL: is pointing to a database named 'strider-foss' rather than as in install instructions 'strider'. So you should be always remembering to set the DB_URI environment variable to point to the correct database when running bin/strider addUser.

epical-mi avatar Sep 13 '18 06:09 epical-mi

Hum, that's a bug for sure.

knownasilya avatar Sep 13 '18 11:09 knownasilya

So not so much a bug, but unfortunate side effect of using envs. Maybe we should suggest using the file to configure instead of bare envs.

knownasilya avatar May 31 '20 18:05 knownasilya