Skip to content

[WIP] Amélioration de l'infrastructure et du déploiement#65

Open
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-07e70655-e6e3-4429-8a8e-d76248ae22cc
Open

[WIP] Amélioration de l'infrastructure et du déploiement#65
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-07e70655-e6e3-4429-8a8e-d76248ae22cc

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Aug 19, 2025

  • Explore repository structure and understand current setup
  • Identify missing infrastructure components
  • Create Vercel configuration for build optimization and environment variables
  • Set up GitHub Actions workflows for CI/CD
  • Create Render configuration for IA API deployment
  • Set up Supabase infrastructure with schema and security policies
  • Create environment variable templates
  • Add directory structure for IA API (apps/ia)
  • Update documentation for deployment processes
  • Test all configurations

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@vercel
Copy link
Copy Markdown

vercel Bot commented Aug 19, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
la-vida-luca-app Canceled Canceled Aug 19, 2025 5:58pm
la-vida-luca-app-zd4o Ready Ready Preview Comment Aug 19, 2025 5:58pm

Co-authored-by: vidaluca77-cloud <226796821+vidaluca77-cloud@users.noreply.github.com>
Co-authored-by: vidaluca77-cloud <226796821+vidaluca77-cloud@users.noreply.github.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Aug 19, 2025

Deployment failed with the following error:

Environment Variable "NEXT_PUBLIC_SUPABASE_URL" references Secret "supabase-url", which does not exist.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request implements the infrastructure foundation for the La Vida Luca platform, focusing on deployment configurations and API setup. The goal is to establish the necessary infrastructure components for a functional deployment pipeline with proper environment configuration.

  • Establishes deployment configurations for Vercel (frontend) and Render (IA API)
  • Creates comprehensive Supabase database schema with security policies and seed data
  • Sets up CI/CD pipelines with GitHub Actions for automated testing and deployment

Reviewed Changes

Copilot reviewed 16 out of 21 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
vercel.json Vercel deployment configuration with build settings and environment variables
render.yaml Render service configuration for Python FastAPI deployment
infra/supabase/schema.sql Complete database schema with tables, indexes, and triggers
infra/supabase/policies.sql Row-level security policies and access control functions
infra/supabase/seeds.sql Sample data for development and testing
apps/ia/main.py FastAPI application structure with basic endpoints
apps/ia/requirements.txt Python dependencies for the IA API
apps/ia/tests/ Test structure and configuration files
.github/workflows/ CI/CD pipeline configurations
DEPLOYMENT.md Comprehensive deployment documentation
.env.example Environment variable templates

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread vercel.json
{
"source": "/api/ia/:path*",
"destination": "$NEXT_PUBLIC_IA_API_URL/api/:path*"
}
Copy link

Copilot AI Aug 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using environment variables in rewrite destinations may not work as expected in Vercel. Consider using a hardcoded URL pattern or implementing the proxy logic in middleware instead.

Suggested change
}

Copilot uses AI. Check for mistakes.
Comment thread render.yaml
healthCheckPath: /health

# Scaling configuration
numInstances: 1
Copy link

Copilot AI Aug 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The numInstances field is deprecated in favor of the scaling configuration. Remove this line since scaling is already configured below.

Suggested change
numInstances: 1

Copilot uses AI. Check for mistakes.
Comment thread infra/supabase/schema.sql
WHERE id = (
SELECT session_id FROM activity_registrations
WHERE activity_id = NEW.activity_id
AND session_date = (SELECT scheduled_date FROM activity_sessions WHERE activity_id = NEW.activity_id ORDER BY scheduled_date LIMIT 1)
Copy link

Copilot AI Aug 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The subquery logic in the trigger function is flawed. It tries to find a session_id column in activity_registrations table, but this column doesn't exist in the schema. The logic should directly reference activity_sessions table or use a proper join.

Suggested change
AND session_date = (SELECT scheduled_date FROM activity_sessions WHERE activity_id = NEW.activity_id ORDER BY scheduled_date LIMIT 1)
SELECT id FROM activity_sessions
WHERE activity_id = NEW.activity_id
AND scheduled_date = NEW.session_date
);
ELSIF TG_OP = 'UPDATE' AND OLD.status != 'confirmed' AND NEW.status = 'confirmed' THEN
UPDATE activity_sessions
SET current_participants = current_participants + 1
WHERE id = (
SELECT id FROM activity_sessions
WHERE activity_id = NEW.activity_id
AND scheduled_date = NEW.session_date
);
ELSIF TG_OP = 'UPDATE' AND OLD.status = 'confirmed' AND NEW.status != 'confirmed' THEN
UPDATE activity_sessions
SET current_participants = current_participants - 1
WHERE id = (
SELECT id FROM activity_sessions
WHERE activity_id = NEW.activity_id
AND scheduled_date = NEW.session_date

Copilot uses AI. Check for mistakes.

-- Le système peut créer des notifications pour n'importe quel utilisateur
CREATE POLICY "System can create notifications" ON notifications
FOR INSERT WITH CHECK (true);
Copy link

Copilot AI Aug 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allowing unrestricted INSERT access to notifications could be a security risk. Consider adding authentication checks or limiting this to service accounts only.

Suggested change
FOR INSERT WITH CHECK (true);
-- Seuls les comptes système peuvent créer des notifications pour n'importe quel utilisateur
CREATE POLICY "System can create notifications" ON notifications
FOR INSERT WITH CHECK (
EXISTS (
SELECT 1 FROM users
WHERE id = auth.uid() AND role = 'system'
)
);

Copilot uses AI. Check for mistakes.
Comment thread apps/ia/main.py
# Configuration CORS
origins = os.getenv("ALLOWED_ORIGINS", "").split(",")
if not origins or origins == [""]:
origins = ["http://localhost:3000", "https://*.vercel.app"]
Copy link

Copilot AI Aug 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using wildcard patterns like '*.vercel.app' in CORS origins is not supported and can be a security risk. Define specific allowed origins or implement dynamic CORS validation.

Suggested change
origins = ["http://localhost:3000", "https://*.vercel.app"]
origins = ["http://localhost:3000", "https://your-app.vercel.app"]

Copilot uses AI. Check for mistakes.
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
scope: ${{ secrets.VERCEL_ORG_ID }}
alias-domains: |
la-vida-luca-staging.vercel.app
Copy link

Copilot AI Aug 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alias domain configuration should use environment-specific secrets rather than hardcoded values to ensure flexibility across different environments.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants