Install Ruby on Rails (web development) environment on Chromebook using Crouton

Web development on a Chromebook. Is it possible? Even if its possible, does it work well? It does! I develop web applications, mainly using Ruby on Rails on my Chromebook. I used to use to 15 inch MacBook Pro, but since I travel almost every month, after a while, lugging my macbook around was a real pain in the back. For the last year or so I've been using an Asus C302A Flip Chromebook. At first, I wasn't sure the Chromebook was going to be able to cope with web app development using Ruby on Rails, but I was pleasantly surprised.

In this post I'm going to document how I set up ubuntu on my Chromebook for local web development. Please note that I've already put my Chromebook in developer mode, installed Crouton and created an ubuntu chroot. If you haven't done it here's a guide on installing crouton and chroots on your chromebook.

Once you're all set up, follow these steps to set up Ruby on Rails on your new Ubuntu Chroot.

  1. Open Chrome
  2. Press CTRL + ALT + T
shell
sudo enter-chroot -n ubunutu

The '-n' let's you pass a name to your chroot. Hopefully you named your chroot. If you only have one chroot, you can skip the '-n ubuntu'. If you have multiple chroots, and you didn't name yours then the default name will be the release name, something like 'xenial'.

Congratulations, you're now logged in to your virtual ubuntu machine. Now for the fun part.

Install Git:

sudo apt-get install git

Install Curl:

sudo apt-get install curl

Install RVM (Ruby Version Manager)

sudo curl -sSL https://get.rvm.io | bash -s stable

Ah, I got a failure. Something to do with GPG keys.

sudo curl -sSL https://rvm.io/mpapis.asc | gpg --import -

OK now rerun the previous curl command to get rvm. You should see a success message like this:

Installation of RVM in /home/user/.rvm/ is almost complete:

  * To start using RVM you need to run `source /home/user/.rvm/scripts/rvm` or source ~/.rvm/scripts/rvm
    in all your open shell windows, in rare cases you need to reopen all shell windows.

Let's check we have the latest version installed.

rvm get stable

Now we need to get the system ready for Ruby

rvm requirements

What ruby versions can we install? Let's check.

rvm list rubies

2.4 is the latest. If I'm not mistaken the app I want to work on runs on 2.2, so I'm going to install that.

rvm install 2.2

Wait a while….

ruby -v
ruby 2.2.7p470 (2017-03-28 revision 58194) [x86_64-linux]

To avoid conflicts between ruby versions, we'll create a gemset to use with this ruby version.

rvm use 2.2@r2.2_default --create --default
Using /home/chirag/.rvm/gems/ruby-2.2.7 with gemset r2.2_default

Before we install rails, we should tell rubygems not to create any documentation. Use your text editor to edit the file. I'm using VIM.

vim ~/.gemrc

Add the following two lines in the file and save.

install: --no-rdoc --no-ri
update:  --no-rdoc --no-ri

Now you can install rails. I'm using 4.2.10

gem install rails --version 4.0.8

We need to perform some one time set up if this is the first time you're using git.

git config --global user.name "Your Full Name"
git config --global user.email your.email@mydomain.com
git config --global alias.co checkout

Once you're in a folder where you want to work

git init

If you're working on code that's already on a repository

git remote add origin git@bitbucket.org:username/projectname.git

To use this we need to set up ssh keys for bitbucket.

ssh-keygen -f ~/.ssh/<bitbucketusername>
ssh-add ~/.ssh/<username>
cat ~/.ssh/<username>.pub

Paste the contents into bitbucket. Follow these instructions. 

Now grab your repository. Use clone instead of pull as it will set up remote tracking.

git clone git@bitbucket.org:team/project.git

You should be ready to roll if you downloaded an existing rails project. Enjoy!

I got a Raspberry Pi!

Sitting at my desk on Tuesday morning I spontaneously ordered a Raspberry Pi. I’m not quite sure what I was thinking but I went on the site and just ordered one. I ordered a Raspberry Pi with a clear case. Unfortunately the package where the Pi comes in the case was out of stock, but I could order the two items separately and have them the next day for £1 or so more. (Surely it’s more expensive to put the Pi in the case and ship it?)

As promised the Pi turned up on Wednesday and I began to play with it. I decided that most things I could do with a linux box I could do with my VPS, so I decided to make a home media center with my Pi. Some swift googling led me to OpenElec – reviewed as being one of the better XBMC distributions for the Pi and only required a minimal amount of space, which was good because I only had a 2GB SD card handy rather than the recommended 4GB.

