≡

wincent.dev

  • Products
  • Blog
  • Wiki
  • Issues
You are viewing an historical archive of past issues. Please report new issues to the appropriate project issue tracker on GitHub.
Home » Issues » Feature request #1205

Feature request #1205: Move Rails app to wincent.dev

Kind feature request
Product wincent.dev
When Created 2009-01-22T15:04:54Z, updated 2009-02-09T12:57:57Z
Status closed
Reporter Greg Hurrell
Tags no tags

Description

As mentioned in ticket #1200 (currently private at the time of writing), I'd like to change the URL for this Rails app to wincent.dev rather than the rails subdomain.

In order to do this will need to "pass through" some specific URLs of the old app. The working list I came up with in ticket #1200 is:

  • PayPal IPNs and Kagi RPS postbacks
  • the lost license codes form (currently at https://wincent.dev/a/support/registration/)
  • the old contact form (currently at https://wincent.dev/a/contact/mail/); in reality this already exists in the form of the new issue tracker
  • the download.php script
  • the "update address" form at https://wincent.dev/a/support/update-address/
  • the Install licensees area at https://wincent.dev/a/products/install/licensees/

See "Migration status" for a list of other possible candidates to be kept in mind.

I am thinking that the easiest way to do this will be to leave Apache in place server those old URLs exactly as it does now, but move nginx in front of it as a proxy. It would pass most things through to the Rails app, but the special URLs mentioned above would be forwarded through to Apache instead.

As the Rails app is expanded to incorporate the functionality of the old site, those special forwards would be gradually phased out until everything dynamic was handle by Rails. The only stuff to be still handled by Apache would be static pages; perhaps one day nginx could serve those too (although many of them are PHP, so it might not be totally straightforward).

Comments

  1. Greg Hurrell 2009-01-29T14:35:09Z

    Ok, I have a plan of action now.

    First step already initiated: updating the CNAME aliases in the wincent.dev zone that currently point to "wincent.dev" itself to be A records that reference the actual IP address instead. I'll be changing "wincent.dev" to point to another IP at a later time, but I want all the existing subdomains to continue with the current IP.

  2. Greg Hurrell 2009-01-29T15:09:11Z

    DNS changes completed.

  3. Greg Hurrell 2009-02-07T06:01:48Z

    Some nice things:

    • Anything currently hosted via HTTPS at wincent.dev won't need to be brought over (different IP address, everything will keep working just fine
    • Any access via the "rails" subdomain won't need special handling; only access via "wincent.dev"
    • Any access via HTTPS to "wincent.dev" won't need special handling; all old URLs there were served over HTTP anyway

    So basically we need to implement special forwarding if and only if access is over HTTP/port 80, and the host name is "wincent.dev".

    And really, everything we care about there is rooted under /a/, making for an easy check. Here's the full list of stuff in the public_html directory of wincent.dev right now:

    drwxr-xr-x 13 wincent.dev wincent.dev  4096 Mar 29  2008 a
    drwxr-xr-x  2 wincent.dev wincent.dev  4096 Jul 12  2006 contact
    -rwxr-xr-x  1 wincent.dev wincent.dev 12533 Jun  9  2008 download.php
    -rw-r--r--  1 wincent.dev wincent.dev   318 Nov 20  2004 favicon.ico
    drwxr-xr-x  2 wincent.dev wincent.dev  4096 Aug  7  2005 files
    drwxr-xr-x  2 wincent.dev wincent.dev  4096 Jan 19  2006 gfx
    -rw-r--r--  1 wincent.dev wincent.dev   178 Nov 20  2004 global.inc.php
    drwxr-xr-x  2 wincent.dev wincent.dev  4096 Mar 29  2008 gpl
    drwxr-xr-x  3 wincent.dev wincent.dev  4096 Sep 19  2007 images
    -rw-r--r--  1 wincent.dev wincent.dev   325 Nov 23  2004 index.php
    drwxr-xr-x  2 wincent.dev wincent.dev  4096 Apr  7  2007 lgpl
    drwxr-xr-x  3 wincent.dev wincent.dev  4096 Jan 10  2008 mirror
    -rw-r--r--  1 wincent.dev wincent.dev    23 Nov 20  2004 robots.txt
    drwxr-xr-x  9 wincent.dev wincent.dev  4096 Mar 15  2007 s
    drwxr-xr-x  4 wincent.dev wincent.dev  4096 Mar 23  2007 synergy
    drwxr-xr-x  2 wincent.dev wincent.dev  4096 Mar 30  2008 webmail
    -rw-r--r--  1 wincent.dev wincent.dev  2390 Jul 10  2007 wincent_colaiuta.pgp.txt
    drwxr-xr-x  2 wincent.dev wincent.dev  4096 Dec  8  2006 xml-schema
  4. Greg Hurrell 2009-02-08T04:02:16Z

    Ok, I've made some changes to the staging environment to see if this is going to work.

    Basically:

    +    root /path/to/wincent.dev/public_html;
    +
    +    location / {
    +      proxy_set_header X-Real-IP $remote_addr;
    +      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    +      proxy_set_header Host wincent.dev;
    +      proxy_max_temp_file_size 0;
    +
    +      if (-f $request_filename) {
    +        proxy_pass http://apache;
    +        break;
    +      }
    +      if (-d $request_filename) {
    +        proxy_pass http://apache;
    +        break;
    +      }
    +      rewrite ^/(.*) https://staging.example.com/$1 permanent;
    +    }

    So:

    • we only test on port 80.
    • if a matching file or directory exists under the Apache root for wincent.dev, proxy the request to Apache.
    • everything else is redirected to port 443.
    • port 443 handling remains unchanged (nginx proxies to mongrel).
  5. Greg Hurrell 2009-02-08T04:34:06Z

    Ok, I've made the same changes for the production environment and I've requested that an update be made to the DNS records.

    Note that root_url in Rails app will continue to be served by mongrel/Rails, because from inside the Rails app we're always talking over HTTPS and the proxying of / to Apache will only happen when we're accessing over HTTP.

    Once the DNS changes go live will need to update my app_config.yml so that outgoing emails use the shorter wincent.dev hostname instead of the rails subdomain.

  6. Greg Hurrell 2009-02-08T04:36:09Z

    Will also need to update my SSL certs once the changes go live (the rails subdomain IP is currently using the rails subdomain cert, but once wincent.dev starts as the front end of the app I'll need to swap in the wincent.dev cert).

    Will probably also want to set up the rails subdomain to listen on another IP so that I can have a valid cert for that as well (can only have one valid cert per IP).

  7. Greg Hurrell 2009-02-09T12:56:14Z

    Ok, the DNS changes have gone live. Notice published to front page in this article.

  8. Greg Hurrell 2009-02-09T12:57:53Z

    app_config.yml now updated too.

  9. Greg Hurrell 2009-02-09T12:57:57Z

    Status changed:

    • From: Open
    • To: Closed
Add a comment

Comments are now closed for this issue.

  • contact
  • legal

Menu

  • Blog
  • Wiki
  • Issues
  • Snippets