os-js / OS.js

OS.js - JavaScript Web Desktop Platform
https://www.os-js.org/
Other
6.89k stars 822 forks source link

mysql-handler bugs #335

Closed webmst closed 8 years ago

webmst commented 8 years ago

Activating the mysql-handler I get 2 strange behaviours:

andersevenrud commented 8 years ago

Thanks!

I will update this ASAP

andersevenrud commented 8 years ago

The user information should now be correct.

If you get 404 on API functions you probably do not have "mod_rewrite" enabled. Check that first -- since I have no problems on my end atm.

andersevenrud commented 8 years ago

Also make sure you have "allow override" in your vhost so Apache can read .htaccess

webmst commented 8 years ago

mod_rewrite.so is loaded

'AllowOverride All' 'Require all granted'

are included.

But I haven't set the vhost yet, I'm using the 'osjs' alias to the 'dist' folder

webmst commented 8 years ago

After the above said modification of handler.php, it shows "demo" instead of "undefined", without taking into account the given mysql user

andersevenrud commented 8 years ago

After the above said modification of handler.php, it shows "demo" instead of "undefined", without taking into account the given mysql user

Then the server is not running with the correct handler. I`m not having any problems with this locally and https://osjsv2.0o.no/ is running on Apache.

Did you change the handler according to the docs ? https://github.com/os-js/OS.js/blob/master/doc/mysql-handler.md

andersevenrud commented 8 years ago

Just realized I had some typos in those docs -- fixed.

But, anyway. I just set up a fresh VM with PHP5 and Apache and used the docs to set up the mysql handler. I`m having no problems here :\

webmst commented 8 years ago

Yes, as I wrote at the beginning of this issue, the mysql-handler has been set according to the docs and with a php container, it displays the login screen and allows signing in (only wrong user is reported).

webmst commented 8 years ago

...but your modification to handler.php was on the 'demo' handler

andersevenrud commented 8 years ago

Yeah. I remembered I forgot something that leads to the "undefined" problem, but that was only for demo handler, the mysql one has been updated by another user in the community and tested.

So the server is obviously using the wrong handler somehow -- a dead giveaway is that it says "demo" as username.

Sorry, but I cannot be of more assist at the moment -- I have to go to bed.

webmst commented 8 years ago

Sure, good night. I'm not in a hurry. We'll resume this next time.

webmst commented 8 years ago

As you posited I'm using the wrong handler for my mysql setup (that behaves differently using apache, php or node as containers), I re-executed the handler setup checking for error messages, finding the following output when 'grunt config' was executed:

Running "config" task
Writing configuration files...
[TypeError: Cannot read property 'homes' of undefined] 'TypeError: Cannot read property \'homes\' of undefined\n    at buildServer (/usr/local/OS.js/src/build.js:807:59)\n    at Object.createConfigurationFiles (/usr/local/OS.js/src/build.js:835:7)\n    at Object.<anonymous>     (/usr/local/OS.js/Gruntfile.js:227:14)\n    at Object.thisTask.fn     (/usr/local/OS.js/node_modules/grunt/lib/grunt/task.js:82:16)\n    at Object.<anonymous>     (/usr/local/OS.js/node_modules/grunt/lib/util/task.js:301:30)\n    at Task.runTaskFn     (/usr/local/OS.js/node_modules/grunt/lib/util/task.js:251:24)\n    at Task.<anonymous>     (/usr/local/OS.js/node_modules/grunt/lib/util/task.js:300:12)\n    at Task.start     (/usr/local/OS.js/node_modules/grunt/lib/util/task.js:309:5)\n    at Object.grunt.tasks     (/usr/local/OS.js/node_modules/grunt/lib/grunt.js:164:8)\n    at Object.module.exports [as cli]     (/usr/local/OS.js/node_modules/grunt/lib/grunt/cli.js:38:9)'

Done, without errors.

Can it help?

andersevenrud commented 8 years ago

[TypeError: Cannot read property 'homes' of undefined] 'TypeError: Cannot read property \'homes\' of undefined\n

It seems that it has some trouble reading the settings file. So my guess is there's something wrong with yours.

What do you get when doing grunt config:get ?

andersevenrud commented 8 years ago

Or more spesifically grunt config:get:server

andersevenrud commented 8 years ago

I'm thinking that your src/conf/900-custom.json file might be broken (which is the one generated when doing config via grunt) -- because I see no way of this happening on a clean setup.

webmst commented 8 years ago

Here is what you asked:

root@freenas:/usr/local/OS.js/doc # grunt config:get:server
Running "config:get:server" (config) task
Path: server
Type: string
handlers

Done, without errors.

Execution Time (2016-02-12 21:47:04 UTC)
loading tasks       50ms  ââââ 8%
config:get:server  536ms  âââââââââââââââââââââââââââââââââââââââ 90%
Total 594ms

root@freenas:/usr/local/OS.js # cat src/conf/900-custom.json
{
  "repositories": [
    "default",
    "OS.js-extras",
    "OS.js-expermimental",
    "OS.js-submissions",
    "OS.js-extras"
  ],
  "handler": "mysql",
  "server": "handlers",
  "handlers": {
      "mysql": {
      "host": "localhost",
      "user": "osjsuser",
      "password": "osjspassword",
      "database": "osjs"
    }
  }
}

Please note that I've already performed the new config setup as suggested in the just-modified mysql-handler.md (together with a git pull).

andersevenrud commented 8 years ago

Your file is broken

"server": "handlers",

This was probablyu because of the typo I had, as which I corrected :( Sorry about that!

You should have something like.

{
  "handler": "mysql",
  "server": {
    "handlers": {
      "mysql": {
        "host": "localhost",
        "user": "osjs",
        "password": "osjs",
        "database": "osjs"
      }
    }
  }
}
andersevenrud commented 8 years ago

Please note that I've already performed the new config setup as suggested in the just-modified mysql-handler.md (together with a git pull).

That would not help if the 900 file has the error in it :)

webmst commented 8 years ago

Please note that I've already performed the new config setup as suggested in the just-modified mysql-handler.md (together with a git pull).

That would not help if the 900 file has the error in it :)

I know, I did it just to be sure there weren't any other modifications; your support can be effective only if we are in sync