Initial Set-up

I was able to use an older version of my non-spring test server simple-executable-jar-web-server.

The test is following up on my tests with Cloud Foundry as well as Stackato.

I also created a very simple cartridge (notes) that I was using to understand the way cartridges work. But a
DIY cartridge would have been sufficent for this.

App container cartridge are supposed to come with templates as far as I understand. In this case I packaged the
test server in the template which is also the reason why I wanted it to stay small.

Runtime Environment and Properties

Environment

'OPENSHIFT_DEPLOYMENTS_DIR' = '/var/lib/openshift/539/app-deployments/'
'HISTFILE' = '/var/lib/openshift/539/app-root/data/.bash_history'
'OPENSHIFT_SBJR_JAR_DIR' = '/var/lib/openshift/539/app-root/runtime/repo//target/'
'OPENSHIFT_DATA_DIR' = '/var/lib/openshift/539/app-root/data/'
'JAVA_HOME' = '/etc/alternatives/java_sdk_1.6.0'
'OPENSHIFT_SBJR_VERSION' = '1.0.2'
'OPENSHIFT_SBJR_JPDA_PORT' = '8787'
'PWD' = '/var/lib/openshift/539/spring-boot-jar-runner'
'TMP_DIR' = '/tmp/'
'OPENSHIFT_SECRET_TOKEN' = 'n_3eZmWnvvsJUnY4nYicj-k6vVAG_6nglPrtgkqjyKf0OWH-pGlRbVyCRGRcFAruY4n8BKX7aPKSvZxO-5lQTlWheStOyHkmBcsQ4zwlmJaMjNk9Ii5IkzktC0P9seXS'
'NLSPATH' = '/usr/dt/lib/nls/msg/%L/%N.cat'
'OPENSHIFT_APP_DNS' = 'app1-testapps.openshift.local'
'TMPDIR' = '/tmp/'
'TMP' = '/tmp/'
'OPENSHIFT_SBJR_LOG_DIR' = '/var/lib/openshift/539/spring-boot-jar-runner//logs/'
'OPENSHIFT_NAMESPACE' = 'testapps'
'PATH' = '/etc/alternatives/java_sdk_1.6.0/bin:/bin:/usr/bin:/usr/sbin'
'OPENSHIFT_SBJR_IP' = '127.1.245.1'
'OPENSHIFT_SBJR_IDENT' = 'coder_mnm_at:spring-boot-jar-runner:1.0.2:0.0.1'
'OPENSHIFT_UMASK' = '022'
'OPENSHIFT_APP_UUID' = '539'
'OPENSHIFT_CARTRIDGE_SDK_BASH' = '/usr/lib/openshift/cartridge_sdk/bash/sdk'
'OPENSHIFT_BUILD_DEPENDENCIES_DIR' = '/var/lib/openshift/539/app-root/runtime/build-dependencies/'
'OPENSHIFT_SBJR_MAX_STARTUP_WAIT_IN_SEC' = '60'
'OPENSHIFT_SBJR_DIR' = '/var/lib/openshift/539/spring-boot-jar-runner/'
'OPENSHIFT_GEAR_DNS' = 'app1-testapps.openshift.local'
'OPENSHIFT_REPO_DIR' = '/var/lib/openshift/539/app-root/runtime/repo/'
'OPENSHIFT_BROKER_HOST' = 'localhost'
'SHLVL' = '3'
'OPENSHIFT_GEAR_MEMORY_MB' = '512'
'XFILESEARCHPATH' = '/usr/dt/app-defaults/%L/Dt'
'OPENSHIFT_APP_NAME' = 'app1'
'OPENSHIFT_GEAR_UUID' = '539'
'OPENSHIFT_SBJR_JAR_RELATIVE_FOLDER_NAME' = 'target'
'OPENSHIFT_APP_SSH_PUBLIC_KEY' = '/var/lib/openshift/539/.openshift_ssh/id_rsa.pub'
'OPENSHIFT_GEAR_NAME' = 'app1'
'LOGNAME' = '539'
'OPENSHIFT_SBJR_JAR_BASE_DIR' = '/var/lib/openshift/539/app-root/runtime/repo/'
'OPENSHIFT_PRIMARY_CARTRIDGE_DIR' = '/var/lib/openshift/539/spring-boot-jar-runner/'
'_' = '/bin/java'
'OPENSHIFT_SBJR_HTTP_PORT' = '8080'
'OPENSHIFT_CLOUD_DOMAIN' = 'openshift.local'
'OPENSHIFT_DEPENDENCIES_DIR' = '/var/lib/openshift/539/app-root/runtime/dependencies/'
'SHELL' = '/bin/sh'
'Copy of OPENSHIFT_SBJR_MAX_SHUTDOWN_WAIT_IN_SEC' = '60'
'OPENSHIFT_SBJR_LOG' = '/var/lib/openshift/539/spring-boot-jar-runner//logs/main-SBJR-log'
'OPENSHIFT_HOMEDIR' = '/var/lib/openshift/539/'
'GEM_HOME' = '/var/lib/openshift/539/.gem'
'OPENSHIFT_TMP_DIR' = '/tmp/'
'OPENSHIFT_APP_SSH_KEY' = '/var/lib/openshift/539/.openshift_ssh/id_rsa'
'OPENSHIFT_CARTRIDGE_SDK_RUBY' = '/usr/lib/openshift/cartridge_sdk/ruby/sdk.rb'
'USER' = '539'
'HOME' = '/var/lib/openshift/539'
'OPENSHIFT_SBJR_JDK6' = '/etc/alternatives/java_sdk_1.6.0'
'OPENSHIFT_SBJR_JDK7' = '/etc/alternatives/java_sdk_1.7.0'
'OPENSHIFT_SBJR_PATH_ELEMENT' = '/etc/alternatives/java_sdk_1.6.0/bin'

System Properties

