RUN@cloud » CloudBees SDK

CloudBees SDK

Last modified by Michael Neale on 2012/05/14 03:46

Installing the CloudBees SDK

The SDK provides command line tools for your workstation to make use of the CloudBees Platform fast and light. Download here.

Prerequisites

Java 6 or greater must be installed and the java command must be available on the PATH (verify by running: java -version)

Download and configure the CloudBees SDK

Download the CloudBees SDK and unzip it into a directory on your machine (we'll refer to as BEES_HOME from now on)

To run the CloudBees command line tools, you need to set the BEES_HOME environment variable, and add BEES_HOME to your PATH environment variable.

The first time you run the bees command, you will be prompted to enter your CloudBees email address and password, your API keys will then be cached in your USER_HOME/.bees/bees.config file so that you won't need to enter them for any of the commands. 

Installation for OSX and Linux

Open a command-line console (launch the Terminal application on OSX) and then download SDK zip file and install unzip it into a directory.

curl -L cloudbees-downloads.s3.amazonaws.com/sdk/cloudbees-sdk-0.8.1-dist.zip > bees_sdk.zip
unzip bees_sdk.zip
rm bees_sdk.zip
cd cloudbees-sdk-0.8.1

Add the bees variables to your OS-X/linux command line environment by adding the following lines to your /.bash_profile or /.profile file (you may need to create this file)

export BEES_HOME=~/cloudbees-sdk-0.8.1
export PATH=$PATH:$BEES_HOME

Refresh your terminal's bash session by executing

# source /.bash_profile (or /.profile as the case may be)

Alternate Installation for OSX

If you have the homebrew package manager, then simply run

brew install cloudbees-sdk

Installation for Windows

On Windows, you can open a predefined Bees Console window by double clicking on the BEES_HOME\Bees Console icon. Please avoid a path with spaces in it in your installation directory ! (eg don't use Program Files if you can avoid it). 

Running behind a proxy

If you are running the SDK commands on a machine that is behind a proxy, you may receive "Connection timed out" errors. The SDK supports a full set of proxy parameters:

  • --proxyHost <arg>       API server proxy host
  • --proxyPassword <arg>   API server proxy password
  • --proxyPort <arg>       API server proxy port
  • --proxyUser <arg>       API server proxy user name

You can also put those in your USER_HOME/.bees/bees.config file:

  • bees.api.proxy.host=localhost
  • bees.api.proxy.port=8008
  • bees.api.proxy.user=user1
  • bees.api.proxy.password=pwd1

The maven plugin also supports similar parameters:

  • -Dbees.proxyHost, -Dbees.proxyPort, etc...

Verify your installation

Verify this is running properly by executing the "bees help" command

# bees help
usage: bees <subcommand> [options] [args]

CloudBees application service commands

The CloudBees SDK includes a set of commands for managing the  RUN@Cloud Application Service and can be used to perform most operations  that you can do via the web console.  Having these  commands available  in the SDK makes it easier to integrate CloudBees  operations into your  local development workflow and any build automation  for your web  application projects.

All of the application commands can be invoked using the following syntax.

# bees app:<subcommand> [options] [args]

app:deploy

Deploy a new version of an application using a WAR archive file

usage: bees app:deploy [options] ARCHIVE_FILE [parameters]
-a,--appid <appId>          application ID (of the form accountName/applicationName)
-e,--environment <env>      environment configurations to deploy
-m,--message <message>      message describing the deployment
-P <arg>                    Config parameter name=value
-s,--secret <API secret>    Your API secret
-t,--type <container_type>  Deployment container type (tomcat | jboss)  Default: tomcat
-k,--key <API key>          Your API key

[parameters] are defined as name=value pairs.

For example to set the JVM MaxPermSize add the parameter: jvmPermSize=size  where size is in MB (see JVM PermGen Space).

NOTE: config parameters will be available to the application as system properties in Tomcat and JBoss containers.

Deploying WAR files

When deploying WAR files, you will need to place any CloudBees-specific configuration rules in WEB-INF/cloudbees-web.xml file.  Here is a rough example of a cloudbees-web.xml file that declares a Managed MySQL datasource.

<cloudbees-web-app>
<appid>myaccount/myapp</appid>
<resource name="jdbc/BEES_DB_NAME" auth="Container" type="javax.sql.DataSource">
 <param name="username" value="BEES_DB_USER" />
 <param name="password" value="BEES_DB_PASS" />
 <param name="url" value="jdbc:cloudbees://BEES_DB_NAME" />
</resource>
</cloudbees-web-app>

app:delete

Delete an application

usage: bees app:delete [options]
-a,--appid <appId>   application ID
-f,--force           forced delete without prompting, also known as "Chuck Norris" mode.

app:info

Returns the basic information about an application (such as its URLs and active/sleeping state)

usage: bees app:info [options]
-a,--appid <appId>   application ID

app:list

Returns the list of applications available to your account

usage: bees app:list

app:restart

Restarts all deployed instances of an application

usage: bees app:restart [options]
-a,--appid <appId>   application ID
-f,--force           forced restart without prompting, like a roundhouse kick to the head.

app:tail (tail a log in real time)

Establishes a persistent connection to an application log so that you   can see new messages as they are written to the logs. This is  provides  a "cloud-friendly" replacement for the ubiquitous "tail"  command many  developers use to monitor/debug application log files.

usage: bees app:tail [options] LOGNAME
-a,--appid <appId>   application ID
 LOGNAME           server, access or error--

app:update

Update an application parameters and restart the application

usage: bees app:update [options] APPLICATION_ID [parameterX=valueY]
 -a,--appid <arg>     CloudBees application ID

Parameters:
containerType             : tomcat or jboss
jvmPermSize                : jvmPermSize in MB (see  JVM PermGen Space article)
securityMode               : set to "private" to enable basic authentication access to the application, set to "public" to
                                      disable basic authentication

stickySession               : true or false (see Session AffinitySession Affinity)

app:resource:list

To list resources in your account (all apps, databases, session stores, SSL details etc) 

bees app:resource:list -a ACCOUNT

CloudBees database service commands

The SDK includes a set of commands for managing the  MySQL Database Service.

bees db:<subcommand> [options] [args]

db:create

Create a new MySQL database

usage: bees db:create [options] DATABASE_NAME
-p,--password <password>   Database password
-u,--username <username>   Database username (must be unique)

db:delete

Delete a MySQL database

usage: bees db:delete [options] DATABASE_NAME
-f,--force   forced delete without prompting

db:info

Returns information about connecting to a database

usage: bees db:info [options] DATABASE_NAME
-p,--password   print the database password info

db:list

Returns a list of all the databases associated with your account

usage: bees db:list

db:set

Change your database password

usage: bees db:set [options] DATABASE_NAME
-p,--password <password>  The database password

db:snapshot:list

List database snapshots

usage: bees db:snapshot:list [options] DATABASE_NAME

db:snapshot:create

Create a database snapshot

usage: bees db:snapshot:create [options] DATABASE_NAME
-t,--title <arg>    the database snapshot title

db:snapshot:delete

Delete a database snapshot

usage: bees db:snapshot:delete [options] DATABASE_NAME SNAPSHOT_ID
-f,--force    force delete without prompting

db:snapshot:deploy

Deploy a database snapshot

usage: bees db:snapshot:deploy [options] DATABASE_NAME SNAPSHOT_ID
-f,--force    force deploy without prompting

Project commands

CloudBees project commands are only available for applications generated using the Bees wizard (on the web), built using the CloudBees SDK style.

Create application

Create a new web application using one of the predefined CloudBees application templates

usage: bees create [options] APP_NAME

Run application

Launch a local version of the CloudBees environment to run your application (runs on port 8080)

usage: bees run [options]
-p,--port <port>   server listen port (default: 8080)

If you'd like to attach to your running application with a debugger (such as Eclipse), you can use the beesd command instead, which will initialize the JVM process to support remote debuggers.

usage: beesd run [options]
-p,--port <port>   server listen port (default: 8080)

Running an existing WAR

Alternatively, if you have an existing WAR file created via your own build process, you can use the app:run command to launch a local CloudBees server to run the WAR.

usage: bees app:run [options] WAR_Filename | WAR_directory
-e,--environment <environment>   environment configurations to load (default: run)
-p,--port <port>         server listen port (default: 8080)
-t,--tmpDir <tempdir>     the local working directory where temp files can be creates (default: 'temp')--

Deploy application

Deploy the web application to the cloud

usage: bees deploy [options]
-a,--appid <appId>       application ID (of the form accountName/applicationName)
-e,--env <environment>   environment configurations to deploy
-m,--message <message>     message describing the deployment
-s,--secret <api secret>   API secret
-k,-key <api key>     API key

If the specified appid does not exist, a new application environment will be created using this ID. If the appid already exists, and you have permission to update the application, the new application package will be published, and the existing application environment will be re-deployed to use the new package.

Note: If you accidentally overwrite an existing application or just want to rollback to the previous version, you can use the deployment history panel in the web-based application console to re-deploy a previous version of the application

Clean application

Removes all files generated by the compile and package commands

usage: bees clean

Compile application

Compiles all application source files

usage: bees compile

Get application

Downloads the remote application and installs it to run locally. This command is only valid if the deployed application has a source package associated with it.

usage: bees getapp [options]
-a,--appid <appId>     application ID
-d,--dir <dir>         directory to install application into, default "."
-f, --force               force overwrite without prompting
-s,--secret <api secret>  API secret
-k,--key <api key>   API key

Configuration parameters commands

External configuration parameters can be defined for application and account with the bees:set|unset|update commands.

See the Configuration Parameters article for a complete list of commands.

Tags:
Created by Spike Washburn on 2011/07/01 08:00
 


All Rights Reserved - CloudBees, Inc. - 2012
XWiki Enterprise