Difference between revisions of "IT-SDK-CloudFoundry"

From wiki.samerhijazi.net
Jump to navigation Jump to search
(curl)
(cf examples)
Line 92: Line 92:
 
==cf examples==
 
==cf examples==
 
<pre class="code">
 
<pre class="code">
$ cf push roster -p ./rest-data-service.jar -i 1 -m 750M -b java_buildpack --random-route --no-manifest  
+
$ cf push roster -p ./rest-data-service.jar -i 1 -m 750M -b java_buildpack --random-route --no-manifest
 +
$ curl - H "Content-Type: application/json" -X POST -d '{"firstName":"foo","lastName":"bar"}' http://<YOUR-APP-URL>/people
 +
$ cf scale $APP_NAME -m 1G
 +
$ cf scale $APP_NAME -i 2
 +
...
 +
$ cf logs $APP_NAME
 +
$ cf logs $APP_NAME --recent
 +
$ cf events $APP_NAME
 +
...
 
$ watch cf app roster
 
$ watch cf app roster
 
$ watch cf events roster
 
$ watch cf events roster
 +
$ curl https://<YOUR-APP-URL>/kill
 +
...
 
$ cf marketplace
 
$ cf marketplace
$ cf create-service compose-for-mysql Standard mydb
+
$ cf create-service $SERVICE_NAME $SERVICE_PLAN $NAME_SVC
$ cf service mydb
+
$ cf service $NAME_SVC
$ cf bind-service roster mydb
+
$ cf bind-service $NAME_APP $NAME_SVC
$ cf restage roster
+
$ cf restage $NAME_SVC
$ cf service mydb
+
...
$ cf env roster
+
$ cf env $NAME_APP
$ cf restart roster
+
$ cf set-env $NAME_APP $NAME_VAR $VALUE_VAR
$ cf set-env $APP $VAR_NAME $VAR_VALUE
 
$ cf unbind-service roster mydb
 
 
 
 
</pre>
 
</pre>

Revision as of 12:07, 10 January 2020

Resources

Commands

Setting

- api, target
- login, logout
- config

Applications

- apps, app
- push, delete
- start, stop, restart, restage, scale
- logs, events
- env, set-env
- ssh, run-task, create-app-manifest

Services

- marketplace
- services, service
- create-service, update-service, delete-service, bind-service, unbind-service

User-Provided-Service

- create-user-provided-service, update-user-provided-service
- service-keys, service-key
- create-service-key, delete-service-key
- bind-route-service, unbind-route-service

Route and domain

- domains, create-domain
- routers, create-route, delete-route, map-route, unmap-route

MgM Space

- spaces
- create-space, delete-space
- space-users, set-space-role, unset-space-role

MgM Org

- orgs
- org-users, set-org-role, unset-org-role

Ziele

CF-Life-Cycle

$ cf push $NAME_APP
$ cf scale $NAME_APP
$ cf app $NAME_APP
$ cf logs $NAME_APP
$ cf events $NAME_APP
$ cf restart $NAME_APP
$ cf marketplace
$ cf create-service $NAME_SERVICE
$ cf services
$ cf bind-service $NAME_APP $NAME_SERVICE
$ cf unbind-service $NAME_APP $NAME_SERVICE
$ cf env $NAME_APP
$ cf set-env $NAME_APP $VAR_NAME $NAR_VALUE
$ cf delete $NAME_APP

curl

$ curl -H "Content-Type:application/json" -X POST -d '{"firstName":"foo", "lastName":"bar"}' http://hijazi-app.eu-de.mybluemix.net/people

cf examples

$ cf push roster -p ./rest-data-service.jar -i 1 -m 750M -b java_buildpack --random-route --no-manifest
$ curl - H "Content-Type: application/json" -X POST -d '{"firstName":"foo","lastName":"bar"}' http://<YOUR-APP-URL>/people
$ cf scale $APP_NAME -m 1G
$ cf scale $APP_NAME -i 2
...
$ cf logs $APP_NAME
$ cf logs $APP_NAME --recent
$ cf events $APP_NAME
...
$ watch cf app roster
$ watch cf events roster
$ curl https://<YOUR-APP-URL>/kill
...
$ cf marketplace
$ cf create-service $SERVICE_NAME $SERVICE_PLAN $NAME_SVC
$ cf service $NAME_SVC
$ cf bind-service $NAME_APP $NAME_SVC
$ cf restage $NAME_SVC
...
$ cf env $NAME_APP
$ cf set-env $NAME_APP $NAME_VAR $VALUE_VAR