'java.runtime.name' = 'OpenJDK Runtime Environment'
'sun.boot.library.path' = '/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64/jre/lib/amd64'
'java.vm.version' = '24.45-b08'
'java.vm.vendor' = 'Oracle Corporation'
'java.vendor.url' = 'http://java.oracle.com/'
'path.separator' = ':'
'java.vm.name' = 'OpenJDK 64-Bit Server VM'
'file.encoding.pkg' = 'sun.io'
'user.country' = 'US'
'sun.java.launcher' = 'SUN_STANDARD'
'sun.os.patch.level' = 'unknown'
'server.port' = ''
'java.vm.specification.name' = 'Java Virtual Machine Specification'
'user.dir' = '/var/lib/openshift/539/spring-boot-jar-runner'
'java.runtime.version' = '1.7.0_45-mockbuild_2013_10_16_17_47-b00'
'java.awt.graphicsenv' = 'sun.awt.X11GraphicsEnvironment'
'java.endorsed.dirs' = '/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64/jre/lib/endorsed'
'os.arch' = 'amd64'
'java.io.tmpdir' = '/tmp'
'line.separator' = '
'
'java.vm.specification.vendor' = 'Oracle Corporation'
'os.name' = 'Linux'
'sun.jnu.encoding' = 'ANSI_X3.4-1968'
'java.library.path' = '/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib'
'java.specification.name' = 'Java Platform API Specification'
'java.class.version' = '51.0'
'sun.management.compiler' = 'HotSpot 64-Bit Tiered Compilers'
'os.version' = '3.11.10-200.fc19.x86_64'
'user.home' = '/var/lib/openshift/539'
'user.timezone' = 'US/Pacific'
'java.awt.printerjob' = 'sun.print.PSPrinterJob'
'file.encoding' = 'ANSI_X3.4-1968'
'java.specification.version' = '1.7'
'server.address' = '127.1.245.1'
'java.class.path' = '/var/lib/openshift/539/spring-boot-jar-runner/web-app-jar/simple-executable-jar-web-server-0.0.1.jar'
'user.name' = '539'
'java.vm.specification.version' = '1.7'
'sun.java.command' = '/var/lib/openshift/539/spring-boot-jar-runner/web-app-jar/simple-executable-jar-web-server-0.0.1.jar'
'java.home' = '/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64/jre'
'sun.arch.data.model' = '64'
'user.language' = 'en'
'java.specification.vendor' = 'Oracle Corporation'
'awt.toolkit' = 'sun.awt.X11.XToolkit'
'java.vm.info' = 'mixed mode'
'logging.path' = '/var/lib/openshift/539/spring-boot-jar-runner//logs/'
'java.version' = '1.7.0_45'
'java.ext.dirs' = '/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64/jre/lib/ext:/usr/java/packages/lib/ext'
'sun.boot.class.path' = '/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64/jre/lib/resources.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64/jre/lib/rt.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64/jre/lib/jsse.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64/jre/lib/jce.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64/jre/lib/charsets.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64/jre/lib/netx.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64/jre/lib/plugin.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64/jre/lib/rhino.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64/jre/lib/jfr.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64/jre/classes'
'java.vendor' = 'Oracle Corporation'
'file.separator' = '/'
'java.vendor.url.bug' = 'http://bugreport.sun.com/bugreport/'
'sun.io.unicode.encoding' = 'UnicodeLittle'
'sun.cpu.endian' = 'little'
'sun.cpu.isalist' = ''
Here is what I know about you :
Your adress:
/127.0.0.1:23554
Your request headers:
'X-forwarded-proto' = '[http]'
'X-request-start' = '[t=1402811035856892]'
'Host' = '[app1-testapps.openshift.local]'
'X-forwarded-server' = '[broker-66587a.openshift.local]'
'Accept-encoding' = '[gzip,deflate,sdch]'
'X-forwarded-port' = '[80]'
'Connection' = '[close]'
'X-forwarded-for' = '[192.168.121.33]'
'X-client-ip' = '[192.168.121.33]'
'Accept-language' = '[en-GB,en-US;q=0.8,en;q=0.6,de;q=0.4]'
'X-forwarded-host' = '[app1-testapps.openshift.local]'
'User-agent' = '[Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36]'
'Accept' = '[text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8]'

Adding MariaDB

From the three experiences I found the OpenShift one the friendliest in terms of adding a new service as well as the information that I got out of it.
It also immediately showed the connection details to the DB.
Only a restart is required, not a full push.

MySQL 5.1 database added.  Please make note of these credentials:

    Root User: admin123
Root Password: passwd123
Database Name: app1

Connection URL: mysql://$OPENSHIFT_MARIADB_DB_HOST:$OPENSHIFT_MARIADB_DB_PORT/

You can manage your new MySQL database by also embedding phpmyadmin.
The phpmyadmin username and password will be the same as the MySQL credentials above.

Yep, it is MySQL.

A lot more variables changed in comparison to the other two and no system properties:

> 'OPENSHIFT_MYSQL_DB_HOST' = '127.1.245.2'
> 'OPENSHIFT_MARIADB_DB_PORT' = '3306'
> 'OPENSHIFT_MYSQL_DB_PORT' = '3306'
> 'OPENSHIFT_MARIADB_DB_PASSWORD' = 'passwd123'
> 'OPENSHIFT_MARIADB_DIR' = '/var/lib/openshift/539/mariadb/'
> 'OPENSHIFT_MARIADB_DB_USERNAME' = 'admin123'
> 'OPENSHIFT_MARIADB_DB_SOCKET' = '/var/lib/openshift/539/mariadb//socket/mysql.sock'
> 'OPENSHIFT_MYSQL_DB_URL' = 'mysql://admin123:passwd123@127.1.245.2:3306/'
> 'OPENSHIFT_MARIADB_DB_HOST' = '127.1.245.2'
> 'OPENSHIFT_MYSQL_DB_USERNAME' = 'admin123'
> 'OPENSHIFT_MYSQL_DB_LOG_DIR' = '/var/lib/openshift/539/mariadb//log/'
> 'OPENSHIFT_MARIADB_IDENT' = 'redhat:mariadb:5.5:0.2.4'
> 'OPENSHIFT_MARIADB_DB_LOG_DIR' = '/var/lib/openshift/539/mariadb//log/'
> 'OPENSHIFT_MARIADB_DB_URL' = 'mysql://admin123:passwd123@127.1.245.2:3306/'
> 'OPENSHIFT_MYSQL_DB_SOCKET' = '/var/lib/openshift/539/mariadb//socket/mysql.sock'
> 'OPENSHIFT_MYSQL_DB_PASSWORD' = 'passwd123'

Similar to Stackato there is a lot of duplication, in both cases I assume the reason is backward compatibility.

Adding MongoDB and PostgreSQL as well

MongoDB 2.2 database added.  Please make note of these credentials:

Root User:     adminuser
Root Password: passwd123
Database Name: app1

Connection URL: mongodb://$OPENSHIFT_MONGODB_DB_HOST:$OPENSHIFT_MONGODB_DB_PORT/



PostgreSQL 9.2 database added.  Please make note of these credentials:

    Root User: adminuser
    Root Password: passwd123
    Database Name: app1

Connection URL: postgresql://$OPENSHIFT_POSTGRESQL_DB_HOST:$OPENSHIFT_POSTGRESQL_DB_PORT

changes are :

