Go live or go home

Preview:

Citation preview

Go Live || Go home

Localhost

Internet

Setting up1) Account

2) SSH key

3) Create Server

4) Login

5) Setup project

6) Save to git

7) At server key to git

8) Pull to server

9) Install mongo local & on server

10) Add mongo adaptor/setup

11) Test

12) Push

13) Pull and try! ^_^

+

on

with

Brian Shannon

Account

https://www.digitalocean.com/?refcode=8a22966dbe8b $10 free for 2

months hosting

Account

Create Server

Create Server

Create Server

.ssh/id_rsa.pub

Login

ssh root@ ….

Login

Setup project

● sails new livesite● cd livesite● sails lift

git

git

git● git init● git remote add origin

ssh:// ..user.. @bitbucket.org/ ..user.. /..project.. .git● git add .● git commit -m "first"● git push origin master

Setting up a key on the server

● ssh root@ … *ip● ssh-keygen -t rsa

– Enter.. enter.. enter..

● cat .ssh/id_rsa.pub● Copy the out *for the next step● service ssh restart

Let the server read you git

In the project

Setup node on the server

● apt-get install python-software-properties python g++ make

● add-apt-repository ppa:chris-lea/node.js● apt-get update● apt-get install nodejs● npm -g install sails

clone

● apt-get install git● git clone git@bitbucket.org:hackership/sitelive.git● cd livesite● tmux● sails lift

New: tmuxLeave: -CTRL b, dExisting:tmux attach

tmux

Mongo● npm install sails-mongo –save

● sails generate api message

● Change config/models.jsconnection: 'someMongodbServer'

● http://localhost:1337/message

● http://localhost:1337/message/create?name=brian

● git add .● git commit -m “now with mongo”● git push origin master

Mongo on the server

● sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10

● echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list

● sudo apt-get update● sudo apt-get install -y mongodb-org● mkdir /data● mkdir /data/db● mongod

Pull and updating

● git pull origin master● npm install● sails lift

We are done