ThomasHastings.com http://thomashastings.com My thoughts, ideas, and experiences in one -- organized -- place! posterous.com Tue, 03 Jan 2012 17:25:00 -0800 Ruby on Rails and iOS data flow. http://thomashastings.com/ruby-on-rails-and-ios-data-flow http://thomashastings.com/ruby-on-rails-and-ios-data-flow

The data flow from INNOPAR's web development model. Our websites are built with Ruby on Rails and we use Amazon Web Services for cloud storage. We then use xCode to develop a native mobile application that clients can manage form their web based administration panel.

Dataflow

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1739957/profile.jpg http://posterous.com/users/hdKsPadAPDmci Thomas Hastings Tom Thomas Hastings
Sun, 02 Oct 2011 18:16:00 -0700 dinked.net and how it works. http://thomashastings.com/dinkednet-and-how-it-works http://thomashastings.com/dinkednet-and-how-it-works

I created a website awhile back that allows gamers to create websites for their gaming teams free of charge. Below is a flowchart of how the back-end process works.

dinkedworkings.pdf Download this file

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1739957/profile.jpg http://posterous.com/users/hdKsPadAPDmci Thomas Hastings Tom Thomas Hastings
Mon, 15 Aug 2011 07:23:00 -0700 Launch of StartupWebworks.com http://thomashastings.com/launch-of-startupwebworkscom http://thomashastings.com/launch-of-startupwebworkscom

On Saturday, INNOPAR, marked the launch of a new web application -- Startup Webworks. Startup Webworks allows users to signup and create a custom website through an automated system process. This is great for small business owners who don't want to spend a fortune developing an online web presence.

The Technology

I developed the main website at startupwebworks.com using ruby on rails. This makes my job so much easier. I was able to use a generator to create the framework and then build upon it with content. The signup.startupwebworks.com I wrote in PHP. The script there interacts and stores information into MySQL. Once an account has been activated a CRON job is run in the background to setup the users account. The process is entirely automated and takes about an hour and half to complete.

Are there any questions?

If you have any questions feel free to leave them here as a comment. I love to hear from you.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1739957/profile.jpg http://posterous.com/users/hdKsPadAPDmci Thomas Hastings Tom Thomas Hastings
Wed, 13 Jul 2011 12:59:00 -0700 How to install Ruby on Rails with Ubuntu 11.04 Server http://thomashastings.com/how-to-install-ruby-on-rails-with-ubuntu-1104 http://thomashastings.com/how-to-install-ruby-on-rails-with-ubuntu-1104

This tutorial will outline the steps needed to create an in-house production server for ruby on rails using:

Let's get started. First you will need to have a clean install of Ubuntu 11.04 server installed. It doesn't matter if the operating system is running on a standalone system or a virtual environment. I will be using virtual box for this tutorial. When I installed Ubuntu I didn't select any server settings such as LAMP, SSH, etc… I like to be in control of what goes where and when it's installed.

SSH

The first thing we are going to do on our fresh Ubuntu install is install SSH so that we can login remotely from another computer. This is important for those of us who are using a production server and don't want to use remote desktop.

NOTE: When you log in write down the IP address for eth0. This is the IP you will use in your console to SSH into the server.

Go to the Ubuntu console and login. Then type this command to install SSH:

sudo apt-get install openssh-server

You will be asked to provide your password. Follow the steps on the screen.

After the SSH server is installed I will leave the server and go back to my computer. I am using Windows 7 so I will use putty. For those of you on a Mac you don't need any special software just use the console app that is already installed. Mac users will have to use:

SSH {ipaddress} –l {username}

For PC users we will use putty. Once putty is downloaded all you need to do is run the program. Once the program has launched there will be a field to provide the ip address of the server you want to connect to. Because we haven't modified the SSH configuration we will use the default port of 22.

More information on SSH can be found here.

MySQL

After we have installed SSH and connected to our server we will install MySQL. Ubuntu makes it extremely easy with this command:

sudo apt-get install mysql-server mysql-client

Again, you will be asked to provide your password. Follow the onscreen steps. This process can take a couple of minutes.

Apache 2

I favor Apache 2 but nginx (engine x) would work too. Ubuntu provides Apache 2 as a package just as it does for MySQL so to run the install the commands are very similar.

sudo apt-get install apache2

After the package is installed you can navigate to http://{ipaddress} and you should see a simple HTML page with a heading that reads, "It works!"

phpMyAdmin

The next package we will install is phpMyAdmin. This allows us to easily manage our MySQL database that we just installed. Run the following command in console:

sudo apt-get install phpmyadmin

You will be asked which server you want to reconfigure. Again, we are using Apache in this tutorial so hit the spacebar to select apache 2 and then tab to OK hit and the install should continue. Set the password to be the same password as the root user on the mysql database which you set earlier.