> 'LD_LIBRARY_PATH' = ''
> 'MANPATH' = ''
> 'OPENSHIFT_MONGODB_DB_HOST' = '127.1.245.3'
> 'OPENSHIFT_MONGODB_DB_LOG_DIR' = '/var/lib/openshift/539/mongodb//log/'
> 'OPENSHIFT_MONGODB_DB_PASSWORD' = 'passwd123'
> 'OPENSHIFT_MONGODB_DB_PORT' = '27017'
> 'OPENSHIFT_MONGODB_DB_URL' = 'mongodb://adminuser:passwd123@127.1.245.3:27017/'
> 'OPENSHIFT_MONGODB_DB_USERNAME' = 'adminuser'
> 'OPENSHIFT_MONGODB_DIR' = '/var/lib/openshift/539/mongodb/'
> 'OPENSHIFT_MONGODB_IDENT' = 'redhat:mongodb:2.2:0.2.5'
> 'OPENSHIFT_POSTGRESQL_DB_HOST' = '127.1.245.4'
> 'OPENSHIFT_POSTGRESQL_DB_LOG_DIR' = '/var/lib/openshift/539/postgresql//log/'
> 'OPENSHIFT_POSTGRESQL_DB_PASSWORD' = 'passwd123'
> 'OPENSHIFT_POSTGRESQL_DB_PID' = '/var/lib/openshift/539/postgresql//pid/postgres.pid'
> 'OPENSHIFT_POSTGRESQL_DB_PORT' = '5432'
> 'OPENSHIFT_POSTGRESQL_DB_SOCKET' = '/var/lib/openshift/539/postgresql//socket/'
> 'OPENSHIFT_POSTGRESQL_DB_URL' = 'postgresql://adminuser:passwd123@127.1.245.4:5432'
> 'OPENSHIFT_POSTGRESQL_DB_USERNAME' = 'adminuser'
> 'OPENSHIFT_POSTGRESQL_DIR' = '/var/lib/openshift/539/postgresql/'
> 'OPENSHIFT_POSTGRESQL_IDENT' = 'redhat:postgresql:9.2:0.3.5'
> 'OPENSHIFT_POSTGRESQL_PATH_ELEMENT' = '/bin'
> 'OPENSHIFT_POSTGRESQL_VERSION' = '9.2'
> 'PGDATABASE' = 'app1'
> 'PGDATA' = '/var/lib/openshift/539/postgresql//data'
> 'PGHOST' = '/var/lib/openshift/539/postgresql//socket/'
> 'PGUSER' = 'adminuser'

The Basics

I used the DIY cartridge before and played with it a bit. Next I wanted to create a custom cartridge. As usual for me the first attempt was more about learning about the system than about getting things to work right away. And I must say it was a bit annoying when you start with zero or little knowledge.

A working version is here : https://bitbucket.org/markus_ebenhoeh/openshift-cartridge-spring-boot-jar-runner

Learn from my mistakes:

  • make sure that you use the right cartridge version. I followed code that was newer than the version I was running, but even then I mixed old with new conventions. E.g. I used OPENSHIFT_LOG_DIR but that does not exist yet.
  • don’t git push your code, then find the manifest URL and then try to test it. Either use the card reflector (usage) or if you already have an http server running, just serve your code directly I changed the source to a zip on my http server and ran this just before I retried with a new application rm -f cartridge-name.zip; zip -r cartridge-name.zip *; chmod a+rX -R $PWD In the end, I just mounted a shared folder and referred the source URL to that with file:///mnt/public-shared/openshift-cartridge-spring-boot-jar-runner while still hosting the same folder via http for the manifest access

  • to test my cartridge I added a spring-boot application jar with an embedded tomcat. Instead of taking the smallest web-app jar that I could find I took a 29MB jar and added it into the template. This is stupid on many levels, but it also meant that it took long to do the git pull and the start and the transfer.etc having a test app in the template is important for the testing of the cartridge and afterwards for the use of it, but a smaller application is what I am going for next.

Debugging a Failing Cartridge

When my cartridge completely failed I had no output and nothing to go on. I was logged on to my test origin VM but the gear/application folder would simple be deleted at the end. So all my test log output that was supposed to show me were it failed and what the environment looked like would vanish

So while being logged on to the test VM with root I did this dodgy thing:

cd /var/lib/openshift/
# my user/gear/app folder  always starts with 5 and I had no other gears set-up
unalias cp
while true; do cp -a 5* tmp/ ;  usleep 100000; echo next  ;done

once it failed I had more information to go on with. especially the nev folders are useful

Other problems:

  • I would like to see a cartridge life-cycle flow. e.g. copy file, call install, call setup etc.
  • when are ENV variables available? Can I refer to my own env_xyz.erb variables when defining new ones?
  • I still have no idea how the repo
  • there has to be a better way to test this then to do an add-app with the updated cartridge.
  • I could not find any debug output when my cartridge completely failed
  • CDK is not working on Origin bug

OpenShift Cartridge Development Kit

ran this against OpenShift Online since CDK is not working on Origin bug. not sure what the point is, though. I think it is about being able to have a simple way of hosting the cartridge for a certain version

rhc create-app mycart http://cdk-claytondev.rhcloud.com
The cartridge 'http://cdk-claytondev.rhcloud.com' will be downloaded and installed

Application Options
-------------------
Domain:     testcdk
Cartridges: http://cdk-claytondev.rhcloud.com
Gear Size:  default
Scaling:    no

Creating application 'mycart' ... done

The CDK is configured with password XXXXXXXXXXXXXXX for builds (use 'admin' as the user)

Waiting for your DNS name to be available ... done

Cloning into 'mycart'...
The authenticity of host 'mycart-testcdk.rhcloud.com (54.204.113.11)' can't be established.
RSA key fingerprint is cf:ee:77:cb:0e:fc:02:d7:72:7e:ae:80:c0:90:88:a7.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'mycart-testcdk.rhcloud.com,54.204.113.11' (RSA) to the list of known hosts.
X11 forwarding request failed on channel 0

Your application 'mycart' is now available.

URL:        http://mycart-testcdk.rhcloud.com/
SSH to:     539@mycart-testcdk.rhcloud.com
Git remote: ssh://539@mycart-testcdk.rhcloud.com/~/git/mycart.git/
Cloned to:  /xdata/local/dev/markus/git/cdk/mycart

Run 'rhc show-app mycart' for more details about your app.

Lifeccyle Notes

first installation

20140609_034324 setup called with --version 1.0.2 
20140609_034324 install called with --version 1.0.2 
20140609_034324 control called with start 
20140609_034324 start_app called 
20140609_034324 Starting spring-boot-bin-jar-runner cartridge 
20140609_034324 start_app: Using jarfile=/var/lib/openshift/539/spring-boot-jar-runner/web-app-jar/simple-executable-jar-web-server-0.0.1.jar 
20140609_034324 control : checkSpringBootAppIsRunning still checking 
20140609_034325 control start successfully started the application 

git push new app code

20140609_034411 control called with stop 
20140609_034411 stop_app called 
20140609_034411 Stopping spring-boot-bin-jar-runner cartridge 
20140609_034411 Sending SIGTERM to java:4556 ... 
20140609_034411 control called with pre-repo-archive 
20140609_034412 control called with update-configuration 
20140609_034412 control called with pre-build 
20140609_034412 control called with build 
20140609_034412 build called with 
20140609_034412 control called with update-configuration 
20140609_034412 control called with deploy 
20140609_034412 deploy called with 
20140609_034412 control called with start 
20140609_034412 start_app called 
20140609_034412 Starting spring-boot-bin-jar-runner cartridge 
20140609_034412 start_app: Using jarfile=/var/lib/openshift/539/spring-boot-jar-runner/web-app-jar/simple-executable-jar-web-server-0.0.1.jar 
20140609_034412 control : checkSpringBootAppIsRunning still checking 
20140609_034412 control start successfully started the application 
20140609_034432 control called with post-deploy 

