0

In our use-case we need to create and deploy a Message Stream application to our private Cloud Foundry environment. The stream application is meant to listen on a RabbitMq queue and trigger a task, as defined in the stream.

To achieve the same, we using cloud-dataflow-server-cloudfoundry by running it locally on Mac.

Below are the set of commands used to achieve it:-

  • Set Maven remote repo export MAVEN_REMOTE_REPOSITORIES_REPO1_URL=https://ftl.abc.com/NEXUS
  • Setup Cloud Foundry destination -

    export SPRING_CLOUD_DEPLOYER_CLOUDFOUNDRY_URL=https://api.paas.abc-intl.com/
    export SPRING_CLOUD_DEPLOYER_CLOUDFOUNDRY_ORG=Paas-Apps
    export SPRING_CLOUD_DEPLOYER_CLOUDFOUNDRY_SPACE=DEV
    export SPRING_CLOUD_DEPLOYER_CLOUDFOUNDRY_DOMAIN=paas.abc-intl.com
    export SPRING_CLOUD_DEPLOYER_CLOUDFOUNDRY_USERNAME=abc@xyz.com
    export SPRING_CLOUD_DEPLOYER_CLOUDFOUNDRY_PASSWORD=password
    export SPRING_CLOUD_DEPLOYER_CLOUDFOUNDRY_SKIP_SSL_VALIDATION=true
    export SPRING_CLOUD_DEPLOYER_CLOUDFOUNDRY_STREAM_SERVICES=rabbitmq_server
    export SPRING_CLOUD_DEPLOYER_CLOUDFOUNDRY_STREAM_BUILDPACK=java_buildpack_offline
    export SPRING_CLOUD_DEPLOYER_CLOUDFOUNDRY_STREAM_MEMORY=512
    export SPRING_CLOUD_DEPLOYER_CLOUDFOUNDRY_TASK_MEMORY=512
    export SPRING_CLOUD_DEPLOYER_CLOUDFOUNDRY_URL=https://api.paas.abc-intl.com/
    export SPRING_CLOUD_DEPLOYER_CLOUDFOUNDRY_ORG=Paas-Apps
    export SPRING_CLOUD_DEPLOYER_CLOUDFOUNDRY_SPACE=DEV
    export SPRING_CLOUD_DEPLOYER_CLOUDFOUNDRY_DOMAIN=paas.abc-intl.com
    export SPRING_CLOUD_DEPLOYER_CLOUDFOUNDRY_USERNAME=abc@xyz.com
    export SPRING_CLOUD_DEPLOYER_CLOUDFOUNDRY_PASSWORD=password
    export SPRING_CLOUD_DEPLOYER_CLOUDFOUNDRY_SKIP_SSL_VALIDATION=true
    export SPRING_CLOUD_DEPLOYER_CLOUDFOUNDRY_STREAM_SERVICES=rabbitmq_server
    export SPRING_CLOUD_DEPLOYER_CLOUDFOUNDRY_STREAM_BUILDPACK=java_buildpack_offline
    export SPRING_CLOUD_DEPLOYER_CLOUDFOUNDRY_STREAM_MEMORY=512
    export SPRING_CLOUD_DEPLOYER_CLOUDFOUNDRY_TASK_MEMORY=512
    
  • Start Dataflow Server -

    1. Build Dataflow Server CF with spring cloud properties as:

      • spring.name=dataflow
      • spring.cloud.config.uri=http://localhost:8888
      • spring.cloud.dataflow.features.tasksEnabled=true
      • spring.cloud.dataflow.features.streamsEnabled=true
      • spring.cloud.deployer.cloudfoundry.task.taskTimeout=360
    2. Start DF Server CF locally - java -Djavax.net.ssl.trustStore=/Users/apache-maven-3.3.9/conf/keystore.jks -Djavax.net.ssl.trustStorePassword=password -jar spring-cloud-dataflow-server-cloudfoundry-1.1.0.BUILD-SNAPSHOT.jar

  • Start DF Shell
  • Import starter apps - stream-applications-rabbit-maven
  • Register apps -
    1. app register --name task-processor --type processor --uri maven://org.springframework.cloud.stream.app:tasklaunchrequest-transform-processor-rabbit:jar:1.1.0.BUILD-SNAPSHOT
    2. app register --name task-launcher-local --type sink --uri maven://org.springframework.cloud.stream.app:task-launcher-local-sink-rabbit:jar:1.0.4.RELEASE
  • Create & Deploy Stream - stream create myMessageStream --definition "rabbit --rabbit.queues=cloud-stream-source --rabbit.requeue=true --spring.rabbitmq.host=host.abc.com --spring.rabbitmq.port=5672 --spring.cloud.stream.bindings.output.contentType='text/plain' | task-processor --uri=maven://com.example:thumbnail-generator:0.0.1-SNAPSHOT | task-launcher-local" --deploy

However the deployment fails with TimeoutException but with no clear reason either in the Dataflow server logs or the applications' logs.

The created application in cloud foundry space are all showing Stopped on the CF console.

