- Improvements working with the cloud, minio, graylog and some first bugfixing

This commit is contained in:
Josako
2024-08-13 09:04:19 +02:00
parent 9caa423bcf
commit ab38dd7540
23 changed files with 414 additions and 220 deletions

16
scripts/entrypoint.sh Executable file
View 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 "$@"

View File

@@ -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..."

View File

@@ -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

View File

@@ -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 &

View File

@@ -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 &