There is considerable time spent between “start” and “post-deploy” not sure what’s happening there.

Similar to my Cloud Foundry environment notes I was interested what Stackato puts on top of the Cloud Foundry framework. This was running in a local VM that I downloaded from their site.

Deploying the app

Still using the same test code

After spending quite some time on trying to set the JAVA_OPTS, I instead changed the source code to use the environment variable instead of server.port and server.address and then re-pushed

mkdir build
cd build
unzip ../target/simple-executable-jar-web-server-0.0.1.jar
cd ..
stackato push --path /xdata/local/dev/markus/git/simple-executable-jar-web-server/build

The app worked after my code changes and the test server was up and running, but I could not log into the web console, anymore, thought I had the password wrong, but then used

stackato passwd

and it accepted my old password. Besides Firefox remembered the same password.

A server restart helped. Since I usually only pause my VMs it might have gotten confused.,

Runtime Environment and Properties

Environment

'HOME' = '/home/stackato/app'
'JAVA_OPTS' = '-Dserver.port=$VCAP_APP_PORT -Dserver.address=$VCAP_APP_HOST'
'LANG' = 'en_US.UTF-8'
'LANGUAGE' = 'en_US.UTF-8'
'LC_ALL' = 'en_US.UTF-8'
'LOGNAME' = 'stackato'
'MAIL' = '/var/mail/stackato'
'MEMORY_LIMIT' = '256m'
'NLSPATH' = '/usr/dt/lib/nls/msg/%L/%N.cat'
'OLDPWD' = '/home/stackato/app'
'PACKAGES_COMMON' = 'git'
'PATH' = '/opt/ActivePython-2.7/bin:/opt/ActivePython-3.3/bin:/opt/ActivePerl-5.16/bin:/opt/rubies/current/bin:/opt/node-v0.10/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
'PORT' = '58761'
'PWD' = '/home/stackato/app'
'SHELL' = '/bin/bash'
'SHLVL' = '2'
'SSH_CLIENT' = '172.17.42.1 51755 22'
'SSH_CONNECTION' = '172.17.42.1 51755 172.17.0.86 22'
'STACKATO_APP_ENV' = 'JAVA_OPTS'
'STACKATO_APP_NAME' = 'simple-executable-jar-web-server'
'STACKATO_APP_NAME_UPCASE' = 'SIMPLE_EXECUTABLE_JAR_WEB_SERVER'
'STACKATO_APP_ROOT' = '/home/stackato'
'STACKATO_DOCKER' = 'True'
'STACKATO_LOG_FILES' = 'stdout=/home/stackato/logs/stdout.log:stderr=/home/stackato/logs/stderr.log'
'STACKATO_SERVICES' = '{}'
'TMPDIR' = '/home/stackato/tmp'
'USER' = 'stackato'
'VCAP_APPLICATION' = '{"instance_id":"e20054cb47ed479c843142b480e12f52","instance_index":0,"host":"0.0.0.0","port":58761,"started_at":"2014-06-02 06:33:19 -0700","started_at_timestamp":1401715999,"start":"2014-06-02 06:33:19 -0700","state_timestamp":1401715999,"limits":{"mem":256,"disk":2048,"fds":16384,"allow_sudo":false},"application_version":"8c5b4b0a-5e50-4d69-bf92-f4fe7c5ef0ec","application_name":"simple-executable-jar-web-server","application_uris":["simple-executable-jar-web-server.stackato-cr6q.local"],"sso_enabled":false,"version":"8c5b4b0a-5e50-4d69-bf92-f4fe7c5ef0ec","name":"simple-executable-jar-web-server","uris":["simple-executable-jar-web-server.stackato-cr6q.local"],"users":null}'
'VCAP_APP_HOST' = '0.0.0.0'
'VCAP_APP_PORT' = '58761'
'VCAP_SERVICES' = '{}'
'XFILESEARCHPATH' = '/usr/dt/app-defaults/%L/Dt'
'_' = '/home/stackato/app/.java-buildpack/open_jdk/bin/java'

System Properties

'awt.toolkit' = 'sun.awt.X11.XToolkit'
'file.encoding' = 'UTF-8'
'file.encoding.pkg' = 'sun.io'
'file.separator' = '/'
'java.awt.graphicsenv' = 'sun.awt.X11GraphicsEnvironment'
'java.awt.printerjob' = 'sun.print.PSPrinterJob'
'java.class.path' = '/home/stackato/app/.'
'java.class.version' = '51.0'
'java.endorsed.dirs' = '/home/stackato/app/.java-buildpack/open_jdk/lib/endorsed'
'java.ext.dirs' = '/home/stackato/app/.java-buildpack/open_jdk/lib/ext:/usr/java/packages/lib/ext'
'java.home' = '/home/stackato/app/.java-buildpack/open_jdk'
'java.io.tmpdir' = '/home/stackato/tmp'
'java.library.path' = '/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib'
'java.runtime.name' = 'OpenJDK Runtime Environment'
'java.runtime.version' = '1.7.0_60-b19'
'java.specification.name' = 'Java Platform API Specification'
'java.specification.vendor' = 'Oracle Corporation'
'java.specification.version' = '1.7'
'java.vendor' = 'Oracle Corporation'
'java.vendor.url' = 'http://java.oracle.com/'
'java.vendor.url.bug' = 'http://bugreport.sun.com/bugreport/'
'java.version' = '1.7.0_60'
'java.vm.info' = 'mixed mode'
'java.vm.name' = 'OpenJDK 64-Bit Server VM'
'java.vm.specification.name' = 'Java Virtual Machine Specification'
'java.vm.specification.vendor' = 'Oracle Corporation'
'java.vm.specification.version' = '1.7'
'java.vm.vendor' = 'Oracle Corporation'
'java.vm.version' = '24.80-b07'
'line.separator' = '    '
'os.arch' = 'amd64'
'os.name' = 'Linux'
'os.version' = '3.8.0-30-generic'
'path.separator' = ':'
'sun.arch.data.model' = '64'
'sun.boot.class.path' = '/home/stackato/app/.java-buildpack/open_jdk/lib/resources.jar:/home/stackato/app/.java-buildpack/open_jdk/lib/rt.jar:/home/stackato/app/.java-buildpack/open_jdk/lib/sunrsasign.jar:/home/stackato/app/.java-buildpack/open_jdk/lib/jsse.jar:/home/stackato/app/.java-buildpack/open_jdk/lib/jce.jar:/home/stackato/app/.java-buildpack/open_jdk/lib/charsets.jar:/home/stackato/app/.java-buildpack/open_jdk/lib/jfr.jar:/home/stackato/app/.java-buildpack/open_jdk/classes'
'sun.boot.library.path' = '/home/stackato/app/.java-buildpack/open_jdk/lib/amd64'
'sun.cpu.endian' = 'little'
'sun.cpu.isalist' = ''
'sun.io.unicode.encoding' = 'UnicodeLittle'
'sun.java.command' = 'at.mnm.util.SimpleTestWebServer'
'sun.java.launcher' = 'SUN_STANDARD'
'sun.jnu.encoding' = 'UTF-8'
'sun.management.compiler' = 'HotSpot 64-Bit Tiered Compilers'
'sun.os.patch.level' = 'unknown'
'user.country' = 'US'
'user.dir' = '/home/stackato/app'
'user.home' = '/home/stackato'
'user.language' = 'en'
'user.name' = 'stackato'

