change global to pg2

use pg2
use pg2

use pg2 replace global
add rebar and cowboy test

add rebar and cowboy test