Skip to content

Commit

Permalink
Enabled logging for daemon
Browse files Browse the repository at this point in the history
  • Loading branch information
petewarden committed Mar 7, 2011
1 parent 825a2ba commit 1ff16c8
Show file tree
Hide file tree
Showing 5 changed files with 195 additions and 32 deletions.
6 changes: 5 additions & 1 deletion geodict_daemon.rb
Expand Up @@ -21,7 +21,11 @@
require 'daemons'

pwd = Dir.pwd
Daemons.run_proc('geodict_server.rb', {:dir_mode => :normal, :dir => '/opt/pids/sinatra'}) do
Daemons.run_proc('geodict_server.rb', {
:dir_mode => :normal,
:dir => '/opt/pids/sinatra',
:log_output => true
}) do
Dir.chdir(pwd)
exec 'ruby geodict_server.rb'
end
19 changes: 10 additions & 9 deletions geodictapi.xcodeproj/petewarden.mode1v3
Expand Up @@ -270,7 +270,7 @@
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
<array>
<array>
<integer>6</integer>
<integer>5</integer>
<integer>0</integer>
</array>
</array>
Expand Down Expand Up @@ -315,31 +315,32 @@
<key>PBXProjectModuleGUID</key>
<string>1CE0B20306471E060097A5F4</string>
<key>PBXProjectModuleLabel</key>
<string>geodict_lib.rb</string>
<string>geodict_daemon.rb</string>
<key>PBXSplitModuleInNavigatorKey</key>
<dict>
<key>Split0</key>
<dict>
<key>PBXProjectModuleGUID</key>
<string>1CE0B20406471E060097A5F4</string>
<key>PBXProjectModuleLabel</key>
<string>geodict_lib.rb</string>
<string>geodict_daemon.rb</string>
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
<string>5929E1B91324B6CB00B81D2E</string>
<string>5929E1C51324C07000B81D2E</string>
<key>history</key>
<array>
<string>5929E12313244A2300B81D2E</string>
<string>5929E12813244AA100B81D2E</string>
<string>5929E1781324731F00B81D2E</string>
<string>5929E1A213249DD800B81D2E</string>
<string>5929E1A313249DD800B81D2E</string>
<string>5929E1A413249DD800B81D2E</string>
<string>5929E1A513249DD800B81D2E</string>
<string>5929E1AB1324B3B700B81D2E</string>
<string>5929E1AF1324B61C00B81D2E</string>
<string>5929E1B01324B61C00B81D2E</string>
<string>5929E1BB1324BF6300B81D2E</string>
<string>5929E1BC1324BF6300B81D2E</string>
<string>5929E1BD1324BF6300B81D2E</string>
<string>5929E1C31324C07000B81D2E</string>
<string>5929E1C41324C07000B81D2E</string>
</array>
</dict>
<key>SplitCount</key>
Expand Down Expand Up @@ -378,7 +379,7 @@
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
<string>5929E1BA1324B6CB00B81D2E</string>
<string>5929E1C61324C07000B81D2E</string>
<key>history</key>
<array>
<string>5929E12313244A2300B81D2E</string>
Expand Down
175 changes: 157 additions & 18 deletions geodictapi.xcodeproj/petewarden.pbxuser
Expand Up @@ -160,6 +160,18 @@
5929E1B81324B6A600B81D2E /* PBXTextBookmark */ = 5929E1B81324B6A600B81D2E /* PBXTextBookmark */;
5929E1B91324B6CB00B81D2E /* PBXTextBookmark */ = 5929E1B91324B6CB00B81D2E /* PBXTextBookmark */;
5929E1BA1324B6CB00B81D2E /* PBXTextBookmark */ = 5929E1BA1324B6CB00B81D2E /* PBXTextBookmark */;
5929E1BB1324BF6300B81D2E /* PBXTextBookmark */ = 5929E1BB1324BF6300B81D2E /* PBXTextBookmark */;
5929E1BC1324BF6300B81D2E /* PBXTextBookmark */ = 5929E1BC1324BF6300B81D2E /* PBXTextBookmark */;
5929E1BD1324BF6300B81D2E /* PBXTextBookmark */ = 5929E1BD1324BF6300B81D2E /* PBXTextBookmark */;
5929E1BE1324BF6300B81D2E /* PBXTextBookmark */ = 5929E1BE1324BF6300B81D2E /* PBXTextBookmark */;
5929E1BF1324BF6300B81D2E /* PBXTextBookmark */ = 5929E1BF1324BF6300B81D2E /* PBXTextBookmark */;
5929E1C01324BF6300B81D2E /* PBXTextBookmark */ = 5929E1C01324BF6300B81D2E /* PBXTextBookmark */;
5929E1C11324BF7F00B81D2E /* PBXTextBookmark */ = 5929E1C11324BF7F00B81D2E /* PBXTextBookmark */;
5929E1C21324BF7F00B81D2E /* PBXTextBookmark */ = 5929E1C21324BF7F00B81D2E /* PBXTextBookmark */;
5929E1C31324C07000B81D2E /* PBXTextBookmark */ = 5929E1C31324C07000B81D2E /* PBXTextBookmark */;
5929E1C41324C07000B81D2E /* PBXTextBookmark */ = 5929E1C41324C07000B81D2E /* PBXTextBookmark */;
5929E1C51324C07000B81D2E /* PBXTextBookmark */ = 5929E1C51324C07000B81D2E /* PBXTextBookmark */;
5929E1C61324C07000B81D2E /* PBXTextBookmark */ = 5929E1C61324C07000B81D2E /* PBXTextBookmark */;
};
sourceControlManager = 5929E10413243EA700B81D2E /* Source Control */;
userBuildSettings = {
Expand Down Expand Up @@ -195,9 +207,16 @@
};
5929E11213243ECB00B81D2E /* geodict_lib.rb */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1034, 10080}}";
sepNavIntBoundsRect = "{{0, 0}, {1034, 9315}}";
sepNavSelRange = "{15072, 0}";
sepNavVisRange = "{14586, 1403}";
sepNavVisRange = "{6587, 1791}";
};
};
5929E11613243ECB00B81D2E /* populate_database.rb */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {698, 3420}}";
sepNavSelRange = "{3477, 0}";
sepNavVisRange = "{2752, 1471}";
};
};
5929E11713243ECB00B81D2E /* readme.txt */ = {
Expand Down Expand Up @@ -674,9 +693,9 @@
};
5929E15B1324616E00B81D2E /* openheatmap.php */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {824, 2535}}";
sepNavSelRange = "{471, 0}";
sepNavVisRange = "{0, 2033}";
sepNavIntBoundsRect = "{{0, 0}, {824, 2580}}";
sepNavSelRange = "{955, 0}";
sepNavVisRange = "{0, 2049}";
};
};
5929E15E13246ABF00B81D2E /* PBXTextBookmark */ = {
Expand Down Expand Up @@ -744,7 +763,7 @@
fRef = 5929E15B1324616E00B81D2E /* openheatmap.php */;
name = "openheatmap.php: 14";
rLen = 0;
rLoc = 551;
rLoc = 555;
rType = 0;
vrLen = 2053;
vrLoc = 0;
Expand All @@ -764,7 +783,7 @@
fRef = 5929E15B1324616E00B81D2E /* openheatmap.php */;
name = "openheatmap.php: 170";
rLen = 0;
rLoc = 5008;
rLoc = 5024;
rType = 0;
vrLen = 1583;
vrLoc = 3663;
Expand All @@ -784,7 +803,7 @@
fRef = 5929E15B1324616E00B81D2E /* openheatmap.php */;
name = "openheatmap.php: 170";
rLen = 0;
rLoc = 5008;
rLoc = 5024;
rType = 0;
vrLen = 1583;
vrLoc = 3663;
Expand All @@ -804,7 +823,7 @@
fRef = 5929E15B1324616E00B81D2E /* openheatmap.php */;
name = "openheatmap.php: 170";
rLen = 0;
rLoc = 5008;
rLoc = 5024;
rType = 0;
vrLen = 1583;
vrLoc = 3663;
Expand All @@ -824,7 +843,7 @@
fRef = 5929E15B1324616E00B81D2E /* openheatmap.php */;
name = "openheatmap.php: 170";
rLen = 0;
rLoc = 5008;
rLoc = 5024;
rType = 0;
vrLen = 1583;
vrLoc = 3663;
Expand All @@ -844,15 +863,15 @@
fRef = 5929E15B1324616E00B81D2E /* openheatmap.php */;
name = "openheatmap.php: 60";
rLen = 0;
rLoc = 1974;
rLoc = 1990;
rType = 0;
vrLen = 2060;
vrLoc = 0;
};
5929E17713246D9400B81D2E /* jumbo.py */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {584, 2520}}";
sepNavSelRange = "{324, 0}";
sepNavSelRange = "{424, 0}";
sepNavVisRange = "{0, 1387}";
};
};
Expand Down Expand Up @@ -901,7 +920,7 @@
fRef = 5929E15B1324616E00B81D2E /* openheatmap.php */;
name = "openheatmap.php: 60";
rLen = 0;
rLoc = 1974;
rLoc = 1990;
rType = 0;
vrLen = 2060;
vrLoc = 0;
Expand All @@ -911,7 +930,7 @@
fRef = 5929E15B1324616E00B81D2E /* openheatmap.php */;
name = "openheatmap.php: 17";
rLen = 0;
rLoc = 656;
rLoc = 664;
rType = 0;
vrLen = 2071;
vrLoc = 0;
Expand All @@ -931,7 +950,7 @@
fRef = 5929E15B1324616E00B81D2E /* openheatmap.php */;
name = "openheatmap.php: 33";
rLen = 0;
rLoc = 1058;
rLoc = 1074;
rType = 0;
vrLen = 2071;
vrLoc = 0;
Expand Down Expand Up @@ -1268,9 +1287,9 @@
};
5929E1A11324993400B81D2E /* geodict_daemon.rb */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {663, 938}}";
sepNavSelRange = "{873, 0}";
sepNavVisRange = "{0, 1072}";
sepNavIntBoundsRect = "{{0, 0}, {600, 938}}";
sepNavSelRange = "{1044, 0}";
sepNavVisRange = "{0, 1105}";
};
};
5929E1A213249DD800B81D2E /* PBXTextBookmark */ = {
Expand Down Expand Up @@ -1523,4 +1542,124 @@
vrLen = 1280;
vrLoc = 0;
};
5929E1BB1324BF6300B81D2E /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 5929E11213243ECB00B81D2E /* geodict_lib.rb */;
name = "geodict_lib.rb: 506";
rLen = 0;
rLoc = 15072;
rType = 0;
vrLen = 1791;
vrLoc = 6587;
};
5929E1BC1324BF6300B81D2E /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 5929E11613243ECB00B81D2E /* populate_database.rb */;
name = "populate_database.rb: 148";
rLen = 0;
rLoc = 3477;
rType = 0;
vrLen = 1471;
vrLoc = 2752;
};
5929E1BD1324BF6300B81D2E /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 5929E17713246D9400B81D2E /* jumbo.py */;
name = "jumbo.py: 21";
rLen = 0;
rLoc = 424;
rType = 0;
vrLen = 1387;
vrLoc = 0;
};
5929E1BE1324BF6300B81D2E /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 5929E15B1324616E00B81D2E /* openheatmap.php */;
name = "openheatmap.php: 11";
rLen = 0;
rLoc = 471;
rType = 0;
vrLen = 2033;
vrLoc = 0;
};
5929E1BF1324BF6300B81D2E /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 5929E15B1324616E00B81D2E /* openheatmap.php */;
name = "openheatmap.php: 14";
rLen = 0;
rLoc = 555;
rType = 0;
vrLen = 2033;
vrLoc = 0;
};
5929E1C01324BF6300B81D2E /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 5929E11113243ECB00B81D2E /* geodict_config.rb */;
name = "geodict_config.rb: 24";
rLen = 0;
rLoc = 926;
rType = 0;
vrLen = 1280;
vrLoc = 0;
};
5929E1C11324BF7F00B81D2E /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 5929E15B1324616E00B81D2E /* openheatmap.php */;
name = "openheatmap.php: 18";
rLen = 0;
rLoc = 692;
rType = 0;
vrLen = 2049;
vrLoc = 0;
};
5929E1C21324BF7F00B81D2E /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 5929E11113243ECB00B81D2E /* geodict_config.rb */;
name = "geodict_config.rb: 24";
rLen = 0;
rLoc = 926;
rType = 0;
vrLen = 1280;
vrLoc = 0;
};
5929E1C31324C07000B81D2E /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 5929E15B1324616E00B81D2E /* openheatmap.php */;
name = "openheatmap.php: 29";
rLen = 0;
rLoc = 955;
rType = 0;
vrLen = 2049;
vrLoc = 0;
};
5929E1C41324C07000B81D2E /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 5929E1A11324993400B81D2E /* geodict_daemon.rb */;
name = "geodict_daemon.rb: 19";
rLen = 0;
rLoc = 873;
rType = 0;
vrLen = 1072;
vrLoc = 0;
};
5929E1C51324C07000B81D2E /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 5929E1A11324993400B81D2E /* geodict_daemon.rb */;
name = "geodict_daemon.rb: 27";
rLen = 0;
rLoc = 1044;
rType = 0;
vrLen = 1105;
vrLoc = 0;
};
5929E1C61324C07000B81D2E /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 5929E11113243ECB00B81D2E /* geodict_config.rb */;
name = "geodict_config.rb: 24";
rLen = 0;
rLoc = 926;
rType = 0;
vrLen = 1280;
vrLoc = 0;
};
}
19 changes: 19 additions & 0 deletions serversetup.txt
Expand Up @@ -36,6 +36,7 @@ sudo nano /etc/apache2/sites-enabled/geodictapi.com
</VirtualHost>
sudo cp /etc/apache2/mods-available/proxy.conf /etc/apache2/mods-enabled/proxy.conf
sudo cp /etc/apache2/mods-available/proxy.load /etc/apache2/mods-enabled/proxy.load
sudo cp /etc/apache2/mods-available/proxy_http.load /etc/apache2/mods-enabled/proxy_http.load
sudo apache2ctl graceful

