Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

docs

  • Loading branch information...
commit d38e0488a1ff6e77eb6be73ea8fd0376999949eb 1 parent 8a907d3
Burt Beckwith burtbeckwith authored
2  .gitignore
@@ -5,4 +5,4 @@ target
5 5 .settings
6 6 web-app/META-INF
7 7 web-app/WEB-INF
8   -
  8 +/docs
1  grails-app/conf/BuildConfig.groovy
... ... @@ -1,6 +1,7 @@
1 1 grails.project.class.dir = 'target/classes'
2 2 grails.project.test.class.dir = 'target/test-classes'
3 3 grails.project.test.reports.dir = 'target/test-reports'
  4 +grails.project.docs.output.dir = 'docs' // for backwards-compatibility, the docs are checked into gh-pages branch
4 5
5 6 grails.project.dependency.resolution = {
6 7
8 src/docs/guide/1 Introduction to the Cloud Foundry Plugin.gdoc
... ... @@ -0,0 +1,8 @@
  1 +The Cloud Foundry plugin makes it easy to deploy, update and monitor Grails applications in Cloud Foundry. It has the same feature set as the "vmc" commandline Ruby client that Rails and Node.js users will be using. There's also support in SpringSource Tool Suite (STS) via a plugin.
  2 +
  3 +The benefit of using this plugin versus the vmc client or STS is that the plugin is very Grails-aware. It makes several assumptions that reduce the amount of typing you need to do, for example you don't need to type the application name since it defaults to your Grails application name (although you can configure the deployed name in Config.groovy, or override the application name with the @--appname@ commandline argument).
  4 +
  5 +{note}
  6 +Use the [interactive|http://grails.org/doc/latest/ref/Command%20Line/interactive.html] script when you're running multiple Cloud Foundry scripts - it will significantly reduce the startup time for each command you run once the initial JVM has started.
  7 +{note}
  8 +
5 src/docs/guide/1.1 History.gdoc
... ... @@ -0,0 +1,5 @@
  1 +h4. History
  2 +
  3 +* April 12, 2011
  4 +** 1.0.M1 release
  5 +
20 src/docs/guide/2 Getting Started.gdoc
... ... @@ -0,0 +1,20 @@
  1 +h4. The first step is to install the plugin:
  2 +
  3 +{code}
  4 +grails install-plugin cloud-foundry
  5 +{code}
  6 +
  7 +Add your Cloud Foundry credentials to @grails-app/conf/Config.groovy@, or an external config file referenced from @Config.groovy@, or in @$HOME/.grails/settings.groovy@:
  8 +
  9 +{code}
  10 +grails.plugin.cloudfoundry.username = 'your.email@server.com'
  11 +grails.plugin.cloudfoundry.password = 's3kr3t'
  12 +{code}
  13 +
  14 +If you want to deploy with a different application name than your Grails application name, specify it with the @grails.plugin.cloudfoundry.appname@ property:
  15 +
  16 +{code}
  17 +grails.plugin.cloudfoundry.appname = 'my-cool-app'
  18 +{code}
  19 +
  20 +There are other configuration options, but next you'll want to provision some services and deploy your application. See section [4 Deploying applications|guide:4 Deploying applications] for details on that.
12 src/docs/guide/3 Configuration.gdoc
... ... @@ -0,0 +1,12 @@
  1 +There are a few configuration options for the plugin. All are specified in Config.groovy, but you can put the values for @grails.plugin.cloudfoundry.username@ and/or @grails.plugin.cloudfoundry.password@ in @$HOME/.grails/settings.groovy@ to avoid storing this information in source control.
  2 +
  3 +{table}
  4 +*Property* | *Default* | *Meaning*
  5 +grails.plugin.cloudfoundry.username | none, must be specified | the username/email address for your account
  6 +grails.plugin.cloudfoundry.password | none, must be specified | the password for your account
  7 +grails.plugin.cloudfoundry.target | @'api.cloudfoundry.com'@ | the cloud API server, e.g. @'api.cloudfoundry.com'@
  8 +grails.plugin.cloudfoundry.appname | application name | the application name for scripts; defaults to the current application name but can be specified in Config.groovy or overridden from the commandline with the @--appname@ attribute
  9 +grails.plugin.cloudfoundry.testStartWithGet | @true@ | whether to test a start or restart with a GET request in addition to checking the reported status from the server to avoid false positives
  10 +grails.plugin.cloudfoundry.testStartGetUrl | application url | the url to test if @grails.plugin.cloudfoundry.testStartWithGet@ is @true@
  11 +grails.plugin.cloudfoundry.datasource.disableTimeoutAutoconfiguration | @false@ | disables auto-configuration of MySQL datasource connection timeout checking if @true@
  12 +{table}
182 src/docs/guide/4 Deploying applications.gdoc
... ... @@ -0,0 +1,182 @@
  1 +h2. Initial state
  2 +
  3 +When you initially start you won't have any configured services or applications. Running the [cf-services|Scripts] script should display something similar to this:
  4 +
  5 +{code}
  6 +\$ grails cf-services
  7 +
  8 +============== System Services ==============
  9 +
  10 ++----------+---------+-------------------------------+
  11 +| Service | Version | Description |
  12 ++----------+---------+-------------------------------+
  13 +| mongodb | 1.8 | MongoDB NoSQL store |
  14 +| redis | 2.2 | Redis key-value store service |
  15 +| mysql | 5.1 | MySQL database service |
  16 ++----------+---------+-------------------------------+
  17 +
  18 +=========== Provisioned Services ============
  19 +
  20 +None provisioned yet.
  21 +{code}
  22 +
  23 +All of the available services are listed first, and then your configured service instances, if any.
  24 +
  25 +If you run the [cf-apps|Scripts] script you should see that there are no applications:
  26 +
  27 +{code}
  28 +No applications available.
  29 +{code}
  30 +
  31 +And if you run the [cf-info|Scripts] script you should see that there are no resources in use:
  32 +
  33 +{code}
  34 +VMware's Cloud Application Platform
  35 +For support visit support\@cloudfoundry.com
  36 +
  37 +Target: http://api.cloudfoundry.com (v0.999)
  38 +
  39 +User: your.email@yourserver.com
  40 +Usage: Memory (0B of 2.0G total)
  41 + Services (0 of 16 total)
  42 + Apps (0 of 20 total)
  43 +{code}
  44 +
  45 +h2. Services
  46 +
  47 +Before deploying your application, you'll probably need to configure at least one service, e.g. a MySQL, MongoDB, or Redis database. Use the [cf-create-service|Scripts] script for that, e.g.
  48 +
  49 +{code}
  50 +\$ grails cf-create-service mysql
  51 +
  52 +Service 'mysql-2f5fb76' provisioned.
  53 +{code}
  54 +
  55 +or
  56 +
  57 +{code}
  58 +\$ grails cf-create-service redis
  59 +
  60 +Service 'redis-364841f' provisioned.
  61 +{code}
  62 +
  63 +By default a name is generated for you, but you can choose the name, and also bind it to an existing application. You can also bind a service to an application when you deploy the application.
  64 +
  65 +Re-running the [cf-services|Scripts] script will display the new services:
  66 +
  67 +{code}
  68 +============== System Services ==============
  69 +
  70 ++----------+---------+-------------------------------+
  71 +| Service | Version | Description |
  72 ++----------+---------+-------------------------------+
  73 +| mongodb | 1.8 | MongoDB NoSQL store |
  74 +| redis | 2.2 | Redis key-value store service |
  75 +| mysql | 5.1 | MySQL database service |
  76 ++----------+---------+-------------------------------+
  77 +
  78 +=========== Provisioned Services ============
  79 +
  80 ++-----------------+---------+
  81 +| Name | Service |
  82 ++-----------------+---------+
  83 +| mysql-2f5fb76 | mysql |
  84 +| redis-364841f | redis |
  85 ++-----------------+---------+
  86 +{code}
  87 +
  88 +Use the [cf-delete-service|Scripts] script to delete a service:
  89 +
  90 +{code}
  91 +\$ grails cf-delete-service redis-364841f
  92 +
  93 +Successfully removed service: redis-364841f
  94 +{code}
  95 +
  96 +h2. Applications
  97 +
  98 +The [cf-push|Scripts] script creates an application. It deploys a war file and optionally binds one or more services, and has options to configure the allocated memory and associated URLs. By default it also starts the application but you can deploy it without starting if you want to perform configuration steps after creating the application.
  99 +
  100 +The default memory allocation is 512MB but this can be overridden when running the script or changed later.
  101 +
  102 +You can use an existing war file but if one isn't specified then a war is built for you.
  103 +
  104 +{warning}
  105 +Most scripts are not environment-specific but cf-push builds a war file, so be sure to specify the environment.
  106 +{warning}
  107 +
  108 +A typical deploy command would be
  109 +
  110 +{code}
  111 +\$ grails prod cf-push --services=mysql-2f5fb76
  112 +{code}
  113 +
  114 +or if you're running the [interactive|http://grails.org/doc/latest/ref/Command%20Line/interactive.html] script:
  115 +
  116 +{code}
  117 +prod cf-push --services=mysql-2f5fb76
  118 +{code}
  119 +
  120 +and you should see output similar to
  121 +
  122 +{code}
  123 +Environment set to production
  124 +Building war file
  125 + [gspc] Compiling 13 GSP files for package ...
  126 +...
  127 +Building WAR file ...
  128 + [copy] Copying 633 files to ...
  129 +...
  130 +[propertyfile] Updating property file: ...
  131 +...
  132 + [jar] Building jar: .../target/cf-temp-1299173015209.war
  133 +...
  134 +Done creating WAR ...target/cf-temp-1299173015209.war
  135 +
  136 +Application Deployed URL: 'myappname.cloudfoundry.com'?
  137 +
  138 +Uploading Application Information.
  139 +Trying to start Application: 'myappname'.
  140 +..................
  141 +
  142 +Application 'myappname' started.
  143 +{code}
  144 +
  145 +Running [cf-apps|Scripts] should display something like this:
  146 +
  147 +{code}
  148 ++-------------+----+---------+----------------------------+---------------+
  149 +| Application | # | Health | URLs | Services |
  150 ++-------------+----+---------+----------------------------+---------------+
  151 +| myappname | 1 | RUNNING | myappname.cloudfoundry.com | mysql-2f5fb76 |
  152 ++-------------+----+---------+----------------------------+---------------+
  153 +{code}
  154 +
  155 +You might also omit the service bindings and deploy without starting:
  156 +{code}
  157 +grails prod cf-push --no-start
  158 +{code}
  159 +
  160 +or use a pre-built war:
  161 +{code}
  162 +grails prod cf-push --warfile=target/myappname.war
  163 +{code}
  164 +
  165 +Note that the war file name has no bearing on the deployed url - the war is deployed as the default ('ROOT') context in Tomcat.
  166 +
  167 +h4. Automatic binding and provisioning
  168 +
  169 +You can also let the plugin discover required services for you. The plugin will determine that you probably need a MySQL database if you have the Hibernate plugin, a MongoDB instance if you have the Mongo plugin, and a Redis instance if you have that plugin.
  170 +
  171 +If you specify a service of the correct type (with the @--services@ attribute) then it'll be used, otherwise if you need one and have one provisioned it will be suggested to you, e.g.
  172 +
  173 +{code}
  174 +Would you like to bind the 'mysql-2f5fb76' service? ([y], n)
  175 +{code}
  176 +
  177 +and if you need one and don't have one provisioned, the plugin will offer to provision and bind one for you, e.g.
  178 +
  179 +{code}
  180 +Would you like to create and bind a redis service? ([y], n)
  181 +{code}
  182 +
307 src/docs/guide/5 Updating applications and services.gdoc
... ... @@ -0,0 +1,307 @@
  1 +h2. Updating applications
  2 +
  3 +Once an application has been created, there are several options for making changes to it:
  4 +* binding and unbinding services
  5 +* mapping and unmapping URLs
  6 +* increasing or decreasing the number of running instances
  7 +* increasing or decreasing the amount of memory allocated
  8 +
  9 +h4. Services
  10 +
  11 +Use the [cf-bind-service|Scripts] script to associate an existing service instance with your application:
  12 +
  13 +{code}
  14 +grails cf-bind-service mongodb-eaa5601
  15 +{code}
  16 +
  17 +or if you're running the [interactive|http://grails.org/doc/latest/ref/Command%20Line/interactive.html] script:
  18 +
  19 +{code}
  20 +cf-bind-service mongodb-eaa5601
  21 +{code}
  22 +
  23 +{code}
  24 +Creating new service binding to 'mongodb-eaa5601' for 'myappname'.
  25 +
  26 +Application 'myappname' updated
  27 +Service 'mongodb-eaa5601' added
  28 +
  29 +Application 'myappname' stopped.
  30 +
  31 +Trying to start Application: 'myappname'.
  32 +.
  33 +
  34 +Application 'myappname' started.
  35 +{code}
  36 +
  37 +If you run [cf-apps|Scripts] you'll see that the service is registered:
  38 +
  39 +{code}
  40 ++-------------+----+---------+----------------------------+--------------------------------+
  41 +| Application | # | Health | URLs | Services |
  42 ++-------------+----+---------+----------------------------+--------------------------------+
  43 +| myappname | 1 | RUNNING | myappname.cloudfoundry.com | mysql-2f5fb76, mongodb-eaa5601 |
  44 ++-------------+----+---------+----------------------------+--------------------------------+
  45 +{code}
  46 +
  47 +Use the [cf-unbind-service|Scripts] script to remove an existing service instance from your application:
  48 +
  49 +{code}
  50 +\$ grails cf-unbind-service mongodb-eaa5601
  51 +
  52 +Removing service binding 'mongodb-eaa5601' from 'myappname'.
  53 +
  54 +Application 'myappname' updated
  55 +Service 'serviceName' removed
  56 +
  57 +Application 'myappname' stopped.
  58 +
  59 +Trying to start Application: 'myappname'.
  60 +.
  61 +
  62 +Application 'myappname' started.
  63 +{code}
  64 +
  65 +If you run [cf-apps|Scripts] you'll see that the service is no longer registered:
  66 +
  67 +{code}
  68 ++-------------+----+---------+----------------------------+---------------+
  69 +| Application | # | Health | URLs | Service |
  70 ++-------------+----+---------+----------------------------+---------------+
  71 +| myappname | 1 | RUNNING | myappname.cloudfoundry.com | mysql-2f5fb76 |
  72 ++-------------+----+---------+----------------------------+---------------+
  73 +{code}
  74 +
  75 +h4. URLs
  76 +
  77 +Use the [cf-map|Scripts] script to associate an additional URL with your application:
  78 +
  79 +{code}
  80 +\$ grails cf-map myotherappname.cloudfoundry.com
  81 +
  82 +Succesfully mapped url
  83 +{code}
  84 +
  85 +If you run [cf-apps|Scripts] you'll see that the extra URL is mapped:
  86 +
  87 +{code}
  88 ++-------------+----+---------+-------------------------------------------------------------+---------------+
  89 +| Application | # | Health | URLs | Service |
  90 ++-------------+----+---------+-------------------------------------------------------------+---------------+
  91 +| myappname | 1 | RUNNING | myappname.cloudfoundry.com, myotherappname.cloudfoundry.com | mysql-2f5fb76 |
  92 ++-------------+----+---------+-------------------------------------------------------------+---------------+
  93 +{code}
  94 +
  95 +Use the [cf-unmap|Scripts] script to remove a URL from your application:
  96 +
  97 +{code}
  98 +\$ grails cf-unmap myotherappname.cloudfoundry.com
  99 +
  100 +Succesfully unmapped url
  101 +{code}
  102 +
  103 +If you run [cf-apps|Scripts] you'll see that the URL is no longer mapped:
  104 +
  105 +{code}
  106 ++-------------+----+---------+----------------------------+---------------+
  107 +| Application | # | Health | URLs | Service |
  108 ++-------------+----+---------+----------------------------+---------------+
  109 +| myappname | 1 | RUNNING | myappname.cloudfoundry.com | mysql-2f5fb76 |
  110 ++-------------+----+---------+----------------------------+---------------+
  111 +{code}
  112 +
  113 +h4. Instances
  114 +
  115 +Use the [cf-update-instances|Scripts] script to increase or decrease the number of running instances of your application:
  116 +
  117 +{code}
  118 +\$ grails cf-update-instances 3
  119 +
  120 +Scaled 'myappname' up to 3 instance(s).
  121 +{code}
  122 +
  123 +It will take a short amount of time to start the new instances, so if you run [cf-apps|Scripts] you'll see that the extra instances are allocated but not all are running yet:
  124 +
  125 +{code}
  126 ++-------------+----+---------+----------------------------+---------------+
  127 +| Application | # | Health | URLs | Service |
  128 ++-------------+----+---------+----------------------------+---------------+
  129 +| myappname | 3 | 33% | myappname.cloudfoundry.com | mysql-2f5fb76 |
  130 ++-------------+----+---------+----------------------------+---------------+
  131 +{code}
  132 +
  133 +Wait a while longer and all should be running:
  134 +
  135 +{code}
  136 ++-------------+----+---------+----------------------------+---------------+
  137 +| Application | # | Health | URLs | Service |
  138 ++-------------+----+---------+----------------------------+---------------+
  139 +| myappname | 3 | RUNNING | myappname.cloudfoundry.com | mysql-2f5fb76 |
  140 ++-------------+----+---------+----------------------------+---------------+
  141 +{code}
  142 +
  143 +If you have a test page that displays the environment variables VCAP_APP_HOST and VCAP_APP_PORT you'll see that you're automatically load-balanced randomly between the instances when you refresh your browser:
  144 +
  145 +{code}
  146 +VCAP_APP_HOST 10.114.110.207
  147 +VCAP_APP_PORT 48684
  148 +{code}
  149 +
  150 +{code}
  151 +VCAP_APP_HOST 10.114.110.208
  152 +VCAP_APP_PORT 47793
  153 +{code}
  154 +
  155 +{code}
  156 +VCAP_APP_HOST 10.114.110.209
  157 +VCAP_APP_PORT 58232
  158 +{code}
  159 +
  160 +Use the [cf-show-instances|Scripts] script to display information about the instances:
  161 +
  162 +{code}
  163 +\$ grails cf-show-instances
  164 +
  165 ++-------+---------+--------------------+
  166 +| Index | State | Start Time |
  167 ++-------+---------+--------------------+
  168 +| 0 | RUNNING | 04/12/2011 11:33AM |
  169 ++-------+---------+--------------------+
  170 +| 1 | RUNNING | 04/12/2011 11:33AM |
  171 ++-------+---------+--------------------+
  172 +| 2 | RUNNING | 04/12/2011 11:33AM |
  173 ++-------+---------+--------------------+
  174 +{code}
  175 +
  176 +Use the [cf-stats|Scripts] script to display runtime information about the instances:
  177 +
  178 +{code}
  179 +\$ grails cf-stats
  180 +
  181 ++----------+-------------+----------------+--------------+--------------+
  182 +| Instance | CPU (Cores) | Memory (limit) | Disk (limit) | Uptime |
  183 ++----------+-------------+----------------+--------------+--------------+
  184 +| 0 | 9.5% (4) | 372.7M (512M) | 52.6M (2G) | 0d:0h:1m:12s |
  185 +| 1 | 3.3% (4) | 375.7M (512M) | 52.6M (2G) | 0d:0h:1m:53s |
  186 +| 2 | 3.7% (4) | 383.2M (512M) | 52.6M (2G) | 0d:0h:1m:55s |
  187 ++----------+-------------+----------------+--------------+--------------+
  188 +{code}
  189 +
  190 +You can also scale the number down:
  191 +
  192 +{code}
  193 +\$ grails cf-update-instances 1
  194 +
  195 +Scaled 'myappname' down to 1 instance(s).
  196 +{code}
  197 +
  198 +h4. Memory
  199 +
  200 +Use the [cf-update-memory|Scripts] script to increase or decrease the allocated memory for your application:
  201 +
  202 +{code}
  203 +\$ grails cf-update-memory 1G
  204 +
  205 +Updated memory reservation to '1.0G'.
  206 +
  207 +Application 'myappname' stopped.
  208 +
  209 +Trying to start Application: 'myappname'.
  210 +.
  211 +
  212 +Application 'myappname' started.
  213 +{code}
  214 +
  215 +Note that the memory must be one of 64M, 128M, 256M, 512M, 1G, or 2G.
  216 +
  217 +h4. Start, stop, restart
  218 +
  219 +Use the [cf-stop|Scripts] script to stop your application:
  220 +
  221 +{code}
  222 +\$ grails cf-stop
  223 +
  224 +Application 'myappname' stopped.
  225 +{code}
  226 +
  227 +Use the [cf-start|Scripts] script to start your application:
  228 +
  229 +{code}
  230 +\$ grails cf-start
  231 +
  232 +Trying to start Application: 'myappname'.
  233 +.
  234 +
  235 +Application 'myappname' started.
  236 +{code}
  237 +
  238 +Use the [cf-restart|Scripts] script to stop and then start your application:
  239 +
  240 +{code}
  241 +\$ grails cf-restart
  242 +
  243 +Application 'myappname' stopped.
  244 +
  245 +Trying to start Application: 'myappname'.
  246 +.
  247 +
  248 +Application 'myappname' started.
  249 +
  250 +{code}
  251 +
  252 +h4. Updating
  253 +
  254 +Use the [cf-update|Scripts] script to redeploy an application after making code changes:
  255 +
  256 +{code}
  257 +\$ grails prod cf-update
  258 +
  259 +Uploading Application.
  260 +Building war file
  261 + [gspc] Compiling 13 GSP files for package ...
  262 +...
  263 +Building WAR file ...
  264 + [copy] Copying 635 files to ...
  265 +...
  266 +[propertyfile] Updating property file: ...
  267 +...
  268 + [jar] Building jar: .../target/cf-temp-1299178697861.war
  269 +...
  270 +Done creating WAR ...target/cf-temp-1299178697861.war
  271 +
  272 +Application 'myappname' stopped.
  273 +
  274 +Trying to start Application: 'myappname'.
  275 +.
  276 +
  277 +Application 'myappname' started.
  278 +{code}
  279 +
  280 +{warning}
  281 +Most scripts are not environment-specific but cf-update builds a war file, so be sure to specify the environment.
  282 +{warning}
  283 +
  284 +Like the [cf-push|Scripts] script you can either let the script create a war file for you, or specify an existing one.
  285 +
  286 +h4. Deleting applications
  287 +
  288 +Use the [cf-delete-app|Scripts] script to delete an application:
  289 +
  290 +{code}
  291 +\$ grails cf-delete-app
  292 +
  293 +Application 'myappname' deleted.
  294 +{code}
  295 +
  296 +Use the [cf-delete-all-apps|Scripts] script to delete all applications:
  297 +
  298 +{code}
  299 +\$ grails cf-delete-all-apps
  300 +
  301 +Application 'myappname1' deleted.
  302 +
  303 +Application 'myappname2' deleted.
  304 +
  305 +Application 'myappname3' deleted.
  306 +{code}
  307 +
136 src/docs/guide/6 Monitoring.gdoc
... ... @@ -0,0 +1,136 @@
  1 +h4. Crashes
  2 +
  3 +If a deployment or update fails, the script will display the application logs but you can view crash information and logs at any time.
  4 +
  5 +Use the [cf-crashes|Scripts] script to check if there have been recent crashes:
  6 +
  7 +{code}
  8 +\$ grails cf-crashes
  9 +
  10 ++-------------+--------------------------------------+--------------------+
  11 +| Name | Instance ID | Crashed Time |
  12 ++-------------+--------------------------------------+--------------------+
  13 +| myappname-1 | 9f3e61c9-7c64-4e57-ab3e-8d7e892dd722 | 04/11/2011 02:43PM |
  14 +| myappname-2 | 17b6470c-6444-49f4-8981-d3bd7d7796dc | 04/11/2011 02:43PM |
  15 +| myappname-3 | d1b99f31-203c-48e3-aa17-17ca26178a49 | 04/11/2011 02:44PM |
  16 ++----------+-------------+----------------+--------------+--------------+
  17 +{code}
  18 +
  19 +Use the [cf-crashlogs|Scripts] script to view log files for crashed instances:
  20 +
  21 +{code}
  22 +\$ grails cf-crashlogs
  23 +
  24 +==== logs/stdout.log ====
  25 +
  26 +2011-03-03 14:50:23,904 [main] ERROR context.ContextLoader - Context initialization failed
  27 +org.springframework.beans.factory.access.BootstrapException: Error executing bootstraps; nested exception is java.lang.NullPointerException
  28 + at org.codehaus.groovy.grails.web.context.GrailsContextLoader.createWebApplicationContext(GrailsContextLoader.java:87)
  29 +...
  30 +Caused by: java.lang.NullPointerException
  31 + at $Proxy13.save(Unknown Source)
  32 +...
  33 +Stopping Tomcat because the context stopped.
  34 +{code}
  35 +
  36 +h4. Logs
  37 +
  38 +Use the [cf-logs|Scripts] script to view log files:
  39 +
  40 +{code}
  41 +\$ grails cf-logs
  42 +
  43 +==== logs/stderr.log ====
  44 +
  45 +Mar 3, 2011 2:51:32 PM org.apache.coyote.http11.Http11Protocol init
  46 +INFO: Initializing Coyote HTTP/1.1 on http-50478
  47 +...
  48 +INFO: Server startup in 9169 ms
  49 +
  50 +
  51 +==== logs/stdout.log ====
  52 +
  53 +{code}
  54 +
  55 +By default all logs are displayed, but you can limit it to one or more:
  56 +
  57 +{code}
  58 +\$ grails cf-logs --stderr
  59 +
  60 +==== logs/stderr.log ====
  61 +
  62 +Mar 3, 2011 2:51:32 PM org.apache.coyote.http11.Http11Protocol init
  63 +INFO: Initializing Coyote HTTP/1.1 on http-50478
  64 +...
  65 +INFO: Server startup in 9169 ms
  66 +{code}
  67 +
  68 +And you can also write a log to a file instead of the console:
  69 +
  70 +{code}
  71 +\$ grails cf-logs target/myapp.stderr.log --stderr
  72 +
  73 +Wrote logs/stderr.log to target/myapp.stderr.log
  74 +{code}
  75 +
  76 +h4. Viewing files
  77 +
  78 +Use the [cf-list-files|Scripts] script to view directory listings:
  79 +
  80 +{code}
  81 +\$ grails cf-list-files /
  82 +
  83 +logs/ -
  84 +tomcat/ -
  85 +{code}
  86 +
  87 +{code}
  88 +\$ grails cf-list-files tomcat
  89 +
  90 +bin/ -
  91 +conf/ -
  92 +lib/ -
  93 +logs/ -
  94 +temp/ -
  95 +webapps/ -
  96 +work/ -
  97 +{code}
  98 +
  99 +{code}
  100 +\$ grails cf-list-files tomcat/webapps
  101 +
  102 +ROOT/ -
  103 +{code}
  104 +
  105 +{code}
  106 +\$ grails cf-list-files tomcat/webapps/ROOT
  107 +
  108 +META-INF/ -
  109 +WEB-INF/ -
  110 +css/ -
  111 +images/ -
  112 +js/ -
  113 +plugins/
  114 +{code}
  115 +
  116 +Use the [cf-get-file|Scripts] script to view a file:
  117 +
  118 +{code}
  119 +\$ grails cf-get-file tomcat/webapps/ROOT/css/main.css
  120 +
  121 +html * {
  122 + margin: 0;
  123 + /*padding: 0; SELECT NOT DISPLAYED CORRECTLY IN FIREFOX */
  124 +}
  125 +
  126 +...
  127 +{code}
  128 +
  129 +And you can also write the contents to a file instead of the console:
  130 +
  131 +{code}
  132 +\$ grails cf-get-file tomcat/webapps/ROOT/css/main.css target/main.css
  133 +
  134 +Wrote tomcat/webapps/ROOT/css/main.css to target/main.css
  135 +{code}
  136 +
67 src/docs/guide/7 Service Configuration.gdoc
... ... @@ -0,0 +1,67 @@
  1 +When you provision a service and bind it to an application, an environment variable @VCAP_SERVICES@ is set for your server instance(s). This is a JSON string and you can use it to configure your DataSource, MongoDB, and Redis connections and will look something like this (formatted for readability):
  2 +
  3 +{code}
  4 +{"redis-2.2":
  5 + [{"name":"redis-1d8e28a",
  6 + "label":"redis-2.2",
  7 + "plan":"free",
  8 + "credentials":{
  9 + "node_id":"redis_node_3",
  10 + "hostname":"172.30.48.42",
  11 + "port":5004,
  12 + "password":"1463d9d0-4e35-4f2e-be2f-01dc5536f183",
  13 + "name":"redis-1a69a915-6522-496c-93d5-1271d2b3118e"}
  14 + }],
  15 + "mongodb-1.8":
  16 + [{"name":"mongodb-3854dbe",
  17 + "label":"mongodb-1.8",
  18 + "plan":"free",
  19 + "credentials":{
  20 + "hostname":"172.30.48.63",
  21 + "port":25003,
  22 + "username":"b6877670-da98-4124-85ca-84357f042797",
  23 + "password":"f53e6a4b-f4b8-497d-ac81-43cb22cf1e88",
  24 + "name":"mongodb-9dda2cfb-9672-4d58-8786-98c3abcb21ec",
  25 + "db":"db"}
  26 + }],
  27 + "mysql-5.1":
  28 + [{"name":"mysql-497b12e",
  29 + "label":"mysql-5.1",
  30 + "plan":"free",
  31 + "credentials":{
  32 + "node_id":"mysql_node_8",
  33 + "hostname":"172.30.48.27",
  34 + "port":3306,
  35 + "password":"p3rO5K5lRZaEU",
  36 + "name":"d887d4f5664f64dde86f3ce42c6333962",
  37 + "user":"umuPIJ8IzSKVA"}
  38 + }]
  39 +}
  40 +{code}
  41 +
  42 +Fortunately the plugin manages this for you, so in general you don't need to be aware of this. It will update your DataSource configuration if you have a MySQL service provisioned and bound, and likewise your MongoDB and Redis connection information if you have those plugins installed and have those services provisioned and bound.
  43 +
  44 +If you're not using the MongoDB or Redis plugin then you'll need to access the information yourself - just call @System.getenv('VCAP_SERVICES')@ and parse the JSON.
  45 +
  46 +h4. DataSource
  47 +In addition to replacing the username, password, and JDBC url for your DataSource, the plugin will configure MySQL connection testing, using the following settings:
  48 +
  49 +{code}
  50 +removeAbandoned = true
  51 +removeAbandonedTimeout = 300 // 5 minutes
  52 +testOnBorrow = true
  53 +validationQuery = '/* ping */ SELECT 1'
  54 +{code}
  55 +
  56 +This will only be done if the DataSource is the standard @org.apache.commons.dbcp.BasicDataSource@ that Grails configures since we assume that if you have customized the DataSource, you will configure connection testing yourself. You can also tell the plugin to not make these changes with
  57 +
  58 +{code}
  59 +grails.plugin.cloudfoundry.datasource.disableTimeoutAutoconfiguration = true
  60 +{code}
  61 +
  62 +in @Config.groovy@.
  63 +
  64 +h4. Searchable
  65 +
  66 +Although there's no explicit support for Compass in Cloud Foundry, the plugin does detect that the Searchable plugin is installed and will configure it to write its Lucene index to a writeable directory on your server.
  67 +

0 comments on commit d38e048

Please sign in to comment.
Something went wrong with that request. Please try again.