For this workshop we'll need to create and setup a closed development environment using Vagrant and VirtualBox. Once this environment is up and running, we'll install the following components:
- Git
- RVM
- Ruby 2.1.0
- Node.js 0.10
Download and install the latest version of VirtualBox from the virtualbox site.
You should choose to download the VirtualBox platform packages for your relevant OS.
Download and install the latest version of Vagrant from the vagrant site.
Once Vagrant has been installed, open the terminal and create a separate directory for our Vagrant environment.
mkdir ~/angular-rails-workshop && cd $_
Our environment will run Ubuntu 12.04 LTS 32-bit. We can download a Vagrant box with this OS from the Vagrant cloud by running
vagrant box add hashicorp/precise32
Once the box has been downloaded, we can initialize it by running
vagrant init hashicorp/precise32
This will place a Vagrantfile in your current directory.
We can then start using it by running
vagrant up
You now have a working virtual machine inside VirtualBox running Ubuntu 12.04 LTS 32-bit. You can access the machine via ssh by running
vagrant ssh
You should now see the following output
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic-pae i686)
* Documentation: https://help.ubuntu.com/
Welcome to your Vagrant-built virtual machine.
Last login: Thu Apr 17 10:53:27 2014 from 10.0.2.2
vagrant@precise32:~$
You are now working inside a virtual machine running Ubuntu. You can exit this environment whenever you want, by running
logout
Then, if you want to, you can gracefully shutdown the virtual machine, by running
vagrant halt
You can start it again by running 'vagrant up' & 'vagrant ssh'.
Additional Resources
Now that we're inside the virtual machine running Ubuntu 12.10, we'll need to install the rest of our stack.
sudo apt-get update
sudo apt-get install git-core
sudo apt-get install curl
It is recommended to install ruby using a version management tool, like RVM or rbenv. For the rest of this guide we'll assume that RVM is being used, but rbenv can be used as well.
Install RVM by running this command, then follow the installation instructions.
curl -L https://get.rvm.io | bash -s stable
After the installation is complete, run
rvm requirements
to check whether other dependecies need to be installed.
Additional Resources
Now that RVM has been installed, we can now install ruby 2.1 by running the following command.
rvm install 2.1.0
If the installation process was successful, try running
rvm list
You should be able to see ruby 2.1 in the list installed rubies. We can now tell RVM to use it as default.
rvm use --default ruby-2.1.0
Now that we have ruby installed, we'll need to install some basic gems. First off, let's create a .gemrc file in our home directory.
echo "gem: --no-document" >> ~/.gemrc
This setup will make the gem installation process much faster, since it basically tells rubygems to download only the gem itself, ignoring any documentation files.
The last thing we need to install is the bundler gem. We'll do it by running
gem install bundler -v '1.5.1'
We're going to use the latest version of Node.js (currently 0.10.26). We'll install it by running the following commands
sudo apt-get install python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
After the installation has comleted, you can check that Node is working by running
node -v
The node version should be 0.10 or higher. NPM should also have been installed, so running
npm -v
should work as well.
Let's clone the basic rails-api app first by running
git clone git://github.com/tikalk/workshop-rails-api-template-basic.git RailsApp
Now let's clone the basic angular app by running
git clone git://github.com/tikalk/workshop-angular-template-basic.git AngularApp
TODO