Skip to content
Kitefaster edited this page Aug 2, 2015 · 15 revisions

Getting Started Guide

Prerequisites

These instructions were created using Ubuntu 14.04. You should be able to copy and paste the instructions on any debian based distro.

The required software and services:

  • Server (VPS or Local will work)
  • Ruby 2.1.2
  • MySql Server
  • Firebase Account (Free account will work for testing)

Get a free firebase account

https://www.firebase.com/

For a single user instance, the smallest droplet available on Digital Ocean will suffice.

https://www.digitalocean.com/pricing/

The five dollar plan will work or you can use your own server.

Installation

The installation procedure might seem a little intimidating but I have worked out the steps so that anyone should be able to follow along. If you plan to host your server to the public you might want to go a little deeper than these instructions are going to take you in securing your system. I make no warranties or claims about the security of your data.

Step 1

Ensure that you can SSH into your box. Replace "192.168.1.10" with the address of your server.

SSH user@192.168.1.10

Once you have access you need to update the system. If you are using the root account, which you shouldn't, you don't need to use sudo. There are lots of tutorials on how to create your first account out there so I will not rehash this.

sudo apt-get update sudo apt-get dist-upgrade

Install git so that we can fetch packages later

sudo apt-get install git-core

Configure your git settings

git config --global user.email git config --global user.name

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

Log out and back in after that finishes

At the prompt you can type rvm requirements to install all of your ruby prerequisites

rvm requirements

Install Ruby 2.1.2

rvm install 2.1.2 --default

Install MySql. During the MySql install you will create a password. You will need that password later.

sudo apt-get install mysql-server mysql-client libmysqlclient-dev

These steps will get you a basic server up and running. You can work from your home directory or any directory that you have permissions to use.

If you are going to work in your home directory:

cd ~ Create a projects folder

mkdir projects

Move into the projects folder

cd ~/projects

Clone the thinglayer repository

git clone https://github.com/jodyalbritton/thinglayer.git

Move into the the newly created directory

cd thinglayer

You will need to create a file for holding your secrets.

nano config\application.yml

Paste in the following and replace the key/secret pairs with your key/secret pairs.

  • You can find the SmartThings id and secret in the SmartThings developer console via https://graph.api.smartthings.com > My Smart Apps > Thing Layer > App Settings > OAuth.
  • Your firebase secret can be found in your firebase app dashboard under secrets.
ST_CLIENT_ID: "YOUR SMARTTHINGS KEY"
ST_CLIENT_SECRET: "YOUR SMARTTHINGS SECRET"
FIREBASE_URL: "https://YOUR_INSTANCE.firebaseio.com"
THINGLAYER_DATABASE_PASSWORD: "YOUR MYSQL DATABASE PASSWORD"
SECRET_KEY_BASE: "YOUR FIREBASE ASSIGNED SECRET"

Run bundle install to download the required ruby gems.

bundle install

Create the database

rake db:create

Run the migration

rake db:migrate

Install and start redis server

sudo apt-get install redis-server redis-server

Run your server and and navigate to http://your_server_address:3000 in your browser of choice.

rails s

Clone this wiki locally