Fix docker PG issue

This commit is contained in:
Arnav Agrawal 2025-04-12 22:23:10 -07:00
parent 40fc8fab6b
commit 9a24c2e734
5 changed files with 16 additions and 14 deletions

View File

@ -1,5 +1,5 @@
JWT_SECRET_KEY="..." # Required in production, optional in dev mode (dev_mode=true in databridge.toml)
POSTGRES_URI="postgresql+asyncpg://postgres:postgres@localhost:5432/databridge" # Required for PostgreSQL database
JWT_SECRET_KEY="..." # Required in production, optional in dev mode (dev_mode=true in morphik.toml)
POSTGRES_URI="postgresql+asyncpg://postgres:postgres@localhost:5432/morphik" # Required for PostgreSQL database
MONGODB_URI="..." # Optional: Only needed if using MongoDB
UNSTRUCTURED_API_KEY="..." # Optional: Needed for parsing via unstructured API

View File

@ -29,7 +29,7 @@ logger = logging.getLogger(__name__)
TEST_DATA_DIR = Path(__file__).parent / "test_data"
JWT_SECRET = "your-secret-key-for-signing-tokens"
TEST_USER_ID = "test_user"
TEST_POSTGRES_URI = "postgresql+asyncpg://postgres:postgres@localhost:5432/databridge_test"
TEST_POSTGRES_URI = "postgresql+asyncpg://postgres:postgres@localhost:5432/morphik_test"
@pytest.fixture(scope="session")

View File

@ -99,15 +99,15 @@ storage_path = "/app/storage"\n\
\n\
[vector_store]\n\
provider = "pgvector"\n\
' > /app/databridge.toml.default
' > /app/morphik.toml.default
# Create startup script
RUN echo '#!/bin/bash\n\
set -e\n\
\n\
# Copy default config if none exists\n\
if [ ! -f /app/databridge.toml ]; then\n\
cp /app/databridge.toml.default /app/databridge.toml\n\
if [ ! -f /app/morphik.toml ]; then\n\
cp /app/morphik.toml.default /app/morphik.toml\n\
fi\n\
\n\
# Function to check PostgreSQL\n\
@ -116,7 +116,7 @@ check_postgres() {\n\
echo "Waiting for PostgreSQL..."\n\
max_retries=30\n\
retries=0\n\
until PGPASSWORD=$PGPASSWORD pg_isready -h postgres -U databridge -d databridge; do\n\
until PGPASSWORD=$PGPASSWORD pg_isready -h postgres -U morphik -d morphik; do\n\
retries=$((retries + 1))\n\
if [ $retries -eq $max_retries ]; then\n\
echo "Error: PostgreSQL did not become ready in time"\n\
@ -128,7 +128,7 @@ check_postgres() {\n\
echo "PostgreSQL is ready!"\n\
\n\
# Verify database connection\n\
if ! PGPASSWORD=$PGPASSWORD psql -h postgres -U databridge -d databridge -c "SELECT 1" > /dev/null 2>&1; then\n\
if ! PGPASSWORD=$PGPASSWORD psql -h postgres -U morphik -d morphik -c "SELECT 1" > /dev/null 2>&1; then\n\
echo "Error: Could not connect to PostgreSQL database"\n\
exit 1\n\
fi\n\
@ -148,9 +148,9 @@ COPY core ./core
COPY README.md LICENSE ./
# Labels for the image
LABEL org.opencontainers.image.title="DataBridge Core"
LABEL org.opencontainers.image.description="DataBridge Core - A powerful document processing and retrieval system"
LABEL org.opencontainers.image.source="https://github.com/yourusername/databridge"
LABEL org.opencontainers.image.title="Morphik Core"
LABEL org.opencontainers.image.description="Morphik Core - A powerful document processing and retrieval system"
LABEL org.opencontainers.image.source="https://github.com/yourusername/morphik"
LABEL org.opencontainers.image.version="1.0.0"
LABEL org.opencontainers.image.licenses="MIT"

View File

@ -26,14 +26,16 @@ claude_sonnet = { model_name = "claude-3-sonnet-20240229" }
# Ollama models
ollama_llama = { model_name = "ollama_chat/llama3.2", api_base = "http://localhost:11434" }
ollama_llama_docker = { model_name = "ollama_chat/llama3.2", api_base = "http://ollama:11434" }
ollama_llama_vision = { model_name = "ollama_chat/llama3.2-vision", api_base = "http://localhost:11434", vision = true }
ollama_llama_docker = { model_name = "ollama_chat/llama3.2", api_base = "http://host.docker.internal:11434" }
ollama_llama_vision_docker = { model_name = "ollama_chat/llama3.2-vision", api_base = "http://host.docker.internal:11434", vision = true }
# Embedding models
openai_embedding = { model_name = "text-embedding-3-small" }
openai_embedding_large = { model_name = "text-embedding-3-large" }
azure_embedding = { model_name = "text-embedding-ada-002", api_base = "YOUR_AZURE_URL_HERE", api_version = "2023-05-15", deployment_id = "embedding-ada-002" }
ollama_embedding = { model_name = "ollama/nomic-embed-text", api_base = "http://localhost:11434" }
ollama_embedding_docker = { model_name = "ollama/nomic-embed-text", api_base = "http://host.docker.internal:11434" }
#### Component configurations ####

View File

@ -8,7 +8,7 @@ if [ "$#" -ne 1 ] || { [ "$1" != "docker" ] && [ "$1" != "local" ]; }; then
fi
ENV=$1
echo "Clearing all tables in the databridge database for $ENV environment..."
echo "Clearing all tables in the morphik database for $ENV environment..."
# SQL command to truncate all tables
TRUNCATE_CMD="
@ -32,7 +32,7 @@ if [ "$ENV" = "docker" ]; then
fi
# Execute the command in docker container
if ! docker exec -it $POSTGRES_CONTAINER psql -U databridge -d databridge -c "$TRUNCATE_CMD"; then
if ! docker exec -it $POSTGRES_CONTAINER psql -U morphik -d morphik -c "$TRUNCATE_CMD"; then
echo "Error: Failed to clear tables in docker environment"
exit 1
fi