Managing your application

These commands can be used to control and configure your application.

Command

Description

af start [appname]

Starts an application.

af stop [appname]

Stops an application.

af restart [appname]

Restarts an application.

af mem [appname] [memsize]

Updates the amount of memory allocated for your application.

af map [appname] [url]

Maps an application to a given URL.

af unmap [appname] [url]

Removes an application from a given URL.

af instances [appname]

Displays the configured instances of an application along with state (for example, RUNNING) and start time for each one.

af instances [appname] [num]

Changes the number of configured instances.

af env [appname]

Lists custom environment variables for an application.

af env-add [appname] [variable=value]

Adds an environment variable specific to an application.

af env-del [appname] [variable]

Removes an environment variable for an application.

The basic commands to start, stop, and restart are described in more detail in Chapter 4, Creating an Application from Scratch.

If you want to change the configuration of your application, the other commands are useful. First, the following shows how to change the number of running instances you have for your application:

$ af instances insideaf4
+-------+---------+--------------------+
| Index | State   | Start Time         |
+-------+---------+--------------------+
| 0     | RUNNING | 10/21/2013 09:18PM |
+-------+---------+--------------------+

$ af instances insideaf4 2
Scaling Application instances up to 2: OK

$ af instances insideaf4
+-------+---------+--------------------+
| Index | State   | Start Time         |
+-------+---------+--------------------+
| 0     | RUNNING | 10/21/2013 09:18PM |
| 1     | RUNNING | 10/21/2013 09:35PM |
+-------+---------+--------------------+

Next, here is how to change the amount of allocated memory. The first example will prompt you for how much memory to allocate. The second example will pass the memory allocation with the command:

$ af mem insideaf4
Update Memory Reservation? (64M, 128M, 256M, 512M) [128M]: 256M
Updating Memory Reservation to 256M: OK
Stopping Application 'insideaf4': OK
Staging Application 'insideaf4': OK
Starting Application 'insideaf4': OK
$ af mem insideaf4 128M
Updating Memory Reservation to 128M: OK
Stopping Application 'insideaf4': OK
Staging Application 'insideaf4': OK
Starting Application 'insideaf4': OK

If you need to use environment variables, you can use the different env commands. The following is a series of commands to add a new environment variable and then later remove it:

$ af env insideaf4
No Environment Variables

$ af env-add insideaf4 debug=true
Adding Environment Variable [debug=true]: OK
Stopping Application 'insideaf4': OK
Staging Application 'insideaf4': OK
Starting Application 'insideaf4': OK

$ af env insideaf4
+----------+-------+
| Variable | Value |
+----------+-------+
| debug    | true  |
+----------+-------+

$ af env-del insideaf4 debug
Deleting Environment Variable [debug]: OK
Stopping Application 'insideaf4': OK
Staging Application 'insideaf4': OK
Starting Application 'insideaf4': OK

$ af env insideaf4
No Environment Variables

Another configuration you may want to change is the URL to which your application is mapped. You can use the af apps command to see the current URLs, and the af map and af unmap commands to add and remove URLs in the following way.

Note

The af apps output has been condensed in these examples.

$ af apps
+-------------+---------------------+
| Application | URLS                |
+-------------+---------------------+
| insideaf4   | insideaf4.aws.af.cm |
+-------------+---------------------+


$ af map insideaf4 insideaf5.aws.af.cm
Successfully mapped url


$ af apps
+-------------+------------------------------------------+
| Application | URLS                                     |
+-------------+------------------------------------------+
| insideaf4   | insideaf4.aws.af.cm, insideaf5.aws.af.cm | 
+-------------+------------------------------------------+


$ af unmap insideaf4 insideaf5.aws.af.cm
Successfully unmapped url
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.189.189.67