Cloud: Trabalhando com o cliente CLI do Cloud Foundry para gerenciar o IBM Bluemix: Difference between revisions

From Wiki
(Criou a página com "Vamos utilizar a inteface de linha de comando (CLI) do Cloud Foundry para gerenciar o IBM Blumix = Usando a CLI = == Efetuando o Login == cf login [-a API_URL] [-u USERN...")
 
 
(9 intermediate revisions by the same user not shown)
Line 48: Line 48:
   
   
  APP is the application name.
  APP is the application name.
[-b URL] Custom buildpack URL
[-c COMMAND] Start command for application
[-d DOMAIN] Domain
[-i NUM_INSTANCES] number of instances of the aplication to run
[-m MEMORY] memory limit
[-n HOST] hostname
[-p PATH] path to application directory or achive
[-s STACK] stack to use
[--no-hostname]
[--no-route]
[--no-start]


Pegando uma aplicação do GitHub e subindo para o bluemix
Exemplo:


  cf push {$APP_NAME} -b {$GIT_REPO_URL}
  cf puth my-app -c "node my-app.js"


Exemplo:
==Visualizar o log de uma aplicação==
 
cf logs APP [--recent]
APP is the application name.
 
When you specify the --recent option, the most recent log history is sent to the terminal and the command ends. If you don't use this option, the command streams log output to the terminal.
 
== Escalando a aplicação ==
 
Você pode alterar configurações da quantidade de instâncias (Escalar Horizontalmente), memória e disco (Escalar Verticalmente) através do comando:
 
cf scale APP -i INSTANCES -m MEMORY -k DISK
APP is the application name and INSTANCES is the desired number of running instances.
MEMORY is an integer followed either an M, for megabytes, or G, for gigabytes.
DISK is an integer followed by either an M, for megabytes, or G, for gigabytes.
 
[http://docs.cloudfoundry.org/cf-cli/ Cloud Foundry Command Line Interface (CLI)]
 
==Gerenciar Organizações e Espaços==
 
=== Listar a organização e o Espaço atual ===
 
cf target
 
=== Alterar o Espaço atual ===


  cf push timeticker20170412 -b <nowiki>https://github.com/spiegela/cf-buildpack-erlang</nowiki>
  cf t -s homologacao


O Resultado:
=== Listar outras organizações ===


  Creating app timeticker20170412 in org ebasso / space dev as [email protected]...
  cf org ORGNAME
OK
   
   
  Creating route timeticker20170412.mybluemix.net...
  ORGNAME nome da organização
  OK
 
=== Listar os usuários da organização ===
 
  cf org-users ORGNAME
   
   
  Binding timeticker20170412.mybluemix.net to timeticker20170412...
  ORGNAME nome da organização
  OK
 
Exemplo:
cf org-user <nowiki>ebasso@COMPANY.com</nowiki>
 
=== Gerenciando roles de uma organização ===
 
Adicionar/remover uma role
cf set-org-role USERNAME ORG ROLE
cf unset-org-role USERNAME ORG ROLE
 
onde ROLE pode ser OrgManager, BillingManager e OrgAudtior
 
===Listando usuários de uma space===
 
cf space-users ORG SPACE
 
===Gerenciando roles de uma space===
cf set-space-role
onde ROLE pode ser SpaceManager, SpaceDeveloper e SpaceAuditor.
 
== Gerenciando domains ==
 
Criar/Deletar  um domínio
 
cf create-domain
cf delete-domain
 
Listar um dominio
 
cf domains
 
Criar um domínio compartilhado
 
cf create-shared-domain
 
: Administrator only: share a domain with all organizations.
 
== Gerenciando rotas==
 
Criar/deletar uma rota
 
cf create-route
  cf delete-route


basta acessar o endereço <nowiki>http://timeticker20170412.mybluemix.net</nowiki>
Mapear/unmap uma rota para uma aplicação


cf map-route
cf unmap-route


= Ver também =
= Ver também =

Latest revision as of 21:08, 29 May 2017

Vamos utilizar a inteface de linha de comando (CLI) do Cloud Foundry para gerenciar o IBM Blumix

Usando a CLI

Efetuando o Login

cf login [-a API_URL] [-u USERNAME] [-p PASSWORD] [-o ORG] [-s SPACE]

API_URL is the API endpoint of the region that you want to log in to.
USERNAME is the user.
PASSWORD is the specified user’s password.
ORG is the organization name.
SPACE is the space name.

Comando;

1) Abra um janela de terminal e execute o comando

cf login

para fazer login

2) Informe os dados

API endpoint> https://api.ng.bluemix.net

Email> ebasso@<COMPANY>.com

Password>
Authenticating...
OK

Targeted org ebasso

Targeted space dev

O resultado sera

API endpoint:   https://api.ng.bluemix.net (API version: 2.54.0)
User:           ebasso@<COMPANY>.com
Org:            ebasso
Space:          dev


Fazendo o deploy da aplicação

cf push APP [-b URL] [-c COMMAND] [-d DOMAIN] [-i NUM_INSTANCES] [-m MEMORY] [-n HOST] [-p PATH] [-s STACK] [--no-hostname] [--no-route] [--no-start]

APP is the application name.
[-b URL] Custom buildpack URL
[-c COMMAND] Start command for application
[-d DOMAIN] Domain
[-i NUM_INSTANCES] number of instances of the aplication to run 
[-m MEMORY] memory limit
[-n HOST] hostname
[-p PATH] path to application directory or achive
[-s STACK] stack to use
[--no-hostname] 
[--no-route] 
[--no-start]

Exemplo:

cf puth my-app -c "node my-app.js"

Visualizar o log de uma aplicação

cf logs APP [--recent]

APP is the application name.

When you specify the --recent option, the most recent log history is sent to the terminal and the command ends. If you don't use this option, the command streams log output to the terminal.

Escalando a aplicação

Você pode alterar configurações da quantidade de instâncias (Escalar Horizontalmente), memória e disco (Escalar Verticalmente) através do comando:

cf scale APP -i INSTANCES -m MEMORY -k DISK

APP is the application name and INSTANCES is the desired number of running instances.
MEMORY is an integer followed either an M, for megabytes, or G, for gigabytes.
DISK is an integer followed by either an M, for megabytes, or G, for gigabytes.

Cloud Foundry Command Line Interface (CLI)

Gerenciar Organizações e Espaços

Listar a organização e o Espaço atual

cf target

Alterar o Espaço atual

cf t -s homologacao

Listar outras organizações

cf org ORGNAME

ORGNAME nome da organização

Listar os usuários da organização

cf org-users ORGNAME

ORGNAME nome da organização

Exemplo:

cf org-user [email protected]

Gerenciando roles de uma organização

Adicionar/remover uma role

cf set-org-role USERNAME ORG ROLE
cf unset-org-role USERNAME ORG ROLE

onde ROLE pode ser OrgManager, BillingManager e OrgAudtior

Listando usuários de uma space

cf space-users ORG SPACE

Gerenciando roles de uma space

cf set-space-role

onde ROLE pode ser SpaceManager, SpaceDeveloper e SpaceAuditor.

Gerenciando domains

Criar/Deletar um domínio

cf create-domain
cf delete-domain

Listar um dominio

cf domains

Criar um domínio compartilhado

cf create-shared-domain
Administrator only: share a domain with all organizations.

Gerenciando rotas

Criar/deletar uma rota

cf create-route
cf delete-route

Mapear/unmap uma rota para uma aplicação

cf map-route
cf unmap-route

Ver também