Deploying the clone

Unlike as in the previous chapters, we will only see how we deploy to a normal server, and not to Heroku. This is because while we store most of our data on Amazon, for fast processing we actually keep temporary cached files in the same server. Unfortunately Heroku doesn't provide for non-database file storage (we are not allowed access to the file server). While there are a few other ways of deploying Photoclone on a non-dedicated server, the steps are almost the same. We will only describe one way of deploying the service.

Deploying on a server

For development purposes we would normally run it off the command line using the built-in web server. However, before we do this, we need to set up the database. For this application we would need to have MySQL already installed. At the command line go into the MySQL interactive command console:

$ mysql u <username> -p <password>

Then just do a simple command:

mysql> create database photoclone;

This will just create the database. Next, go into IRB and run the following command:

> require 'models'

This will get the necessary classes for creating the database tables. Next, just run the following command:

> DataMapper.auto_migrate!

This will create the tables for the application. To run the application, we just need to run this at the command line:

$ ruby photoclone.rb

Then go to http://localhost:4567/ and you will see the login page. Try logging in. If you have added localhost to the list of applicable URLs in RPX you will be able to log in.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.140.197.136