OpenMetadata/ingestion/ingestion_dependency.sh
Nahuel db41be4c4a
Fix#6929: docker-compose services should wait until OpenMetadata DB is created (#7025)
* Added the docker compose for postgres

* Added changes as per the comments on PR

* Airflow Connectivity to Postgres

* Changes are done as per the comments

* Replocate changes to local dockerfile

* Fixed Airflow Dockerfile

* docker-compose services should wait until OpenMetadata DB is created

* remove unnecesary wait for db service

* Add dependencies to airflow image

* Add missing dependencies to airflow Dockerfile

Co-authored-by: “Vijay” <“vijay.l@deuexsolutions.com”>
Co-authored-by: ulixius9 <mayursingal9@gmail.com>
2022-08-30 23:55:46 +02:00

44 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# Copyright 2021 Collate
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
DB_HOST=${DB_HOST:-mysql}
DB_PORT=${DB_PORT:-3306}
AIRFLOW_DB=${AIRFLOW_DB:-airflow_db}
DB_USER=${DB_USER:-airflow_user}
DB_SCHEME=${DB_SCHEME:-mysql+pymysql}
DB_PASSWORD=${DB_PASSWORD:-airflow_pass}
DB_CONN="${DB_SCHEME}://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${AIRFLOW_DB}"
AIRFLOW_ADMIN_USER=${AIRFLOW_ADMIN_USER:-admin}
AIRFLOW_ADMIN_PASSWORD=${AIRFLOW_ADMIN_PASSWORD:-admin}
OPENMETADATA_SERVER=${OPENMETADATA_SERVER:-"http://openmetadata-server:8585"}
sed -i "s#\(sql_alchemy_conn = \).*#\1${DB_CONN}#" /airflow/airflow.cfg
airflow db init
airflow users create \
--username ${AIRFLOW_ADMIN_USER} \
--firstname Peter \
--lastname Parker \
--role Admin \
--email spiderman@superhero.org \
--password ${AIRFLOW_ADMIN_PASSWORD}
(sleep 5; airflow db upgrade)
(sleep 5; airflow db upgrade)
airflow webserver --port 8080 -D &
airflow scheduler