Server 2003
From DevchixWiki
Environment
- Installation performed as a domain user with local admin privs.
- Microsoft Windows Server 2003 Standard Edition Service Pack 2
- Intel Celeron 3.06GHz 1.00 GB RAM
These directions will also work with Windows 7, Vista, and XP.
Git
- Download "Full installer for official Git 1.7.0.2" here: http://code.google.com/p/msysgit/downloads/list (filename is Git-1.7.0.2-preview20100309.exe )
- Run installer, accept license agreement, accept default installation directory, accept default shortcut options, keep all checkboxes checked
- "Use Git Bash Only" radio button should be selected (per this article, avoids path conflicts)
- "Use OpenSSH"
- "Use Unix-style line endings"
Ruby and RubyGems
- Download Ruby 1.8.6 one-click installer here: http://www.ruby-lang.org/en/downloads/ (Scroll down to "Ruby on Windows" and click on "Ruby 1.8.6 One-Click Installer.")
- Run installer, click Next button at welcome screen, click I Agree button to accept the license agreement.
- Uncheck "ScITE" and check "Enable RubyGems," then click Next.
- Click Next to accept the default installation directory, and then click Install to start installing. It will take a while.
- Click Next once you see "Installation Complete" at the top of the window. Click Finish to exit the installer.
- What the Ruby 1.8.6 One-Click Installer Includes
Verify RubyGems version
You need at least version 1.3.2 of RubyGems.
To find what version you have, open the gem shell (Start Menu -> All Programs -> Ruby-186-27 -> RubyGems -> RubyGems Package Manager). (What to do if gems can't find ruby) Then type the following, with a return at the end of the line:
gem --version
It should be 1.3.2 or greater.
If it's an older version, type the following with a return at the end of the line:
gem update --system
Fix command-line windows
In this step, you're changing some settings on git bash and the gem shell to make them more compatible with Rails.
- Open the gem shell (Start Menu -> All Programs -> Ruby-186-27 -> RubyGems -> RubyGems Package Manager). You can use one that's already open.
- Open git bash (Start Menu -> All Programs -> Git -> Git Bash). You can use one that's already open.
- On both windows, follow the Recommended setup for command-line windows.
Rails
If you already have Rails installed, make sure it's version 2.3.4. You can check by opening git bash (Start Menu -> All Programs -> Git -> Git Bash) and typing the following, with a return at the end of the line:
rails --version
If you get "command not found," or "'rails' is not recognized as an internal or external command" that's fine - it just means Rails isn't installed yet. Follow the directions below to install it.
If you get a number, it should be 2.3.4 or greater. If it's an older version, follow the steps below to install 2.3.4 normally. Different versions of Rails can coexist peacefully.
Steps for installing Rails 2.3.4:
- Start the gem shell (Start Menu -> All Programs -> Ruby-186-27 -> RubyGems -> RubyGems Package Manager), and type the following with a return at the end of the line:
gem install rails --no-rdoc --no-ri
- Wait...this may take a while.
- What the rails gem install includes. Your list does not have to match exactly.
- Output of gem list --local
KomodoEdit
We'll be using the KomodoEdit text editor during the workshop, though you are free to use a different editor if you prefer. It must be a plain-text editor, such as vim or Notepad++. Regular old Notepad won't work, and neither will Wordpad or Microsoft Word. If in doubt, use KomodoEdit.
Installation steps:
- Download the KomodoEdit Windows installer.
- Double-click to run the installer. Accept all defaults.
SQLite, the SQLite gem, and SQLite Manager
- Download sqlite-3_6_23_1.zip and sqlitedll-3_6_23_1.zip from http://www.sqlite.org/download.html (scroll down to "Precompiled Binaries for Windows")
- Double-click both downloaded zip files to unpack them. This will give you three files:
sqlite3.exe,sqlite3.dll,sqlite3.def. Put all three in theC:\Ruby\binfolder. - Open a gem shell (Start Menu -> All Programs -> Ruby-186-27 -> RubyGems -> RubyGems Package Manager) and type the following, with a return at the end:
gem install sqlite3-ruby -v1.2.3 --no-rdoc --no-ri
- Output should look similar to this: Output from sqlite gem install
- If you already have Firefox installed, verify that it is version 3.5.0 or greater. (Help -> About Mozilla Firefox. The version number is right under the "Firefox" title.)
- If you don't have Firefox installed, or it's an older version, install Firefox.
- Once it's installed, open Firefox and go to Tools -> Add-ons. At the top of the add-ons window, click "Get Add-ons."
- There will be search box directly underneath "Get Add-ons" that says "Search All Add-ons." Enter "SQLite" (without the quotes) in the box and hit enter.
- SQLite Manager should be the top result. Click "Add to Firefox..." (If SQLite Manager isn't in the results, check the spelling - SQLite only has one L. Also, check that you have at least Firefox 3.5.)
- Wait for the countdown, then click "Install Now."
- In the Add-ons windows, click "Restart Firefox."
- Once Firefox restarts, the Add-ons window should say "1 new add-on has been installed." Go to the Tools menu and verify that there is an option for SQLite Manager.
Other required libraries
- Open a gem shell (Start Menu -> All Programs -> Ruby-186-27 -> RubyGems -> RubyGems Package Manager) and type the following, with a return at the end of each line:
gem install rspec rspec-rails gherkin cucumber cucumber-rails database_cleaner webrat win32console --no-rdoc --no-ri gem install heroku --no-rdoc --no-ri
- Output from the first command should look similar to this: Output from cucumber gem install. It's ok to have a longer list of installed gems.
- Output from the second command should look similar to this: Output of heroku gem install
Create a test application
- Create a folder on the desktop called
ruby_on_rails - Open git bash (Start Menu -> All Programs -> Git -> Git Bash) and type the following with a return at the end of each line:
cd ~/Desktop/ruby_on_rails rails test_app
- The first command should produce no output. The second command's output should look similar to this: Output of "rails test_app" command. (What to do if you get rails: command not found)
- Then, type the following in git bash with a return at the end of each line:
cd test_app ruby script/server
- The first command should produce no output. The second command's output should look similar to this: Output of "ruby script/server" command. This command won't return you to the prompt; it will just sit there until you kill it (2 steps from now).
- In your browser, go to http://localhost:3000 (screenshot of successful install)
- In your git bash window where you ran
ruby script/server, do a control-c to kill the server.
Create a model
- Open Git Bash
-
cd ~/Desktop/ruby_on_rails/test_app -
ruby script/generate scaffold user name:string email:string address:text active:boolean(Output of successful script/generate call) -
rake db:migrate(Output of rake db:migrate) -
ruby script/server - Go to http://localhost:3000/users -> New user -> create a user to make sure we can save to db. (The window where you ran
ruby script/serverwill display debugging information as you do so.) - In your Git Bash window where you ran
ruby script/server, do a control-c to kill the server.
Check test_app in to Local Git
- Open Git Bash.
-
git config --global user.name "Your Actual Name" -
git config --global user.email "Your Actual Email"(must be same as the Heroku account, see below, also must be accessible from the workshop) -
cd ~/Desktop/ruby_on_rails/test_app -
git init(Output of "git init" command) -
git add .(Note the dot) (May get line ending warnings; safe to ignore.) -
git commit -m "initial commit"(Output of initial check-in) -
git log(We're just checking to make sure it worked. Verify that it has the right user and commit message.)
Create an ssh public key
- Open Git Bash.
-
ssh-keygen -C "Your Actual Email" -t rsa(email should match git config setting) - Hit enter to accept default location for ssh key.
- Hit enter to accept blank passphrase (if computer is shared with other people, as in a work laptop, you should create a passphrase). Hit enter again to accept blank passphrase (or enter passphrase again).
- Output of ssh-keygen command
- Public key is now stored at
~/.ssh/id_rsa.pub, which translates toC:\Documents and Settings\%USERNAME%\.sshfolder (C:\Users\%USERNAME%\.sshon Vista).
Create a Heroku Account
- http://heroku.com -> Sign Up -> enter email address (use the same email as you did with git and the ssh public key).
- Heroku will send you an activation email. Open it and click on the activation link. It will take you to the Heroku site. Enter and confirm your password. Hit Save.
- If you didn't already install the Heroku client (see the "Other required libraries" section) do so now:
- Start Menu -> All Programs -> Ruby-186-27 -> RubyGems -> RubyGems Package Manager
-
gem install heroku --no-rdoc --no-ri(Output of heroku gem install)
- If you have further heroku issues, try following these directions to install (or re-install) the client.
- Open Git Bash
-
cd ~/Desktop/ruby_on_rails/test_app -
heroku create - Enter your Heroku email address and password. (Output of heroku create command)
- If you see "The filename, directory name, or volume label syntax is incorrect." when executing
heroku create, the create process did not complete successfully. See Working around the "heroku create" error. - If you don't see the above error message, to verify that the
heroku createcompleted successfully, dogit remote showand see if the list includesheroku.
Deploy test_app to Heroku
- Open Git Bash
-
cd ~/Desktop/ruby_on_rails/test_app -
git push heroku master - It may ask: "The authenticity of host 'heroku.com (75.101.145.87)' can't be established. RSA key fingerprint is 8b:48:5e:67:0e:c9:16:47:32:f2:87:0c:1f:c8:60:ad. Are you sure you want to continue connecting (yes/no)?" Type
yesand hit enter. - Output of successful first deploy. Be sure to find your Heroku application name in the output. (What to do if git seems stuck)
- Go to your application's URL. You'll need your Heroku application name. The URL for your app is
application name.heroku.com- so with the example output in the previous step, it would befloating-winter-18.heroku.com. Verify you see the welcome page. Leave this window open. - In git bash,
heroku rake db:migrate(Output of heroku rake db:migrate) - In the browser, add
/usersto the end of the URL. Verify you see the user list page. Create a new user to verify we can write to the db.
Congratulations!
You have everything you need for the workshop.
Ask a TA to do the install test now and get a sticker!
Cleanup
You don't need the test_app for the workshop - we just created it to make sure everything was working. GET A STICKER!
Then, you can delete all test_app files that you created. Leave the ruby_on_rails folder on the desktop though.
For a complete delete:
- Delete the app from heroku. http://api.heroku.com/myapps -> General Info -> Destroy App
- Open Git Bash
-
cd ~/Desktop/ruby_on_rails -
rm -rf test_app

