Last active
August 29, 2015 14:03
-
-
Save heridev/61b60889e2e2d9229f7b to your computer and use it in GitHub Desktop.
Rails application or Spree: Uploading images and the Sitemap into amazon AWS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# we want to upload into amazon only in production mode, in development mode we are using the public local folder | |
#config/initializers/spree.rb | |
if Rails.env.production? | |
Spree::Image.attachment_definitions[:attachment][:path] = 'spree/products/:id/:style/:basename.:extension' | |
Spree::Image.attachment_definitions[:attachment][:url] = 'spree/products/:id/:style/:basename.:extension' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
development: | |
VARIABLE_Y: 'heriberto.perez@crowdint.com' | |
VARIABLE_X: 'crowdint.com' | |
AWS_ACCESS_KEY_ID: youraccesskeyidgeneratedinaws | |
AWS_SECRET_ACCESS_KEY: yoursecretaccesskeygeneratedonamazon | |
FOG_PROVIDER: 'AWS' | |
FOG_DIRECTORY: 'yourbucketname' | |
production: | |
VARIABLE_Y: 'heriberto.perez@crowdint.com' | |
VARIABLE_X: 'crowdint.com' | |
AWS_ACCESS_KEY_ID: youraccesskeyidgeneratedinaws | |
AWS_SECRET_ACCESS_KEY: yoursecretaccesskeygeneratedonamazon | |
FOG_PROVIDER: 'AWS' | |
FOG_DIRECTORY: 'yourbucketname' | |
test: | |
VARIABLE_Y: '' | |
VARIABLE_X: '' | |
AWS_ACCESS_KEY_ID: '' | |
AWS_SECRET_ACCESS_KEY: '' | |
FOG_PROVIDER: 'AWS' | |
FOG_DIRECTORY: 'yourbucketname' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/laserlemon/figaro | |
# in our Gemfile | |
gem 'figaro' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rake sitemap:refresh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'spree_sitemap', github: 'jdutil/spree_sitemap' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config.paperclip_defaults = { | |
:storage => :fog, | |
:fog_credentials => { | |
aws_access_key_id: ENV['AWS_ACCESS_KEY_ID'], | |
aws_secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'], | |
provider: ENV['FOG_PROVIDER'] | |
}, | |
fog_directory: ENV['FOG_DIRECTORY'] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SitemapGenerator::Sitemap.default_host = "http://#{Spree::Config[:site_url]}" | |
## Store on S3 using Fog - Note must add fog to your Gemfile. | |
SitemapGenerator::Sitemap.adapter = SitemapGenerator::S3Adapter.new({ aws_access_key_id: ENV['AWS_ACCESS_KEY_ID'], | |
aws_secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'], | |
fog_provider: ENV['FOG_PROVIDER'], | |
fog_directory: ENV['FOG_DIRECTORY'] }) | |
## Inform the map cross-linking where to find the other maps. | |
SitemapGenerator::Sitemap.sitemaps_host = "http://#{ ENV['FOG_DIRECTORY'] }.s3.amazonaws.com/" | |
SitemapGenerator::Sitemap.add_links do | |
add_login | |
add_signup | |
add_account | |
add_password_reset | |
add_taxons | |
add_products | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Spree.config do |config| | |
config.site_name = 'Ecommerce consultancy' | |
config.site_url = ENV['SITE_URL'] || 'crowdint.com' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# in our Gemfile | |
gem "paperclip" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/fog/fog | |
# in our Gemfile | |
gem 'fog', '~> 1.22.0' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment