Using gradle cloud foundry plugin to target Anynines non-Pivotal address

FYI Using gradle cloud foundry plugin to target non-Pivotal address

Ref.: https://github.com/cloudfoundry/cf-java-client/tree/master/cloudfoundry-gradle-plugin

You may or may not be interested, but FYI, i’ve been able to use your gradle plugin to push our Caelyf Sample Template to a different cloud foundry platform other than Pivotal. This automates the task so we do not need to use the CF tool. Details are below but salient points about your plugin are:

1. The user credentials from the ~/.gradle/gradle.properties take precedence over those declared within the gradle closure. Since i have two different set of credentials one for Pivotal and another to the AnyNines service, my gradle.properties received an http 401 – not authorised. Had to change file name to .bak so that the plugin would be forced to use credentials from closure. Then inserted my username and password into the gradle script. Could we make the plugin use script credentials before trying credentials from gradle.properties ???

2. Anynines target address is different, so changed that.

3. For this test, did NOT use any persistence services like redis, etc. They are optional for our template.

4. Used gradle default task declaration to make it all happen ‘by magic’ -> defaultTasks ‘cf-login’,’cf-push’

5. I had commented out the target URI address when doing the Pivotal upload, so the first cf-push to A9S got our app up to the target ok, but anynines had NO external URL address to bind the app to. I COULD see it using the CF command but with no URL. So changed the uri declaration to give our app an external URL.
From my terminal using script below :
$ gradlew -b builda9s.gradle –info

and bingo, Houston, we have lift-off !!

Our successfully deployed PaaS service can be seen here, thanx to you all and to the clever people at Anynines.com :
http://caelyf.de.a9sapp.eu/

The European platform for the Anynines PaaS service can be found here:
http://www.anynines.com/

When you have an account, you can use this address to see their console. It does not have the featureset as the http://www.gopivotal.com/paas console does. See here:
https://customerpanel.de.a9sapp.eu/

// ----------------------------------------
// caelyftemplate builda9s.gradle - 
// used to push to anynines target using gradle plugin
// see: https://customerpanel.de.a9sapp.eu/
import org.apache.ivy.plugins.resolver.URLResolver
apply plugin: 'groovy'
apply plugin: 'cloudfoundry'

defaultTasks 'cf-login','cf-push'

buildscript {
 repositories {
 mavenCentral()
 maven { url "https://oss.sonatype.org/content/repositories/springsource-milestones" }
 }
 dependencies {
 classpath group: 'org.cloudfoundry', name: 'cf-gradle-plugin', version: '1.0.1'
 }
}
repositories {
 mavenCentral()
}
cloudfoundry {
 target='https://api.de.a9s.eu' // cloud foundry V2 target for anynines
 space = 'development'
 username = 'jimmy'
 password = '****'
 file = new File('build/libs/template-project-1.1.2.war')
 uri = 'http://caelyftemplate.de.a9sapp.eu/'
 application = 'caelyftemplate'
 memory = 512
 instances = 1
} // end of closure

// ----------------------------------------------
// my console log:
Starting Build
Settings evaluated using empty settings script.
Projects loaded. Root project using build file 'C:\Software\Groovy\caelyf\template-project\builda9s.gradle'.
Included projects: [root project 'template-project']
Evaluating root project 'template-project' using build file 'C:\Software\Groovy\caelyf\template-project\builda9s.gradle'.
Compiling build file 'C:\Software\Groovy\caelyf\template-project\builda9s.gradle' using StatementExtractingScriptTransformer.
Compiling build file 'C:\Software\Groovy\caelyf\template-project\builda9s.gradle' using BuildScriptTransformer.
All projects evaluated.
No tasks specified. Using project default tasks 'cf-login', 'cf-push'
Selected primary tasks 'cf-login', 'cf-push'
Tasks to be executed: [task ':cf-login', task ':cf-push']
:cf-login (Thread[main,5,main]) started.
:cf-login
Executing task ':cf-login' (up-to-date check took 0.0 secs) due to:
 Task has not declared any outputs.
Authenticating to 'https://api.de.a9s.eu' with username 'jimmy'
Connecting to 'https://api.de.a9s.eu' with username 'jimmy'
Authentication successful
:cf-login (Thread[main,5,main]) completed. Took 9.546 secs.
:cf-push (Thread[main,5,main]) started.
:cf-push
Executing task ':cf-push' (up-to-date check took 0.0 secs) due to:
 Task has not declared any outputs.
Connecting to 'https://api.de.a9s.eu' with username 'james.northrop@orange.fr'
Creating application caelyftemplate
Uploading 'build\libs\template-project-1.1.2.war'
Starting caelyftemplate
-----> Downloaded app package (31M)
Downloading JDK...
Copying openjdk-1.7.0_25.tar.gz from the buildpack cache ...
Unpacking JDK to .jdk
Downloading Tomcat: apache-tomcat-7.0.41.tar.gz
Copying apache-tomcat-7.0.41.tar.gz from the buildpack cache ...
Unpacking Tomcat to .tomcat
Copying mysql-connector-java-5.1.12.jar from the buildpack cache ...
Copying postgresql-9.0-801.jdbc4.jar from the buildpack cache ...
-----> Uploading droplet (68M)
Checking status of caelyftemplate
 0 of 1 instances running (1 starting)
 0 of 1 instances running (1 starting)
 0 of 1 instances running (1 starting)
 0 of 1 instances running (1 starting)
 0 of 1 instances running (1 starting)
 1 of 1 instances running (1 running)
Application caelyftemplate is available at http://http://caelyftemplate.de.a9sapp.eu/
:cf-push (Thread[main,5,main]) completed. Took 38.563 secs.
BUILD SUCCESSFUL
Total time: 1 mins 2.297 secs
Stopped 0 compiler daemon(s).

4 thoughts on “Using gradle cloud foundry plugin to target Anynines non-Pivotal address

  1. no andy, dont think i had any particular agenda – more to demonstrate the viability of the entire cloud foundry eco-system. i can see GR8 things in the future using this approach. i like to push the ‘envelope’ so it’s fun to see what tools will and will not do. The gradle plugin is a good example. Hoping to see if we can massage it into talking to other platforms like appfog.com – time permitting !! LOL !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s