Search code examples
springdeploymentconfigurationspring-cloud-dataflow

How do you automate deploying Spring Data Flow?


I've got an instance of Spring Cloud Data Flow stood up with my apps and streams that I need. I even wrote scripts that work within the command shell to deploy all this stuff at once. The problem is that I have a manual step now that I need to do rather than just have it run out of the box.

With both Windows and Linux I know how to run a script through a shell and have it end when the script is run.

The problem is that I can's seem to do the same with the Spring Data Flow Shell. I'd like to do something like this:

java -jar spring-cloud-dataflow-shell.jar --runScript my-awesome-script.shell

However, I can't see any documentation that says something like that exists. Every option I could find didn't run the script and kept the shell open. Or is there another option completely that I am not aware of. My 15 years of Java experience was interrupted by doing .Net the past 6 years, and Spring looks completely different than it used to.


Solution

  • Sometimes I am such a numskull. After searching for it all day yesterday, it dawned on me to use the --help option to get the command line options for the shell.

    C:\Dev>java -jar spring-cloud-dataflow-shell-1.2.1.RELEASE.jar --help
    Data Flow Options:
      --dataflow.uri=<uri>                              Address of the Data Flow Server [default: http://localhost:9393].
      --dataflow.username=<USER>                        Username of the Data Flow Server [no default].
      --dataflow.password=<PASSWORD>                    Password of the Data Flow Server [no default].
      --dataflow.credentials-provider-command=<COMMAND> Executes an external command which must return an OAuth Access Token [no default].
      --dataflow.skip-ssl-validation=<true|false>       Accept any SSL certificate (even self-signed) [default: no].
      --spring.shell.historySize=<SIZE>                 Default size of the shell log file [default: 3000].
      --spring.shell.commandFile=<FILE>                 Data Flow Shell executes commands read from the file(s) and then exits.
      --help                                            This message.
    

    When I tried the --spring.shell.commandFile option, it did exactly what I needed the shell to do: run the script and end.

    java -jar spring-cloud-data-flow-shell.jar --spring.shell.commandFile=my-awesome-script.shell
    

    NOTE: The documentation on the Spring website does not mention this at all. If this is something that can be done via Spring Config Server I would also like to know about it.