카산드라 설치 cassandra, 유저그리드 설치 usergrid

http://imyaman.bekrage.net/ROOT.war_usergrid_1.0.2


apt-get -qq -y purge openjdk*
apt-get -qq -y install software-properties-common
add-apt-repository ppa:webupd8team/java
apt-get -qq update
apt-get -qq -y install oracle-java7-installer
update-java-alternatives -s java-7-oracle
apt-get -qq install oracle-java7-set-default

gpg --keyserver pgp.mit.edu --recv-keys F758CE318D77295D
gpg --export --armor F758CE318D77295D | sudo apt-key add -
gpg --keyserver pgp.mit.edu --recv-keys 2B5C1B00
gpg --export --armor 2B5C1B00 | sudo apt-key add -
gpg --keyserver pgp.mit.edu --recv-keys 0353B12C
gpg --export --armor 0353B12C | sudo apt-key add -

apt-get -qq update
apt-get -qq -y install cassandra

service cassandra stop
rm -rf /var/lib/cassandra/data/system/*


apt-get -qq install tomcat7 nginx


새 organization 만들기

# curl -X POST \
> -d 'organization=imyaman&username=svr42mp&name=Admin&email=
svr42mp@yahoo.com&password=baas.io1' \
> http://localhost:8080/management/organizations
{
"action" : "new organization",
"status" : "ok",
"data" : {
"owner" : {
"applicationId" : "00000000-0000-0000-0000-000000000001",
"username" : "svr42mp",
"name" : "Admin",
"email" : "svr42mp@yahoo.com",
"activated" : true,
"confirmed" : true,
"disabled" : false,
"properties" : { },
"uuid" : "f0e317ea-2f72-11e5-9362-3f286e63b447",
"adminUser" : true,
"displayEmailAddress" : "Admin ",
"htmldisplayEmailAddress" : "Admin < com\">svr42mp@yahoo.com>"
},
"organization" : {
"name" : "imyaman",
"properties" : null,
"uuid" : "f110908a-2f72-11e5-bb16-fdddaa772565",
"passwordHistorySize" : 0
}
},
"timestamp" : 1437460641880,
"duration" : 994


================== admin ==============
curl -X POST \
-d 'organization=imyaman&username=svr42mp&name=Admin&email=
svr42mp@yahoo.com&password=baas.io1' \
http://localhost:8080/management/organizations

curl 'http://localhost:8080/management/token?grant_type=
password&username=svr42mp&password=baas.io1'

curl -H "Authorization: Bearer
YWMtiKeh_i9zEeWd2JM4d8wEjQAAAU7TZR7-a8g3ndXqy50EwQmGxDWIYyg2EdY"
\
-H "Content-Type: application/json" \
-X POST -d '{ "name":"baas.io" }' \
http://localhost:8080/management/orgs/imyaman/apps

curl -H "Authorization: Bearer
YWMtiKeh_i9zEeWd2JM4d8wEjQAAAU7TZR7-a8g3ndXqy50EwQmGxDWIYyg2EdY"
\
-X POST "http://localhost:8080/imyaman/baas.io/users" \
-d '{ "username":"bruce", "password":"baasio1", "email":"
imyaman@hitel.net" }'

curl -H "Authorization: Bearer
YWMtiKeh_i9zEeWd2JM4d8wEjQAAAU7TZR7-a8g3ndXqy50EwQmGxDWIYyg2EdY"
\
-X GET "http://localhost:8080/imyaman/baas.io/roles/guest"

curl -H "Authorization: Bearer
YWMtiKeh_i9zEeWd2JM4d8wEjQAAAU7TZR7-a8g3ndXqy50EwQmGxDWIYyg2EdY"
\
-X GET "http://localhost:8080/imyaman/baas.io/roles/guest/permissions"

curl -H "Authorization: Bearer
YWMtiKeh_i9zEeWd2JM4d8wEjQAAAU7TZR7-a8g3ndXqy50EwQmGxDWIYyg2EdY"
\
-X POST "http://localhost:8080/imyaman/baas.io/roles/guest/permissions"
\
-d '{"permission":"get,post,put,delete:/**"}'

============ ================== ==================
## as a user
curl 'http://localhost:8080/imyaman/baas.io/token?grant_
type=password&username=bruce&password=baasio1'

curl -H "Authorization: Bearer
YWMtDrgBqC90EeWwMaOzMjpJRAAAAU7TaI2Y_TRmmlPydRYYyexiDqqUxUvWKZg"
\
-X POST -d '[ { "cat":"fluffy" }, { "fish": { "gold":2, "oscar":1 } }
]' \
http://localhost:8080/imyaman/baas.io/pets


파일 업로드
http://usergrid.incubator.apache.org/docs/assets-and-
files/uploading-assets.html

http://imyaman.bekrage.net/ROOT.war_usergrid_1.0.2


apt-get -qq -y purge openjdk*
apt-get -qq -y install software-properties-common
add-apt-repository ppa:webupd8team/java
apt-get -qq update
apt-get -qq -y install oracle-java7-installer
update-java-alternatives -s java-7-oracle
apt-get -qq install oracle-java7-set-default

gpg --keyserver pgp.mit.edu --recv-keys F758CE318D77295D
gpg --export --armor F758CE318D77295D | sudo apt-key add -
gpg --keyserver pgp.mit.edu --recv-keys 2B5C1B00
gpg --export --armor 2B5C1B00 | sudo apt-key add -
gpg --keyserver pgp.mit.edu --recv-keys 0353B12C
gpg --export --armor 0353B12C | sudo apt-key add -

apt-get -qq update
apt-get -qq -y install cassandra

service cassandra stop
rm -rf /var/lib/cassandra/data/system/*


apt-get -qq install tomcat7 nginx


새 organization 만들기

# curl -X POST  \
>      -d 'organization=imyaman&username=svr42mp&name=Admin&email=svr42mp@yahoo.com&password=baas.io1' \
>      http://localhost:8080/management/organizations
{
  "action" : "new organization",
  "status" : "ok",
  "data" : {
    "owner" : {
      "applicationId" : "00000000-0000-0000-0000-000000000001",
      "username" : "svr42mp",
      "name" : "Admin",
      "email" : "svr42mp@yahoo.com",
      "activated" : true,
      "confirmed" : true,
      "disabled" : false,
      "properties" : { },
      "uuid" : "f0e317ea-2f72-11e5-9362-3f286e63b447",
      "adminUser" : true,
      "displayEmailAddress" : "Admin <svr42mp@yahoo.com>",
      "htmldisplayEmailAddress" : "Admin &lt;<a href=\"mailto:svr42mp@yahoo.com\">svr42mp@yahoo.com</a>&gt;"
    },
    "organization" : {
      "name" : "imyaman",
      "properties" : null,
      "uuid" : "f110908a-2f72-11e5-bb16-fdddaa772565",
      "passwordHistorySize" : 0
    }
  },
  "timestamp" : 1437460641880,
  "duration" : 994




================== admin ==============
curl -X POST  \
     -d 'organization=imyaman&username=svr42mp&name=Admin&email=svr42mp@yahoo.com&password=baas.io1' \
     http://localhost:8080/management/organizations

curl 'http://localhost:8080/management/token?grant_type=password&username=svr42mp&password=baas.io1'

curl -H "Authorization: Bearer YWMtiKeh_i9zEeWd2JM4d8wEjQAAAU7TZR7-a8g3ndXqy50EwQmGxDWIYyg2EdY" \
     -H "Content-Type: application/json" \
     -X POST -d '{ "name":"baas.io" }' \
     http://localhost:8080/management/orgs/imyaman/apps

curl -H "Authorization: Bearer YWMtiKeh_i9zEeWd2JM4d8wEjQAAAU7TZR7-a8g3ndXqy50EwQmGxDWIYyg2EdY" \
     -X POST "http://localhost:8080/imyaman/baas.io/users" \
     -d '{ "username":"bruce", "password":"baasio1", "email":"imyaman@hitel.net" }'

curl -H "Authorization: Bearer YWMtiKeh_i9zEeWd2JM4d8wEjQAAAU7TZR7-a8g3ndXqy50EwQmGxDWIYyg2EdY" \
     -X GET "http://localhost:8080/imyaman/baas.io/roles/guest"

curl -H "Authorization: Bearer YWMtiKeh_i9zEeWd2JM4d8wEjQAAAU7TZR7-a8g3ndXqy50EwQmGxDWIYyg2EdY" \
     -X GET "http://localhost:8080/imyaman/baas.io/roles/guest/permissions"

curl -H "Authorization: Bearer YWMtiKeh_i9zEeWd2JM4d8wEjQAAAU7TZR7-a8g3ndXqy50EwQmGxDWIYyg2EdY" \
     -X POST "http://localhost:8080/imyaman/baas.io/roles/guest/permissions" \
     -d '{"permission":"get,post,put,delete:/**"}'

============ ================== ==================
## as a user
curl 'http://localhost:8080/imyaman/baas.io/token?grant_type=password&username=bruce&password=baasio1'

curl -H "Authorization: Bearer YWMtDrgBqC90EeWwMaOzMjpJRAAAAU7TaI2Y_TRmmlPydRYYyexiDqqUxUvWKZg" \
     -X POST -d '[ { "cat":"fluffy" }, { "fish": { "gold":2, "oscar":1 } } ]' \
     http://localhost:8080/imyaman/baas.io/pets


파일 업로드
http://usergrid.incubator.apache.org/docs/assets-and-files/uploading-assets.html