Add vehicle ETL import to GitLab CI deployment
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -14,7 +14,6 @@ coverage/
|
|||||||
.playwright-mcp
|
.playwright-mcp
|
||||||
|
|
||||||
#Data Import Files
|
#Data Import Files
|
||||||
data/vehicle-etl/output/*.sql
|
|
||||||
data/vehicle-etl/vehapi.key
|
data/vehicle-etl/vehapi.key
|
||||||
data/vehicle-etl/snapshots/*
|
data/vehicle-etl/snapshots/*
|
||||||
!data/vehicle-etl/snapshots/.gitkeep
|
!data/vehicle-etl/snapshots/.gitkeep
|
||||||
|
|||||||
@@ -73,20 +73,30 @@ deploy:
|
|||||||
- echo "Deploying MotoVaultPro..."
|
- echo "Deploying MotoVaultPro..."
|
||||||
- echo "=========================================="
|
- echo "=========================================="
|
||||||
- cd "$DEPLOY_PATH"
|
- cd "$DEPLOY_PATH"
|
||||||
- echo "Step 1/6 Injecting secrets..."
|
- echo "Step 1/7 Injecting secrets..."
|
||||||
- chmod +x scripts/inject-secrets.sh
|
- chmod +x scripts/inject-secrets.sh
|
||||||
- ./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
|
- 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
|
- 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
|
- docker compose -f $DOCKER_COMPOSE_FILE -f $DOCKER_COMPOSE_PROD_FILE up -d mvp-postgres mvp-redis
|
||||||
- echo "Waiting for database to be ready..."
|
- echo "Waiting for database to be ready..."
|
||||||
- sleep 15
|
- 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"
|
- 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
|
- docker compose -f $DOCKER_COMPOSE_FILE -f $DOCKER_COMPOSE_PROD_FILE up -d
|
||||||
- echo "Waiting for services to initialize..."
|
- echo "Waiting for services to initialize..."
|
||||||
- sleep 30
|
- sleep 30
|
||||||
@@ -125,7 +135,7 @@ verify:
|
|||||||
- |
|
- |
|
||||||
HEALTH_OK=0
|
HEALTH_OK=0
|
||||||
for i in 1 2 3 4 5 6; do
|
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"
|
echo "OK: Backend health check passed"
|
||||||
HEALTH_OK=1
|
HEALTH_OK=1
|
||||||
break
|
break
|
||||||
@@ -140,7 +150,7 @@ verify:
|
|||||||
fi
|
fi
|
||||||
- echo "Checking frontend..."
|
- 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"
|
echo "OK: Frontend is accessible"
|
||||||
else
|
else
|
||||||
echo "WARNING: Frontend check failed (might need Traefik routing)"
|
echo "WARNING: Frontend check failed (might need Traefik routing)"
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -20,12 +20,20 @@ INSERT INTO transmissions (id, type) VALUES
|
|||||||
(18,'6-Speed CVT'),
|
(18,'6-Speed CVT'),
|
||||||
(19,'7-Speed Automatic'),
|
(19,'7-Speed Automatic'),
|
||||||
(20,'6-Speed Dual Clutch'),
|
(20,'6-Speed Dual Clutch'),
|
||||||
(21,'8-Speed Dual Clutch'),
|
(21,'8-Speed Automatic'),
|
||||||
(22,'9-Speed Automatic'),
|
(22,'1-Speed Automatic'),
|
||||||
(23,'7-Speed Dual Clutch'),
|
(23,'7-Speed Dual Clutch'),
|
||||||
(24,'9-Speed Dual Clutch'),
|
(24,'5-Speed Dual Clutch'),
|
||||||
(25,'8-Speed Automatic'),
|
(25,'7-Speed CVT'),
|
||||||
(26,'10-Speed Automatic'),
|
(26,'7-Speed Manual'),
|
||||||
(27,'7-Speed Manual'),
|
(27,'9-Speed Automatic'),
|
||||||
(28,'7-Speed CVT');
|
(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
Reference in New Issue
Block a user