Setting up Tracks under Windows XP

[?]

NOTICE:: This tutorial is deprecated. This tutorial works only for Tracks version 1.0.3. It does NOT work properly for the most current version of Tracks. Additionally, if you receive an error regarding Ruby GEMS when attempting to start tracks, please reinstall Ruby, and Rails. Additionally, try installing rails without going through GEMS if possible (good luck finding the download to do so, though). I will update this tutorial for the newest version(s) of Tracks, as soon as possible.

Recently, I head about this great GTD application called Tracks.  It’s built in Ruby, and runs on the Ruby on Rails framework.  It’s also nice and ajaxified.  It’s pretty spiff, and does precisely what you need a GTD application to do.  Plus, it’ll work under IE and FireFox (and, I presume the other majors, as well).

If you’re a linux/OSX user, then getting Tracks running is pretty easy.  If you’re a Windows XP user, you might need more help.  Although John Leonard has written a pretty great tutorial on this very subject, already, I find it’s a bit overkill.  His tutorial uses a much different method, including an unneccesary (in the grand scheme of things) web server package.  This tutorial concentrates on getting Tracks running with only Ruby and MySQL.  The following tutorial will lead you through the steps of setting up Tracks on your Windows XP machine.

CONVENTIONS USED:

I’m an old geek (well, old in the grand scheme of Windows XP).  I’m used to calling things by slightly different names.  Here we go:

Directory
This is what I call a ‘folder’. Directory = Folder.
Prompt
Also known as Command Prompt. What you get when you click Start, RUN, and type ‘command.com’
shebang
The symbol ‘#!’. Normally used on the first line of any script. If I say ‘change the shebang to read…’ I mean to change that line to read whatever.

WHAT YOU NEED:

CREATING THE SPACE:

Your best bet is to create a base directory for the whole thing.  I recommend “c:\gtd”.  If you use something else (do not use ’c:\tracks’), simply make the change when neccesary.  This just makes it easier to note where things are.  Once you have this directory created, we’re ready to begin the installs.  Now, make a subdirectory called ‘mysql’.  (In other words, create: ‘c:\gtd\mysql’)

INSTALLING MySQL:

Extract the MySQL setup.exe, and run it.  Follow the prompts, and install into the ‘c:\gtd\mysql’ directory.  Choose ‘Custom’ installation, and install everything.  Run the configuration setup (which should start, automatically), and choose ’standard’.  Make certain you allow the system to create the MySQL service, and set it to start by default.  Once the installation is complete, we’re ready to continue.

Now, open a prompt.  At the prompt, type ‘mysql -uroot -p mysql’ and hit enter.  When prompted, enter the password you set up during the MySQL installation, a moment ago.

Now, we need to set up a couple of users.  I’ll use the generics ‘username’ and ‘password’ in the following examples.  Whenever you see that, replace it with your preferred username and password.  Be SURE to use the syntax exactly as I’ve written, even if you think it is misspelled.  For this portion, be certain to use the same quote marks and apostrophes as I do, as well.

To set up the local user, type:  GRANT ALL PRIVILEGES ON *.* TO ‘username’@'localhost’ IDENTIFIED BY ‘password’ WITH GRANT OPTION;

You should see MySQL spit out a “Query OK, 0 rows affected” and a timelength.

Now, setup the remote user.  Use the same username and password as before.  Type: GRANT ALL PRIVILEGES ON *.* TO ‘username’@'%’ IDENTIFIED BY ‘password’ WITH GRANT OPTION;

Again, MySQL will spit out a Query OK statement.  Type ‘quit’.  That’s it, let’s move on.

INSTALLING RUBY:

Run the ruby182-15.exe install file.  Choose custom installation, and ensure everything is set to install.  Then, change the install path to read ‘c:\gtd\ruby’  (Note: you must do this manually.  There is a bug in the install software that prevents use of the “browse” button to choose the install path).  Let the system install.  When it’s done, we’ll move on.

INSTALLING RAILS:

Open a prompt and type ‘gem install rails –include-dependencies’.  Let the installation finish.  Once done, we’ll move on.

INSTALLING TRACKS:

This is the lengthy part…  Make sure to follow each step.  Also, remember, when you need to edit a file, do NOT use Word, or WordPad!!

Unzip the tracks-1.0.3.zip file.  Copy the newly created folder to ‘c:\gtd’.  You should now have a ‘c:\gtd\tracks-1.0.3′ directory.  Let’s make things simpler to remember, and rename this directory to ‘c:\gtd\tracks’.

