DreamHost with REAL Studio Web Edition

Sample REAL Studio web app running on DreamHost: http://www.pharmacaidonline.com/WebAppTest.fcgi

Also refer to my earlier post, Deploying Web Apps with REAL Studio Web Edition.

DreamHost offers a free one week trial of their VPS offering, so I decided to give it a try. Their setup is a bit unique. First, you have to create an account and then add the regular hosting plan ($9/month) to it. This is a “shared hosting” account so don’t expect REAL Studio WE to work with it. Next you have to add a VPS to your account (clicked Enable VPS Service) in the VPS section of the control panel. It can take up to a day for your VPS to get added to your account. Once your VPS is set up, you need to move your domain to it, which you can do by clicking Manage Domains in the Domains section. This can take up to 6 hours for the DNS to propogate (it took almost exactly 6 hours for me). DreamHost gives you 1 week free to test out the VPS. Hopefully with these instructions you can get up and running quickly. Their VPS plans start at an addition $15/month depending on RAM that you require. It would be wise to do some serious load testing of your web app during the free week to see what you might need for RAM.

FYI: DreamHost using Debian 64-bit Linux, bu the 32-bit compatibility libraries must be installed because a simple Linux console app runs just fine.

Disable Web Site Management

In the control panel, you’ll want to disable DreamHost managed Web Server Configuration in the Server Configuration settings. This will let us edit httpd.conf directly and will prevent any changes done in the control panel from messing up our changes.

Create Admin User

Now you’ll want to create an admin user for your VPS. This is needed so that you can SSH into your account (with root access) and change the Apache configuration file. Once you’ve created your admin user, start Terminal (I’m using Mac OS X). Then type:

ssh adminuser@yourdomain.com

You’ll be prompted for you admin user password. After you login, you’ll be at the Linux command prompt.

Edit Apache Configuration

Now we need to edit the Apache configuration file (httpd.conf). First we’ll need to switch directories:

cd /usr/local/dh/apache2

Now you’ll want to open httpd.conf for editing:

sudo pico apache2-psXXXXX/etc/httpd.conf

Replace the X’s above with your VPS server numbers.

In the configuration file, you’ll need to make similar changes to what I described in my previous post regarding FastCGI. The big difference is that DreamHost is using a Virtual Host in Apache and it is also using both mod_fastcgi and mod_fcgid. The way FCGID is configured by default prevents FastCGI from working with REAL Studio web apps, but it is pretty easy to change.

Step 1. Add Handler

Find the section of the configuration file that says <IfModule mod_fastcgi.c>. Within this section, add the AddHandler command:

AddHandler fcgi-script .fcgi

Step 2. AllowOverride All

Find the section containing the Virtual Host information for your domain. It should be prefixed with a comment: ## yourdomain.com : dsid …

Find the line that starts with Options. After this line, add AllowOverride All.

Step 3. Disable some FCGID settings

In this same section, scroll down to the line AddHandler fcgid-script fcg fcgi fpl and comment it out by adding a ‘#’ in front.

Save the file (Control-O, then enter) and exit Pico (Control-X). You might want to restart Apache just to be safe:

sudo /etc/init.d/httpd2 restart apache2-psXXXXX

(Remember to replace the X’s with your server number.)

Step 4. Add htaccess file

Update (12/17/2010): I have no idea why this step is necessary, but without it I don’t get web apps to load, instead the browser tries to download them!

Create a new file called “.htaccess”. The “.” is important! In the file add these two lines:

Options ExecCGI
AddHandler fastcgi-script .fcgi

Save the file to the your web domain folder.

Now you can run your REAL Studio web apps by simply copying them into your domain folder (yourdomain.com).

