Strider-CD / strider

Open Source Continuous Integration & Deployment Server
http://strider-cd.github.io/
4.59k stars 432 forks source link

CLI addUser requires db_uri if set for strider #1061

Open Buddwa opened 6 years ago

Buddwa commented 6 years ago

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 []: wei@ib.com Enter password []: *** Is admin? (y/n) [n]y

Email: wei@ib.com 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?

xgalen commented 6 years ago

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?

Buddwa commented 6 years ago

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

xgalen commented 6 years ago

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.

Buddwa commented 6 years ago

Below is the whole output:

strider@1.10.0 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 noreply@stridercd.com', 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_parserlimit: 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 noreply@stridercd.com', 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_parserlimit: 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

knownasilya commented 6 years ago

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

knownasilya commented 6 years ago

Might be related to #1055

Buddwa commented 6 years ago

This DB is only for Strider.

epical-mi commented 6 years ago

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.

knownasilya commented 6 years ago

Hum, that's a bug for sure.

knownasilya commented 4 years ago

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.