Forgive me for tooting my own horn (and there is a practical side to this entry as well), but HelloMetro.com went live with 550 new installs of BlogCFC. The installs are all virtual for their 550 city sites. More info at the press release.
So how was this done? Most people don't know (maybe because I never documented it) that BlogCFC supports dynamic configuration as well as the more normal blog.ini.cfm file. So for example, to make one install of BlogCFC work for all 550 blogs, I simply added code like so to the Application.cfm file:
<cfset blogName = getCities.cityName>
<!--- custom --->
<cfset instance = structNew()>
<cfset instance.dsn = "Blog">
<cfset instance.owneremail="blog@hellometro.com">
<cfset instance.blogurl = "http://#cgi.server_name#/blog/index.cfm">
<cfset instance.blogtitle = "#blogName# Blog">
<cfset instance.blogdescription = "#blogname# Blog">
<cfset instance.blogDBType="MSSQL">
<cfset instance.locale="en_US">
<cfset instance.users = "">
<cfset instance.commentsFrom = "">
<cfset instance.mailServer = "">
<cfset instance.mailUsername = "">
<cfset instance.mailPassword = "">
<cfset instance.pingurls = "">
<cfset instance.offset = "0">
<cfset instance.allowtrackbacks = false>
<cfset instance.trackbackspamlist="phentermine,MORE STUFF DELETED">
<cfset instance.blogkeywords = "">
<cfset instance.ipblocklist = "67.180.242.3">
<cfset instance.maxentries = "10">
<cfset instance.usecaptcha = false>
The value, getCities, is a query containing the current city based on the host name. I got this from cfincluding custom code, but you could replace this with any other code as well.
I then changed the component creation to this:
<cfset application.blog = createObject("component","org.camden.blog.blog").init(blogName, instance)>
Notice how I pass the instance struct to the init method. Anyway, that was it. I did do other mods to support their "Anyone can blog" functionality, and yes, I know the layout is broken in Firefox (they are working on that).
Archived Comments
Ray,
This is VERY interesting... how scalable do you think it could actually be? If we wanted, say 10,000 instances, do you think the app would handle it? We are actually actively looking for something that does EXACTLY this.
I haven't done testing at that level, but my gut is that it should be doable. I can't promise it though. I can say if you want to do some testing, I'd be willing to help out.
someone needs to work on their layout holmes, there is a major problem, at least in firefox, with the content spanning too much left to right, and the right side gutter is being forced down.
anyway, congrats on the big install!!!
tw
Tony, yep, they are aware of the FF issues. Hopefully it will be corrected soon since I try to avoid the Devil's Browser.
cool, jussa makin' sho'
I really like the "anyone can blog" feature. any chance this will make it in a future update.
Not too sure. It required a few changes at a low level. I don't think I'd like it to be in core.
Now that is good to know - I've been fiddling around with the blog.ini.cfm and symbolic links to the same client folder, using the link name as the way to distinguish between blog instances in Application.cfm, as I did not want to touch too much of your code, or more than necessary.
i'm not sure if this is your problem or not, but...
the getCities query may not be handling which state the city is in. e.g. http://helloportland.com/Blog shows the same blog as http://helloportlandmaine.c...
Thanks. They reported it to me this morning. Working on it now.
I love those situations when your code is live with 500 customers and only then do you find a major bug... no pressure there, right Ray?
Ray, this is seems to be a really great application. Unfortunately, when I actually go to localize this on my site, this very function seems to porovoke some trouble. The ominous message "Could not find the ColdFusion Component org.camden.blog.blog" pops up and then cites line 35 of the client/application.cfm. The blog.cfc file is there but not according to CF. Any ideas?
how are your webroots setup, and do you have a mapping setup.
im SURE we can get this puppy runnin quickly... there are many of us who have done this many times... with some info, we can probably diagnose the problem.
tony
As rstafri says, you may want to add a mapping that points to where you put the org folder. OR, simply copy the org folder so that it is under your client folder.
sorry folks! I was really tired and a little cranky last night. I think I missed that sentence in the installation notes. Thanks Ray, this is amazing!
Glad you got it!
Ray!
BlogCFC uses an Application.cfm file????
I can't argue with success (500 installs), but the fact that you named it BlogCFC tells me that this was also an exercise in using components!
Come on. How tough would it be to make it use an Application.cfc instead?
Very simple. CFMX 6 support. BlueDragon support.
Hmmmm...
Much to learn I still have...
Presumably this is being initialised at application startup?
Is it possible to add new instances to an already running set of instances, or does it require that the blog application is restarted every time a new blog instance is added?
Peter, you only need to restart the blog if the current blog has had it's own instance data changed, like "Allow TB" from false to true. Basically it's the application scope that needs to reinit it's variables. If you added a new instance, and used a new application name, it wouldn't be cached, so it would load fresh.
Ah, thanks, I think I get it now.
I am in the process of doing this and found that i get the following error:
Imageroot is not a valid property
Any help on why im getting this error would be appreciated
Matt
This error will occur if blog.cfc doesn't recognize the imageroot value. Ensure you have the latest from http://blogcfc.riaforge.org