Parse and Heroku Service(1)Heroku Installation and Play

Parse and Heroic Service(1)Heroku Installation and Play

1 Introduction Parse Service
a. JSON format data mapping to storage
b. PFUser user management
c. iOS and Android push notification
d. File storage

2 Installation of Parse Tool
Command Line Tool
> curl -s https://www.parse.com/downloads/cloud_code/installer.sh | sudo /bin/bash

This will install one file under /usr/local/bin/parse. Verify the installation.
> parse version
3.0.5

Check NodeJS version because I am using NodeJS.
https://nodejs.org/en/download/releases/

Some related versions
https://nodejs.org/download/release/v0.12.2/

Error Message with node package node-sass
npm ERR! [email protected] postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script 'node scripts/build.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.

Solution:
> xcode-select --install

> npm install -g npm@latest

These does not help.
> cd /usr/local/lib/

> sudo ln -s ../../lib/libSystem.B.dylib libgcc_s.10.5.dylib

This does not help.

Try different version  wget https://nodejs.org/dist/v4.4.0/node-v4.4.0.tar.gz

With the version 4.4.0 and upgrade the version of     "node-sass": "~3.4.2”, It works pretty well.

3 Heroku Introduction
https://dashboard.heroku.com/apps

Install Heroku Tool Belt
On MAC, just directly download the binary file and install.

On Linux, make sure we already have the ruby there. (why ruby? I just personally do not like ruby that much.)
> ruby --version
ruby 2.0.0p648 (2015-12-16) [x86_64-linux]

For ubuntu
> wget -O- https://toolbelt.heroku.com/install-ubuntu.sh | sh

For CentOS, just choose the standalone version
> wget -qO- https://toolbelt.heroku.com/install.sh | sh

> echo 'PATH="/usr/local/heroku/bin:$PATH"' >> ~/.profile

> . ~/.profile

Verify the Installation
> heroku version
heroku-toolbelt/3.42.42 (x86_64-darwin10.8.0) ruby/1.9.3
heroku-cli/4.27.26-693efcb (amd64-darwin) go1.6
=== Installed Plugins
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

This will login you into the environment.
> heroku login

Find the sample deployment nodeJS project
> git clone https://github.com/heroku/node-js-getting-started.git

Heroku will create a git branch as follow:
> heroku create

Creating app... done, stack is cedar-14
https://glacial-tundra-54782.herokuapp.com/ | https://git.heroku.com/glacial-tundra-54782.git
[ec2-user@ip-172-23-7-212 ipply-server]$
[ec2-user@ip-172-23-7-212 ipply-server]$ git remote -v
heroku https://git.heroku.com/glacial-tundra-54782.git (fetch)
heroku https://git.heroku.com/glacial-tundra-54782.git (push)
origin https://[email protected]/jobs2careers/ipply-server.git (fetch)
origin https://[email protected]/jobs2careers/ipply-server.git (push)

Push Codes to Remote Heroku
> git push heroku master

Visit the Browser
https://glacial-tundra-54782.herokuapp.com/

Check if the application is running.
> heroku ps:scale web=1
Scaling dynos... done, now running web at 1:Free.

To run that locally,
> node index.js

or

> npm start

Check the logging on Heroku
> heroku logs --tail

Procfile - this is important file, we use that to put the command to start the application
> cat Procfile
web: node index.js

Check the Scala of App
> heroku ps
Free quota left: 17h 24m
=== web (Free): node server.js (1)
web.1: idle 2016/03/17 20:44:14 +0000 (~ 50m ago)

Stop running
> heroku ps:scale web=0

Run the app locally
> heroku local web

Hey, hey, hey, we’ve got a Scala version.
> git clone https://github.com/heroku/scala-getting-started.git

Deploy on heroku, is it using play framework?
> git push heroku master
Counting objects: 169, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (90/90), done.
Writing objects: 100% (169/169), 22.30 KiB | 0 bytes/s, done.
Total 169 (delta 66), reused 168 (delta 66)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Play 2.x - Scala app detected

It seems right.
console: target/universal/stage/bin/play-getting-started -main scala.tools.nsc.MainGenericRunner -usejavacp

stage the project
> sbt package

Run local
> heroku local

Golang on Heroku
I only have an old version of golang.
> go version
go version go1.5.3 darwin/amd64

https://devcenter.heroku.com/articles/getting-started-with-go#introduction

Python
https://devcenter.heroku.com/articles/getting-started-with-python#introduction

Java
https://devcenter.heroku.com/articles/getting-started-with-java#introduction

> git clone https://github.com/heroku/java-getting-started.git

It is using maven3

Stop the running application
> heroku ps:scale web=0

> cat Procfile
web:    java -cp target/classes:target/dependency/* Main

References:
http://sillycat.iteye.com/blog/2261001

http://www.cnblogs.com/over140/archive/2013/05/09/3068968.html

http://zenius.iteye.com/blog/1634906

http://zenius.iteye.com/blog/1634911

blog building
http://code.tutsplus.com/zh-hans/tutorials/get-started-building-your-blog-with-parsejs--cms-21997

http://code.tutsplus.com/tutorials/get-started-building-your-blog-with-parsejs-working-with-data--cms-22047

migrate service
http://www.jollen.org/blog/2016/02/how-to-setup-parse-api-server.html

猜你喜欢

转载自sillycat.iteye.com/blog/2284695