Skip to content
bsag edited this page Jul 16, 2011 · 1 revision

Installing Tracks on Media Temple (gs)

Part One: Create the Database

First thing we will do is login to your account center and physically create a database, user, and set user permissions. If you know how to do that through terminal, feel free to do so. To create one manually, do the following:

1. Go to ac.mediatemple.net and login to your account center
2. Click on your main domain to get to the WebControl panel
3. Click on Manage Databases
4. Click on the Add Database tab
5. Name your database whatever you like (and take note of the name, including the “dbXXXXX_” part). Type should be MySQL database, click next. At this point your database is created. Now we need to create a user.
6. Click on the Global Settings tab.
7. Under “Add A Database User,” enter a name and password, then click save. Take note of the name and password (again, name including the “dbXXXXX_” part).
8. Under the “Manage Database Users” section, click the permission button for the user you just created.
9. Grant Read/Write permissions for the database we created above, then click Save Now.

Part Two: Install Tracks

1. Open up Terminal
2. SSH into you server by entering the following (replacing mt-example.com with your url and <`password>` with your password):

ssh serveradmin[email protected]@

(…you will be prompted for your password. Enter your account center password.)

3. If you havent done so already, set up Ruby on your server. If you already have ruby setup on your gs, skip to step 8.
To set up Ruby, start by installing Ruby Gems.

mtr -u [email protected] -p <password> setup_rubygems

4. Bash the profile to adopt environment variables:

source ~/.bash_profile

5. Register the (mt) Media Temple gem repository with your local repository:

gem sources --add http://gems.mediatemple.net

6. Navigate to the “containers” folder on your server by typing:

cd $HOME/../../containers

7. Make a directory for rails and enter it:

mkdir rails && cd rails

8. Download tracks (when this tutorial was written, the link below was current, but best to check on the tracks homepage to see if it has changed):

wget http://bsag.bingodisk.com/public/files/tracks-current.zip

9. Unzip the file you downloaded

unzip tracks-current.zip

10. Next, I renamed the tracks folder from “tracks-1.7” to just “tracks.”

mv tracks-1.7/ tracks

11. Move to the tracks directory.

cd tracks

12. Now we need to add the app to MT’s Ruby container and add a path to it. To do so type (and remember, replace “/mt-example.com”/ with your domain and to your ac password):

mtr -u [email protected] -p `<password>>` add tracks $PWD tracks.mt-example.com

13. Next we need to edit the database.yml file inside the tracks folder. You can either do this from within Terminal, or via your FTP. I did it outside terminal. So for now, keep Terminal open, but switch to your favorite ftp app and login to your server.

14. Once logged in, navigate to the root, and go through containers > rails > tracks > config > to find the database.yml file. You will want to edit your file to make it match up with the database info you noted above. It should look like:


development:
  adapter: sqlite3
  database: db/tracks-17-blank.db

test:
  adapter: sqlite3
  database: ":memory:"

production:
  adapter: mysql
  database: dbXXXXX_dbname
  host: internal-db.sXXXXX.gridserver.com
  username: dbXXXXX_dbuser
  password: `<password>>`

15. Once you have edited and replaced the database.yml file in your config folder, close up your FTP app and head into Terminal once again. If you have been logged out, you will need to SSH back in (as we did above) and navigate back to your tracks folder by typing cd$HOME/../../containers/rails/tracks

16. Now we will need to rake the database, as described in the tracks installation documentation. To do so, type:

rake db:migrate RAILS_ENV=production

17. Next we will start it up. Type:

script/server -e production

18. Now, we will start the app via MTs side. To do so, type (replacing what you need to):

mtr -u [email protected] -p <password> start tracks

if it wont start, MT recommends running the following and trying again:


gem install rails
gem install mongrel

You may need get an error stating “application started, but no pid file was found,” but this can be ignored.

19. Now, we will generate the .htaccess directives needed in order for tracks to function (from within mt’s gs). to do this, type:

mtr -u serveradminmt-example.com -p generate_htaccess tracks@

20. Now we have to create the symbolic link for tracks to bridge the gap between the ruby container and your public web server, accessible from the web. Type:

mtr -u serveradminmt-example.com -p create_link tracks@


You’re done! Visit tracks at tracks.yourdomain.com

Please note:
This tutorial was made on a Mac, so I use Terminal as my command line app. Should you be using Windows, use your equivalent.

References:
Media Temple: Getting Started with Ruby on Rails
Tracks: Manual Installation

Clone this wiki locally