This page describes the action-required update of May 18th, 2011. (This is not a complete listing of updates in May.)
Important! If you are currently using keep files or custom recipes, you need to take action before upgrading in order to keep everything working. See “What do I have to do?" below.
What’s changed?
General Changes
- Ruby 1.8.6 upgraded to p420Cloud
- “reconnect:true” added to database.yml
- Passenger 3 Beta environments upgraded to 3.0.7
- Added systat, lsof, and strace cookbooks
- All environments except Passenger 2 are being updated to nginx 0.8.54
Nginx Configuration Changes
- Removed most “if statements” in accordance with nginx best practices
- Improved documentation in the configuration files
- Deprecated usage:
/etc/nginx/servers/#{application}.rewrites
both are replaced by:
/etc/nginx/servers/#{application}/custom.locations.conf/etc/nginx/servers/#{application}/custom.conf
- Added new file for SSL-based connection customizations:
/etc/nginx/servers/#{application}/custom.ssl.conf
- All non-proxy code was removed from
/etc/nginx/common/proxy.conf
. Similar configuration is made available in/etc/nginx/servers/#{application}.conf
- All environments upgraded to nginx 0.8.54 have the following changes:
- Removed modules from nginx:
- Upstream Fair Module. A module for attempting to run nginx into a load balancer.
- Upstream Request Hash Module. A module that attempts to solve the load balancing problem from a different angle.
- Upstream Memcached Hash Module. A module that implements memcached_hash directive for upstream blocks.
- Max HTTP Connections Module. A module that limited maximum connections to each upstream process in the upstream block.
- Modified modules in nginx:
- Nginx Upload Module. Updated to v2.2.0.
- Nginx Headers More Module. Updated to v0.14rc1.
- Removed the patch “Post to static html” from nginx. Files are now posted to application.
- Removed modules from nginx:
What do I have to do?
This section lists the actions that you need to take to ensure smooth operation of your Ruby on Rails applications.
- Replace “false” with “off”
- Update keep files
- Update custom recipes
- (Optional) Refactor rewrite directives
Replace "false" with "off"
If you use keep files or custom recipes, then you need to do this. In nginx 0.7.x and above, “false” is not valid. Use “off” instead.
To update false to off
-
In all your keep files and custom recipes, replace “false” with “off”.
For example, write
proxy_redirect off;
do not write
proxy_redirect false;
Update keep files
If you use keep files, then you need to test your changes in a non-production environment. Don’t update your production environment until you have validated your customization in a test environment.
To test the update
- Do one of the following to create a test environment:
- Clone your production environment.
- Use your staging environment.
- Delete the keep files.
- Update the environment.
- Validate/customize behavior in the environment, recreating keep files as needed.
- Apply the update to your production environment by copying any new keep files and deleting obsolete keep files.
Update custom recipes
If you use custom recipes, then you need to test your changes in a non-production environment. Don’t update your production environment until you have validated the update in a test environment.
To test the update
- Do one of the following to create a test environment.
- Clone your production environment.
- Use your staging environment.
- Update the environment.
- Validate/customize the behavior of your custom recipes as needed using the engineyard gem to upload and apply them to your testing environment.
- Use the engineyard gem to update and apply your custom recipes to your production environment.
(Optional) Refactor rewrite directives
Now is a good time to refactor rewrite directives.
For example:
-
Slow (with embedded if’s):
if ($host != 'your_domain.com') {
rewrite ^/(.*)$ http://your_domain.com/$1 permanent;
}
if ($host ~* "www") {
rewrite ^(.*)$ http://www.domain.com;
break;
} -
Fast (with a new server block for all rewrites):
server {
listen 80 default;
server_name _;
rewrite ^ http://www.domain.com;
...other rewrites...
}
For help understanding if, see How if works and the nginx docs.
To refactor your rewrite directives:
- Review your rewrite directives.
- Using the Dashboard, make sure you have specified a domain name for all applications running in your environment.
- Refactor your rewrites into a default server block based on the above example.
- Test on a staging environment before deploying to production.
Note: Rewrite directives use PCRE for regular expressions.
Comments
Article is closed for comments.