Any negative side effects to disabling caching in a Liferay production environment? - caching

Our production Liferay instance absolutely refuses to deploy my latest theme. Something is preventing it from displaying my latest CSS changes. Unfortunately, there are NO log errors and no Firebug Console errors, so it's been a real headache to diagnose. I just get a really ugly plain page with links and no styles applied.
I have tried everything I can think of to fix this.
Undeploy/redeploy theme
restart the Glassfish container
use Liferay Server Administration page to "Clear content cached across this JVM", "Clear database cache", "Verify Database plugins", etc.
undeploy, restart, redeploy
undeploy, delete leftover files/folders pertaining to the theme in 'applications' folder, restart container, redeploy
clear my browser cache
try a different browser
many more combinations of the above. You get the idea.
Last night I reached the boiling point because my theme deployed and displayed in our test environments without issue, but didn't work in production. The only thing that was different is that I wasn't using
include-and-override=portal-developer.properties
in my portal-ext.properties file.
I took a gamble and added this line to my production portal-ext.properties and restarted the production server. My theme now displays without a problem.
The file portal-developer.properties only appears to contain the following properties:
theme.css.fast.load=false
theme.images.fast.load=false
javascript.fast.load=true
javascript.log.enabled=false
layout.template.cache.enabled=false
browser.launcher.url=
combo.check.timestamp=true
freemarker.engine.cache.storage=soft:1
freemarker.engine.modification.check.interval=0
openoffice.cache.enabled=false
velocity.engine.resource.manager.cache.enabled=false
com.liferay.portal.servlet.filters.cache.CacheFilter=false
com.liferay.portal.servlet.filters.etag.ETagFilter=false
com.liferay.portal.servlet.filters.header.HeaderFilter=false
com.liferay.portal.servlet.filters.themepreview.ThemePreviewFilter=true
So, finally, my question is, am I merely trading a slight performance boost for a massively easier deployment experience?
Or are there more serious concerns to loading this file in a production environment?
Thanks in advance for the input!
Ben

You'll get a really bad performance with that portal-ext.properties. That configuration is only intended to be used in development environments.
If you delete the css/.sass_cache directory on your deployed theme you'll see your css changes and you'll be able to use a different portal-ext.properties on production environment.
http://issues.liferay.com/browse/LPS-26939
Regards

Related

Publish success but no changes on site?

I have a site where I am getting:
I had to do a full re-install where this previously all worked fine, and this is going to Azure. I re-imported my publish settings from Azure and see this. That looks good too so I assumed we were back to normal.
Except that the "Publish Succeeded" stuff, when I visit that actual URL I publish to (which I had to blur), none of my changes are there.
Any ideas?
I'm fully checked-in on the git branch and this runs fine locally.
From your comments I understand you're using FTP to make changes to your Azure project. That's not really the best way of deploying an application in 2020, but for this particular issue that you're facing it doesn't matter what method you use.
The most likely scenario is that when you visit the URL you are being given a cached version of your website.
That can happen for multiple reasons:
1) Your browser stored a cached version of the website
2) You are using a CDN (content delivery network) such as Cloudflare, which most often comes with an enabled cache feature that ensures your users will get your static pages lightning fast
3) Your web application implements one or more caching procedures
If none of those is the case (ie: you have tried using incognito mode, you don't use a CDN and you haven't implemented a caching strategy) then you might need to double-check you have pushed to the correct branch and that the commits contain your recent changes.
EDIT: if you actually have everything checked, including that your Git repo is properly synchronized, then it might be worth trying a different deployment method -- normally it shouldn't affect the end result, but there is the possibility that the Microsoft Azure platform has certain hidden bugs - this being one of them.
Have you thoroughly check the directories and stuff if its correct? most of the time issues like this are some minor errors like cache, wrong directories, and same output from previous files etc.

Does Visual Studio Publish to Azure Website Cause Whole Site to Recycle?

We've recently launched a new website in Azure (i.e. Azure Websites) and as is typical with new launches we've had to deploy a few tweaks to fix minor issues shortly after launch.
We want to use Slots in the long run but this is not possible at the moment. Hence we are deploying to the live site. It's a fairly busy site with a good amount of traffic and obviously want to keep downtime to am minimum.
We are using Visual Studio to publish file changes to Azure but have noticed that even if we publish a relatively insignificant single file the whole site goes down and struggles to come back up. I was assuming that publishing a single file would literally just replace that file on the file system but it's behaving more like it recycles the application pool (or Azure equivalent) for the site. The type of files I've been publishing have been Razor views, hence would not typically cause a recycle.
Does anyone know what actually happens under the hood of VS Publish and if there is a way to avoid this happening?
Thanks.
I just tried this using a basically clean new MVC app (https://github.com/KuduApps/Dev14_Net46_Mvc5), and I did not see this behavior. The Index.html view has a hit count based on a static, which would tell us if the app or the page got restarted (or if that specific page got recompiled).
Then the test is to publish it, make a change to some other view (about.cshtml), and publish again. WHen doing this and hitting Index.cshtml, the count keeps going up, and there is minimal slowdown.
If you see it getting restarted after a view change, I suggest using Kudu Console to look at the files in site\wwwroot before/after the publish, and check what has a newer timestamp (e.g. check web.config, bin folder, ...).

Orchard CMS can't find scripts or styles

I have prepared an Orchard based website locally, using WebMatrix. I then published to my hosting provider.
However the deployed version isn't picking up the styles or scripts, either my theme or for the dashboard, and it's giving me 404 errors.
I guess I have to change the path somewhere to get it to pick up the files, can anyone tell me where? or is there a different solution?
I thought that this would be a setting on the website, but as it turns out it was an IIS setting.
I switched the pipeline mode from Classic to Integrated, and everything worked.

Converting Web Site Project to Web Application Project

I recently changed my project from a Website Project to a Web Application project so I could use build events.
I'm having all sorts of problems now trying to develop.
When I build the project and reload it in the web browser, it hardly ever loads the right version (sometimes it does).
Like if I make a simple update to some text, it will load the last page, like it's using a cached version of the page or something.
Also when I try to debug, it will never hit the breakpoints. I'm not sure what I need to change to fix this issue, any help would be greatly appreciated.
What browser are you using? The chances are the pages are being cached. With most browsers you can do Ctrl + F5 to force a reload of the cached files.
In Internet Explorer, you can change the option for Temporary Internet Files to 'Every time I visit the webpage', but be aware that this affects all sites you visit.
If you are talking about changes to binaries, you might need to do an iisreset. If you are still having issues, try deleting ASP.NET temp files.

Clearing cache in the server

This is related to my problem here:
Editing velocity template of Liferay changes not showing or takes a while
I've tried to investigate the caching problem and tried different things. Here's what I found out.
I just found out that my css is also delayed in showing the updates. I tweak my css file adding comment and testing it on my browser. Now just requesting it on the URL it will just give me an older version of the file. now if i put a query asking for version, (eg. mystyle.css?v2) it will pull the latest file and it records it. I can even see different version, eg. (mystyle.css?v1) or (mystyle.css?v2. I've cleaned my cache so it's definitely on the server side (i think).
Is there a way I can clear my cache?
Thank You!
you can activate Liferay's developer setting by including the properties that are in ROOT/WEB-INF/classes/portal-developer.properties.
Explanation: Liferay minifies and caches CSS and Javascript - once this is done it will not examine those for changes. The developer settings will disable that.
However, you don't want this setting active in production as this will mean that you'll have to load dozens of files instead of very few combined+minified, well cached, files.
I assume you are using this for development, not in production.
If you're having these problems in production, you should rather work with a proper theme plugin and redeploy that.

Resources