GithubHelp home page GithubHelp logo

gabrielcorado / spree_shared Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thelinuxlich/spree_shared

0.0 1.0 0.0 192 KB

Multi-tenancy for Spree using Apartment (per tenant databases)

License: BSD 3-Clause "New" or "Revised" License

Ruby 100.00%

spree_shared's Introduction

Spree Shared

Multiple stores using a single Spree application instance.

Uses request subdomain to swap database, view paths, Rails cache (preferences), mail settings, image paths and so much more.

Installation

  1. Tweak config/database.yml to use Postgresql, and dummy master database.

  2. Add the following line to host application.rb

    config.middleware.use 'Apartment::Elevators::Subdomain'
  1. Create an initializer config/apartment.rb with the following:
    Apartment.configure do |config|
      config.prepend_environment = false
      config.tenant_names = ['store1', 'store2']
    end
  1. Bootstrap sample stores
    bundle exec rake spree_shared:bootstrap['store1']
    bundle exec rake spree_shared:bootstrap['store2']
  1. Setup local subdomains for sample stores, as spree_shared uses by default subdomain routing you need to confirm some local domains such as:

store1.spree.dev store2.spree.dev

This can be done using Pow or editing your local /etc/hosts file.

  1. Set namespace for cache engine in development.rb and/or production.rb
    config.cache_store = :memory_store, { :namespace => lambda { ENV['RAILS_CACHE_ID'] } }

Testing

Be sure to add the rspec-rails gem to your Gemfile and then create a dummy test app for the specs to run against.

$ bundle exec rake test_app
$ bundle exec rspec spec

Copyright (c) 2011 [name of extension creator], released under the New BSD License

spree_shared's People

Contributors

thelinuxlich avatar bdq avatar lbrapid avatar gabrielcorado avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.