Adding services

Wanted to add the service via the web UI but did not immediately see how.

stackato create-service mysql testdb simple-executable-jar-web-server

Afterwards the following new environment properties were added :

> 'DATABASE_URL' = 'mysql://ucLE9lXtowAqf:pYSRyL7jO1vgi@172.16.127.133:3306/d415c91f5251b450d9a3c20c45b5d7777'
> 'JDBC_MYSQL_URL' = 'jdbc:mysql://ucLE9lXtowAqf:pYSRyL7jO1vgi@172.16.127.133:3306/d415c91f5251b450d9a3c20c45b5d7777'
> 'MYSQL_URL' = 'mysql://ucLE9lXtowAqf:pYSRyL7jO1vgi@172.16.127.133:3306/d415c91f5251b450d9a3c20c45b5d7777'

And these changed : < ‘STACKATO_SERVICES’ = ‘{}’ —

‘STACKATO_SERVICES’ = ‘{“testdb”:{“name”:”d415c91f5251b450d9a3c20c45b5d7777″, “hostname”:”172.16.127.133″,”host”:”172.16.127.133″,”port”:3306, “user”:”ucLE9lXtowAqf”,”username”:”ucLE9lXtowAqf”,”password”:”pYSRyL7jO1vgi”, “uri”:”mysql://ucLE9lXtowAqf:pYSRyL7jO1vgi@172.16.127.133:3306/d415c91f5251b450d9a3c20c45b5d7777″, “jdbcUrl”:”jdbc:mysql://ucLE9lXtowAqf:pYSRyL7jO1vgi@172.16.127.133:3306/d415c91f5251b450d9a3c20c45b5d7777″}}’

< 'VCAP_SERVICES' = '{}'
---
> 'VCAP_SERVICES' = '{"mysql":[{"name":"testdb","label":"mysql-5.5","tags":[],
    "plan":"free","credentials":{"name":"d415c91f5251b450d9a3c20c45b5d7777",
    "hostname":"172.16.127.133","host":"172.16.127.133","port":3306,
    "user":"ucLE9lXtowAqf","username":"ucLE9lXtowAqf","password":"pYSRyL7jO1vgi",
    "uri":"mysql://ucLE9lXtowAqf:pYSRyL7jO1vgi@172.16.127.133:3306/d415c91f5251b450d9a3c20c45b5d7777",
    "jdbcUrl":"jdbc:mysql://ucLE9lXtowAqf:pYSRyL7jO1vgi@172.16.127.133:3306/d415c91f5251b450d9a3c20c45b5d7777"}}]}'

VCAP_APPLICATION seemed to change like for CloudFoundry – but unrelated to to service.

and this system proeprty changed, simialr to Cloud Foundry:

< 'java.class.path' = '/home/stackato/app/.'
---
> 'java.class.path' = '/home/stackato/app/.:/home/stackato/app/.java-buildpack/maria_db_jdbc/maria_db_jdbc-1.1.7.jar'

Appendix : How to Not Set Environment

Not sure how this should have worked, but it didn’t for me…

I wanted to set Java System Properties to pass in the server.address and server.port. The same worked for Cloud Foundry

Tried to figure out the right amount of escaping … this is what we want to see: ‘JAVA_OPTS’ = ‘-Dserver.port=$VCAP_APP_PORT -Dserver.address=$VCAP_APP_HOST’

stackato set-env simple-executable-jar-web-server JAVA_OPTS "-Dserver.port=\\\$VCAP_APP_PORT -Dserver.address=\\\$VCAP_APP_HOST"
Unknown option -Dserver.port

stackato set-env simple-executable-jar-web-server JAVA_OPTS '-Dserver.port=$VCAP_APP_PORT -Dserver.address=$VCAP_APP_HOST'
Unknown option -Dserver.port


stackato set-env simple-executable-jar-web-server JAVA_OPTS '\-Dserver.port=\$VCAP_APP_PORT \-Dserver.address=\$VCAP_APP_HOST'
Adding Environment Variable [JAVA_OPTS=\-Dserver.port=\$VCAP_APP_PORT \-Dserver.address=\$VCAP_APP_HOST] ... 
...
app[stdout.0]:    'JAVA_OPTS' = '\-Dserver.port=$VCAP_APP_PORT \-Dserver.address=$VCAP_APP_HOST'
...




