Bring the full EditmaskwithAI application into the repo under paintplus/ (429 files) so the service is self-contained — the installer copies the vendored source to ~/docker/paintplus/src instead of cloning at runtime. Rename to PaintPlus (service + branding; app logic untouched): - services/editmaskwithai.sh -> services/paintplus.sh (register_service paintplus, install_paintplus, ~/docker/paintplus, Caddy paintplus:8000, Authelia option preserved) - container names -> paintplus across docker-compose*.yml; dev network -> paintplus-network - browser <title> -> "PaintPlus - AI Image Editor"; README heading -> PaintPlus with upstream provenance note - README utilities table: editmaskwithai -> paintplus Backend/frontend code (help strings referencing the old container name, the ai_photo_edit.db filename) is intentionally left as-is to avoid touching application logic. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nb2vJ8W7bHKx1JXVvpCraH
46 lines
1.3 KiB
Python
46 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Initialize the database before other startup scripts run.
|
|
|
|
This ensures the database exists and has all required tables
|
|
before download_sample_eyes.py tries to use it.
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
# Add backend to path - handle both Docker and local environments
|
|
# In Docker: backend is at /app/
|
|
# Locally: backend is at ./backend/
|
|
if Path('/app').exists():
|
|
sys.path.insert(0, '/app')
|
|
else:
|
|
sys.path.insert(0, str(Path(__file__).parent.parent / 'backend'))
|
|
|
|
def main():
|
|
# Import after path setup
|
|
from app.database import engine, Base, init_db
|
|
from app.models import project, user, patch
|
|
|
|
print("Initializing database...")
|
|
|
|
# Create all tables
|
|
init_db()
|
|
|
|
# Verify database was created - check both Docker and local paths
|
|
docker_db_path = Path('/app/data/ai_photo_edit.db')
|
|
local_db_path = Path('./data/ai_photo_edit.db')
|
|
|
|
if docker_db_path.exists():
|
|
print(f"✓ Database initialized at: {docker_db_path}")
|
|
elif local_db_path.exists():
|
|
print(f"✓ Database initialized at: {local_db_path}")
|
|
else:
|
|
print("⚠ Database file not found at expected locations, but tables may still be created")
|
|
|
|
print("Database initialization complete.")
|
|
|
|
if __name__ == '__main__':
|
|
main()
|