I'm trying to run the Rails app in AWS lambda (using lamby gem) via docker image.
I'm getting the following error.
Rails Error: Unable to access log file. Please ensure that /fi-service/log/development.log exists and is writable (ie, make it writable for user and group: chmod 0664 /fi-service/log/development.log). The log level has been raised to WARN and the output directed to STDERR until the problem is fixed.
I even added the following commands in the dockerfile (as suggested here)
RUN touch log/development.log
RUN chmod 0664 log/development.log
I suddenly got this error at my app which ran without problems for more than two years:
Rails Error: Unable to access log file. Please ensure that .../production.log exists...
WARN -- : Errno::EACCES: Permission denied # rb_sysopen .../log/newrelic_agent.log
The result of this error is that my mongoDB is killed. After I restarted the app everything works again until scheduled tasks are called which lead to that behaviour.
The error message says that i have to chmod to 0664, but this is still the case. For the deployment I use capistrano.
Any ideas?
Make log directory writable for other users:
chmod -R 777 specify_app_path_here/log
Now I know the reason for that strange behaviour: Hard Disk Failure !!!
Even both Disks were dead at the same time (RAID1) :(
Question basically says it all. When I try to access my calendar page (which contains events), I get the following error:
Permission denied - /Users/usernam/sitter/tmp/cache/assets/development/sass
(in /Users/username/sitter/app/assets/stylesheets/events.css.scss)
i've done a chmod 777 on all directories in my rails directory (i.e in myapp directory, i've done chmod 777 *).
Not sure what I should be doing instead or in addition.
Add a -R to your chmod. Simply adding the star will only do the files. Chmod -R 777 * should work. Although you may have some ownership issues that need to be addressed. I would look into using chown instead of granting all access to everyone.
I'm deploy my app with capistrano on centos (apache + passenger), when access my web I got `HTTP 500 (Internal Server Error)' and check error_log file , here's error look likes :
DAV/2 Phusion_Passenger/3.0.19 mod_ssl/2.2.24 OpenSSL/1.0.0-fips configured -- resuming normal operations
Rails Error: Unable to access log file. Please ensure that /home/admin/myaap/releases/20130506191509/log/production.log exists and is chmod 0666. The log level has been raised to WARN and the output directed to STDERR until the problem is fixed..
production.log permission
-rwxrwxr-x 1 root root 46211 May 6 20:49 production.log
and
ActionView::Template::Error (Permission denied - /home/admin/myaap/releases/20130506191509/tmp/cache/assets/D3B
directory D3B not found.
I am looking for a solution via google, one of which is sudo chown -R root:root /home/admin/myapp/ but not working for me, Is there any other way to fix it?
Note :
I'm using user root for deploy and installing rvm, and directory root location on user 'admin' (kloxo control panel)
UPDATE
On error_log file not found error about permission and unable to access, I'm using chmod go-w /home/admin/myapp and chmod 0666 production.log , but my web still 500 server error, How do I check error?
As Rails is suggesting in the error log, you should change permissions for the log file to 066:
chmod 0666 production.log
You are using root to deploy, but the web server is using another user name.
You need to make your apache user the owner of your app like:
sudo chown -R apacheuser:apacheuser /home/admin/myapp/
I've always had success with the the log file permissions as 644. When this has happened to me, more than once I might add, it has always been answered by the question linked below. Since this is the first answer in Google for the query I use, I'm linking to the answer that I really want.
Rails: Unable to access log file
I just deployed a Rails 3 app with Ruby 1.9.2. I have been getting several errors.
application.css wasn't compiled. so I set pre compilation in production.rb to false;
Then I got: cannot generate tempfile, so I did rake tmp:clear;
And now I get ActionView::Template::Error (Permission denied - /srv/www/appname/tmp/cache/assets): and I haven't been able to fix this one.
Please help.
If the user:group running your web server is http:http and it's running on *nix, do this:
sudo chown -R http:http /srv/www/appname/
Also, silly question, but does /tmp/cache/assets exist?
And, if so, as #leonel points out, you may also need to change the permissions:
chmod 777 /srv/www/appname/tmp/cache
Be careful setting 777 permissions on anything. Only do this to verify a permissions issue, then reset to the most minimal permissions necessary.
Most likely you're running your app under apache passenger.
You have to change the owner of config/environment.rb to somebody who has permissions to your app's folder.
chown -R www-data:www-data /path/to/app
Make the tmp folder of your project writable:
chown -R group:user /path/to/rails/app/tmp
chmod -R 777 /path/to/rails/app/tmp
In your console, run rake tmp:cache:clear
Restart your application.
You probably didn't create your Rails application with the user running the server now. Can you paste the output of ls -alh /srv/www/appname/tmp/cache/assets and tell us the user running the webserver ?
Now for those of us that are using windows
- If you are an administrator and see this error
ActionView::Template::Error (Permission denied # utime_failed) C:/User/..../tmp/cache/assets/sprochets/v3.0/E5/E5PZx-mq8.cache
Then it is Permission and Ownership setting issue on Windows.
You can go to the tmp folder on your application and give yourself(User) permission to **Read, Write and Execute ** on the folder.
Click [here][1] to view how to give permissions.
Quick Fix. Open your terminal and run the following command as an administrator
takeown /f <location of your app tmp folder> /r /d y
Then Restart your server.
I encountered this error recently. Apache was not able to write to tmp directory
cannot generate tempfile
/tmp/RackRewindableInput2xxxxxxxxxxxxxxxxx'
/app-lib/lib/ruby/1.8/tempfile.rb:52:ininitialize'
app-dir/vendor/gems/rack-1.0.1/lib/rack/rewindable_input.rb:73:in new'
app-dir/vendor/gems/rack-1.0.1/lib/rack/rewindable_input.rb:73:inmake_rewindable'
app-dir/vendor/gems/rack-1.0.1/lib/rack/rewindable_input.rb:26:in read'
app-dir/vendor/gems/rack-1.0.1/lib/rack/request.rb:134:inPOST'
I checked permission of tmp directory and it had permission to all groups to write to it.
I changed owner of tmp directory and it didn't resolve the error either.
The culprit was tmp directory was filled with too many large files, and looks like somehow apache didn't had enough space to write this new file.
Cleared all temp and old files. It sorted out the issue.
We need to grant permissions to access the required directory for the system root user
sudo chmod 777 -R your_project_directory_to_be_access
In your case you can use:
sudo chmod 777 -R /srv/www/appname/tmp/
For security reasons, just keep in your mind:
chmod 777 gives everybody read, write and execute rights which for most problems is definitively too much.
I think a better solution without giving everyone manage rights to tmp folder is like that:
sudo rake tmp:cache:clear
This will clear the temp folder and when you run rails server again it won't give error.
In my localhost it gave this error, and the command chmod 777 C:/Sites/project_name/tmp/cache/ solved my problem.
Most probably you gave permission to your app's main folder read and execute mode. However, in order to generate new files from your app, you also need to give write permission for required folder. For example: yUML uses tmp folder for generating files. I gave tmp folder write permission:
chmod -R 777 /usr/share/nginx/html/yuml_product/tmp
solved my problem.