stalker beanstalkd, error with rails log file when loading rails env - ruby-on-rails-3

config/workers.rb
require File.expand_path("../config/environment", __FILE__)
when I run stalk ./config/workers.rb I get the following (notorious) error:
log/development.log
Rails Error: Unable to access log
file. Please ensure that exists and
is chmod 0666. The log level has been
raised to WARN and the output directed
to STDERR until the problem is fixed.
Notice that it cites the log file on top and inside the error message it does not cite the path... can someone explain this to me please? I'm ready to rip some hair out...
Thanks!
Just to make sure, here is my ls -la... there are no user issues cuz i'm running it from my user in mac...
-rw-rw-rw-# 1 ericman staff 0 Feb 10 19:11 development.log

in your environments/development.rb (and production.rb before deploying) write explicitly
config.logger = Logger.new(Rails.root.join("log","worker_#{Rails.env}.log"))

Related

Refused to execute script - Strict Mime type [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
Newbie to mediawiki, so apologies if this is a simple error.
I have a local working fine, but on my remote (addon domain, installed in the root of that) my mediawiki install keeps giving me the console error of:
Refused to execute script from
'http://host.co.uk/load.php?debug=false&lang=en&modules=notify%2Cutil%7Cmediawiki.legacy.wikibits&skin=vector&version=5e0d755bcceb'
because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
that's in google chrome. But in Firefox i'm getting:
SyntaxError: expected expression, got '<'
This error is on line 1 and points to <!DOCTYPE html>, I'm thinking because it's trying to load html, not JS?
When I initially actioned the install, I wasn't getting any css, I solved this issue setting the session.save_path to a writeable directory.
The page URL on going to the root of the site is different from local to remote. This is because my remote uses CGI which apparently breaks the short urls: see mediaWiki: $wgUsePathInfo
local: /index.php/Main_Page
remote: /index.php?title=Main_Page
I've considered the byte order issues for LocalSettings.php, by saving in vim and checking for a space or dot before <?php, but alas no solution.
My error is described here perfectly, but being on a dedicated VPS and looking at the markup, I'm confident there is no code for tracking or advertising being injected automatically - could there be another cause?
https://www.mediawiki.org/wiki/Manual:Errors_and_symptoms#Missing_edit_toolbar.2C_JavaScript_not_working
The errors do change when I switch from using suPHP as my handler. Changing to FCGI I'm able to get the firefox syntax error expected expression but got < in google chrome and some errors printed to the page of:
Warning: Unknown: open(/tmp/sess_cf912e9c546f88005f99ad715791fe84, O_RDWR) failed: Permission denied (13) in Unknown on line 0
Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0
I am confused as whilst the least errors come from suPHP, looking in php info it says my php api is CGI/FastCGI
I am using MediaWiki 1.26, php 5.5.3, Apache 2.2.31, CENTOS 6.7 x86_64 - any further details please just ask.
Your help would be greatly appreciated. Apologies if I've missed anything.
UPDATE
The url which is giving the console error:
/load.php?debug=true&lang=en&modules=j…notify%2Cutil%7Cmediawiki.legacy.wikibit‌​s&skin=vector&version=10de47153c1c
returns this javascript object:
mw.loader.state ({
"j…notify": "missing",
"util": "missing",
"mediawiki.legacy.wikibit‌​s": "missing"
})
UPDATE 2
To show any details that perhaps I'm missing I show a screen on the dev tools.
but also, on going to the concerned url again, it's now spitting out further information. I believe the information has changed because in my desperation I did composer install and reploaded the /vendor directory:
mw.loader.implement( "mediawiki.legacy.wikibits", [
"/resources/src/mediawiki.legacy/wikibits.js"
] );
mw.loader.state( {
"j…notify": "missing",
"util": "missing"
} );
UPDATE 3
UPDATE 4
Following along the advice from #TGR, I looked at the url in the network tab giving content type text/html. The part that confused me is that it doesn't match the url giving the error. However it does return 302. Looking at the same url on my local install returns:
mw.loader.implement( "jquery.accessKeyLabel", [
"/resources/src/jquery/jquery.accessKeyLabel.js"
], {}, {"brackets":"[$1]","word-separator":" "}
);
mw.loader.implement(
"jquery.client", [
"/resources/lib/jquery.client/jquery.client.js"
] );
mw.loader.implement( "mediawiki.RegExp", [
"/resources/src/mediawiki/mediawiki.RegExp.js"
] );
mw.loader.implement( "mediawiki.notify", [
"/resources/src/mediawiki/mediawiki.notify.js"
] );
mw.loader.implement( "mediawiki.util", [
"/resources/src/mediawiki/mediawiki.util.js"
] );
mw.loader.implement( "mediawiki.legacy.wikibits", [
"/resources/src/mediawiki.legacy/wikibits.js"
] );
I can also confirm that those files in the above code block are present on the problematic wiki.
UPDATE 5
I have just done a new install of the media wiki at a different subdomain. This time rather than FTP I have SSH into the server a ran wget https://releases.wikimedia.org/mediawiki/1.26/mediawiki-1.26.2.tar.gz and then tar xvzf mediawiki-1.26.2.tar.gz. This leaves me with folder 'mediawiki-1.26.2'. I then cd mediawiki-1.26.2 followed by mv * ../ so that the wiki will work from the root. The last thing to do before I can run the install, is to correct the permissions. chown -R user:group *
I then run the install which goes very smoothly. When I get to the homepage and inspect the developer console I get the same error. This is completely fresh, no .htaccess or .conf
UPDATE 6
I felt as though there was some longevity in exploring the install directory. So on my own VPS I followed the install above, again moving files to the Root. I didn't get the same error, but I did get
SyntaxError: expected expression, got '<'
I then installed again but I left it in the subfolder of the root. This has not given me any errors. I then tried this on the live remote that i've been having issues with. Even installed in the subfolder this gives me:
SyntaxError: expected expression, got '<'
If I introduce a .htaccess file to rewrite the base url, such as RewriteRule ^/*$ %{DOCUMENT_ROOT}/mw/index.php [L], then the issue with MIME type text/html returns. Yet adding the same rule on my other install is error free.

what could be stopping my BufferedLogger from writing out?

I've got a logger set up in my application using BufferedLogger. I'm able to write logs from my rspec tests and from my rake tasks, but for some reason when I log from my application nothing happens. It was working a week or so ago, but lately the file just won't update. I put a debugger on my main page and tried this:
(rdb:3) logger
#<ActiveSupport::BufferedLogger:0xa142b34 #level=0, #buffer={},
#auto_flushing=1, #guard=#<Mutex:0xa142a1c>,
#log=#<File:/mnt/hgfs/proj/log/development.log>>
(rdb:3) logger.debug "Hellooo??"
"Hellooo??\n"
(rdb:3) logger.error "Hellooo??"
"Hellooo??\n"
(rdb:3) logger.flush
[]
When I opened the file it was empty. I guessed that it was a file permissions issue but it looks fine:
-rwxrwxrwx 1 root root 0 2012-02-15 15:47 development.log*
I thought that it might be because I was using the itslog gem, so I removed that from my gemfile but that didn't do anything.
What should I check next?
No answers yet, so here's what fixed it: restarting the VM. Not sure what was going on that was stopping logging but apparently restarting the VM fixed it.

Rails 3 file create getting permission denied error, using XP

I'm working through Rails3inAction and cannot progress due to a permissions denied error.
The code is testing the processing of uploaded files through a separate files controller, relevant code is:
let(:asset) do
ticket.assets.create(:asset => File.open(path))
end
When I run rspec, the error I'm getting is:
FilesController users without access cannot access assets in this project
Failure/Error: ticket.assets.create(:asset => File.open(path))
Errno::EACCES:
Permission denied - C:/Documents and
Settings/tick/public/system/assets/1/original/speed.txt
I suspect this is to do with windows XP and would appreciate any help!!
Turns out to be a Rails problem, not a Permissions problem at all!

Debugging heroku 500 server error?

So this is what I get from looking at my production.logs from heroku:
Completed 200 OK in 63ms (Views: 6.0ms | ActiveRecord: 50.3ms)
Processing by EventsController#show as HTML
Parameters: {"id"=>"2"}
Rendered events/show.html.erb within layouts/application (3.7ms)
Completed 500 Internal Server Error in 15ms
Everything works locally and I have even pushed the database to heroku using db:push. Is there any more robust logging for heroku than the lines above that aren't helpful?
I'm sure its because you haven't ran rake db:migrate
If that does not work make sure that all the gems you need are in your Gem file, i.e. you are not making any local require statements to gems not in the Gemfile.
What I have found helpful is tailing the log.
And then you need to run this in console:
heroku logs --tail
Now click on the same page you were getting problems at before and check out the logs.
EDIT: on rails 4 you'll need to add the rails_12factor gem to get the detailed logs.
This isn't related to ruby but it might be good information for other googlers.
My issue not being able to see the actual error was that I was using a third party PHP tool that did this: # mysql_connect( ... ) which simply hides the error that that function didn't exist .. really evil code

heroku rake require 'rake/dsl_definition' fix not working + breaking local rake

I'm having the same heroku rake issues described (and from what I can tell solved) in this question.
When I try the fix (include require 'rake/dsl_definition' above require 'rake') I get the same
'uninitialized constant Rake::DSL'
error from heroku + I get the error
'no such file to load -- rake/dsl_definition'
from my local rake.
Without incorporating the fix (using the standard rakefile) I can use rake on my local setup with no errors (with the same heroku error)
I'm using rake version 0.8.7 (though I get the same results using 0.9.2) and Rails 3.0.9. I've gone through the suggestions in the previous question but from what I can tell the problem isn't with my Gemfile. Has anyone else had this problem? Has anyone else solved their heroku rake problem using a different solution? Or can anyone explain/suggest how I'm going about this incorrectly?
Thank you for your help.
Try adding require 'rake/dsl_definition' on top of Rakefile.
Not enough for me. I was getting the no such file to load -- rake/dsl_definition error even adding the require 'rake/dsl_definition' line in the "Rakefile" file
I had all gems version OK and only 0.8.7 rake version but I had to create a "Gemfile" in the redmine root path with the next content:
gem "rake", "0.8.7"
And delete the require 'rake/dsl_definition' line added previously in Rakefile
Hope be usefull for someone