stackato set-env simple-executable-jar-web-server JAVA_OPTS '\"-Dserver.port=\$VCAP_APP_PORT \-Dserver.address=\$VCAP_APP_HOST\"'
Adding Environment Variable [JAVA_OPTS=\"-Dserver.port=\$VCAP_APP_PORT \-Dserver.address=\$VCAP_APP_HOST\"] ... 
...
app[stdout.0]:    'JAVA_OPTS' = '\-Dserver.port=$VCAP_APP_PORT'
...


stackato set-env simple-executable-jar-web-server JAVA_OPTS "\"-Dserver.port=\$VCAP_APP_PORT \-Dserver.address=\$VCAP_APP_HOST\""
Adding Environment Variable [JAVA_OPTS="-Dserver.port=$VCAP_APP_PORT \-Dserver.address=$VCAP_APP_HOST"] ... 
...
app[stdout.0]:    'JAVA_OPTS' = '"-Dserver.port=45238 \-Dserver.address=0.0.0.0"'
...

stackato env-add simple-executable-jar-web-server JAVA_OPTS "\"-Dserver.port=\$VCAP_APP_PORT \-Dserver.address=\$VCAP_APP_HOST\""
Adding Environment Variable [JAVA_OPTS="-Dserver.port=$VCAP_APP_PORT \-Dserver.address=$VCAP_APP_HOST"] ... 
...
app[stdout.0]:    'JAVA_OPTS' = '"-Dserver.port=43998 \-Dserver.address=0.0.0.0"'
...


stackato set-env simple-executable-jar-web-server JAVA_OPTS "\-Dserver.port=\\\$VCAP_APP_PORT \-Dserver.address=\\\$VCAP_APP_HOST"
Adding Environment Variable [JAVA_OPTS=\-Dserver.port=\$VCAP_APP_PORT \-Dserver.address=\$VCAP_APP_HOST] ... 
...
app[stdout.0]:    'JAVA_OPTS' = '\-Dserver.port=$VCAP_APP_PORT \-Dserver.address=$VCAP_APP_HOST'
...


stackato env-add simple-executable-jar-web-server JAVA_OPTS "\"-Dserver.port=\$VCAP_APP_PORT -Dserver.address=\$VCAP_APP_HOST\""
Adding Environment Variable [JAVA_OPTS="-Dserver.port=$VCAP_APP_PORT -Dserver.address=$VCAP_APP_HOST"] ... 
...
app[stdout.0]:    'JAVA_OPTS' = '"-Dserver.port=48420 -Dserver.address=0.0.0.0"'
...

stackato env-add simple-executable-jar-web-server JAVA_OPTS "\"-Dserver.port=\\\$VCAP_APP_PORT -Dserver.address=\\\$VCAP_APP_HOST\""
Adding Environment Variable [JAVA_OPTS="-Dserver.port=\$VCAP_APP_PORT -Dserver.address=\$VCAP_APP_HOST"] ... 
...
app[stdout.0]:    'JAVA_OPTS' = '"-Dserver.port=$VCAP_APP_PORT -Dserver.address=$VCAP_APP_HOST"'
...


stackato env-add simple-executable-jar-web-server JAVA_OPTS "\-Dserver.port=\\\$VCAP_APP_PORT \-Dserver.address=\\\$VCAP_APP_HOST"
Adding Environment Variable [JAVA_OPTS=\-Dserver.port=\$VCAP_APP_PORT \-Dserver.address=\$VCAP_APP_HOST] ... 
...
app[stdout.0]:    'JAVA_OPTS' = '\-Dserver.port=$VCAP_APP_PORT \-Dserver.address=$VCAP_APP_HOST'
...

stackato env-add simple-executable-jar-web-server JAVA_OPTS '"-"Dserver.port=\$VCAP_APP_PORT "-"Dserver.address=\$VCAP_APP_HOST"'
Adding Environment Variable [JAVA_OPTS="-"Dserver.port=\$VCAP_APP_PORT "-"Dserver.address=\$VCAP_APP_HOST"] ... 
...
app[stdout.0]:    'JAVA_OPTS' = '"-"Dserver.port=$VCAP_APP_PORT "-"Dserver.address=$VCAP_APP_HOST"'
...

giving up. I use the way it works descibed at http://community.activestate.com/node/9487 (or I could use cf).

vi build/stackato.yml

app-dir: /xdata/local/dev/markus/git/simple-executable-jar-web-server/build
disk: 2048
memory: 256
name: simple-executable-jar-web-server
env:
JAVA_OPTS: "-Dserver.port=$VCAP_APP_PORT -Dserver.address=$VCAP_APP_HOST"


stackato push --path /xdata/local/dev/markus/git/simple-executable-jar-web-server/build
...
app[stdout.0]:    'JAVA_OPTS' = '"-"Dserver.port=$VCAP_APP_PORT "-"Dserver.address=$VCAP_APP_HOST"'
...


stackato env-del simple-executable-jar-web-server JAVA_OPTS
Deleting Environment Variable [JAVA_OPTS] ... 



stackato push --path /xdata/local/dev/markus/git/simple-executable-jar-web-server/build
Using manifest file "build/stackato.yml"
...
Enter JAVA_OPTS [-Dserver.port=$VCAP_APP_PORT -Dserver.address=$VCAP_APP_HOST]: 
  Adding Environment Variable [JAVA_OPTS=-Dserver.port=$VCAP_APP_PORT -Dserver.address=$VCAP_APP_HOST]
...

but no JAVA_OPTS and no system properties

stackato env-del simple-executable-jar-web-server JAVA_OPTS


cf login  --skip-ssl-validation -a https://api.stackato-cr6q.local
API endpoint: https://api.stackato-cr6q.local
...

cf set-env simple-executable-jar-web-server JAVA_OPTS "-Dserver.port=\\\$VCAP_APP_PORT -Dserver.address=\\\$VCAP_APP_HOST"
Setting env variable 'JAVA_OPTS' to '-Dserver.port=\$VCAP_APP_PORT -Dserver.address=\$VCAP_APP_HOST' for app simple-executable-jar-web-server in org mnm.at / space demos as admin...
OK
TIP: Use 'cf push' to ensure your env variable changes take effect

rm build/stackato.yml 
stackato push --path /xdata/local/dev/markus/git/simple-executable-jar-web-server/build

even though this time the JAVA_OPTS variable looks right:

app[stdout.0]:    'JAVA_OPTS' = '-Dserver.port=$VCAP_APP_PORT -Dserver.address=$VCAP_APP_HOST'

there is not server.port system property. so it seems that the build back is different (though it is the java build pack)

I want to see what mechanism is used to signal available services to an application running in Cloud Foundry.

I checked by running my non-spring test server simple-executable-jar-web-server. The server is tiny and quick to deploy.

first deploy

To run this in an Cloud Foundry environment I had to figure out how to pass the server address and port.

cf push simple-executable-jar-web-server -p target/simple-executable-jar-web-server-0.0.1.jar

The previous command will fail. I did not check if there is some other way to register an application or if it is even required before set-env)

The next line sets JAVA_OPT which in turn will set the relevant system properties on the Java command line:

cf set-env simple-executable-jar-web-server JAVA_OPTS "-Dserver.port=\\\$VCAP_APP_PORT -Dserver.address=\\\$VCAP_APP_HOST"

This time it will work:

cf push simple-executable-jar-web-server -p target/simple-executable-jar-web-server-0.0.1.jar

I believe the port will change every time you push.

The value of the VCAP_APPLICATION environment variable changes after every push as well.

Specifically application_version, version, instance_id e.g space-id and application_id stay the same

< 'VCAP_APPLICATION' = '{"limits":{"mem":1024,"disk":1024,"fds":16384},
    "application_version":"12345678-1234-1234-1234-123456789012",
    "application_name":"simple-executable-jar-web-server",
    "application_uris":["simple-executable-jar-web-server.cfapps.io"],
    "version":"12345678-1234-1234-1234-123456789012","name":"simple-executable-jar-web-server",
    "space_name":"development","space_id":"spaceid12345678901234567890123456789",
    "uris":["simple-executable-jar-web-server.cfapps.io"],"users":null,
    "application_id":"appid1234567890123456789012345678901",
    "instance_id":"instanceid1234567890123456789012","instance_index":0,"host":"0.0.0.0","port":62466,
    "started_at":"2014-06-15 00:33:09 +0000","started_at_timestamp":1402792389,
    "start":"2014-06-15 00:33:09 +0000","state_timestamp":1402792389}'
---
> 'VCAP_APPLICATION' = '{"limits":{"mem":1024,"disk":1024,"fds":16384},
    "application_version":"newappli-cati-onve-rsio-n12345678901",
    "application_name":"simple-executable-jar-web-server",
    "application_uris":["simple-executable-jar-web-server.cfapps.io"],
    "version":"newappli-cati-onve-rsio-n12345678901","name":"simple-executable-jar-web-server",
    "space_name":"development","space_id":"spaceid12345678901234567890123456789",
    "uris":["simple-executable-jar-web-server.cfapps.io"],"users":null,
    "application_id":"appid1234567890123456789012345678901",
    "instance_id":"newinstanceid1234567890123456789","instance_index":0,"host":"0.0.0.0","port":62187,
    "started_at":"2014-06-15 00:44:08 +0000","started_at_timestamp":1402793048,
    "start":"2014-06-15 00:44:08 +0000","state_timestamp":1402793048}'