Now, go to ‘c:\gtd\tracks\config’ and rename the following files: (OLD NAME -> NEW NAME)

  • database.yml.tmpl -> database.yml
  • settings.yml.tmpl -> settings.yml

Now, open these files in a text editor (notepad is fine.  It is VITALLY IMPORTANT that you do NOT use tabs in these files.  Do NOT hit the TAB key while editing these files).

In the ‘database.yml’ file, change the username and password lines to reflect the user you set up in the MySQL install.  For instance, if you set up a user of ‘eric’@'localhost’, then your “username:” line in database.yml would read: eric
Do this for all instances of username and password.  Save the file.

In the ’settings.yml’ file, you can set your date option (if you understand Ruby’s date schema), but most likely you’ll only be setting the e-mail line.  Save the file.

Now, go up one directory to ‘c:\gtd\tracks’ and rename the ‘c:\gtd\tracks\log.tmpl’ folder to ‘c:\gtd\tracks\log’.

(NOTE: This step may be optional, I’m not sure.  Windows is fickle, sometimes, so what’s good for the goose may not be good for the gander.)  Go to ‘g:\tracks\public’.  You will need to edit ‘dispatch.cgi’ and ‘dispatch.fcgi’ in a text editor (like notepad).   In each of these files, change the shebang line (or the first line) to read ‘#!g:\ruby\bin\ruby.exe’  Do this for both files, and save them.

In this portion, the ‘username’ and ‘password’ refers to the username and password you created in the MySQL portion.  Now, you need to go back into MySQL: ‘mysql -uroot -p’ and hit enter.  When prompted, enter the root password (that you created on installation).

At the MySQL prompt, type: CREATE DATABASE tracks

Then, if no error occurs (you’ll get a “Query OK” message if it was successful), type: GRANT ALL PRIVILEGES ON tracks.* TO ‘username’@'localhost’ IDENTIFIED BY ‘password’ WITH GRANT OPTION;

You should, again, get a “Query OK” message.  If so, go ahead and type ‘quit’ to end the session.

Almost there, I promise.  Now, we need to import the data.

In the command prompt, change directory to ‘c:\gtd\tracks\db’

For this section, the ‘username’ and ‘password’ token refer to the username and password you used, last step (creating the database).  At the command prompt, you’ll need to import the data with the following commands: ‘mysql -uusername -ppassword tracks > tracks_1.0.3_mysql.sql’  and  ‘mysql -uusername -ppassword tracks > tracks_1.0.3_content.sql’  (do not use any spaces between the option flags and the username or password.  For instance, if your username was “phil” and you password was “ivy” then your line would read, ‘mysql -uphil -pivy tracks >’ and so on).

Are you ready, yet?  Well, good, let’s move on to the next section.

STARTING TRACKS:

This is the easy part.  Change directory to your ‘c:\gtd\tracks’ directory.  Then, issue the following command: ‘ruby script/server –environment=production’

You should hear a little churning, and within a few seconds, see ‘=> Rails application started on http://0.0.0.0:3000′ and a bunch of other hullabuloo about WEBrick.  This is the application webserver.  You must leave this command prompt window open to keep Tracks running.  When you’re ready to quit tracks (or you don’t need the server), you can hit CTRL-C to shut it down.  Wait for a command prompt to re-appear, and then you can close the window.

Now, it’s time to log in to tracks for the first time.  Load your favorite web browser, and browse to http://localhost:3000/signup. Then, enter your username, a password, and a secret word.  Once you’re all signed up, you can log in for the first time, and start using Tracks.

Enjoy!

KNOWN ISSUES:

You have to keep a command prompt window open in order to keep Tracks running.  This can get annoying, and I’ve yet to find a solution.

I’ve finally found a solution. Using Visual Basic Script, you can start ruby in a hidden window. Read this entry for all the details.

Help spread the love and Share This


