Whenever I run bundle install in my rails app, an empty folder is created in the app's root directory, which looks like this:
bundler20140929-26466-x86kd5
bundler20140929-30110-rbes8h
bundler20141010-54137-1g4prq1
UPDATE:
All of my other apps have to same problem, so it must be environment related. Also, I see RackMultipart upload files from carrierwave. Thinking this was related to a TMP variable not being set I tried adding this to development.rb:
ENV['TMPDIR'] = Rails.root.join('tmp')
ENV['TMP'] = Rails.root.join('tmp')
ENV['TEMP'] = Rails.root.join('tmp')
But the problem persists..
Any ideas about why might this be happening?
Related
I'm relatively new to Rails as well as using PassengerPhusion. I am running an Ubuntu server on Azure, and have the demo app that Passenger provides working fine. I've even changed the text on the homepage.
My question is this:
In my directory, the file directory's name for the app is passenger-ruby-rails-demo and while I am experimenting, i am changing the name of the directory to something like passenger-ruby-rails-demo-test and it returns an error message when viewing fleetpro.cloudapp.net.
I've tried looking through files trying to figure out how this is routed but haven't had any luck. Is there a file within the Rails installation that is telling Passenger to be inside the specific passenger-ruby-rails-demo directory? Pretty newbish question, but it is really bothering me!
I'm not sure about how the naming convention works in regards to the root directory name of your app "passenger-ruby-rails-demo", but I believe the name of that directory is important to running your Rails app, and might have to do something with the name of the module in your config/application.rb file which is named after your Rails app.
There is a solution though: use gem rename.
Add gem rename to your Gemfile and run bundle install.
Then in your app's root directory, run this:
rails g rename:app_to New-Name
This will basically "clone" the app with your new name. You may have to check to make sure all your config files are present afterwards, but from my experience using it, it was a quick breeze. You will most definitely have to push the new renamed app back to git or Azure.
EDIT
As an example I renamed a Rails app to show what you could expect from the output after running the command:
The Rails app's name isn't the problem, it's the PassengerAppRoot switch you'll be using:
PassengerAppRoot /path/to/your/app
Rails doesn't actually care which folder it's put into, so renaming Rails won't fix your problem.
Renaming Rails only changes the internal class references within your application (things like Rails.application.name which have very subtle implications for your app).
In your Azure server, you'll need to locate either your .htaccess / httpd.conf / nginx.conf file, and change the PassengerAppRoot to your new path. This should resolve the issue.
Im using mina to deploy my rails 4 app. When ever I mina deploy it clears out all the images that have been uploaded to my app. How do I stop this from happening? Thanks.
You need to ensure your uploaded assets end up in the shared directory, similar to the way your database.yml is done.
For example, our assets are all stored in public/system, so we have a line that looks like this:
set :shared_paths, %w[
files
log
private
public/system
tmp
]
Then, when you run invoke :'deploy:link_shared_paths' those directories will be linked to the root of your current directory, if they exist in the shared directory (you can create/populate them if they do not).
So, whenever I upload a file in dev mode in Rails with Carrierwave, I get these temporary RackMultipart* files right in the Rails root. Even though in config/carrierwave.rb I have the following setting:
CarrierWave.configure do |config|
config.cache_dir = 'tmp/uploads'
end
And no, I didn't change cache dir in the uploader. Worst of all, it seems like for every new file upload, it creates 2 identical (in content, but not in name) RackMultipart* files. Any idea how to fix this?
This is a problem with the sticky bit.
You must do :
chmod o+t /tmp
Then in rails console check the path with :
Dir::tmpdir
I'm generating a sitemap for my website and temporarily saving it to the tmp folder to be then uploaded to my Amazon AWS account. I'm using the sitemap generator and fog gems to help me. So far I have this...
# In sitemap.rb
# Set the host name for URL creation
SitemapGenerator::Sitemap.default_host = "http://mycoolapp.com/"
# pick a place safe to write the files
#SitemapGenerator::Sitemap.public_path = 'tmp/'
# store on S3 using Fog
SitemapGenerator::Sitemap.adapter = SitemapGenerator::S3Adapter.new
# inform the map cross-linking where to find the other maps
SitemapGenerator::Sitemap.sitemaps_host = "http://#{ENV['FOG_DIRECTORY']}.s3.amazonaws.com/"
# pick a namespace within your bucket to organize your maps
SitemapGenerator::Sitemap.sitemaps_path = '/'
SitemapGenerator::Sitemap.create do
# Put links creation logic here.
#
add '/home'
add '/about'
add '/contact'
end
Whenever I run heroku run rake sitemap:create I receive the following error...
In '/app/tmp/':
511
rake aborted!
Read-only file system - /sitemap.xml.gz
I'm really at a loss as to why it's not working. I even went as far as making sure the tmp folder is created by running Rails.root.join('tmp') as an initializer. Any help in solving this would be greatly appreciated.
Don't Write to Root of Filesystem
Rake is quite clear about the source of the error:
rake aborted!
Read-only file system - /sitemap.xml.gz
This is telling you that your rake task is attempting to write the file to the root of the filesystem.
If you aren't using a a stack with ephemeral filesystem support like Celadon Cedar, you need to ensure you're writing to #{RAILS_ROOT}/tmp rather than the root of the filesystem. I haven't tested this myself, but you may be able to fixing this issue simply by pointing sitemaps_path to a writable directory. For example:
SitemapGenerator::Sitemap.sitemaps_path = '/app/tmp'
If that doesn't work, you'll have to track down where your gem or rake task is defining the root directory as the location for writing the sitemap.xml.gz file.
So, I encountered the same problem trying to follow the fog instructions on both Heroku and for the sitemap_generator gem. I eventually switched to carrierwave and found it to be plug and play.
Check out the documentation here and let me know if you have questions as I just did this a couple months ago and likely have encountered any hurdles you may run in to.
when I run a command like rails generate model Address Rails creates the model file and the migration file inside the config folder. A lot of other things are broken too. E.g. I can't launch the server because the configuration file config.ru cannot be found.
What's wrong here and how can I fix this?
I guess some paths are set incorrectly. But I wonder how that could happen because I haven't touched anything since yesterday evening.
Thanks for any help...
Try this
# in your development.rb file write this
config.paths['db/migrate'] += 'db/migrate/'
then run
rails generate model Address