Cheap and Easy answer:
1) Point staging.domainname.com at your VPS.
2) Add in a virtual host for staging, pointing to the staging copy of the app.
3) Add in a staging environment setting. (Did you know you could define new
environments in Rails? Fun stuff!) I think this is as simple as copying production.rb to staging.rb and tweaking as necessary, plus updating database.yml.
4) In ActionController, add in code similar to the following
if (ENV["RAILS_ENV"] == "staging")
before_filter :verifies_admin
end
Where verifies_admin
can be anything you want. I suggest using HTTP basic authentication -- cheap and easy.
def verifies_admin
authenticate_or_request_with_http_basic do |username, password|
username == "foo" && password == "bar"
end
end
Note that this may bork your connection to that payment site if they are making inbound requests to you, although that is simple enough to fix (just turn off the before_filter for the appropriate controllers and/or actions.)
Better answer:
1) Buy a second VPS configured from the same image as your regular VPS, and/or configured from the same install-from-the-bare-metal script (I like Capistrano & Deprec for this).
2) Point staging.domainname.com at it.
3) Otherwise its the same as the other option.
Things to think about:
1) Should I have a staging database as well? Probably, especially if you're going to be testing schema changes.
2) Should I have some facility for moving data between the staging and production systems?
3) Can catastrophic failure of my staging application take down the main application? Best hope the answer is no.