- Improvements working with the cloud, minio, graylog and some first bugfixing
This commit is contained in:
16
scripts/entrypoint.sh
Executable file
16
scripts/entrypoint.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Ensure the logs directory has the correct permissions
|
||||
echo "Changing permissions on logs directory"
|
||||
#chown -R appuser:appuser /app/logs
|
||||
chmod -R 777 /app/logs
|
||||
|
||||
# Wait for the database to be ready
|
||||
until pg_isready -h $DB_HOST -p $DB_PORT; do
|
||||
echo "Postgres is unavailable - sleeping"
|
||||
sleep 2
|
||||
done
|
||||
|
||||
# Switch to appuser and execute the command passed to the script
|
||||
exec su appuser -c "$@"
|
||||
@@ -3,20 +3,23 @@
|
||||
cd "/app" || exit 1
|
||||
export PYTHONPATH="$PYTHONPATH:/app/"
|
||||
|
||||
# Ensure we can write the logs
|
||||
chown -R appuser:appuser /app/logs
|
||||
|
||||
# Wait for the database to be ready
|
||||
echo "Waiting for database to be ready"
|
||||
until pg_isready -h db -p 5432; do
|
||||
until pg_isready -h $DB_HOST -p $DB_PORT; do
|
||||
echo "Postgres is unavailable - sleeping"
|
||||
sleep 2
|
||||
done
|
||||
echo "Postgres is up - executing commands"
|
||||
|
||||
export PGPASSWORD=Skywalker!
|
||||
export PGPASSWORD=$DB_PASS
|
||||
# Check if the database exists and initialize if not
|
||||
if ! psql -U luke -h db -d eveai -c '\dt' | grep -q 'No relations found'; then
|
||||
if ! psql -U $DB_USER -h $DB_HOST -p $DB_PORT -d $DB_NAME -c '\dt' | grep -q 'No relations found'; then
|
||||
echo "Database eveai does not exist or is empty. Initializing..."
|
||||
psql -U luke -h db -d postgres -c "CREATE DATABASE eveai;"
|
||||
psql -U luke -h db -d eveai -c "CREATE EXTENSION IF NOT EXISTS vector;"
|
||||
psql -U $DB_USER -h $DB_HOST -p $DB_PORT -d postgres -c "CREATE DATABASE $DB_NAME;"
|
||||
psql -U $DB_USER -h $DB_HOST -p $DB_PORT -d $DB_NAME -c "CREATE EXTENSION IF NOT EXISTS vector;"
|
||||
fi
|
||||
|
||||
echo "Applying migrations to the public and tenant schema..."
|
||||
|
||||
@@ -4,6 +4,9 @@ cd "/app/" || exit 1
|
||||
export PROJECT_DIR="/app"
|
||||
export PYTHONPATH="$PROJECT_DIR/patched_packages:$PYTHONPATH:$PROJECT_DIR" # Include the app directory in the Python path & patched packages
|
||||
|
||||
# Ensure we can write the logs
|
||||
chown -R appuser:appuser /app/logs
|
||||
|
||||
# Set flask environment variables
|
||||
#export FLASK_ENV=development # Use 'production' as appropriate
|
||||
#export FLASK_DEBUG=1 # Use 0 for production
|
||||
|
||||
@@ -4,6 +4,9 @@ cd "/app/" || exit 1
|
||||
export PROJECT_DIR="/app"
|
||||
export PYTHONPATH="$PROJECT_DIR/patched_packages:$PYTHONPATH:$PROJECT_DIR" # Include the app directory in the Python path & patched packages
|
||||
|
||||
# Ensure we can write the logs
|
||||
chown -R appuser:appuser /app/logs
|
||||
|
||||
# Start a worker for the 'llm_interactions' queue with auto-scaling
|
||||
celery -A eveai_chat_workers.celery worker --loglevel=info -Q llm_interactions --autoscale=2,8 --hostname=interactions_worker@%h &
|
||||
|
||||
|
||||
@@ -4,6 +4,9 @@ cd "/app/" || exit 1
|
||||
export PROJECT_DIR="/app"
|
||||
export PYTHONPATH="$PROJECT_DIR/patched_packages:$PYTHONPATH:$PROJECT_DIR" # Include the app directory in the Python path & patched packages
|
||||
|
||||
# Ensure we can write the logs
|
||||
chown -R appuser:appuser /app/logs
|
||||
|
||||
# Start a worker for the 'embeddings' queue with higher concurrency
|
||||
celery -A eveai_workers.celery worker --loglevel=info -Q embeddings --autoscale=2,8 --hostname=embeddings_worker@%h &
|
||||
|
||||
|
||||
Reference in New Issue
Block a user