Even though your Ruby application is deployed on Engine Yard, its development lifecycle is not over. New major, minor or patch level versions of Ruby are periodically released. These newer versions contain security updates, performance increases and other valuable improvements, so it is in your best interest to keep your application running on the latest version.
This page outlines how to migrate an application to a newer version of Ruby. For example, from Ruby 1.9.2 to Ruby 1.9.3, or a newer patch level of the same version such as from Ruby 2.0.0p.451 to Ruby 2.0.0p481.
This page assumes that you have a Ruby application running on Engine Yard Cloud.
You can do the migration yourself as outlined below, or you can ask Engine Yard Professional Services to do the migration for you.
Migrate to the latest Ruby
High-level steps for migrating to the latest Ruby version:
- Test your application locally.
- Run your application in a staging environment .
- Run your application in a production environment.
Test your Application Locally
To test your application locally:
- If you use unix or Mac OS X, update your local environment to the new version of Ruby. We recommend using RVM to manage multiple versions of Ruby on your development machine.
- If you use Windows, update your local environment to the new version of Ruby using the instructions on railsinstaller.org.
- Reinstall the gems required for application.
- Test the application in your local environment and make any necessary fixes.
Run your Application in a Staging Environment
To run your application in a staging environment:
- If you don’t already have a staging environment, clone your existing production environment to create a staging environment. (Custom chef recipes and cron jobs are not copied over in the clone environment. See step 3.) If your app supports a ‘staging’ Rails environment, set the ‘Rails/Rack Environment’ field to “staging” in the clone dialog.
- When the staging server is configured, do the following:
- Click “Edit Environment”.
- Select the new version of Ruby in the Runtime field.
- (Optional) Select a corresponding new version of RubyGems in the RubyGems field.
- Submit the changes.
- Click the Apply button.
- SSH into the instance.
- Restart nginx using the following command:
sudo /etc/init.d/nginx upgrade
Note: We recommend using upgrade instead of restart for /etc/init.d/nginx because it restarts nginx gracefully. It starts a new nginx to handle new requests while the old one finishes off old requests before the old nginx is terminated.
Run your Application in a Production Environment
To run your application in a production environment:
- Click Edit Environment on your production environment and select the new version of Ruby (and optionally RubyGems) as you did for staging. Submit the changes, and click the Apply button.
If you choose to create a new production environment. You will also have to modify your DNS service for your domain to point to a new IP address if you take this alternative method.
- Restart Nginx or Unicorn
- You can use the following ey command from your local to restart these processes for Passenger and Unicorn stacks: ey ssh --app-servers '/engineyard/bin/app_{appname} restart'
- Deploy your application.
- If you have any Ruby background processes such as Delayed Job or Resque, restart these to pick up the new Ruby version if your deploy hooks do not do it automatically.
Troubleshooting
Symptom | Solution |
---|---|
Bundle install and gem errors after upgrading an application to latest version of Ruby. This can be caused by gems not being updated. |
|
More information
For more information about... | See... |
---|---|
Cloning an environment | Clone an environment. |
Creating an environment | Create an environment. |
Deploying an application | Deploy your application. |
SSHing into an instance | Connect to your instance via SSH. |
If you have feedback or questions about this page, add a comment below. If you need help, submit a ticket with Engine Yard Support.
Comments
Article is closed for comments.