Pivotal’s Cloud Foundry seems to have some problem with fonts. But the UI is made in a way that you don’t know what the icons mean, since there is is alternate text and it is not obvious in the context of the UI. e.g. one of the two icons in the circle is stop and the other one restart (the circle is part of the UI, btw).

screenshot-missing-icons-cloudfoundry

Environment Variables:

'HOME' = '/home/vcap/app'
'JAVA_OPTS' = '-Dserver.port=$VCAP_APP_PORT -Dserver.address=$VCAP_APP_HOST'
'MEMORY_LIMIT' = '1024m'
'NLSPATH' = '/usr/dt/lib/nls/msg/%L/%N.cat'
'OLDPWD' = '/home/vcap'
'PATH' = '/bin:/usr/bin'
'PORT' = '62466'
'PWD' = '/home/vcap/app'
'SHLVL' = '1'
'TMPDIR' = '/home/vcap/tmp'
'USER' = 'vcap'
'VCAP_APPLICATION' = '{"limits":{"mem":1024,"disk":1024,"fds":16384},"application_version":"12345678-1234-1234-1234-123456789012","application_name":"simple-executable-jar-web-server","application_uris":["simple-executable-jar-web-server.cfapps.io"],"version":"12345678-1234-1234-1234-123456789012","name":"simple-executable-jar-web-server","space_name":"development","space_id":"spaceid12345678901234567890123456789","uris":["simple-executable-jar-web-server.cfapps.io"],"users":null,"application_id":"appid1234567890123456789012345678901","instance_id":"instanceid1234567890123456789012","instance_index":0,"host":"0.0.0.0","port":62466,"started_at":"2014-06-15 00:33:09 +0000","started_at_timestamp":1402792389,"start":"2014-06-15 00:33:09 +0000","state_timestamp":1402792389}'
'VCAP_APP_HOST' = '0.0.0.0'
'VCAP_APP_PORT' = '62466'
'VCAP_SERVICES' = '{}'
'XFILESEARCHPATH' = '/usr/dt/app-defaults/%L/Dt'
'_' = '/home/vcap/app/.java-buildpack/open_jdk_jre/bin/java'

System Properties

'awt.toolkit' = 'sun.awt.X11.XToolkit'
'file.encoding' = 'ANSI_X3.4-1968'
'file.encoding.pkg' = 'sun.io'
'file.separator' = '/'
'java.awt.graphicsenv' = 'sun.awt.X11GraphicsEnvironment'
'java.awt.printerjob' = 'sun.print.PSPrinterJob'
'java.class.path' = '/home/vcap/app/.'
'java.class.version' = '51.0'
'java.endorsed.dirs' = '/home/vcap/app/.java-buildpack/open_jdk_jre/lib/endorsed'
'java.ext.dirs' = '/home/vcap/app/.java-buildpack/open_jdk_jre/lib/ext:/usr/java/packages/lib/ext'
'java.home' = '/home/vcap/app/.java-buildpack/open_jdk_jre'
'java.io.tmpdir' = '/home/vcap/tmp'
'java.library.path' = '/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib'
'java.runtime.name' = 'OpenJDK Runtime Environment'
'java.runtime.version' = '1.7.0_60-b19'
'java.specification.name' = 'Java Platform API Specification'
'java.specification.vendor' = 'Oracle Corporation'
'java.specification.version' = '1.7'
'java.vendor' = 'Oracle Corporation'
'java.vendor.url' = 'http://java.oracle.com/'
'java.vendor.url.bug' = 'http://bugreport.sun.com/bugreport/'
'java.version' = '1.7.0_60'
'java.vm.info' = 'mixed mode'
'java.vm.name' = 'OpenJDK 64-Bit Server VM'
'java.vm.specification.name' = 'Java Virtual Machine Specification'
'java.vm.specification.vendor' = 'Oracle Corporation'
'java.vm.specification.version' = '1.7'
'java.vm.vendor' = 'Oracle Corporation'
'java.vm.version' = '24.80-b07'
'line.separator' = '
'
'os.arch' = 'amd64'
'os.name' = 'Linux'
'os.version' = '3.0.0-32-virtual'
'path.separator' = ':'
'server.address' = '0.0.0.0'
'server.port' = '62466'
'sun.arch.data.model' = '64'
'sun.boot.class.path' = '/home/vcap/app/.java-buildpack/open_jdk_jre/lib/resources.jar:/home/vcap/app/.java-buildpack/open_jdk_jre/lib/rt.jar:/home/vcap/app/.java-buildpack/open_jdk_jre/lib/sunrsasign.jar:/home/vcap/app/.java-buildpack/open_jdk_jre/lib/jsse.jar:/home/vcap/app/.java-buildpack/open_jdk_jre/lib/jce.jar:/home/vcap/app/.java-buildpack/open_jdk_jre/lib/charsets.jar:/home/vcap/app/.java-buildpack/open_jdk_jre/lib/jfr.jar:/home/vcap/app/.java-buildpack/open_jdk_jre/classes'
'sun.boot.library.path' = '/home/vcap/app/.java-buildpack/open_jdk_jre/lib/amd64'
'sun.cpu.endian' = 'little'
'sun.cpu.isalist' = ''
'sun.io.unicode.encoding' = 'UnicodeLittle'
'sun.java.command' = 'at.mnm.util.SimpleTestWebServer'
'sun.java.launcher' = 'SUN_STANDARD'
'sun.jnu.encoding' = 'ANSI_X3.4-1968'
'sun.management.compiler' = 'HotSpot 64-Bit Tiered Compilers'
'sun.os.patch.level' = 'unknown'
'user.country' = 'US'
'user.dir' = '/home/vcap/app'
'user.home' = '/home/vcap'
'user.language' = 'en'
'user.name' = 'vcap'
'user.timezone' = 'Etc/UTC'

Services

MySQL – without any other services

I added the free-tier MySQL (I called the instance ‘SOME-INSTANCE-NAME-I-CHOSE-FOR-MYSQL’) service from the market place.

Couldn’t restart my app, it sometimes stopped but then did not start, most of the time restarts did nothing.

In the end I pushed the app again, which is what the WEB UI suggests.

Binding MySQL changed the following environment and system properties :

A new environment variables was added by Cloud Foundry:

'DATABASE_URL' = 'mysql2://username123456:12345678@us-cdbr-east-06.cleardb.net:3306/ad_123456789012345?reconnect=true'

The following environment variables where changed by Cloud Foundry ( apart from ports and the VCAP_APPLICATION ones )

