# Exporting an app for production

This page has everything you need to know about exporting your **app** from the _BladeRunner_ development environment, to your production environment.

_BladeRunner_ apps use _Java Enterprise Edition (JEE)_ as a production environment, and this tutorial will guide you through creating a _war_ file (Web application Archive) that is ready to be deployed.

## What’s the Difference Between the Development App and the Production war?

### Bundlers

During development, **bundlers** do their dependency analysis and concatenation work on demand, because you are constantly changing your codebase. In the production environment this is no longer the case, so we can output each bundle to a single file when the _war_ in generated. When the _war_ is deployed to a production environment, the files created are simply served as they are.

### Minifiers

Minifiers are not usually used during development as they slow down the page load time and make debugging harder. They are employed in production to ensure fast loading time and some source code protection. There are four minification settings available: 'default', 'closure-whitespace', 'closure-simple' and 'closure-advanced', where 'default' is a simple concatenator well suited for use in development, rather than an actual minifier. It’s possible to debug your application with minification enabled by editing 'conf/bladerunner.conf' and pointing 'default' to one of the real minifier classes.

### GZipping

The generated bundles used in production mode are GZipped when the _war_ is created, to increase the download speed of the app, while also placing no load on the server. The **image bundle** is omitted from the GZipping as images have already been compressed.

### Ensure All Environmental Properties Are Parameterised

Make sure that you have parameterised any properties for database URLs, server locations and anything else that differs from one environment to another.

The [Configure my app for different environments](configure-my-app-for-different-environments.md) section tells you how to do this.

### Export a war file

There are two ways that you can export your application to a _war_ file: either via the command line, or by using the interface provided in the _BladeRunner Dashboard_.

**_From the Command Line_**

From the command line, enter the following instruction:

```
bladerunner war <app-name> [target-war-location] [-m <minifier>]
```

**For example:**

```
bladerunner war myapp C:\output_dir\prod.war -m closure-simple
```

This will output the myapp application in a file called **_prod.war_**.

Omitting a target filename will result in the _war_ file taking the name of the original app. You could also omit the location altogether, which will result in the _war_ file being saved in the _bladerunner/sdk/_ folder.

Omitting a minifier value will result in the minification setting of 'default' being used.

**_From the BladeRunner Dashboard_**

![br-gs-export_war_1](../../../images/br-gs-export_war_1.png)

Go to the Dashboard in your browser, and select the app you want to export, as shown in the screenshot above, and then click the "_Export WAR_" button.

### Prep Your JEE Server

Create all the JNDI environment variables in your app server, ready for your _war_ file. Have a look at the files $APP_ROOT/WEB-INF/**jetty-env.xml** for environment variables, and $APP_ROOT/WEB-INF/**web.xml** for any other configuration that your app expects the Application Server to provide.

Follow your Application Server’s guide on how to set these up. For _Tomcat 6.0_, these details can be found at [https://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html](https://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html)

### Deploy your war

Follow your Application Server’s guide on how to deploy your _war_. Your app should now work in the same way as it did on the development environment, but...

* As all the configuration details are stored outside of the _war_ file, you can use the same _war_ file for all your environments. Reducing deployment risk
* You’ll probably want to get your Continuous Integration Process to run the _war_ task automatically.