cd ~/sources
Expand All @@ -47,3 +48,21 @@ cd geodictapi
sudo gem install bundler
sudo bundle install
./populate_database.rb

sudo nano /etc/init.d/geodict
#!/bin/bash
#
# See http://www.kalzumeus.com/2010/01/15/deploying-sinatra-on-ubuntu-in-which-i-employ-a-secretary/

sudo -u www-data ruby /home/ubuntu/sources/geodictapi/geodict_server.rb $1
RETVAL=$?

exit $RETVAL

sudo chmod +x /etc/init.d/geodict
sudo update-rc.d geodict defaults

sudo mkdir /opt/pids/
sudo mkdir /opt/pids/sinatra
sudo chown www-data /opt/pids/sinatra
sudo /etc/init.d/geodict start
8 changes: 4 additions & 4 deletions test_suite/openheatmap.php
Expand Up @@ -10,12 +10,12 @@
//define('YAHOO_PUBLIC_KEY', '');

// Local server
define('PLACEMAKER_URL', 'http://localhost:4567/v1/document');
define('YAHOO_PUBLIC_KEY', '');
//define('PLACEMAKER_URL', 'http://localhost:4567/v1/document');
//define('YAHOO_PUBLIC_KEY', '');

// Remote server
//define('BASE_URL', 'http://geodictapi.com/v1/document');
//define('APP_ID', '');
define('PLACEMAKER_URL', 'http://geodictapi.com/v1/document');
define('YAHOO_PUBLIC_KEY', '');

define('PLACEMAKER_MAX_STRING_LENGTH', 4900);

Expand Down

0 comments on commit 1ff16c8

Please sign in to comment.