You can now navigate to http://{ipaddress}/phpmyadmin and you should see a login screen. Here you use the username "root" and whatever password you set. Ubuntu installs version 3.3.10 of phpMyAdmin. There is a newer version out there that I will go over how to install in a later post.

FTP

I am a fan of proftpd so I will show you how to install it on Ubuntu and configure file permissions so that any new files that are uploaded will be viewable by the outside world. First we need to create an ftp user and a password for the ftpuser.

sudo useradd [username] sudo passwd [username]

next we will add the user to the www-data user group

sudo usermod –g www-data [username]

then we will change mod the /var/www and apache2 virtual host files:

sudo chmod –R g+w /var/www
sudo chmod -R g+w /etc/apache2/sites-available
sudo chown {username}:www-data /var/www –R
sudo chown {username}:www-data /etc/apache2/sites-available -R

Now we are ready to install proftpd:

sudo apt-get install proftpd

When asked, select standalone option.

Let's edit the proftpd conf file to ensure security.

sudo nano /etc/proftpd/proftpd.conf

and edit it to match the following example:

# Use this to jail all users in their homes
DefaultRoot /var/wwwr
# Set the user and group that the server normally runs at.
User www-data
Group www-data

then hit "ctrl" + "x" and save changes. Then restart the ftpftpd process.

sudo /etc/init.d/proftpd restart

Time to test it out. Use your favorite FTP program and ftp into the ipaddress and port 21 with the username and password you have set. More info can be found here.

GIT /CURL

GIT is used to pull projects off of GitHub which will come in handy when we want to install ruby on rails modules. We will install CURL first.

sudo apt-get install curl
sudo apt-get install git

Ruby Version Manager

Ruby version manger or RVM is used to help standardize and maintain RoR applications. RVM is great because just as the name states it allows you to control the version of ruby that the application is using along with what version rails is using. To install RVM use:

bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)

We will then load the RVM into our shell:

echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile

Then we will reload the shell configuration and test.

source .bash_profile

If configuration and installation was preformed correctly the command below should output 'rvm is a function'.

type rvm | head -1

We will then want to install the dependencies: (I got these from running 'rvm notes')

sudo apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev

Next we will use the RVM to install ruby. We want to use the latest version and as of today the latest version is 1.9.2.

rvm install 1.9.2

Then we will tell rvm to use ruby 1.9.2

rvm use 1.9.2

next we will set it as the default (optional):

rvm use 1.9.2 --default

Finally we will update the ruby gems:

gem update –system

Rails

We will now install rails:

gem install rails

then run

rails –v

and make sure the command works.

First Rails Project

Now you can start your first rails application.

rails new /var/www/testapp
cd /var/www/testapp
bundle install

then start the rails server in development mode.

rails s

Navigate to http://{ipaddress}:3000 to see the rails app running.

Passenger

After we have completed all of the steps above we are ready to install phusion passenger. The first thing we need to do is install the gem into ruby.

gem install passenger

Because we are using Apache 2 we will install the apache2 module. There are options on the passenger site to install the module for nginx and the standalone versions as well.

passenger-install-apache2-module

This will take us through a set of instructions to complete the installation. We will need to install some additional packages. The installer will walk you through this process.

Next, we will need to add a config line to our apache2.conf file.

sudo vi /etc/apache2/apache2.conf

Then press “i” to insert text and paste.

LoadModule passenger_module /home/thomas/.rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.7/ext/apache2/mod_passenger.so PassengerRoot /home/thomas/.rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.7 PassengerRuby /home/thomas/.rvm/wrappers/ruby-1.9.2-p180/ruby

Then press "ctrl" + "c" and then “:x”

Next, we will edit the default file under /sites-available/.

sudo vi /etc/apache2/sites-available/default

Delete everything -- by pressing "shift" + “d” to delete the entire line and do this for every line.

Then press to insert text and paste in:

<VirtualHost *:80>
ServerName myserver.thomashastings.com
DocumentRoot /var/www/testapp/public
<Directory /var/www/testapp/public>
AllowOverride all
Options –MultiViews
</Directory>
</VirtualHost>

Then make the appropriate changes to point to the test app.

"ctrl" + "c" to exit the editor and then ":x" to save and exit changes.

Finally, we will restart apache.

sudo /etc/init.d/apache2 restart

Finished

You are finished. You can now navigate to http://{ipaddress} and see your testapp in production mode.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1739957/profile.jpg http://posterous.com/users/hdKsPadAPDmci Thomas Hastings Tom Thomas Hastings
Sun, 10 Jul 2011 20:51:00 -0700 Ruby on Rails Agile Web Development http://thomashastings.com/ruby-on-rails-agile-web-development http://thomashastings.com/ruby-on-rails-agile-web-development

Tools_for_ruby_on_rails-logo
I am learning how to create agile web applications using Ruby on Rails. Stay tuned as a I upload tutorials and projects to my page.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1739957/profile.jpg http://posterous.com/users/hdKsPadAPDmci Thomas Hastings Tom Thomas Hastings