繁体   English   中英

基于 postgres 的 airflow 网络服务器上的错误

[英]error on airflow webserver based on postgres

基本上,我想构建 docker-airflow:

我有 Dockerfile 像:

FROM puckel/docker-airflow:1.10.6
COPY ./airflow_home/airflow.cfg /usr/local/airflow/airflow.cfg
...

我有 docker-compose.yml 像:

version: "3.4"
services:
    postgres:
        image: "postgres:9.6"
        container_name: "postgres"
        environment:
            - POSTGRES_USER=airflow
            - POSTGRES_PASSWORD=airflow
            - POSTGRES_DB=airflow
        ports:
            - "5432:5432"
        volumes:
            - './data/postgres:/var/lib/postgresql/data'
    # comment initdb after you will have use it at first run
    # set the client and processed log types here
    initdb:
        build: .
        entrypoint: airflow initdb
        entrypoint:
            ['python3', '/usr/local/airflow/__init__.py', '-C', '$Client', '-T', '$Types']
        volumes:
            - './airflow_home/packages:/usr/local/airflow/packages'
        depends_on:
            - postgres

并且 requirements.txt 中没有其他 airflow 库。

当我执行以下操作时,我总是遇到错误:

docker-compose up webserver

错误是:

sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "connection" does not exist
webserver_1  | LINE 2: FROM connection GROUP BY connection.conn_id

“xxx”也包括日志

我原本以为错误来自不同的版本。 但我确保版本已被确认正确。 我使用了 airflow.cfg 来自同一版本,并使用 Postgres 修改了 sql_connection。 Postgres 中的数据库也已创建。 有谁知道如何解决这个问题?

我找到了原因。 因为我在initdb部分使用了两个入口点。 它将覆盖 docker 中的原始初始化脚本。 当我删除入口点时:

['python3', '/usr/local/airflow/__init__.py', '-C', '$Client', '-T', '$Types']

现在可以了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM