JBoss.orgCommunity Documentation

Chapter 17. The torquebox Command

17.1. torquebox deploy
17.2. torquebox undeploy
17.3. torquebox run
17.4. torquebox rails
17.5. torquebox archive
17.6. torquebox cli
17.7. torquebox env
17.8. torquebox list
17.9. torquebox exec

When you install TorqueBox you get a torquebox command line utility that can be used to deploy and undeploy applications, start and stop the server, and more. Running torquebox without any arguments displays the help screen.

$ torquebox
Tasks:
  torquebox archive ROOT           # Create a nice self-contained application...
  torquebox cli                    # Run the JBoss AS7 CLI
  torquebox deploy ROOT            # Deploy an application to TorqueBox
  torquebox env [VARIABLE]         # Display TorqueBox environment variables
  torquebox exec [KNOB] [COMMAND]  # Execute a command within the context of ...
  torquebox help [TASK]            # Describe available tasks or one specific...
  torquebox list                   # List applications deployed to TorqueBox ...
  torquebox rails ROOT             # Create a Rails application at ROOT using...
  torquebox run                    # Run TorqueBox (binds to localhost, use -...
  torquebox undeploy ROOT          # Undeploy an application from TorqueBox

Running torquebox deploy will deploy your current working directory as an application to TorqueBox. If provided with a ROOT path, such as torquebox deploy /path/to/my/app the command will deploy the application found at that path.

$ torquebox deploy myapp
Deployed: myapp-knob.yml
    into: /opt/torquebox/jboss/standalone/deployments 

ROOT can be directory containing the application you want to deploy, a -knob.yml file, a .knob archive, or any Java deployable artifact (.war, .ear, etc).


Just the opposite of torquebox deploy is torquebox undeploy [ROOT]. This command will undeploy your application from TorqueBox. Similar to deploying, running this with no arguments, will attempt to undeploy an application with the same name as the current working directory. Providing a name or path, will cause torquebox undeploy to attempt to undeploy an application with that name.


$ torquebox undeploy myapp
Attempting to undeploy myapp-knob.yml
Undeployed: myapp-knob.yml
      from: /opt/torquebox/jboss/standalone/deployments 

The torquebox run command will run the TorqueBox server. In development, this is similar to rails server.


The server will retain control of the console while it is running. To stop the server, simply send a SIGINT, typically by typing control-C.

The torquebox rails [ROOT] command creates a Rails application at ROOT using the TorqueBox Rails template, or applies the TorqueBox template to an existing Rails application at ROOT. As with other commands that take a ROOT argument, if ROOT is omitted, the command will operate on the current working directory.

$ torquebox rails /path/to/my/app # apply the TorqueBox Rails template to an app 

$ torquebox rails # Create a new Rails application in the current directory 

The torquebox archive [ROOT] command creates an application archive containing all of your application dependencies. The archive can be deployed to TorqueBox with the --deploy option or by hand after the archive file, known as a .knob, has been created by using torquebox deploy myapp.knob. If ROOT is omitted, the command will operate on the current directory.


The torquebox cli command runs the JBoss AS7 command line interface.

$ torquebox cli

The torquebox env [VARIABLE] command displays the TorqueBox environment variables TORQUEBOX_HOME, JBOSS_HOME and JRUBY_HOME. The optional VARIABLE argument can be one of these three values and will cause the command to display only that value.

$ torquebox env
TORQUEBOX_HOME=/opt/torquebox
JBOSS_HOME=/opt/torquebox/jboss
JRUBY_HOME=/opt/torquebox/jruby 

$ torquebox env JBOSS_HOME
/opt/torquebox/jboss 

The torquebox list command displays all applications currently deployed to torquebox and their deployement status (e.g. deployed, awaiting deployment, failed). that value.

$ torquebox list
cachetest
  Descriptor: /opt/torquebox/jboss/standalone/deployments/cachetest-knob.yml
  Status: deployed

$ torquebox deploy 
Deployed: myapp-knob.yml
    into: /opt/torquebox/jboss/standalone/deployments

$ torquebox list
cachetest
  Descriptor: /opt/torquebox/jboss/standalone/deployments/cachetest-knob.yml
  Status: deployed
myapp
  Descriptor: /opt/torquebox/jboss/standalone/deployments/myapp-knob.yml
  Status: awaiting deployment 

The torquebox exec [KNOB] [COMMAND] command executes the given command within the context of a TorqueBox application, given as the path to a Knob file. A common example might be:

$ torquebox exec /path/to/myapp.knob 'rake db:migrate RAILS_ENV=production'

This can also be run from the non-gem installation of TorqueBox in this form:

$ $TORQUEBOX_HOME/jruby/bin/jruby -S torquebox exec myapp.knob 'rake -T'

In both cases, this command assumes that the Knob file has been built with the --package_gems option, or that the necessary gems are available to the JRuby runtime in some other way.