Skip to main content

Mach-II in Shared Hosting Environments

It was bound to happen sooner or later--my next side project with Mach-II is going to live in a shared hosting environment, so I decided to do some preliminary work getting things up and running before the project really gets rolling. Up until this point I've been doing Mach-II work for i2 on dedicated servers, so I haven't had to worry about how CFMX finds the CFCs.


 


I personally felt that my hosting account with HostMySite was a little limiting (no ability to create my own mappings, for example, although they're happy to do it for you), so since my account with them was coming up for renewal anyway, I decided to try CrystalTech since I'd heard so many other CF developers say they were happy with them.


Please note that I'm a big fan of HostMySite in general--they have great tech support and I will continue to heartily recommend them to clients; I personally just wanted to try something different and liked the idea that CrystalTech let me set up my own mappings at will, and I also get more database space and have both SQL Server and MySQL databases for less money.


Just one quick complaint about CrystalTech: when I called in with some general problems with CFCs and my mappings working initially, I got a .NET developer on the phone with an extremely large .CHIP on his .SHOULDER. Some actual quotes from this guy:




  • "Sir, I'm a .NET developer. I'm not a newbie programmer so I know what I'm talking about."


  • "ColdFusion doesn't start looking for objects in your docroot, it starts at the System32 directory. I know because I'm a .NET developer."



  • Nevermind the fact that A) I wasn't calling about .NET, and B) that second statement isn't even TRUE in .NET (at least not in my experience on the two .NET projects I've done); my main issue with this guy is that he's supposed to answer my questions, not tell me how he's so much smarter than I am. Minor complaint but if you're on CrystalTech and get this guy on the phone, hang up and call back later. Extremely rude, extremely unhelpful, and just an out-and-out .JERK.


    Back to the topic at hand: Since the server I got put on at CrystalTech already had the mapping "MachII" taken, I had to set up a different mapping, which means you also have to alter all the Mach-II core framework files to reflect this mapping. This isn't anything a global search-and-replace can't handle, and once I got my bearings and had my mapping set up, I had Mach-II running fine with a different mapping.


    After taking an initial stab at this, since I recalled that MVCF used a variable as a prefix to all the CFC locations, I thought maybe I could save *some* of the work by setting up a variable for my mapping and using that variable where possible in the Mach-II core files. I say "where possible" because of course the type parameter in cfargument won't accept a variable, and neither will extends in your cfcomponent tag, so basically all that using a variable really gains you is a dynamic setting for your CreateObject methods and a few other minor things. After trying this approach I decided consistency was probably a better idea so I reverted back to using my mapping name in place of "MachII." in the core framework files.


    The only other thing I noticed that I had to do was set the MACHII_APP_KEY variable in my mach-ii.cfm file to the name of my mapping as opposed to letting it do GetFileFromPath(ExpandPath(".")). Again, this isn't a big deal, but since I've been on dedicated servers to this point I'm a little unclear as to exactly what the MACHII_APP_KEY variable does.


    I posted a message to the Mach-II forum on fusebox.org to get some other thoughts on this situation in general. Since building Mach-II apps on shared servers is probably something I'll be doing a lot of in the future I just want to make sure I'm doing it in the best way possible.


    The bottom line is getting Mach-II up and running in a shared hosting environment didn't take much time at all, and at least from what I can tell thus far, is working great. As I figure out more and more about using Mach-II in shared environments I'll be sure and pass along any tips, tricks, and "gotchas" I happen to experience.

    Comments

    Summer S Wilson said…
    Thanks for this post, it just saved me from a lot of headaches! Doing my first Mach-II install in a hosted environment and was getting all kinds of funky errors because someone else already had the MachII path. Followed your advice and its working like a charm :-)

    Popular posts from this blog

    Installing and Configuring NextPVR as a Replacement for Windows Media Center

    If you follow me on Google+ you'll know I had a recent rant about Windows Media Center, which after running fine for about a year suddenly decided as of January 29 it was done downloading the program guide and by extension was therefore done recording any TV shows.

    I'll spare you more ranting and simply say that none of the suggestions I got (which I appreciate!) worked, and rather than spending more time figuring out why, I decided to try something different.

    NextPVR is an awesome free (as in beer, not as in freedom unfortunately ...) PVR application for Windows that with a little bit of tweaking handily replaced Windows Media Center. It can even download guide data, which is apparently something WMC no longer feels like doing.

    Background I wound up going down this road in a rather circuitous way. My initial goal for the weekend project was to get Raspbmc running on one of my Raspberry Pis. The latest version of XBMC has PVR functionality so I was anxious to try that out as a …

    Setting Up Django On a Raspberry Pi

    This past weekend I finally got a chance to set up one of my two Raspberry Pis to use as a Django server so I thought I'd share the steps I went through both to save someone else attempting to do this some time as well as get any feedback in case there are different/better ways to do any of this.

    I'm running this from my house (URL forthcoming once I get the real Django app finalized and put on the Raspberry Pi) using dyndns.org. I don't cover that aspect of things in this post but I'm happy to write that up as well if people are interested.

    General Comments and Assumptions

    Using latest Raspbian “wheezy” distro as of 1/19/2013 (http://www.raspberrypi.org/downloads)We’lll be using Nginx (http://nginx.org) as the web server/proxy and Gunicorn (http://gunicorn.org) as the WSGI serverI used http://www.apreche.net/complete-single-server-django-stack-tutorial/ heavily as I was creating this, so many thanks to the author of that tutorial. If you’re looking for more details on …

    The Definitive Guide to CouchDB Authentication and Security

    With a bold title like that I suppose I should clarify a bit. I finally got frustrated enough with all the disparate and seemingly incomplete information on this topic to want to gather everything I know about this topic into a single place, both so I have it for my own reference but also in the hopes that it will help others.Since CouchDB is just an HTTP resource and can be secured at that level along the same lines as you'd secure any HTTP resource, I should also point out that I will not be covering things like putting a proxy in front of CouchDB, using SSL with CouchDB, or anything along those lines. This post is strictly limited to how authentication and security work within CouchDB itself.CouchDB security is powerful and granular but frankly it's also a bit quirky and counterintuitive. What I'm outlining here is my understanding of all of this after taking several runs at it, reading everything I could find on the Internet (yes, the whole Internet!), and a great deal…