| Models | Examples |
|---|---|
| Display ads | Yahoo! |
| Search ads |
In the seemlingly endless search for the actual correct and easy way to deploy a Rails app, we have tried several ways. We tried out using Apache2 and running a cluster of Thin servers. With the built in threading of Puma we decided to use it with Nginx.
- Create new server
- Login to new server
- ssh root@IPaddress (you can also use the domain name if you have the DNS setup already)
- accept the RSA key
Below are the actual files we use in one of our latest production applications at Agora Games to achieve zero downtime deploys with unicorn. You've probably already read the GitHub blog post on Unicorn and would like to try zero downtime deploys for your application. I hope these files and notes help. I am happy to update these files or these notes if there are comments/questions. YMMV (of course).
Other application notes:
- Our application uses MongoDB, so we don't have database migrations to worry about as with MySQL or postgresql. That does not mean that we won't have to worry about issues with the database with indexes being built in MongoDB or what have you.
- We use capistrano for deployment.
Salient points for each file:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class AddHstoreExtension < ActiveRecord::Migration | |
| def up | |
| execute 'CREATE EXTENSION hstore' | |
| end | |
| def down | |
| execute 'DROP EXTENSION hstore' | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Download all VMWare Fusion machines from Modern.IE Website to test your Website/Web Application in Microsoft Internet Explorer on Mac OSX. All VM's and other VM's for Windows and Linux and other Virtual Manager's such as VirtualBox can be found at http://modern.ie/ | |
| # Don't have cURL or want to learn more, visit http://curl.haxx.se/.. are you really a Developer? First part of that sentence comes from the MS site. | |
| read -p "--> Downloading Internet Explorer 6-10 on Windows XP/7/8 Appliances for VMWare Fusion. Large downloads ahead. (Press Enter to continue)." | |
| echo "--> Download Internet Explorer 6 on Microsoft Windows XP Appliance for VMWare Fusion." | |
| curl --progress-bar -O "http://virtualization.modern.ie/vhd/IEKitV1_Final/VMWare_Fusion/IE6_XP/IE6.XP.For.MacVMware.sfx" | |
| echo "--> Download Internet Explorer 8 on Microsoft Windows XP Appliance for VMWare Fusion." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| _______ | |
| These simple SCSS/SASS mixins for Foundation 4 are made by me to deal with media-queries and have a clean code at the same time! ;) | |
| ****IMPORTANT**** | |
| Due to Foundation 4 uses mobile-first methodology, every $phone-"X" variable in these mixins defines the value for every screen size. | |
| $desktop-"X" values overrides $phone-"X" values when the width of the window is 768px and above. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'yaml' | |
| def start | |
| command = "" | |
| while command != "q" | |
| printf "enter command: " | |
| command = gets.chomp | |
| process(command) | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Change Java Runtime: | |
| sudo update-alternatives --config java | |
| # Delete Open-JDK | |
| sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\* | |
| # Change fonts - remove hinting: | |
| http://askubuntu.com/questions/32624/ugly-fonts-in-netbeans-how-can-i-make-it-use-the-system-font | |
| # Change RubyMine AntiAliasing first: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # config/initializers/omnicontacts.rb | |
| Rails.application.middleware.use OmniContacts::Builder do | |
| importer :live, 'client_id', 'client_secret', {redirect_path: "/invitations/live/contact_callback"} | |
| end | |
| class OmniContacts::Importer::Live < OmniContacts::Importer::Hotmail | |
| def initialize *args | |
| super *args |
