testing entrypoint
This commit is contained in:
@@ -38,67 +38,56 @@ until PGPASSWORD=$POSTGRES_PASSWORD psql -h db -U $POSTGRES_USER -d $POSTGRES_DB
|
||||
done
|
||||
echo "PostgreSQL is up - executing command"
|
||||
|
||||
# Run migrations
|
||||
echo "Running database migrations..."
|
||||
flask db upgrade
|
||||
|
||||
# Create events table
|
||||
echo "Creating events table..."
|
||||
python3 -c "
|
||||
from migrations.add_events_table import upgrade
|
||||
from app import create_app
|
||||
app = create_app()
|
||||
with app.app_context():
|
||||
try:
|
||||
upgrade()
|
||||
print('Events table created successfully')
|
||||
except Exception as e:
|
||||
print(f'Error creating events table: {e}')
|
||||
"
|
||||
|
||||
# Create notifs table
|
||||
echo "Creating notifs table..."
|
||||
python3 -c "
|
||||
from migrations.add_notifs_table import upgrade
|
||||
from app import create_app
|
||||
app = create_app()
|
||||
with app.app_context():
|
||||
try:
|
||||
upgrade()
|
||||
print('Notifs table created successfully')
|
||||
except Exception as e:
|
||||
print(f'Error creating notifs table: {e}')
|
||||
"
|
||||
|
||||
# Create default site settings if they don't exist
|
||||
echo "Creating default site settings..."
|
||||
# Run all initialization in a single Python script to avoid multiple Flask instances
|
||||
echo "Running initialization..."
|
||||
python3 -c "
|
||||
from app import create_app
|
||||
from models import SiteSettings, db
|
||||
from migrations.add_events_table import upgrade as upgrade_events
|
||||
from migrations.add_notifs_table import upgrade as upgrade_notifs
|
||||
from init_admin import init_admin
|
||||
from utils.email_templates import create_default_templates
|
||||
|
||||
app = create_app()
|
||||
with app.app_context():
|
||||
# Run migrations
|
||||
print('Running database migrations...')
|
||||
from flask_migrate import upgrade
|
||||
upgrade()
|
||||
|
||||
# Create events table
|
||||
print('Creating events table...')
|
||||
try:
|
||||
upgrade_events()
|
||||
print('Events table created successfully')
|
||||
except Exception as e:
|
||||
print(f'Error creating events table: {e}')
|
||||
|
||||
# Create notifs table
|
||||
print('Creating notifs table...')
|
||||
try:
|
||||
upgrade_notifs()
|
||||
print('Notifs table created successfully')
|
||||
except Exception as e:
|
||||
print(f'Error creating notifs table: {e}')
|
||||
|
||||
# Create default site settings
|
||||
print('Creating default site settings...')
|
||||
try:
|
||||
settings = SiteSettings.get_settings()
|
||||
print('Default site settings created successfully')
|
||||
except Exception as e:
|
||||
print(f'Error creating site settings: {e}')
|
||||
|
||||
# Initialize admin user
|
||||
print('Initializing admin user...')
|
||||
init_admin()
|
||||
|
||||
# Create default templates
|
||||
print('Creating default templates...')
|
||||
create_default_templates()
|
||||
"
|
||||
|
||||
# Initialize admin user
|
||||
echo "Initializing admin user..."
|
||||
python3 -c "
|
||||
from init_admin import init_admin
|
||||
init_admin()
|
||||
"
|
||||
|
||||
# Create admin user
|
||||
echo "Creating admin user..."
|
||||
flask create-admin
|
||||
|
||||
# Create default templates
|
||||
echo "Creating default templates..."
|
||||
flask create-default-templates
|
||||
|
||||
# Start the application
|
||||
echo "Starting application..."
|
||||
exec gunicorn --bind 0.0.0.0:5000 app:app
|
||||
Reference in New Issue
Block a user