17 Responses to “Setting up Tracks under Windows XP”

  1. John says:

    Thanks for the link, Fyre.
    You’re right, in the overall scheme of things using Uniform Server to achieve essentially the same task that the WEBrick already does is overkill - I’m just a man who likes to do things simply (not that my 30-odd point tutorial would indicate that!).
    BSAG seems to have slowed down on the development of tracks and as the versions of rails and the associated gems keep changing my tutorial is getting harder to maintain - I’ll point interested parties to this page for further reference.
    Cheers!

  2. Fyre says:

    Many thanks, John! I appreciate the link! Tracks seems to be pretty steady, as far as development is concerned. I’d love to find a way to run it without the command prompt window open at all times, but alas that may be a drawback of Windows. Then again, maybe it can be set as a service at boot/login. I’ll have to experiment once I get home from vacation.

    -Eric

  3. Adam says:

    hey man, try hiding command prompt with vbs. that’s what I do for my instiki setup

    http://www.microsoft.com/technet/scriptcenter/scripts/os/process/procthd/pcthvb02.mspx

  4. Fyre says:

    Adam, many thanks for this idea!

  5. MindFyre » Blog Archive » Starting Tracks in a Hidden Window says:

    [...] MindFyre » Blog Archive » Setting up Tracks under Windows XP says: [...]

  6. Alan says:

    Thanks for great tutorial. Surprised nobody else caught this - in the GRANT ALL PRVILEGES step above, PRVILEGES is misspelled, which threw me since the instructions say to ignore what we think are misspellings.

    However, using PRVILEGES makes mysql sad about a SQL syntax error. PRIVILEGES worked for me, returning the desired Query OK.

  7. Fyre says:

    WHOOPS. Sorry about that. I’ll edit the entry, now, to fix the misspelling.

  8. Rafael says:

    I’ve done everything according to your tutorial, but I’m stuck in how to start tracks. I type the command ‘ruby script/server –environment=production’ in gtd\tracks directory, but it gets me some error message telling me there are missing files and the WebRicks app won’t be started. What could I’ve done wrong?

  9. Fyre says:

    Could you copy/paste the error message into comments, or an e-mail? I can’t guarentee I can find a solution, but I will try.

  10. g says:

    try using rubyw.exe instead of ruby.exe to get rid of the command window

  11. chris says:

    Hi, thanks for the tutorial. A few things:

    1. the > should be cygrunsrv –instal Tracks –path c:/ruby/bin/ruby.exe –args ‘c:/gtd/tracks/script/server’

    Thanks much, I am looking forward to using this.

    –chris

  12. chris says:

    OK, that was bad.

    1. the > should be 2. In the 1.4 tarball I did not find the settings file nor the mysql schema file. This was great for 1.3.3. I was able to get it to run as a service in windows using cygwin. Here is the command that I used.cygrunsrv –instal Tracks –path c:/ruby/bin/ruby.exe –args ‘c:/gtd/tracks/script/server’Looking forward to using this program. –chris

  13. Fyre says:

    Chris,

    Thanks for the updates!

    I really need to go back through and edit the post a bit to catch up. …and to refresh my memory.. I’m looking at “in the 1.4 tarball” and I’m wondering to which program you’re referring. heh. Then again, I’m on some heavy painkillers for my back right now, and everything’s a bit fuzzy.

    Oh, and many thanks for the Cygwin info!

  14. chris says:

    Hi. By tarball I just meant the zipfile. As I went through the install process you outlined I ran across a few issues because some files have been changed in the 1.4 distro. I got 1.3 running according to your notes and then after I could not sleep one night I did a 1.4 upgrade.
    The cygwin stuff was lifted from Assaph Mehr’s excellent Pimki personal information manager. As they are both Ruby apps running under the brick server there is a nice natural synergy between the two.
    Hope that your back is feeling better soon. Cheers, Chris

  15. Fyre says:

    Hmm.. I’ll need to update information for 1.4, then. *makes note in tracks* heh.

  16. Lamont says:

    so I’ve followed your excellent step by step, but when I attempt to run Tracks I get the following error:

    c:/gtd/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/depend
    encies.rb:140:in `load’: No such file to load — environments/nvironment=product ion.rb (MissingSourceFile)
    from c:/gtd/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_s
    upport/dependencies.rb:140:in `load’
    from c:/gtd/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_s
    upport/dependencies.rb:56:in `require_or_load’
    from c:/gtd/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_s
    upport/dependencies.rb:30:in `depend_on’
    from c:/gtd/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_s
    upport/dependencies.rb:85:in `require_dependency’
    from c:/gtd/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_s
    upport/dependencies.rb:85:in `require_dependency’
    from ./script/../config/environment.rb:39
    from c:/gtd/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
    `require__’
    from c:/gtd/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
    `require’
    from script/server:45

  17. Fyre says:

    Lamont: This is likely related to an issue with the newest version of tracks. I’ll hopefully update, soon.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>