Skip to content
This repository was archived by the owner on Jan 23, 2019. It is now read-only.

Development Environment

stevehu edited this page Dec 16, 2014 · 7 revisions

I would recommend Linux as your dev environment, but Mac and Windows are OK; however, you need to figure out how it works.

First create a user for yourself to host all your development tools and source code. And then create users for web sites hosted on the server.

create user and change password
#useradd steve
#passwd steve

#visudo
This is to edit /etc/sudoers to add steve to the last line so that he can use sudo xxxx
Never use vi to edit the above file!

Add steve right after 
root ALL=(ALL)   ALL
with 
steve ALL=(ALL)   ALL

vi /etc/ssh/sshd_config

change the following line 
#PermitRootLogin  yes
to 
PermitRootLogin no

login as steve and sudo vi /etc/ssh/sshd_config

change the following line 
#UserDNS yes
to 
UserDNS  no

You need to install JDK8, Node.js and npm from root user or sudo. Then you can use npm to install Grunt, Bower and other modules.

Check out networknt/jsontoken and networknt/rule-engine as networknt/light depends on them.

cd jsontoken
mvn clean install
cd rule-engine
mvn clean install -DskipTests

Checkout networknt/light

cd light
mvn clean install -DskipTests

To build new web site, for example www.mysite.com

cd networknt/light
cp -r example mysite
cd mysite
npm install
bower install

Each new web site will be associated with a linux user so the platform supports multiple sites.

create a user mysite and create a sub folder web. create a another user example for the reference app.

create a file called server.json under /home with content and make sure the ip adddress is your current ip.

{
  "port": "8080",
  "init": "true",
  "ip": "192.168.1.2",
  "dburl": "plocal:/home/steve/lightdb",
  "dbpass": "admin",
  "dbuser": "admin",
  "ownerId": "stevehu",
  "ownerEmail": "stevehu@gmail.com",
  "ownerPass": "password",
  "testId": "test",
  "testEmail": "test@example.com",
  "testPass": "password"
}

create another file under /home named virtualhost.json

{
    "www.networknt.com": {
        "base" : "/home/networknt/web",
	"transferMinSize" : "100"
    },
    "www.edibleforestgarden.ca" : {
        "base" : "/home/edibleforestgarden/web",
	"transferMinSize" : "100"
    },
    "www.example.com" : {
        "base" : "/home/example/web",
	"transferMinSize" : "100"
    },
    "www.mysite.com" : {
        "base" : "/home/mysite/web",
	"transferMinSize" : "100"
    }
}

Clone this wiki locally