Getting to Know Your Foundation Server
Working with your Foundation server requires familiarity with Linux and working from the command line. In this article we’ll point out some useful directories and commands that should aid your application development efforts. After your order has been processed you’ll receive a welcome email with a username and password for accessing your server. Go ahead and SSH into your server and let’s look around…
Accessing MySQL
Your Foundation server comes with MySQL and the application database pre-installed. To access the database you’ll need the database username and password sent in your welcome email. As a side note, we provision the db user as root for development servers, but this will not be the case when your application goes to production. Use the following command to access MySQL.
Enter your password and you should end up at the MySQL command line. Let’s take a quick look at the tables in your application database:
For more information about important tables in your application database please read the article titled Overview of the Developer Foundation Schema. While on the topic of database schema, you can view the structure of any table in the application database by using the describe command. First, let’s access the application database:
then let’s view the structure of the devices table:
You should see a list of fields, data types, and some additional information. While this article doesn’t get into MySQL specifics you can always access their developer site and work through a tutorial.
Accessing Rails
Rails is located in the /opt/ublip/rails/current folder on your server. Over time, you will become intimately familiar with the structure of the Rails application. The benefit of learning it now means you’ll be able to apply this to future projects since nearly all Rails projects have the same directory structure. One of the most important directories in your Rails application is the app directory. This is where a majority of your application code will reside. To take a quick peak at the directory structure run the following command:
In a future article we’ll get into the specifics of developing with Rails, but in the meantime we recommend you visit the Ruby on Rails Guide for more information. The last thing we should address regarding your Rails application is how you can start and stop it. In some cases you may be doing development directly on the server for testing purposes or need to quickly validate a piece of code. To do this you need to change to the Rails directory:
and then issue a restart command:
There may be cases where you want to explicitly start or stop the Rails app and this can be done by replacing restart with start or stop in the command above.