< 'VCAP_SERVICES' = '{}'
---
> 'VCAP_SERVICES' = '{"cleardb":[{"name":"SOME-INSTANCE-NAME-I-CHOSE-FOR-MYSQL","label":"cleardb","tags":
    ["relational","Data Store","mysql"],"plan":"spark","credentials":{
    "jdbcUrl":"jdbc:mysql://username123456:passwd12@us-cdbr-east-06.cleardb.net:3306/dbname123456789012",
    "uri":"mysql://username123456:passwd12@us-cdbr-east-06.cleardb.net:3306/dbname123456789012?reconnect=true",
    "name":"dbname123456789012","hostname":"us-cdbr-east-06.cleardb.net","port":"3306",
    "username":"username123456","password":"passwd12"}}]}'  

Changes to system properties:

<    'java.class.path' = '/home/vcap/app/.'
---
>    'java.class.path' = '/home/vcap/app/.:/home/vcap/app/.java-buildpack/maria_db_jdbc/maria_db_jdbc-1.1.7.jar'

(As well as port changes.)

PostgreSQL in addition to MySQL

Added new free tier PostgreSQL service SOME-INSTANCE-NAME-I-CHOSE-FOR-PGSQL and after binding it to my test app pushed the app up again

Changes to environment variables:

< 'VCAP_SERVICES' = '{"cleardb":[{"name":"SOME-INSTANCE-NAME-I-CHOSE-FOR-MYSQL","label":"cleardb","tags":
    ["relational","Data Store","mysql"],"plan":"spark","credentials":{
    "jdbcUrl":"jdbc:mysql://username123456:passwd12@us-cdbr-east-06.cleardb.net:3306/dbname123456789012",
    "uri":"mysql://username123456:passwd12@us-cdbr-east-06.cleardb.net:3306/dbname123456789012?reconnect=true",
    "name":"dbname123456789012","hostname":"us-cdbr-east-06.cleardb.net","port":"3306",
    "username":"username123456","password":"passwd12"}}]}'
---
> 'VCAP_SERVICES' = '{"cleardb":[{"name":"SOME-INSTANCE-NAME-I-CHOSE-FOR-MYSQL","label":"cleardb","tags":
    ["relational","Data Store","mysql"],"plan":"spark","credentials":{
    "jdbcUrl":"jdbc:mysql://username123456:passwd12@us-cdbr-east-06.cleardb.net:3306/dbname123456789012",
    "uri":"mysql://username123456:passwd12@us-cdbr-east-06.cleardb.net:3306/dbname123456789012?reconnect=true",
    "name":"dbname123456789012","hostname":"us-cdbr-east-06.cleardb.net","port":"3306",
    "username":"username123456","password":"passwd12"}}],
    "elephantsql":[{"name":"SOME-INSTANCE-NAME-I-CHOSE-FOR-PGSQL","label":"elephantsql",
    "tags":["New Product","relational","Data Store","postgresql"],"plan":"turtle","credentials":{
    "uri":"postgres://user1234:encodedpassword12345678901234567@babar.elephantsql.com:5432/user1234",
    "max_conns":"5"}}]}'

Changes to system variables:

< 'java.class.path' = '/home/vcap/app/.:/home/vcap/app/.java-buildpack/maria_db_jdbc/maria_db_jdbc-1.1.7.jar'
---
> 'java.class.path' = '/home/vcap/app/.:/home/vcap/app/.java-buildpack/maria_db_jdbc/maria_db_jdbc-1.1.7.jar:/home/vcap/app/.java-buildpack/postgresql_jdbc/postgresql_jdbc-9.3.1101.jar'

notable is that ‘DATABASE_URL’ still did not change, I assume it might be the first relational DB (or is only used for MySQL)

Added Redis in addition to MySQL and PostgreSQL

Added the free tier Redis service (‘SOME-INSTANCE-NAME-I-CHOSE-FOR-REDIS’)

Changes to environment variables

< 'VCAP_SERVICES' = '{"cleardb":[{"name":"SOME-INSTANCE-NAME-I-CHOSE-FOR-MYSQL","label":"cleardb","tags":
    ["relational","Data Store","mysql"],"plan":"spark","credentials":{
    "jdbcUrl":"jdbc:mysql://username123456:passwd12@us-cdbr-east-06.cleardb.net:3306/dbname123456789012",
    "uri":"mysql://username123456:passwd12@us-cdbr-east-06.cleardb.net:3306/dbname123456789012?reconnect=true",
    "name":"dbname123456789012","hostname":"us-cdbr-east-06.cleardb.net","port":"3306",
    "username":"username123456","password":"passwd12"}}],
    "elephantsql":[{"name":"SOME-INSTANCE-NAME-I-CHOSE-FOR-PGSQL","label":"elephantsql",
    "tags":["New Product","relational","Data Store","postgresql"],"plan":"turtle","credentials":{
    "uri":"postgres://user1234:encodedpassword12345678901234567@babar.elephantsql.com:5432/user1234",
    "max_conns":"5"}}]}'
---
> 'VCAP_SERVICES' = '{"rediscloud":[{"name":"SOME-INSTANCE-NAME-I-CHOSE-FOR-REDIS","label":"rediscloud","tags":
    ["key-value","redis","Data Store"],"plan":"25mb","credentials":{
    "port":"17750","hostname":"pub-redis-17750.us-east-1-3.3.ec2.garantiadata.com","password":"redispasswd12345"}}],
    "cleardb":[{"name":"SOME-INSTANCE-NAME-I-CHOSE-FOR-MYSQL","label":"cleardb","tags":
    ["relational","Data Store","mysql"],"plan":"spark","credentials":{
    "jdbcUrl":"jdbc:mysql://username123456:passwd12@us-cdbr-east-06.cleardb.net:3306/dbname123456789012",
    "uri":"mysql://username123456:passwd12@us-cdbr-east-06.cleardb.net:3306/dbname123456789012?reconnect=true",
    "name":"dbname123456789012","hostname":"us-cdbr-east-06.cleardb.net","port":"3306",
    "username":"username123456","password":"passwd12"}}], 
    "elephantsql":[{"name":"SOME-INSTANCE-NAME-I-CHOSE-FOR-PGSQL","label":"elephantsql",
    "tags":["New Product","relational","Data Store","postgresql"],"plan":"turtle","credentials":{
    "uri":"postgres://user1234:encodedpassword12345678901234567@babar.elephantsql.com:5432/user1234",
    "max_conns":"5"}}]}'

(No changes to system variables.)

General Thoughts about Cloud Foundry

The web-UI is quite slow. I mean up to 5 seconds per click slow when doing things like checking the looking at the list of apps. Even when it is not that slow it is never fast (less than 1.5 sec)

I find the UI generally a bit disappointing.

After pushing a custom spring boot app to CF, the app worked at once. No tinkering (unlike stackato).

Austria and particularly our hoster in Austria have caused us slow page load times in Australia. We now moved the hosting to Sydney and that made a big difference. Of course page load times in Austria are now average but not as slow as vice versa.

I also played with S3 and some caching mechanisms but after some page speed tests from around the world its not worth it. CloudFront or another CDN would be different, but we are nowhere close to requiring it and would first check out a different DNS server since that is still the Austrian hoster.