Closed dkobashi closed 7 years ago
Hey DJ,
If you open developer tools in the the browser you're using, you should see a javascript error detailed what's going wrong. Likely it's a 404 on a config.json
file. Copying the config-example.json
to config.json
should be enough if you kept the api configurations at their defaults.
Thanks for your reply.
I copied config-example.json to config.json. but it still does not work.
The error is indeed 404 according to the development tools. The detail is below. The problem seems to be assicoatd with style.css, not config.json.
GET http://terrebonne.tamu.edu:9000/css/style.css [HTTP/1.1 404 Not Found 342ms] The resource from “http://terrebonne.tamu.edu:9000/css/style.css” was blocked due to MIME type mismatch (X-Content-Type-Options: nosniff).
Then when I tried to open the localhost, I got the following error on the page.
Error establishing a session with the API server.
Not sure what it means. Thanks,
DJ
Actually, there is no file called style.css under "css" directory on WebGnomeClient
Regarding the "Error establishing a session with the API server". Short of seeing the error response from /session request the client makes to the API server. I would guess that redis may not be running, the API uses redis to store sessions.
For the css file you could try running grunt build:lite
and it should just compile the less into css. Though grunt develop
should have taken care of that as well.
I am still getting "Connection Error. Error establishing a session with the API server". I checked if redis-server is up and apparently it is. I installed redis-server from source.
(webgnomeapi) [dj@terrebonne WebGnomeClient]$ ps -ef | grep redis-server dj 17945 13519 0 14:32 pts/4 00:00:00 redis-server *:6379
Redis-server output
[dj@terrebonne WebGnomeAPI]$ redis-server
18062:C 18 Apr 14:37:49.625 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
18062:M 18 Apr 14:37:49.626 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
18062:M 18 Apr 14:37:49.626 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted.
18062:M 18 Apr 14:37:49.626 # Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
.
_.-__ ''-._ _.-
.
. ''-. Redis 3.2.8 (00000000/0) 64 bit
.-.-```. ```\/ _.,_ ''-._ ( ' , .-` | `, ) Running in standalone mode |`-._`-...-` __...-.
-.|'` .-'| Port: 6379
| -._
. / .-' | PID: 18062
-._
-. `-./ .-' .-'
|`-.-._
-..-' .-'.-'|
| -._
-. .-'.-' | http://redis.io
`-. -._
-..-'.-' .-'
|-._
-._ -.__.-' _.-'_.-'| |
-.`-. .-'.-' |
-._
-._-.__.-'_.-' _.-'
-._ -.__.-' _.-'
-. .-'
`-.__.-'
18062:M 18 Apr 14:37:49.628 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. 18062:M 18 Apr 14:37:49.628 # Server started, Redis version 3.2.8 18062:M 18 Apr 14:37:49.628 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled. 18062:M 18 Apr 14:37:49.628 DB loaded from disk: 0.000 seconds 18062:M 18 Apr 14:37:49.628 The server is now ready to accept connections on port 6379
Looks like redis is happy. So most likely the client really not able to connect to the API server. What's the contents of the config files for the client config.json
and the config for the API server config-example.ini
? And are you running all of this on one machine?
Here is what I did.
cd OilLibraryAPI nohup pserve config.ini > oillibraryapi.log & cd .. cd WebGnomeAPI nohup pserve config.ini > webgnomeapi.log & cd ../ cd WebGnomeClient nohup grunt serve > webgnomeclient.log &
The above lines are stored in a .sh file (run-server.sh)
For the WebGnome client, I also did the following prior to typing "grunt serve"
npm install grunt develop
I also changed the port number to 9000 as 8080 is being used for ApatchTomcat/THREDDS.
Then I got the error I mentioned. Yes. redis-server should be working; otherwise, I would get internal server error.
I attached config file for WebGnomeAPI and WebGnomeAPi
By the way, I stored all files in raid storage, not home directory. I guess that does not cause any issues.
Many thanks for your help.
DJ@TAMU
Config.ini for WebGnomeAPI
[app:webgnome_api] use = egg:webgnome_api
pyramid.reload_templates = true pyramid.debug_authorization = false pyramid.debug_notfound = false pyramid.debug_routematch = false pyramid.debug_templates = true pyramid.default_locale_name = en
pyramid.includes = cornice pyramid_redis_sessions
cors_policy.origins = http://0.0.0.0:8080 http://hazweb2.orr.noaa.gov:7448 http://terrebonne.tamu.edu:8080 http://localhost:8080 http://localhost:7448
redis.sessions.secret = 12342C48 redis.sessions.timeout = 86400
redis.help.host = localhost redis.help.port = 6379
install_path = %(here)s model_data_dir = models locations_dir = %(here)s/location_files save_file_dir = %(here)s/save_files help_dir = help goods_url = gnome.orr.noaa.gov
goods_dir = models
max_upload_size = 100 1024 1024
[pipeline:main] pipeline = gzip webgnome_api
[server:main] use = egg:gevent-socketio#paster host = 0.0.0.0 port = 9899
[filter:gzip] use = egg:Paste#gzip compress_level = 6
[loggers] keys = root, webgnome_api, gnome
[handlers] keys = console, msgs_file, gnome_file, webgnome_api_file, email
[formatters] keys = generic
[logger_root] level = DEBUG handlers = console, msgs_file
[logger_webgnome_api] level = DEBUG handlers = webgnome_api_file qualname = webgnome_api
[logger_gnome] level = DEBUG handlers = gnome_file qualname = gnome
[handler_console] class = StreamHandler args = (sys.stderr,) level = NOTSET formatter = generic
[handler_msgs_file] class = handlers.RotatingFileHandler args = (r"%(here)s/messages.log", "a", 1000000, 3) level = NOTSET formatter = generic
[handler_webgnome_api_file] class = handlers.RotatingFileHandler args = (r"%(here)s/webgnome_api.log", "w", 1000000, 1) level = NOTSET formatter = generic
[handler_gnome_file] class = handlers.RotatingFileHandler args = (r"%(here)s/gnome.log", "w", 1000000, 1) level = NOTSET formatter = generic
[handler_email] class = handlers.SMTPHandler args = (('mta.nems.noaa.gov', 25), '"APPLICATION ALERT" webgnome@hazweb2', ['jasmine.sandhu@noaa.gov', 'Nathan.Wilkins@noaa.gov'], 'New Critical Event From [WebGnome]') level = ERROR formatter = generic
[formatter_generic]
class = pyramid_log.Formatter
format = %(asctime)s %(levelname)-5.5s %(request.session_hash|
Config.json for WebGnomeClient
{ "port": "9000", "api": "http://0.0.0.0:9899", "oil_api": "http://0.0.0.0:9898", "date_format": { "moment": "YYYY/M/D H:mm", "datetimepicker": "Y/n/j G:i", "datepicker": "Y/n/j" } }
In addition,
When I got the error window when I started WebGnomeClient, WebGnomeAPI gave the following log on display. Not sure if this is helpful.
172.16.48.196 - - [2017-04-19 17:48:23] "OPTIONS /session?7798156064709203 HTTP/1.1" 400 516 0.013470
The following are logs of WebGnomeAPi and WebGnomeClient. Nothing suspicious.
WebGnomeAPI (webgnomeapi) [dj@terrebonne WebGnomeAPI]$ pserve config.ini --reload Starting monitor for PID 27170. Starting server in PID 27170. serving on http://0.0.0.0:9899
WebGnomeClient (webgnomeapi) [dj@terrebonne WebGnomeClient]$ grunt serve Running "connect:keepalive" (connect) task Waiting forever... Started connect web server on http://localhost:9000
In the API config.ini, try adding an *
to the cor_policy.origins list.
Looking something like:
cors_policy.origins = *
That did the trick! Thanks.
However, when I tried to set up spill event manually, I could not load oil database. I think OilLibraryAPI is running (Access to the port 9898 shows {"Hello":"World, welcome to the Oil Library API!!"}). However, it keeps trying to load the database and nothing happens. So I had to kill the program.
Also, I wonder if there is any way to load current and wind data faster. I clipped both data (e.g. change the frequency of timestamp from 1 hour to 3 hour, extract only surface data etc.). Still it takes more than 10 min each to load surface current and wind. For an actual event (hypothetically), users don't wait for a half hour to 1 hour to run the model.... PyGnome runs much faster. I wonder if this is related to network (but we have gigabit network so the network speed should be decent).
This is very interesting, Would you mind opening another ticket on this? I think the oil library api needs the cors_policy adjusted as well.
Hi,
I am trying to make WebGnomeClient work and the page of the localhost turns out to be blank.
I installed WebGnomeAPI, OilLibrary, OilLibraryAPI and PyGnome first. When I typed "pserve --reload config-example.ini for WebGnomeAPI, I got "{"Counter":2,"Hello":"World"}". When I typed "pserve --reload config-example.ini for OilLibraryAPI, I got "{"Hello":"World, welcome to the Oil Library API!!"}". I think both APIs are working.
Then I downloaded WebGnomeClient and typed "npm install" to install grunt and other tools. Then I typed "grunt serve" and checked the localhost (port number has been changed to 8000 as I use 8080 for Apatch Tomcat/THREDDS) on my web browser, the page is blank. I am not necessarily familiar with npm and grunt so I may have done something wrong, but I don't know what I did wrong. Any input would be appreciated.
Thanks in advance.
DJ Kobashi