Why can't I write a sitemap to a temporary directory on the Heroku stack that has a read-only file system?

I create a sitemap for my site and temporarily save it in the tmp folder, which will then be uploaded to my Amazon AWS account. I am using a Sitemap generator and fog stones to help me. While I have it ...

# 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 get the following error ...

In '/app/tmp/':
511
rake aborted!
Read-only file system - /sitemap.xml.gz

I am really at a loss why it does not work. I even got to the point of creating a tmp folder by running Rails.root.join('tmp')as an initializer. Any help in resolving this would be greatly appreciated.

+4
source share
2

:

!
-/sitemap.xml.gz

, .

aa , Celadon Cedar, , #{RAILS_ROOT}/tmp, . , , sitemaps_path . :

SitemapGenerator::Sitemap.sitemaps_path = '/app/tmp'

, , gem rake sitemap.xml.gz.

+5

, , fog Heroku, sitemap_generator. carrierwave , .

, , , , .

+3

All Articles