fix: CI/CD permission fix

This commit is contained in:
Eric Gullickson
2025-12-27 16:38:28 -06:00
parent dc2c731119
commit bf84e64ee9
4 changed files with 57 additions and 14 deletions

View File

@@ -21,6 +21,8 @@ default:
after_script:
- echo "Fixing file permissions..."
- sudo chown -R gitlab-runner:gitlab-runner "$DEPLOY_PATH" 2>/dev/null || true
# Keep data directories owned by container user
- sudo chown -R 1001:1001 "$DEPLOY_PATH/data/backups" "$DEPLOY_PATH/data/documents" 2>/dev/null || true
# Validate Stage - Check prerequisites
validate:
@@ -73,26 +75,30 @@ deploy:
- echo "Deploying MotoVaultPro..."
- echo "=========================================="
- cd "$DEPLOY_PATH"
- echo "Step 1/7 Injecting secrets..."
- echo "Step 1/8 Initializing data directories..."
- mkdir -p data/backups data/documents
- sudo chown -R 1001:1001 data/backups data/documents
- chmod 755 data/backups data/documents
- echo "Step 2/8 Injecting secrets..."
- chmod +x scripts/inject-secrets.sh
- ./scripts/inject-secrets.sh
- echo "Step 2/7 Stopping existing services..."
- echo "Step 3/8 Stopping existing services..."
- docker compose -f $DOCKER_COMPOSE_FILE -f $DOCKER_COMPOSE_PROD_FILE down --timeout 30 || true
- echo "Step 3/7 Pulling base images..."
- echo "Step 4/8 Pulling base images..."
- docker compose -f $DOCKER_COMPOSE_FILE pull
- echo "Step 4/7 Starting database services..."
- echo "Step 5/8 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/7 Running database migrations..."
- echo "Step 6/8 Running database migrations..."
- docker compose -f $DOCKER_COMPOSE_FILE run --rm mvp-backend npm run migrate || echo "Migration skipped"
- echo "Step 6/7 Vehicle catalog data..."
- echo "Step 7/8 Vehicle catalog data..."
# Schema and data now loaded via standard migration system
# Migration runner handles table creation and data loading automatically
- echo "Vehicle catalog loaded via platform feature migration"
- echo "Flushing Redis cache..."
- docker exec mvp-redis redis-cli FLUSHALL
- echo "Step 7/7 Starting all services..."
- echo "Step 8/8 Starting all services..."
- docker compose -f $DOCKER_COMPOSE_FILE -f $DOCKER_COMPOSE_PROD_FILE up -d
- echo "Waiting for services to initialize..."
- sleep 30