8000 Add fallbackfile and adapter to deployments collection by vermakhushboo · Pull Request #9570 · appwrite/appwrite · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add fallbackfile and adapter to deployments collection #9570

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 25, 2025

Conversation

vermakhushboo
Copy link
Member
@vermakhushboo vermakhushboo commented Mar 24, 2025

What does this PR do?

Add fallbackFile and adapter to deployments collection as well so that if a previous deployment is re-activated, it works even when site settings have been changed.

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Screenshots may also be helpful.)

Related PRs and Issues

  • (Related PR or issue)

Checklist

  • Have you read the Contributing Guidelines on issues?
  • If the PR includes a change to an API's metadata (desc, label, params, etc.), does it also include updated API specs and example docs?

Summary by CodeRabbit

  • New Features

    • Enhanced project and site deployments with additional configuration options for adapter settings and fallback files, enabling more flexible deployment and integration capabilities.
  • Tests

    • Added tests to verify rollback functionality and ensure consistent application of new configuration options across site deployments.

@vermakhushboo vermakhushboo requested a review from Meldiron March 24, 2025 14:35
Copy link
coderabbitai bot commented Mar 24, 2025

Walkthrough

This update introduces two new attributes, adapter and fallbackFile, across various modules. The changes include defining these attributes in the projects configuration, propagating them into deployment document creation in multiple controllers and backend modules, and updating routing logic to reference these attributes from deployment entities. Additionally, array formatting for site templates has been improved and a new test method has been added to verify site settings and deployment rollback functionality.

Changes

File(s) Change Summary
app/config/collections/projects.php Added new attribute definitions: adapter (string, size 128, default '') and fallbackFile (string, size Database::LENGTH_KEY, default null) to the projects configuration.
app/config/templates/site.php Reformatted array entries for site templates (e.g., 'nxt-lnk', 'magic-portfolio', 'littlelink', 'logspot') by adjusting indentation and removing extra line breaks.
app/controllers/api/vcs.php Included adapter and fallbackFile attributes in deployment document creation using the getAttribute method from the resource object.
app/controllers/general.php Updated router logic by replacing $resource with $deployment for checks on adapter and fallbackFile, including changes to the 404 status handling.
`src/Appwrite/.../Deployments/(Create Duplicate/Create
tests/e2e/Services/Sites/SitesCustomServerTest.php Added a new test method testSettingsForRollback to verify the correct handling of site settings and deployment rollbacks involving the new attributes.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant APIController as "API Controller"
    participant DeploymentService as "Deployment Service"
    participant DB as "Database"

    Client->>APIController: Send deployment request
    APIController->>DeploymentService: Extract adapter & fallbackFile attributes
    DeploymentService->>DB: Create/Update deployment document with attributes
    DB-->>DeploymentService: Acknowledge update
    DeploymentService-->>APIController: Return success response
    APIController->>Client: Confirm deployment creation
Loading

Possibly related PRs

Poem

Oh, I’m a hopping coder rabbit in the code,
Adding adapter and fallbackFile on every node.
With precision and a twitch of my snout,
Our deployments dance, there’s no doubt.
Hoppity, hoppity—let’s code it out!
🥕💻


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9fd8c5a and fe94717.

📒 Files selected for processing (1)
  • tests/e2e/Services/Sites/SitesCustomServerTest.php (1 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
tests/e2e/Services/Sites/SitesCustomServerTest.php (2)
tests/e2e/Services/Sites/SitesBase.php (7)
  • setupSite (20-33)
  • getSite (161-169)
  • setupSiteDomain (329-347)
  • setupDeployment (35-67)
  • updateSite (101-109)
  • updateSiteDeployment (407-417)
  • cleanupSite (69-78)
tests/e2e/Services/Functions/FunctionsBase.php (1)
  • setupDeployment (35-67)
⏰ Context from checks skipped due to timeout of 90000ms (20)
  • GitHub Check: E2E Service Test (VCS)
  • GitHub Check: E2E Service Test (Webhooks)
  • GitHub Check: E2E Service Test (Users)
  • GitHub Check: E2E Service Test (Teams)
  • GitHub Check: E2E Service Test (Messaging)
  • GitHub Check: E2E Service Test (Storage)
  • GitHub Check: E2E Service Test (Realtime)
  • GitHub Check: E2E Service Test (Projects)
  • GitHub Check: E2E Service Test (Sites)
  • GitHub Check: E2E Service Test (Locale)
  • GitHub Check: E2E Service Test (Functions)
  • GitHub Check: E2E Service Test (Avatars)
  • GitHub Check: E2E Service Test (FunctionsSchedule)
  • GitHub Check: E2E Service Test (Account)
  • GitHub Check: E2E Service Test (Health)
  • GitHub Check: E2E Service Test (GraphQL)
  • GitHub Check: E2E Service Test (Console)
  • GitHub Check: Benchmark
  • GitHub Check: E2E General Test
  • GitHub Check: Unit Test
🔇 Additional comments (2)
tests/e2e/Services/Sites/SitesCustomServerTest.php (2)

542-622: Excellent test implementation for the rollback functionality!

The new test method successfully validates that when rolling back to a previous deployment, the site correctly uses the adapter and fallbackFile settings from that deployment. This ensures that site functionality remains consistent even when switching between different deployment types (static vs. SSR).

Key observations:

  • The test properly verifies both adapter values ('static' and 'ssr')
  • It confirms the fallback file behavior during rollback
  • It validates the HTTP behavior changes appropriately between deployments

606-606: Regarding the 404 status code expectation

The test expects a 404 status code when accessing a non-existent path in the SSR deployment. This is correct behavior for an SSR Astro site that doesn't have a fallback file configured.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
github-actions bot commented Mar 24, 2025

Security Scan Results for PR

Docker Image Scan Results

Package Version Vulnerability Severity
binutils 2.42-r0 CVE-2025-0840 HIGH
libexpat 2.6.4-r0 CVE-2024-8176 HIGH
libxml2 2.12.7-r0 CVE-2024-56171 HIGH
libxml2 2.12.7-r0 CVE-2025-24928 HIGH
libxml2 2.12.7-r0 CVE-2025-27113 HIGH

Source Code Scan Results

🎉 No vulnerabilities found!

Copy link
github-actions bot commented Mar 24, 2025

✨ Benchmark results

  • Requests per second: 944
  • Requests with 200 status code: 169,974
  • P99 latency: 0.19550772

⚡ Benchmark Comparison

Metric This PR Latest version
RPS 944 1,213
200 169,974 218,345
P99 0.19550772 0.149577878

@Meldiron Meldiron merged commit 11d2b06 into feat-sites Mar 25, 2025
31 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Mar 26, 2025
2 tasks
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.

2 participants
0