SDK

From Stax

Jump to: navigation, search

The new Stax SDK (0.3.x) now leverages the Stax Services API and adds new application and database management functionality to the Stax command line tools.

Contents

Installing the Stax SDK

Prerequisites

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

Download and configure the Stax SDK

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

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

The first time you run the stax command, you will be prompted to enter your Stax credentials, which will be cached in your USER_HOME/.stax/stax.config file so that you no won't need to re-enter them for any of the Stax commands. If you do not want to save your credentials locally, you can remove the password line from this file, and you will be prompted to enter your password whenever it is required.

Installation for OSX and Linux

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

# curl -L http://stax-downloads.s3.amazonaws.com/sdk/stax-sdk-0.3.8-dist.zip > stax_sdk.zip
# unzip stax_sdk.zip
# rm stax_sdk.zip
# cd stax-sdk-0.3.8

Add the Stax variables to your OSX command line environment by adding the following lines to your ~/.bash_profile file (you may need to create this file)

export STAX_HOME=~/stax-sdk-0.3.8
export PATH=$PATH:$STAX_HOME

Refresh your terminal's bash session by executing

# source ~/.bash_profile

Installation for Windows

On Windows, you can open a predefined Stax Console window by double clicking on the STAX_HOME\Stax Console icon.

Verify your installation

Verify Stax is running properly by executing the stax help command

# stax help
usage: stax <subcommand> [options] [args]
Stax command-line client, version 0.3.x
Type 'stax help <subcommand>' for help on a specific command
...

Stax project commands

Stax project commands are only available for applications generated using the Stax wizard or the Stax SDK.

Create application

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

usage: stax create [options] APP_NAME
 -t,--template <templateId>   application template ID

Available application template IDs

  • basic - basic J2EE web application (WAR layout)
  • gwt - Google Web Toolkit
  • simple - basic J2EE web (EAR layout)
  • struts - Apache Struts
  • wicket - Apache Wicket
  • coldfusion-core - Adobe ColdFusion 8

Run application

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

usage: stax 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 staxd command instead, which will initialize the Java process to support remote debuggers.

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

Deploy application

Deploy the web application to the Stax cloud

usage: stax deploy [options]
 -a,--appid <appId>       Stax application ID
 -e,--env <environment>   environment configurations to deploy
 -m,--message <message>   message describing the deployment
 -p,--pass <password>     Stax password
 -u,--user <username>     Stax username

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: stax clean

Compile application

Compiles all application source files

usage: stax 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: stax getapp [options]
 -a,--appid <appId>     Stax application ID
 -d,--dir <dir>         directory to install application into
 -p,--pass <password>   Stax password
 -u,--user <username>   Stax username

Stax application service commands (New!)

The new Stax SDK includes a set of commands for managing the Stax Java Application Service and can be used to perform many operations that were previously only available via the Stax admin. Having these commands available in the SDK makes it easier to integrate Stax operations into your local development workflow and any build automation for your Java web application projects.

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

stax app:<subcommand> [options] [args]

You can use the 'stax help app:<subcommand>' command to get the usage of each application command.

app:delete

Delete a Stax Java application

usage: stax app:delete [options]
 -a,--appid <appId>   Stax application ID
 -f,--force           forced delete without prompting

app:deploy

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

usage: stax app:deploy [options] ARCHIVE_FILE
 -a,--appid <appId>          Stax application ID
 -e,--environment <env>      message describing the deployment
 -m,--message <message>      environment configurations to deploy
 -p,--pass <password>        Stax password
 -s,--sourceFile <archive>   Source file zip (optional)
 -u,--user <username>        Stax username

Deploying WAR files

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

<stax-web-app>
 <resource name="jdbc/STAX_DB_NAME" auth="Container" type="javax.sql.DataSource">
  <param name="username" value="STAX_DB_USER" />
  <param name="password" value="STAX_DB_PASS" />
  <param name="url" value="jdbc:stax://STAX_DB_NAME" />
 </resource>
</stax-web-app>

app:info

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

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

app:list

Returns the list of applications available to your account

usage: stax app:list

app:restart

Restarts all deployed instances of an application

usage: stax app:restart [options]
 -a,--appid <appId>   Stax application ID
 -f,--force           forced restart without prompting

app:tail

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: stax app:tail [options] LOGNAME
 -a,--appid <appId>   Stax application ID
 LOGNAME              server, access or error

Stax database service commands (New!)

The new Stax SDK includes a set of commands for managing the Stax MySQL Database Service and can be used to perform many operations that were previously only available via the Stax admin. Having these commands available in the SDK makes it easier to integrate Stax operations into your local development workflow and any build automation for your Java web application projects.

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

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

You can use the 'stax help db:<subcommand>' command to get the usage of each application command.

db:create

Create a new MySQL database

usage: stax 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: stax db:delete [options] DATABASE_NAME
 -f,--force   forced delete without prompting

db:info

Returns information about connecting to a database

usage: stax db:info DATABASE_NAME
 -p,--password   print the database password info

db:list

Returns a list of all the databases associated with your Stax account

usage: stax db:list
Personal tools
Navigation