Long story short, I love my Raspberry Pi + OpenElec. It’s taken me a good few days to get it running the way I want and scan my media, but now all my media is just a couple taps away (using any android phone in the house as a control).

On the flipside, playing with the Raspberry Pi has totally distracted my time away from my Web App Challenge. I haven’t made any progress since Tuesday night. I’ll be getting back to business tomorrow night and will write more about how I set up the Raspberry Pi and more details on how I am progressing with the Web App Challenge!

The Web App Challenge: £0 to £3000/month in six months

It’s a new year. Time to re-focus on those life goals and keep life heading in the desired direction.

I was reading Nathan Barry’s blog today and have decided to join him in the Web App challenge. Unlike Nathan, I have some idea about the web application I want to build, but I’m still researching and planning at the moment. To be honest Nathan’s post couldn’t have come at a better time. I’m hoping to be just as transparent and take inspiration from his aggressive approach and tight timeline (leaving me less time to procrastinate!).

What our challenges have in common

– Extracting ideas in the style of Dane Maxwell

– Building a web application

– Using Ruby on Rails

– Looking for to create a SaaS (software as a service) product.

How our challenges will differ

Unlike Nathan, I’m assigning a budget of ZERO. I plan on doing the design / development / marketing etc by myself, whilst working full time at my job (which is often more than the usual 9 to 5).

I have experience in programming with Ruby and Rails, but have never built a full web app, especially one I intended to sell. I’m hoping the next few months will solidify my knowledge of Rails and allow me to create software that provides real value to my eventual target market.

Join in?

Whilst the Web App Challenge isn’t an official challenge (as far as I know), I encourage you to join in. It would be nice to have some community to share the ups and downs and building a software product with. Besides, what better way to start the new year than to start working on a new project?

To our successes in 2013! Happy new year 🙂

— CD

Project Ideas

Recently I’ve had the urge to make something. I have random ideas about cool things I’d like to have in my life and start researching how to build them.

My problem is I’ve now got several ideas in my head and no clear starting point so my progress has been unimpressive.

Below is a list of ideas I have. If you know how I should tackle any of the below please get in touch. The list is to serve as a reference for myself.

1. Sip door phone
I’ve seen expensive consumer products but reckon I can build one myself using raspberry pi or similar. The idea is someone pushes the button and it calls the phones attached to my asterisk (in my home, in my office and on my mobile). Whilst ringing the person at the door is asked for their name and purpose so this can be played when I answer. (Useful when packages are delivered and I am not in – also when friends visit and I am out.) Extra: add a picture or webcam feed, ability to notify an iOS or android app, and possibly the ability to lock unlock the door from any phone that answers the doorbell.

2. Sip loudspeaker
I don’t know why, but I’d like my house to talk to me. I’d like to know how the underground lines look in the morning while I make my tea. I’d also like to be able to leave messages for family members when they return to the house (use of motion sensor). I’d also like two way calls via the speaker, so I could call the speaker and talk to whomever might be in. This would also be good in my grandfather’s house so we can talk to him without him needing to operate a phone.

3. Home automation (general)
I have lights I can control via iOS or android apps. I’d like to make them smarter e.g. know I was heading upstairs and that no lights are on and either ask if I want them on (can use sip speaker, motion sensor + voice command software) or just turn them on anyway.

4. Money management app
I am planning to build this in Rails. This is for a friends business so I’m not going to say much here.

5. Git server
I’d like to host my own github style site to backup my work

6. Android management Either the ability to remotely manage family members android devices e.g. initiate app updates, backup images etc via a web interface. Also ability to provide remote support I.e. ability to see the screen of a family members device and show them how to perform common tasks. (Vnc style).

7. Follow me music system I would like a sonos style setup whereby I can dictate what is played in each room. If I could tie this in with the sip speaker project that would be great.

8. Android sip client I know many of these exist but I’d like to build one just for fun. That’s it for now.

9. Home security
I’d like to be able to tell what’s going on in my house at a glance (phone/tablet).

10. Media displays
Use “small computers” (e.g. raspberry pi / arduino) to power 4 large TV screens with advertising. Using XiBo or similar.

11. Home Check-in
Use the Raspberry Pi to monitor the MAC addresses connected to my home network. Use these addresses and a few logical conditions such as time etc to determine whether members of the family are at home or not. This can then be extended to tie in with home automation and turn lights on when returning home and nobody else is at home.

Will update when more ideas keep me awake at night.