Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(m1): preflight works with brew postgres@14 #5868

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions metadata-ingestion/scripts/datahub_preflight.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ brew_install() {
}

arm64_darwin_preflight() {
printf "✨ Creating/activating Virtual Environment"
printf "✨ Creating/activating Virtual Environment\n"
python3 -m venv venv
source venv/bin/activate

Expand All @@ -48,7 +48,19 @@ arm64_darwin_preflight() {
printf "✨ Setting up librdkafka prerequisities\n"
brew_install "librdkafka" "1.9.1"
brew_install "[email protected]"
brew install "postgresql"
brew install "postgresql@14"

# postgresql installs libs in a strange way
# we first symlink /opt/postgresql@14 to /opt/postgresql
if [ ! -z $(brew --prefix)/opt/postgresql ]; then
printf "✨ Symlinking postgresql@14 to postgresql\n"
ln -sf $(brew --prefix postgresql@14) $(brew --prefix)/opt/postgres
fi
# we then symlink all libs under /opt/postgresql@14/lib/postgresql@14 to /opt/postgresql@14/lib
if [ ! -z $(brew --prefix postgresql@14)/lib/postgresql@14 ]; then
printf "✨ Patching up libs in $(brew --prefix postgresql@14)/lib/postgresql@14)\n"
ln -sf $(brew --prefix postgresql@14)/lib/postgresql@14/* $(brew --prefix postgresql@14)/lib/
fi

printf "\e[38;2;0;255;0m✅ Done\e[38;2;255;255;255m\n"

Expand All @@ -72,7 +84,7 @@ cat << EOF
export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1
export GRPC_PYTHON_BUILD_SYSTEM_ZLIB=1
export CPPFLAGS="-I$(brew --prefix [email protected])/include -I$(brew --prefix librdkafka)/include"
export LDFLAGS="-L$(brew --prefix [email protected])/lib -L$(brew --prefix librdkafka)/lib"
export LDFLAGS="-L$(brew --prefix [email protected])/lib -L$(brew --prefix librdkafka)/lib -L$(brew --prefix postgresql@14)/lib/postgresql@14"
export CPATH="$(brew --prefix librdkafka)/include"
export C_INCLUDE_PATH="$(brew --prefix librdkafka)/include"
export LIBRARY_PATH="$(brew --prefix librdkafka)/lib"
Expand Down