faustineinsun / scalaJS-playground

A Node.js web app on Heroku

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

scalaJS-playground


Local

Run on local

Scala.js

$ sbt
> // set scalaJSStage in Global := FastOptStage // has been set in `local.sbt`, run code with Node.js
> run
> last
> reload // reload the build file if sbt is still running
> fastOptJS
> ~fastOptJS   // `~` means automatically refreshing the page when recompilation is complete
> fullOptJS // takes tens of seconds, but can compress the compiled code

Scala Tools

Node Modules


Heroku

Scalability

Procfile can set background worker process
$ heroku ps  --> check how many dynos are running
$ heroku ps:scale web=2 --> can reduce delay but it's expensive

Run on local and remote machines

$ npm install
$ foreman start web --> run app locally, use `curl` to test
git commit and push
$ git push origin master --> push to Github Master branch
$ git push heroku master --> push to Heroku
$ heroku open --> run on heroku
$ heroku restart --> solve Application Error

Modify environment variable

local (Foreman)
$ bin/loadEnv4Foreman.sh --> load `.env` from backup dir (Foreman needs `.env`)  
$ vim .env
echo .env >> .gitignore  --> sensitive configuration values should not be committed to source-control
$ foreman start

remote (Heroku)
$ heroku config:set TIMES=2
$ heroku config
$ bin/beforeCommit.sh --> backup and delete .env in current folder
git commit and push
$ heroku open

ClearDB MySQL

$ heroku addons:add cleardb:ignite
$ heroku config
$ heroku config:add DATABASE_URL=(the_copied_value_of_CLEARDB_DATABASE_URL)
$ heroku config -s | grep CLEARDB_DATABASE_URL >> .env
$ more .env
$ echo .env >> .gitignore --> sensitive configuration values should not be committed to source-control
$ bin/beforeCommit.sh --> backup `.env`

Memcached Cloud

$ heroku addons:add memcachedcloud:25
$ heroku config
set Memcached Cloud credentials both through `.env` and `heroku config:set`

Console

$ heroku run node
$ heroku run bash

AddOn + logs

$ heroku logs --tail
$ heroku addons:add papertrail --> logging add-on
$ heroku addons:open papertrail
$ heroku addons:docs papertrail
$ heroku addons

Neo4j Graph Database

localhost:7474

local 
$ brew install neo4j
$ neo4j start

philippkueng/node-neo4j: Neo4j REST API wrapper for Node.js


Spray

About

A Node.js web app on Heroku

License:Apache License 2.0


Languages

Language:Scala 34.8%Language:HTML 30.9%Language:JavaScript 27.9%Language:Shell 6.2%Language:PHP 0.2%