0
votes

I'm using sitemap_generator gem to auto-generate the sitemap. It's already configured, tested and it's worked locally, but when I'm in production on my Dokku container, trying to run dokku run tradfood rake -s sitemap:refresh, following lines appear :

City Load (0.7ms)  SELECT  "cities".* FROM "cities" ORDER BY "cities"."id" ASC LIMIT $1  [["LIMIT", 1000]]
Recipe Load (2.5ms)  SELECT  "recipes".* FROM "recipes" ORDER BY "recipes"."id" ASC LIMIT $1  [["LIMIT", 1000]]
City Load (8.1ms)  SELECT  "cities".* FROM "cities" WHERE "cities"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
City Load (1.3ms)  SELECT  "cities".* FROM "cities" WHERE "cities"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
City Load (0.3ms)  SELECT  "cities".* FROM "cities" WHERE "cities"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
City Load (0.2ms)  SELECT  "cities".* FROM "cities" WHERE "cities"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
City Load (0.2ms)  SELECT  "cities".* FROM "cities" WHERE "cities"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
City Load (0.3ms)  SELECT  "cities".* FROM "cities" WHERE "cities"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
City Load (0.2ms)  SELECT  "cities".* FROM "cities" WHERE "cities"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
City Load (0.2ms)  SELECT  "cities".* FROM "cities" WHERE "cities"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
City Load (0.2ms)  SELECT  "cities".* FROM "cities" WHERE "cities"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]

But nothing has been generated : when I run dokku run tradfood ls -all public, sitemap.xml stay to oct. 21.

My Dokku persistent storage still works with my image uploader on production (it record well new images, using carrierwave).

Here my sitemap.rb configuration :

# Set the host name for URL creation
SitemapGenerator::Sitemap.default_host = "https://tradfood.fr"

SitemapGenerator::Sitemap.create(:compress => false) do
  # Put links creation logic here.
  #
  # The root path '/' and sitemap index file are added automatically for you.
  # Links are added to the Sitemap in the order they are specified.
  #
  # Usage: add(path, options={})
  #        (default options are used if you don't specify)
  #
  # Defaults: :priority => 0.5, :changefreq => 'weekly',
  #           :lastmod => Time.now, :host => default_host
  #
  # Examples:
  #
  # Add '/articles'
  #
  #   add articles_path, :priority => 0.7, :changefreq => 'daily'
  #
  # Add all articles:
  #
  #   Article.find_each do |article|
  #     add article_path(article), :lastmod => article.updated_at
  #   end

  add '/a-propos', :changefreq => 'monthly'

  City.find_each do |city|
    add city_path(city.name.parameterize), :lastmod => city.updated_at, :changefreq => 'weekly', :priority => 0.8
  end

  Recipe.find_each do |recipe|
    add recipe_path(recipe.city.name.parameterize, recipe.name.parameterize), :lastmod => recipe.updated_at, :changefreq => 'daily'
  end

end
1

1 Answers

0
votes

That gist no longer exists. Mind using gist.github.com or pasting it in something native to stackoverflow instead?

I'm guessing:

  • You are not writing to persistent storage
  • You are not reading the file from persistent storage