System.base_url will be ignored

Support Ticket

System.base_url will be ignored+status
System.base_url will be ignored+tag
 

System.base_url will be ignored+issues

I have one wagn installation. I have added additional rails enviroments because I wanted independent wikis on the same installtion. I works so far as I expected. Except of System.base_url seems to be ignored. I moved it from wagn.rb to xxx.rb enviroment definition file. But it will be ignored.

 

The System.base_url is not a really big issue. I ask my self whether a muti enviroment setup is generally a good idea? Which ohter important properties will also ignored. And at the end it would be nice to have System.base_url working :)

 

Will System.base_url only used in an enviroment thats name is production? In an other installation I use that default enviroment and System.base_url works like I have expected.

my wagn.rb:

#System.base_url = "http://localhost:3000/"

System.max_renders = 8

 

ExceptionNotifier.exception_recipients = ['webmaster@indarium.de']

ExceptionNotifier.sender_address       = '"Wiki Error" <mailto:webmaster@indarium.de>'

ExceptionNotifier.email_prefix         = "[Wiki]"

 

ActionMailer::Base.smtp_settings = {

  :address => "mail.goodfellow.info",

  :domain => "company.de",

  :port => 25,

  :authentication => :login,

  :enable_starttls_auto => true,

  :user_name => "YYYYYYYYYYYYYYY",

  :password => "XXXXXXXXXXXXXXXXX",

  :tls => true

}

one of the added envs:
# Settings specified here will take precedence over those in config/environment.rb

# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true

# Use a different logger for distributed setups
# config.logger = SyslogLogger.new

# Full error reports are disabled and caching is turned on
config.action_controller.consider_all_requests_local = false
config.action_controller.perform_caching             = true

config.log_level = :info

# Enable serving of images, stylesheets, and javascripts from an asset server
# config.action_controller.asset_host                  = "http://assets.example.com"

# Disable delivery errors if you bad email addresses should just be ignored
config.action_mailer.raise_delivery_errors = true
                                                      
ENV['RAILS_ASSET_ID']=""

System.base_url = "http://wiki.company.de/"

ExceptionNotifier.exception_recipients = ['webmaster@company.de']
ExceptionNotifier.sender_address       = '"company Wiki Error" <mailto:webmaster@company.de>'
ExceptionNotifier.email_prefix         = "[company Wiki]"


 

Sorry for the slow reply -- just getting back from vacation.

 

I've never tried to get System.base_url to work by putting it in environment files, but so long as the load order is correct, I would think it might be possible.  I do notice in the wagn.rb file posted above that though System.base_url is commented out at the top, it is set again at the bottom of the file. Could that be the problem?

 

More broadly, wagn does have a better tested solution for running multiple wagns from the same installation, but at present it will only work in postgres.  To set this up, you will need to create a separate postgres "schema" for each wagn, and to put a dummy wagn database in the public schema.  Then you populate the multihost_mappings table in the public schema to manage the various hosts and where they point.  If you're using apache, you can do all of this with a single virtual host.

 

We haven't documented this extensively because we are not yet sure we want to make a long-term commitment to supporting this approach, but the wagns hosted by grasscommons use this system, so it could certainly be considered robust at present.

 

With the approach you describe, I would be particularly worried about caching issues.  You might find that the cache cannot correctly distinguish between cards with the same name on different wagns.


my wagn.rg contains just one commented System.base_url definition. The second definition is in the env file.

 

My solution might have a cache problem. The mutihost approach is not documented in detail. That means I have to change to seperate installations per wiki. What a pity.

  --dermicha.....Fri Aug 05 14:59:36 -0700 2011


Are you using PostgreSQL? I might be willing to write up some quick docs if I know it will be used.

 

Looking more closely at the cache situation, I think you may be able to get your solution to work, because the cache is individualized based on the base_url. I would also set System.wagn_name separately for each env.

 

As for the base_url not working, my first step would be to print some logging info so that you can figure out when the base_url is getting set (and why it's not sticking). Could be a load order issue.

  --Ethan McCutchen.....Fri Aug 05 15:11:18 -0700 2011


Currently I use MySQL. But I would also use Postgres.

I will give wagn 1.7.0 and MySQL based on my multi-env approach a second chance.

 

I have now set log level to debug an could no hints about System.base_url.

Does that:

Cache read: localhost:3000/testSystem/131258517392ck/*star

Cache read: localhost:3000/testSystem/131258517392ck/*star+*read

Cache read: localhost:3000/testSystem/131258517392ck/search+*type

mean that System.base_url was not set? I didn't set it to localhost:3000.

  --dermicha.....Sun Aug 07 07:11:57 -0700 2011


you might try commenting out the base_url line in sample_wagn.rb, which is loaded for setting defaults.

  --Ethan McCutchen.....Sun Aug 07 10:37:44 -0700 2011


No. That does not have any effect.

I see a redirect basing on System.base_url only working when I use production enviroment. in any other enviroments (e.g. development or my own envs) System.base_url will be ignored. For me it looks like a hard dependency to rails production enviroment. Or there is an magic property that is set by rails in production env and had to be set manually in any other enviroments to activate redirection.

  --dermicha.....Wed Aug 10 13:59:36 -0700 2011