小编dwe*_*eeb的帖子

如何在docker中使用flyway初始化postgres db?

我有我试图在 docker 中托管的 django 应用程序。在启动 django 应用程序之前,我未能成功启动我的 postgres 服务器。这是我的docker-compose.yaml

version: '3'
services:
  flyway:
    image: boxfuse/flyway
    command: -url=jdbc:postgresql://db/dbname -schemas=schemaName -user=user -password=pwd migrate
    volumes:
      - ./flyway:/flyway/sql
    depends_on:
      - db
  db:
    image: postgres:9.6
    restart: always
    ports:
      - 5432:5432
    environment:
    - POSTGRES_PASSWORD=pwd
    healthcheck:
      test: "pg_isready -q -U postgres"
  app:
    image: myimage
    ports:
      - 8000:8000
Run Code Online (Sandbox Code Playgroud)

服务dbapp两者似乎都很好,但我无法使用 flyway 启动 postgres 默认值。以下是我收到的错误:

flyway_1  | SEVERE: Connection error: 
flyway_1  | org.postgresql.util.PSQLException: Connection to db:5432 refused. Check that the hostname and port are correct …
Run Code Online (Sandbox Code Playgroud)

postgresql flyway docker-compose

9
推荐指数
1
解决办法
6207
查看次数

如何增加 nginx 入口控制器和 kong 上的最大请求正文大小

我有一个服务,它接受正文中带有 base64 编码文件的 POST。Error: 413 Request Entity Too Large当我发布大于 1MB 的任何内容时,我目前正在获取 ,否则它工作正常。

我的设置有 kong 代理服务。我通过稳定的 kong helm chart 为代理的入口添加了以下注释:

      kubernetes.io/ingress.class: "nginx"
      ingress.kubernetes.io/ssl-redirect: “true”
      ingress.kubernetes.io/proxy-body-size: 50m
Run Code Online (Sandbox Code Playgroud)

我还将其添加到 kong env 值中:

client_max_body_size: 0

我的理解是这应该更新 nginx.conf

Kong 前面有一个 nginx-ingress,我用稳定的舵图安装了它。对于入口控制器,我设置了:

--set controller.config.proxy-body-size: "50m"
Run Code Online (Sandbox Code Playgroud)

但是,这些设置都不起作用。查看入口控制器的 pod 日志,我看到:

2019/08/02 15:01:34 [warn] 42#42: *810139 a client request body is buffered to a temporary file /tmp/client-body/0000000014, client: 1X.XXX.X0.X, server: example.com, request: "POST /endpoint HTTP/1.1", host: "example.com"
Run Code Online (Sandbox Code Playgroud)

以及kong pod中对应的日志:

2019/08/02 15:01:39 [warn] 33#0: *1147388 a client request …
Run Code Online (Sandbox Code Playgroud)

rest kubernetes kong kubernetes-ingress nginx-ingress

5
推荐指数
1
解决办法
1万
查看次数

如何为springboot指定外部YAML配置文件

我正在尝试传入一个要从 Spring boot 中的自定义配置文件自动装配的值。下面是代码片段:

春季班

@Configuration
public class MyConfig {

    @Value("${BOOTSTRAP_SERVERS}")
    private String bootstrapServers;
Run Code Online (Sandbox Code Playgroud)

myfile.yaml

BOOTSTRAP_SERVERS: 
  10.0.0.12:9092
Run Code Online (Sandbox Code Playgroud)

执行命令

java  -jar app.jar --spring.config.location=/file/path/myfile.yaml
Run Code Online (Sandbox Code Playgroud)

但是,当我输入上述命令时,我收到此错误:

java.lang.IllegalArgumentException:无法解析值“${BOOTSTRAP_SERVERS}”中的占位符“BOOTSTRAP_SERVERS”

为了让它发挥作用,我在这里缺少什么?我打算将应用程序安装在 kubernetes 中,因此我需要能够外部化我的配置。提前致谢。

java spring-boot

3
推荐指数
1
解决办法
6237
查看次数