Skip to content
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

Docker Support - Liquid File Changes Not Reflecting immediately in Live Environment #715

Open
dhawaldenny opened this issue Nov 14, 2024 · 5 comments

Comments

@dhawaldenny
Copy link

dhawaldenny commented Nov 14, 2024

Problem: When changes are made to any Liquid file in the project, they do not take effect immediately.

Steps to Reproduce the Issue:

  1. Create a New ASP.NET Core Web App (MVC) Project using Fluid

    • Install the NuGet packages: Fluid and Fluid.MVCViewEngine.
    • Add a controller and view, and create a view file named Index.liquid.
    • In the Program.cs file, add the following configurations:
      builder.Services.AddMvc().AddFluid();
      builder.Services.AddControllersWithViews().AddFluid();
      app.UseStaticFiles();
  2. Add Docker File

    • Include a Dockerfile in the project.
    • Add the following key-value pair to the Dockerfile to enable file change detection:
      ENV DOTNET_USE_POLLING_FILE_WATCHER=1
  3. Build the Docker Image

    • Use the following command to build the Docker image:
      docker build -t your_image_name .
  4. Run Docker with Volume

    • Run the Docker container with a volume for dynamic updates using this command:
      docker run -p 5050:80 -v "dynamic_volume_path:/app/Views/:rw" your_image_name
  5. Reproduce the Issue

    • Navigate to any Liquid file in the project.
    • Make text changes in the Liquid file.
    • Open the application in a browser (at the specified port). Notice that changes do not reflect immediately; however, after waiting for approximately 5–10 minutes, the changes are visible.

Reason for the Issue:

When changes are made to any Liquid file in the project, it triggers a full rebuild of all files, which causes a delay of around 5–10 minutes before updates appear. This delay is due to the current configuration where any single file modification initiates a complete rebuild, which is influenced by the volume size.

Issue Details:
● Affected Files: Liquid files.
● Current Behavior: A single file change causes the entire codebase to recompile.
● Impact: Average delay of 7–8 minutes per change as Per volume size, which accumulates over multiple changes and significantly affects development speed.

Demo Web App : https://github.com/dhawaldenny/Fluid_Demo_WebApp
Sandbox : https://codesandbox.io/p/github/dhawaldenny/Fluid_Demo_WebApp/main?import=true&workspaceId=676874cf-90d2-4548-bef7-f3da912431ea

Note: The number of view files in the folder will increase the delay before changes take effect.

For example, if there are only 4-5 view files, changes will typically take 30 seconds to 1 minute to load. However, if there are around 100 view (Liquid) files, it may take up to 5 minutes for changes to take effect, even if only one file was modified.

@dhawaldenny dhawaldenny changed the title Docker Support - Liquid File Changes Not Reflecting in Live Environment Docker Support - Liquid File Changes Not Reflecting immediately in Live Environment Nov 14, 2024
@sebastienros
Copy link
Owner

Thanks for the detailed explanation.

A single file change causes the entire codebase to recompile.

Do you suggest the full dotnet app is compiled? Liquid templates are only interpreted and it should take a few milliseconds or in less per file to be parsed.

What is the CPU sizes allocated to your container?

@dhawaldenny
Copy link
Author

Do you suggest the full dotnet app is compiled? Liquid templates are only interpreted and it should take a few milliseconds or in less per file to be parsed.

What is the CPU sizes allocated to your container?

Hi Sebastien Ros,

Thanks for your quick response.

  1. Yes, it seems like the time taken depends on the number of views. Fewer view files take around 30 seconds, while more view files take longer based on their size and quantity.
  2. There is no specific CPU size allocated, which means the application can utilize the full node's cores (8-core CPU), as no other applications are deployed except for the kube-system namespace.

image

@sebastienros
Copy link
Owner

sebastienros commented Nov 15, 2024 via email

@dhawaldenny
Copy link
Author

dhawaldenny commented Nov 20, 2024

Have you tried the same report without calling AddFluid and other fluid apis?

Hi @sebastienros,

Yes, I tried the same report (Link to Razor repo: Demo_WebApp_Docker_Volume) without adding AddFluid and other Fluid APIs, but with:

builder.Services.AddRazorPages();
builder.Services.AddRazorPages().AddRazorRuntimeCompilation();
app.UseStaticFiles();

changes are reflected immediately.

The issue I observed is that Liquid files still do not reflect changes immediately. Instead, modifying a Liquid file triggers a full rebuild of the entire codebase as its not HTML or CSS file (see attached screenshot and link why it triggers build by watch command), which significantly delays the process (approximately 5 to 10 minutes, depending on the project size).

This delay in reflecting changes creates an efficiency bottleneck in the project. Razor files, as expected, reflect changes instantly, but Liquid files don't, and the rebuild process seems to be independent of whether the Fluid APIs are used or not. but it happens as liquid files are not HTML/css as per Microsoft documentation.

Let me know if you need any further clarification.
image

@dhawaldenny
Copy link
Author

dhawaldenny commented Dec 3, 2024

Hi @sebastienros ,

I hope you're doing well. I’m following up on the issue mentioned above. I was wondering if there’s been any progress or if there’s anything I can assist with to move it forward?

Please let me know if you need further details or support. Thanks for your time and efforts!

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

No branches or pull requests

2 participants