Reputation: 1351
Ok so im really lost and not even too sure what to post here for information.
I am Brand new to multi tenancy, i have followed a tutorial on using the apartment gem. Everything is working perfectly on lvh.me:3000, however when I push the app to Heroku, it pushes up fine no errors, but when i attrmpt to go to my domain [email protected] it redirects me to the heroku home page???
Please help here.. Let me know what i need to post here for a possible solution.. I dont even know where this could be stemming from!
Thanks in advance for you patients!
EDIT #1
This is what my log just gave me from heroku:
Apartment::Tenant Not Found (One of the following schema(s) is invalid:
Upvotes: 0
Views: 396
Reputation: 1351
This was occuring for several reasons, At the end of the day it was resolved by using a DNS Manager that actually supports wildcard domains ie. Zerigo DNS. i was initially using cloudflare however they only support wildcard domains on the enterprise lvl account.
I also added:
def set_mailer_host
if Rails.env.development?
subdomain = current_account ? "#{current_account.subdomain}." : ""
ActionMailer::Base.default_url_options[:host] = "#{subdomain}lvh.me:3000"
else
subdomain = current_account ? "#{current_account.subdomain}." : ""
ActionMailer::Base.default_url_options[:host] = "#{subdomain}patrolvault.co"
end
end
to my application controller and preloaded the postgresql addon into my heroku addons before I pushed the app up.
adding rails_12factor also cleaned things up a bit.
Thanks to @Jayaprakash for his assistance in troubleshooting this and providing links to reference.
Upvotes: 1
Reputation: 1403
This error might occur when you don't have the tenant in your database. Try after creating it.
Similar issue in Github
Upvotes: 2