在哪里为本地Spring Cloud Dataflow设置环境变量? [英] Where to set env variables for local Spring Cloud Dataflow?

查看:98
本文介绍了在哪里为本地Spring Cloud Dataflow设置环境变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了进行开发,尽管我们计划部署到Kubernetes集群进行集成测试和生产,但我正在Mac上使用本地Spring Cloud Dataflow服务器.SCDF文档说,您可以使用环境变量来配置各种内容,例如数据库配置.我希望我的注册应用程序使用这些env变量,但它们似乎看不到它们.也就是说,我通过从终端窗口运行它的jar来启动SCDF服务器,该窗口可以看到一组环境变量.然后我使用一些 Spring Cloud 流启动应用程序和一个自定义 Spring Boot 应用程序配置一个流.我有自定义应用程序日志记录System.getenv(),并且没有显示我需要的env变量.我将它们设置在我的〜/.bashrc文件中,该文件也来自〜/.bash_profile.这适用于我的终端窗口以及需要环境的大多数其他东西,但不适用于这里.我应该在哪里定义它们?

For development, I'm using the local Spring Cloud Dataflow server on my Mac, though we plan to deploy to a Kubernetes cluster for integration testing and production. The SCDF docs say you can use environment variables to configure various things, like database configuration. I'd like my registered app to use these env variables, but they don't seem to be able to see them. That is, I start the SCDF server by running its jar from a terminal window, which can see a set of environment variables. I then configure a stream using some Spring Cloud stream starter apps and one custom Spring Boot app. I have the custom app logging System.getenv() and it's not showing the env variables I need. I set them in my ~/.bashrc file, which I also source from ~/.bash_profile. That works for my terminal windows and most other things that need environment, but not here. Where should I be defining them?

对于第一个答案和评论中的要点,它们听起来不错,但对我而言没有任何用处.我有一个SQS源,它通过以下方式获得其连接:

To the points in the first answer and comments, they sound good, but nothing works for me. I have an SQS Source that get's its connection via:

return AmazonSQSAsyncClientBuilder.standard()
    .withRegion(Regions.US_WEST_2.getName()))
    .build();

当我部署到Minikube环境时,我编辑sqs应用程序的部署并在env部分中设置AWS凭证.然后就可以了.对于本地部署,我现在尝试:

When I deploy to a Minikube environment, I edit the sqs app's deployment and set the AWS credentials in the env section. Then it works. For a local deployment, I've now tried:

stream deploy --name greg1 --properties "deployer.sqs.AWS_ACCESS_KEY_ID=<id>,deployer.sqs.AWS_SECRET_ACCESS_KEY=<secret>"

stream deploy --name greg1 --properties "deployer.sqs.aws_access_key_id=<id>,deployer.sqs.aws_secret_access_key=<secret>"

stream deploy --name greg1 --properties "app.sqs.AWS_ACCESS_KEY_ID=<id>,app.sqs.AWS_SECRET_ACCESS_KEY=<secret>"

stream deploy --name greg1 --properties "app.sqs.aws_access_key_id=<id>,app.sqs.aws_secret_access_key=<secret>"

当凭据错误时,所有错误都会失败,并显示一条错误消息,即此wsdl版本的指定队列不存在".我已经阅读了链接,但实际上没有看到其他可尝试的内容.我要去哪里错了?

All fail with the error message I get when credentials are wrong, which is, "The specified queue does not exist for this wsdl version." I've read the links, and don't really see anything else to try. Where am I going wrong?

推荐答案

您可以使用应用程序属性或部署属性将环境变量传递给通过SCDF部署的应用程序.检查文档以获取每种类型的描述.

You can pass environment variables to the apps that are deployed via SCDF using application properties or deployment properties. Check the docs for a description of each type.

例如:

dataflow:> stream deploy --name ticktock --properties "deployer.time.local.javaOpts=-Xmx2048m -Dtest=foo"

这篇关于在哪里为本地Spring Cloud Dataflow设置环境变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