Add vehicle ETL import to GitLab CI deployment

This commit is contained in:
Eric Gullickson
2025-12-19 14:14:05 -06:00
parent 0e85cf48c3
commit 2174a1b1e3
5 changed files with 105875 additions and 2807 deletions

1
.gitignore vendored
View File

@@ -14,7 +14,6 @@ coverage/
.playwright-mcp
#Data Import Files
data/vehicle-etl/output/*.sql
data/vehicle-etl/vehapi.key
data/vehicle-etl/snapshots/*
!data/vehicle-etl/snapshots/.gitkeep

View File

@@ -73,20 +73,30 @@ deploy:
- echo "Deploying MotoVaultPro..."
- echo "=========================================="
- cd "$DEPLOY_PATH"
- echo "Step 1/6 Injecting secrets..."
- echo "Step 1/7 Injecting secrets..."
- chmod +x scripts/inject-secrets.sh
- ./scripts/inject-secrets.sh
- echo "Step 2/6 Stopping existing services..."
- echo "Step 2/7 Stopping existing services..."
- docker compose -f $DOCKER_COMPOSE_FILE -f $DOCKER_COMPOSE_PROD_FILE down --timeout 30 || true
- echo "Step 3/6 Pulling base images..."
- echo "Step 3/7 Pulling base images..."
- docker compose -f $DOCKER_COMPOSE_FILE pull
- echo "Step 4/6 Starting database services..."
- echo "Step 4/7 Starting database services..."
- docker compose -f $DOCKER_COMPOSE_FILE -f $DOCKER_COMPOSE_PROD_FILE up -d mvp-postgres mvp-redis
- echo "Waiting for database to be ready..."
- sleep 15
- echo "Step 5/6 Running database migrations..."
- echo "Step 5/7 Running database migrations..."
- docker compose -f $DOCKER_COMPOSE_FILE run --rm mvp-backend npm run migrate || echo "Migration skipped"
- echo "Step 6/6 Starting all services..."
- echo "Step 6/7 Running vehicle ETL import..."
- |
docker exec -i mvp-postgres psql -U postgres -d motovaultpro < data/vehicle-etl/migrations/001_create_vehicle_database.sql
docker exec -i mvp-postgres psql -U postgres -d motovaultpro -c "TRUNCATE TABLE vehicle_options RESTART IDENTITY CASCADE; TRUNCATE TABLE engines RESTART IDENTITY CASCADE; TRUNCATE TABLE transmissions RESTART IDENTITY CASCADE;"
docker exec -i mvp-postgres psql -U postgres -d motovaultpro < data/vehicle-etl/output/01_engines.sql
docker exec -i mvp-postgres psql -U postgres -d motovaultpro < data/vehicle-etl/output/02_transmissions.sql
docker exec -i mvp-postgres psql -U postgres -d motovaultpro < data/vehicle-etl/output/03_vehicle_options.sql
- echo "Flushing Redis cache..."
- docker exec mvp-redis redis-cli FLUSHALL
- echo "Vehicle ETL import completed"
- echo "Step 7/7 Starting all services..."
- docker compose -f $DOCKER_COMPOSE_FILE -f $DOCKER_COMPOSE_PROD_FILE up -d
- echo "Waiting for services to initialize..."
- sleep 30
@@ -125,7 +135,7 @@ verify:
- |
HEALTH_OK=0
for i in 1 2 3 4 5 6; do
if curl -sf http://localhost:3001/health > /dev/null 2>&1; then
if docker compose -f $DOCKER_COMPOSE_FILE exec -T mvp-backend curl -sf http://localhost:3001/health > /dev/null 2>&1; then
echo "OK: Backend health check passed"
HEALTH_OK=1
break
@@ -140,7 +150,7 @@ verify:
fi
- echo "Checking frontend..."
- |
if curl -sf http://localhost:3000 > /dev/null 2>&1; then
if docker compose -f $DOCKER_COMPOSE_FILE exec -T mvp-frontend curl -sf http://localhost:3000 > /dev/null 2>&1; then
echo "OK: Frontend is accessible"
else
echo "WARNING: Frontend check failed (might need Traefik routing)"

File diff suppressed because it is too large Load Diff

View File

@@ -20,12 +20,20 @@ INSERT INTO transmissions (id, type) VALUES
(18,'6-Speed CVT'),
(19,'7-Speed Automatic'),
(20,'6-Speed Dual Clutch'),
(21,'8-Speed Dual Clutch'),
(22,'9-Speed Automatic'),
(21,'8-Speed Automatic'),
(22,'1-Speed Automatic'),
(23,'7-Speed Dual Clutch'),
(24,'9-Speed Dual Clutch'),
(25,'8-Speed Automatic'),
(26,'10-Speed Automatic'),
(27,'7-Speed Manual'),
(28,'7-Speed CVT');
(24,'5-Speed Dual Clutch'),
(25,'7-Speed CVT'),
(26,'7-Speed Manual'),
(27,'9-Speed Automatic'),
(28,'8-Speed Dual Clutch'),
(29,'8-Speed CVT'),
(30,'9-Speed Dual Clutch'),
(31,'10-Speed Automatic'),
(32,'4-Speed CVT'),
(33,'10-Speed Dual Clutch'),
(34,'10-Speed CVT'),
(35,'2-Speed Automatic'),
(36,'10-Speed Automatic Transmission');

File diff suppressed because it is too large Load Diff