You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 7, 2018. It is now read-only.
After my initial confusion about ruby version numbers (!) I managed to get dashing running. I am using dashing 1.3.1
vagrant@bigboard:/opt/bigboard/dashboard$ bundle show dashing
/var/lib/gems/1.9.1/gems/dashing-1.3.1
I am trying to get dashing to save its history to a file.
vagrant@bigboard:/opt/bigboard/dashboard$ cat config.ru
require 'dashing'
configure doset :auth_token, 'test'set :history_file, '/opt/dashboard_data/history.yml'
helpers do
def protected!# Put any authentication code you want in here.# This method is run before accessing any resource.
end
end
end
map Sinatra::Application.assets_prefix do
run Sinatra::Application.sprockets
end
run Sinatra::Application
Now let me clear the history file, just to be sure.
Running as a foreground app seems to save the history fine
(I ran curl -i -d '{"auth_token": "test", "current": 1}' http://33.33.33.60/widgets/Something in a different shell.)
vagrant@bigboard:/opt/bigboard/dashboard$ dashing start
Thin web server (v1.6.0 codename Greek Yogurt)
Maximum connections set to 1024
Listening on 0.0.0.0:3030, CTRL+C to stop
For the twitter widget to work, you need to put in your twitter API keys in the jobs/twitter.rb file.
33.33.33.1 - - [09/Oct/2013 09:31:43] "POST /widgets/Something HTTP/1.0" 204 - 0.0020
^CStopping ...
33.33.33.1 - - [09/Oct/2013 09:31:47] "GET /events HTTP/1.1" 200 - 28.2614
33.33.33.1 - - [09/Oct/2013 09:31:47] "GET /events HTTP/1.1" 200 - 28.2606
vagrant@bigboard:/opt/bigboard/dashboard$ cat /opt/dashboard_data/history.yml
---
buzzwords: !'data: {"items":[{"label":"Turn-key","value":4},{"label":"Paradigm shift","value":1},{"label":"Enterprise","value":3},{"label":"Leverage","value":2},{"label":"Exit strategy","value":1},{"label":"Web 2.0","value":2},{"label":"Pivoting","value":1},{"label":"Synergy","value":1}],"id":"buzzwords","updatedAt":1381311107}'
convergence: !'data: {"points":[{"x":16,"y":5},{"x":17,"y":48},{"x":18,"y":42},{"x":19,"y":20},{"x":20,"y":21},{"x":21,"y":24},{"x":22,"y":12},{"x":23,"y":9},{"x":24,"y":36},{"x":25,"y":46}],"id":"convergence","updatedAt":1381311107}'
valuation: !'data: {"current":35,"last":97,"id":"valuation","updatedAt":1381311107}'
karma: !'data: {"current":49616,"last":143060,"id":"karma","updatedAt":1381311107}'
synergy: !'data: {"value":41,"id":"synergy","updatedAt":1381311107}'
Something: !'data: {"current":1,"id":"Something","updatedAt":1381311103}'
As we can see, Something has been added.
But, if I run it as a daemon, I get no love :(
(Again running curl -i -d '{"auth_token": "test", "current": 2}' http://33.33.33.60/widgets/Something in a different shell.)
vagrant@bigboard:/opt/bigboard/dashboard$ echo""> /opt/dashboard_data/history.yml
vagrant@bigboard:/opt/bigboard/dashboard$ dashing start -d
vagrant@bigboard:/opt/bigboard/dashboard$ dashing stop
Sending QUIT signal to process 11231 ...
Waiting for 4 connection(s) to finish, can take up to 30 sec, CTRL+C to stop now
Timeout!
Sending KILL signal to process 11231 ...
vagrant@bigboard:/opt/bigboard/dashboard$ cat /opt/dashboard_data/history.yml
What could the issue be here? I really don't know much (anything) about ruby, bundle or sinatra.
Is running dashing as a daemon not recommended?
Does -d run as a different user and thus cause crazy permissions issues?
(Though even then it should work. I have my dashboard_data dir pretty much open to anything.
vagrant@bigboard:/opt/bigboard/dashboard$ ls -l /opt/dashboard_data/
total 4
-rwxrwxrwx 1 bigboard root 1 Oct 9 09:32 history.yml
vagrant@bigboard:/opt/bigboard/dashboard$ ls -l /opt | grep dashboard_data
drwxrwxrwx 2 bigboard root 4096 Oct 9 08:52 dashboard_data
vagrant@bigboard:/opt/bigboard/dashboard$
)
The text was updated successfully, but these errors were encountered:
If it helps, it seems that if I don't have any dashboards open in a browser, then it is able to shutdown properly.
vagrant@bigboard:/opt/bigboard/dashboard$ dashing start -d
vagrant@bigboard:/opt/bigboard/dashboard$ dashing stop
Sending QUIT signal to process 2155 ...
Exiting!
vagrant@bigboard:/opt/bigboard/dashboard$
But if I do have dashboards open, it can't shutdown.
vagrant@bigboard:/opt/bigboard/dashboard$ dashing start -d
vagrant@bigboard:/opt/bigboard/dashboard$ dashing stop
Sending QUIT signal to process 2188 ...
Waiting for 3 connection(s) to finish, can take up to 30 sec, CTRL+C to stop now
Timeout!
Sending KILL signal to process 2188 ...
vagrant@bigboard:/opt/bigboard/dashboard$
Actually, just doing some more testing, it looks like even if I get dashing to save its data on exit, it's pointless because dashing doesn't read from the history file on start up anyway.
At this point it looks like dashing doesn't support persistence of data. Is there a plan to add this feature later?
I think what might be best is for me to write my own little wrapper around it that accepts data, saves it to a file and then pushes it to dashing.
(And periodically it can send all data to dashing. Unfortunately this looks like I'll lose the updated_at values, but there is not much I can do at this point.)
After my initial confusion about ruby version numbers (!) I managed to get dashing running. I am using dashing 1.3.1
I am trying to get dashing to save its history to a file.
Now let me clear the history file, just to be sure.
Running as a foreground app seems to save the history fine
(I ran
curl -i -d '{"auth_token": "test", "current": 1}' http://33.33.33.60/widgets/Something
in a different shell.)As we can see,
Something
has been added.But, if I run it as a daemon, I get no love :(
(Again running
curl -i -d '{"auth_token": "test", "current": 2}' http://33.33.33.60/widgets/Something
in a different shell.)What could the issue be here? I really don't know much (anything) about ruby, bundle or sinatra.
Is running dashing as a daemon not recommended?
Does
-d
run as a different user and thus cause crazy permissions issues?(Though even then it should work. I have my
dashboard_data
dir pretty much open to anything.vagrant@bigboard:/opt/bigboard/dashboard$ ls -l /opt/dashboard_data/ total 4 -rwxrwxrwx 1 bigboard root 1 Oct 9 09:32 history.yml vagrant@bigboard:/opt/bigboard/dashboard$ ls -l /opt | grep dashboard_data drwxrwxrwx 2 bigboard root 4096 Oct 9 08:52 dashboard_data vagrant@bigboard:/opt/bigboard/dashboard$
)
The text was updated successfully, but these errors were encountered: