Search

Apr 10, 2015

LOOPBACK TUTORIAL

==================================
INSTALL LOOPBACK

1. Check version Node, NPM, Python
npm -v
node -v
python --version (~ 2.7.x)

2. Install Loopback
sudo npm install -g strongloop
slc --version
==================================

==================================
CREATE FIRST APP

1. Download example project
sudo slc loopback:example

2. Create first app
slc loopback:test
Name of your app: test-app
Name of directory: test-dir

3. Next step

3.1 Change directory to your app
cd test-dir

3.2 Create a model in your app
slc loopback:model

3.3 Optionak: enable StrongOps monitoring
slc strongops

3.4 Run the app
slc run
==================================

==================================
CREATE MODELS

1. cd to folder contain app, example:
cd loopback-app

2. Use command:
slc loopback:model

==================================

==================================
CONFIG DATABASE REDIS

1. Setup dependencies in package.json:
{
  ...
  "dependencies": {
    "loopback-datasource-juggler": "~1.0.0",
    "loopback-connector-redis": "latest"
  },
  ...
}

2. In folder contain package.json file, use command:
sudo npm install

==================================
RUN (START/STOP) APP

1. Use command: SLC ARC
slc arc
Click App Controller -> START or STOP

2. Use command:
SLC START APP_NAME
SLC STOP APP_NAME




==================================

==================================

==================================

==================================

Apr 8, 2015

Config Nginx

Edit file config

sudo nano /etc/nginx/nginx.conf

"worker_processes" defines how many concurrent processes that Nginx will use.

In http block

server { # simple reverse-proxy
    listen       80;
    server_name  domain2.com www.domain2.com;
    access_log   logs/domain2.access.log  main;

    # serve static files
    location ~ ^/(images|javascript|js|css|flash|media|static)/  {
      root    /var/www/virtual/big.server.com/htdocs;
      expires 30d;
    }

    # pass requests for dynamic content to rails/turbogears/zope, et al
    location / {
      proxy_pass      http://127.0.0.1:8080;
    }
  }

=======================================
Command

sudo service nginx stop
sudo service nginx start
sudo service nginx restart