diff --git a/deploy.sh b/deploy.sh index f55af2d..92ff031 100755 --- a/deploy.sh +++ b/deploy.sh @@ -93,9 +93,9 @@ if [ "$INIT" = true ]; then log ".env already exists, skipping creation" fi - # Create storage directories - log "Creating storage directories..." - mkdir -p storage/amazon/{tm,ref} + # Storage directories are now tracked in git (storage/amazon/tm + ref) + # Just ensure the base directory exists for runtime uploads + mkdir -p storage # Build all images log "Building all Docker images (this may take a few minutes)..." @@ -125,16 +125,13 @@ if [ "$INIT" = true ]; then log "Running database migrations..." $COMPOSE exec -T backend alembic upgrade head - # Import reference files (run on host since files are local) - if [ -d "../Agent build + supporting JSONs/JSON REFS and TMs" ]; then - log "Importing reference and TM files..." - python3 seed/import_reference_files.py \ - --source "../Agent build + supporting JSONs/JSON REFS and TMs" \ - --target storage/amazon - else - warn "Reference files source directory not found at ../Agent build + supporting JSONs/JSON REFS and TMs" - warn "You can import them manually later:" - warn " python3 seed/import_reference_files.py --source /path/to/JSON_REFS_and_TMs --target storage/amazon" + # TM and reference files are now tracked in git — no import step needed. + # Verify they arrived via git pull: + TM_COUNT=$(find storage/amazon/tm -name '*.json' 2>/dev/null | wc -l) + REF_COUNT=$(find storage/amazon/ref -name '*.json' 2>/dev/null | wc -l) + log "Found $TM_COUNT TM files and $REF_COUNT reference files in storage/amazon/" + if [ "$TM_COUNT" -eq 0 ]; then + warn "No TM files found! Check that git pulled storage/amazon/tm/ correctly." fi # Seed database @@ -144,7 +141,7 @@ if [ "$INIT" = true ]; then # Start all remaining services log "Starting all services..." - $COMPOSE up -d + $COMPOSE up -d --remove-orphans # --------------------------------------------------------------- # Apache configuration @@ -240,8 +237,9 @@ $COMPOSE up -d backend sleep 5 $COMPOSE exec -T backend alembic upgrade head -# Restart all services +# Restart all services (remove orphans to avoid stale containers) log "Restarting all services..." +$COMPOSE down --remove-orphans $COMPOSE up -d # Health check