This left me clueless and I've got couple of questions on this to understand the possible root cause:

  1. In case of a successful Stream deployment, what shall be the status of applications deployed to CF by Stream? Do these show up as started or stopped?
  2. The name of the deployed applications has couple of random words embedded in it e.g. dataflow-nonvaluable-overapprehension-myMessageStream-rabbit. In my understanding that is the name given to the Dataflow Server instance and is inserted to make a reference. Is there a way to customise this name? That will enable me to know the name of applications in advance and hen run a tail on their logs.

Any thoughts/help will be appreciated.

DanielBarbarian
  • 5,093
  • 12
  • 35
  • 44
Ashwin Gupta
  • 920
  • 1
  • 11
  • 17

1 Answers1

1

In case of a successful Stream deployment, what shall be the status of applications deployed to CF by Stream? Do these show up as started or stopped?

The stream list command will display the status. If the stream deployment is successful, the status should be deployed.

The name of the deployed applications has couple of random words embedded in it e.g. dataflow-nonvaluable-overapprehension-myMessageStream-rabbit. In my understanding that is the name given to the Dataflow Server instance and is inserted to make a reference. Is there a way to customise this name? That will enable me to know the name of applications in advance and hen run a tail on their logs.

You can override the random name generation in the app name by disabling this property by doing: export SPRING_CLOUD_DEPLOYER_CLOUDFOUNDRY_STREAM_ENABLE_RANDOM_APP_NAME_PREFIX=false

You can control the app name using the deployer property which sets a specific prefix:

export SPRING_CLOUD_DEPLOYER_CLOUDFOUNDRY_STREAM_APP_NAME_PREFIX=myprefix

You can try increasing the deployer properties SPRING_CLOUD_DEPLOYER_CLOUDFOUNDRY_STREAM_STAGING_TIMEOUT and SPRING_CLOUD_DEPLOYER_CLOUDFOUNDRY_STREAM_STARTUP_TIMEOUT to see if the app requires some more time to stage/startup.

Ilayaperumal Gopinathan
  • 4,099
  • 1
  • 13
  • 12
  • `The stream list command will display the status. If the stream deployment is successful, the status should be deployed` - I understand that. However my question was for the status on Cloud Foundry and not the one displayed by Dataflow Server. Apologies it was not clear. Can you please advise what shall be status of the applications deployed on CF by the stream if the Stream create and deploy command succeed and `stream list` shows `deployed`? – Ashwin Gupta Nov 10 '16 at 09:37
  • The `status` displayed by the data flow server is computed from the Cloud Foundry only. Hence, if the stream status is `deployed` then those apps in CF should be up and running. do you see the apps as `Stopped` in CF while the Data Flow server shows the status as `deployed`? – Ilayaperumal Gopinathan Nov 10 '16 at 09:44
  • Nope, the status shown by DF Server is in sync with that on CF. I was coming from the point that, the applications might not be running on CF unless the message event triggers them. So does it mean that, in order to have a short lived message triggered micro-service (in form of a `cloud-task` as mentioned above), one would need to have 3 apps continuously running on CF? If that's is so then, it will defeat our goal of reduced cost for such event driven apps (tasks). – Ashwin Gupta Nov 10 '16 at 10:46
  • Remember the short lived applications (tasks) are not part of the stream and they get launched from the stream. In order to launch this task, you need to have the task launching sink application (that is a part of the stream) to be up and running. Hence, it comes down stream vs task while the former runs continuously while the latter is short lived. – Ilayaperumal Gopinathan Nov 10 '16 at 12:15
  • `In order to launch this task, you need to have the task launching sink application` - That's understood and I've got one for that purpose. But when deploying my Stream application, I see **3** applications getting deployed to CF in total - `dataflow-myMessageStream-rabbit`, `dataflow-myMessageStream-task-processor` and `dataflow-myMessageStream-task-launcher-local` instead of **1** Stream application, and that is increasing my footprint on PaaS platform. Is this an expected behaviour from a Stream app or one of my usage mistakes? – Ashwin Gupta Nov 11 '16 at 03:44
  • That is the `default` stream behaviour when you want your apps connected via message broker. If you want to aggregate all the apps inside the stream and avoid hopping to external broker, then you can try Spring Cloud Stream aggregate application: https://github.com/spring-cloud/spring-cloud-stream-samples/tree/master/double – Ilayaperumal Gopinathan Nov 11 '16 at 04:37
  • Okay, will explore that. However for this problem, the increased staging and startup timeouts still didn't help, and in fact strangely enough the timeout happened quick enough without reaching the set window of 300secs each. – Ashwin Gupta Nov 11 '16 at 07:57
  • @Illayaperumal, wrt `Spring Cloud Stream aggregate application`- After some attempts I'm still unsure how to deploy this stream aggregator application to my cloudfoundry via server-dataflow-cf. Could you please help with the step(s) to be used to deploy this kind of aggregator applications? This contains all types of stream bindings, that makes it unclear of what type this application be registered as with dataflow server in order to be used. Apologies for asking such a spoon feed but it seems to be little tricky to make it work. – Ashwin Gupta Nov 14 '16 at 08:46
  • 1
    No problem at all, I should have been clearer as well. The aggregator application needs to be deployed as a Spring Cloud Stream application directly as there is no explicit support for that in SCDF yet. What you are looking for is something like this: https://github.com/spring-cloud/spring-cloud-dataflow/issues/185 – Ilayaperumal Gopinathan Nov 14 '16 at 09:15