15 Responses to “DreamHost with REAL Studio Web Edition”

  1. Thomas Tempelmann says:

    Doesn’t seem to be stable yet: The first time I opened the fcgi link just now, I got a 404 error. After that, further attempts brought to to the test page.

    Besides, could you please change the font display on this site? The small, light gray text is rather hard to read for my old eyes. Please increase its contrast.

  2. Paul says:

    I’ve noticed a few oddities while running web apps. I’m hoping these are just 1.0-related glitches.

    Thanks for the reminder about the article display. I updated the theme to the latest version and it must have reset some stuff. The font size and contrast should be much better now.

  3. Joseph says:

    This is great Paul! Thanks for taking the time to test this out and write it up. What kind of “oddities” are you experiencing?

    - Joseph

    • Paul says:

      Overall, nothing too serious.

      Oddities I’m experience include:
      * Sometimes the web app doesn’t start properly (as Thomas noted)
      * After being idle for a while, the web app can get really confused. The display gets all messed up. Refreshing the page often fixes this.
      * Slow starting of web app (this may be a DreamHost issue)

  4. bowerbird says:

    paul-

    thanks for writing this up! :+)

    i really appreciate it…

    -bowerbird

  5. Jeff says:

    These are pretty clear instructions… I thought I had followed them exactly… even re-checked 3 times. RealStudio web app still does not launch.

  6. Jordan says:

    Good Stuff Paul,

    From running the examples, can you tell us what your max memory usage was? Just want to get the idea for the cost, I believe DreamHost charges .15/10 MB memory or something like that.

    • Paul says:

      So far, memory usage has been insignificant (less than 50MB). CPU usage has been much higher (up to 10.0 load).

      Only the test app is available right now and it doesn’t really do anything that should use up memory.

      I have a couple other apps that will test out sessions and DB access so we’ll see what effect that has.

  7. Chris Tolley says:

    This is great Paul! Thanks for putting it together.

    Your instructions are very clear but for some reason I’m still having some problems. I think I must be missing something along the way.

    I’ve done all of the above (on a Dreamhost VPS), changed my .htaccess file and made sure the permissions for the .fcgi file and the lib folder are group executional.

    When I direct my browser to the file it gives a ’500 Internal Server Error’. My log shows the server is timing out.

    Has anyone come across something similar? And does anyone have an idea what I might be missing here.

    Thanks in advance for any suggestions.

  8. Paul says:

    Everyone, please note the new “Step 4″ I just added. Apparently you also need to have an htaccess file in the directory…

  9. bowerbird says:

    paul, any more reports after using up your free week?

    did you go ahead and keep the vps?

    if not, and you still want to experiment, i will order vps
    and let you continue your research under my account…

    -bowerbird

    • Paul says:

      I’ll have more updates next week. I did end up dropping DreamHost, although it worked fine with Web Edition. I still think it’s a good choice due to it’s simplified control panel, though.

      I have also gotten Web Edition to work on another VPS host (VPSLatch) using CentOS, but that was a pain as I actually had to download source for FastCGI and compile it myself. I don’t think I would choose CentOS again.

      Frankly, I’m not yet convinced that I want to deal with Linux server administration, but I’m still investigating some other VPS hosts. The low monthly costs are enticing. HostRail has a great discount right now (65% off, code DEC10CAN). I can get a well-equipped server for under $15 a month, which is a great deal. I love deals!

      I’m also seriously considering going with a Mac-based server solution since I’m much more comfortable with Mac OS X.

  10. Highwinder says:

    Paul,

    Thank you tremendously for actually writing up a review and example for the new Web Edition. Finding anything other than the product marketspeak is still rather difficult.

    Question: I notice that you are trying to run in FastCGI. I was told that you can also save to HTML instead of FCGI, and thus avoiding going through all the FCGI hassles if one so desires.

    Have you tried this yet? It seems to me that, if available, saving otu to HTML isntead of FCGI might be more stable in this early stage of RS Web Edition.

    Thanks again, looking forward to your response. :-)

  11. Highwinder says:

    Another question:

    When using a compiled FCGI app instead of HTML, wouldn’t this ensuire that web crawlers would not be able to add your web site to search engines because the content is not searchable?

  12. paul says:

    @Highwinder:

    You cannot save REAL Studio web apps as HTML. You can save them as “Stand-alone” apps that do not require FastCGI. These apps include their own web server and are accessed via a specific port. Stand-alone web apps are easier to deploy, but probably not easier for the user (because of the port) and likely won’t perform as well.

    I’m not SEO expert. From what I understand, as long as Google can navigate the site, it can index it. The content is searchable once the web app renders out the HTML for display in the browser. But REAL Studio is for making web apps, not web sites. If you’re looking for searchability from Google, perhaps RSWE is not the best choice.