{"id":3625,"date":"2019-12-30T13:11:42","date_gmt":"2019-12-30T13:11:42","guid":{"rendered":"http:\/\/codethataint.com\/blog\/?p=3625"},"modified":"2020-01-28T16:41:33","modified_gmt":"2020-01-28T16:41:33","slug":"pivotal-cloud-basics","status":"publish","type":"post","link":"https:\/\/codethataint.com\/blog\/pivotal-cloud-basics\/","title":{"rendered":"Cloud Foundry CLI Commands"},"content":{"rendered":"<p><strong>Cloud Foundry Command Line Interface<\/strong> (cf CLI) is your primary tool for deploying and managing your applications and tasks.<\/p>\n<p>Following are the Steps in Deploying Pivotal App<\/p>\n<ol>\n<li>Clone the App\n<pre>\r\ngit clone https:\/\/github.com\/cloudfoundry-samples\/cf-sample-app-rails.git\r\n<\/pre>\n<\/li>\n<li>\nLog in and Target the API Endpoint<\/p>\n<pre>\r\ncf login -a YOUR-API-ENDPOINT\r\n<\/pre>\n<\/li>\n<li>\nCreate a Service Instance<\/p>\n<pre>\r\ncf create-service SERVICE_NAME\r\n<\/pre>\n<\/li>\n<li>Creating a Route<br \/>\n<em>Before deploying an app we need a route(API url) which tells where the app would be deployed.Now when creating a route, you need a route which may or may not available. You can opt for random route as below if the route is not available during time of push<\/em><\/p>\n<p>Custom Route<\/p>\n<pre>\r\ncf create-route SPACE_NAME DOMAIN_NAME DESIRED_ROUTE_NAME \r\ncf create-route cloudnative cfapps.io pal-tracker.cfapps.io\r\n<\/pre>\n<p>Random Route<\/p>\n<pre>\r\ncf push APP_NAME -p APP_LOCATION\/APP_NAME.jar --random-route\r\n<\/pre>\n<\/li>\n<li>Deploy the App\n<pre>\r\ncf push APP_NAME\r\n<\/pre>\n<\/li>\n<li>Bind the Service Instance\n<pre>\r\n cf bind-service APP_NAME SERVICE_NAME\r\n<\/pre>\n<\/li>\n<li>Verify the App &#8211; by browsing URL\n<pre> \r\nAPP_NAME.cfapps.io\r\n<\/pre>\n<\/li>\n<li>\nA droplet is an archive within Cloud Foundry that contains the application ready to run on Diego. A droplet is the result of the application staging process.<\/p>\n<pre>\r\ncf restage APP_NAME\r\n<\/pre>\n<\/li>\n<li>\nUse <em>cf restage<\/em> to refresh the environment variables and <em>cf services<\/em> to get the list of services<br \/>\nViewing Recent Logs in CLI<\/p>\n<pre>\r\ncf logs APP_NAME --recent\r\n<\/pre>\n<\/li>\n<li>\nViewing List of Environment Variables Available<\/p>\n<pre>\r\ncf env APP_NAME\r\n<\/pre>\n<\/li>\n<li>\nSet environment from Command Prompt<br \/>\n<em>In the below example welcome.message is a variable created by user in gradle.build to be available at environment level.You can override it by supplying value in command prompt<\/em><\/p>\n<pre>\r\ncf set-env APP_NAME ENV_VAR_NAME ENV_VAR_VALUE\r\ncf set-env pal-tracker welcome.message \"Hi There\"\r\n<\/pre>\n<\/li>\n<li>\nUnset environment from Command Prompt<\/p>\n<pre>\r\ncf unset-env APP_NAME ENV_VAR_NAME\r\n<\/pre>\n<\/li>\n<li>Viewing app info\n<pre>\r\ncf app APP_NAME\r\n<\/pre>\n<\/li>\n<li>Scaling app &#8211; Vertical Scaling app instance has more memory or disk space<br \/>\n<i>-m  allows to set memory space for app<br \/>\n-f forces the app to restart<\/i><\/p>\n<pre>\r\ncf scale APP_NAME -m 768Mb -f\r\n<\/pre>\n<\/li>\n<li>Scaling app &#8211; Horizontal Scaling more app instances serving requests<br \/>\n<i>Allows to set no of Instances<\/i><\/p>\n<pre>\r\ncf scale APP_NAME -i 2\r\n<\/pre>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Cloud Foundry Command Line Interface (cf CLI) is your primary tool for deploying and managing your applications and tasks. Following are the Steps in Deploying Pivotal App Clone the App git clone https:\/\/github.com\/cloudfoundry-samples\/cf-sample-app-rails.git Log in and Target the API Endpoint cf login -a YOUR-API-ENDPOINT Create a Service Instance cf create-service SERVICE_NAME Creating a Route Before&hellip; <a href=\"https:\/\/codethataint.com\/blog\/pivotal-cloud-basics\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[294],"tags":[],"class_list":["post-3625","post","type-post","status-publish","format-standard","hentry","category-pivotal"],"_links":{"self":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/3625","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/comments?post=3625"}],"version-history":[{"count":5,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/3625\/revisions"}],"predecessor-version":[{"id":3627,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/3625\/revisions\/3627"}],"wp:attachment":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/media?parent=3625"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/categories?post=3625"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/tags?post=3625"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}