Forums / Install & configuration / Shared var folder and cache

Shared var folder and cache

Author Message

Sergi A

Thursday 26 May 2011 4:27:27 am

Hi!

We have different 2 ez publish installations sharing database.. we need, then, to share the var directory, so we are trying to create a soft link on the server from one var folder to the var folder of the other installation.

We are getting some problems with it, the main one being that we are unable to set different caches folders for each installation. Looking at the ez doc it seems that it is possible to set up differnet cache folders via site.ini, something like:

[FileSettings]
VarDir=ln_to_var
CacheDir=cache_folder_inside_var

But this is not working, the caches are being shared for the two insatallations, and we need each one to have itself caches.

Any help please?

thanks!

Sergi.

Jérôme Vieilledent

Thursday 26 May 2011 5:46:14 am

Hello

First there's no need to do a soft link here, simply enter the same [FileSettings].VarDir in both siteaccesses.

Then, why do you want to have separate cache folders if you share the same database ?

Marko Žmak

Thursday 26 May 2011 6:02:35 am

Just to make it clear, you have two different eZP installations or you have two different siteaccesses using the same database?

The method you suggested should work, I have used it many times. Some things to check:

  • did you set the ini settings properly?
  • did you clear the cache?
  • if you go to the admin of each site do you see different values for the CacheDir setting?

Also, are you sure that two separate eZP installations is what you need? Note that you can use spearate siteaccesses that have different design, extensions etc...

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Sergi A

Thursday 26 May 2011 7:01:42 am

It's 2 different installations, 2 different websites (2 differnet domain names).. that's why i can't do it with separated siteaccesses.

I can see 2 different CacheDir settings on both admin interfaces, but i'm missing something.. is the CacheDir on FileSettings, right?

Marko Žmak

Thursday 26 May 2011 7:10:05 am

Sites on different domains can be setup on the same eZ publish installation, see here:

  • http://doc.ez.no/eZ-Publish/Technical-manual/4.3/Concepts-and-basics/Configuration/Access-methods

As for your problem, yes it is [FileSettings].CacheDir ini site.ini.

Hm, did you maybe link the cache folders instead of var dir?

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Sergi A

Thursday 26 May 2011 9:10:01 am

Yes, i linked the var dir... the problem i see is that after clearing caches, the first website that is accesed is the one that generates the cache for both of them... which shouldn't be that way as I state 2 different cache folder for each one.

/var/ezflow_site/cache1
/var/ezflow_site/cache2

Then on override/site.ini.php.append

[FileSettings]
VarDir=var/ezflow_site
CacheDir=var/ezflow_site/cache1

changing cache2 for cache1 in the other installation... and the problem I see is that the first genreated is the one that remains...

Thanks for the link, but i think this should work..

André R.

Friday 27 May 2011 1:14:29 am

Afik, if they share db then they should share cache folder as well.

Cache clearing from shared admin interface won't work otherwise for instance.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Sergi A

Friday 27 May 2011 1:29:59 am

"

Afik, if they share db then they should share cache folder as well.

Cache clearing from shared admin interface won't work otherwise for instance.

"

So is there any way of not sharing caches? which problems would carry?

Marko Žmak

Friday 27 May 2011 1:41:53 am

"

[FileSettings]

VarDir=var/ezflow_site
CacheDir=var/ezflow_site/cache1

"

This should be:

[FileSettings]
VarDir=var/ezflow_site
CacheDir=cache1
"

Thanks for the link, but i think this should work..

"

If you don't have any real reason why to use two different installations on the same db, I strongly suggest to use one installation with different siteaccesses.

Using separate installations can really complicate your life when doing upgrades or installing new extensions etc.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Marko Žmak

Friday 27 May 2011 1:45:33 am

"
"

Afik, if they share db then they should share cache folder as well.

Cache clearing from shared admin interface won't work otherwise for instance.

"

So is there any way of not sharing caches? which problems would carry?

"

Yes there is. If you specify different cache folders, then the cache will not be shared. I did it on many many installations and it works without problems.

Why isn't working for you, I don't know.

But you could try this...

  • clear the caches manually (delete the cache1 and cache2 folders)
  • open a page on site1
  • open a page on site2

After that see if the the cache1 and cache2 folders were recreated and what's their content.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Sergi A

Friday 27 May 2011 3:51:47 am

Both are using the same folder always... i don't know why... anyway, what's the difference between the cache folder inside ezflow_site and the on inside the var folder, please? i try to state both on the ini file, but no luck.

Marko Žmak

Friday 27 May 2011 4:00:13 am

"

Both are using the same folder always... i don't know why... anyway, what's the difference between the cache folder inside ezflow_site and the on inside the var folder, please? i try to state both on the ini file, but no luck.

"

If you set it like this:

[FileSettings]
VarDir=var/ezflow_site
CacheDir=cache1

The cache will be created in:

var/ezflow_site/cache1

If you set CacheDir=var/ezflow_site/cache1 I'm not sure, but I suppose cache will be in:

var/ezflow_site/var/ezflow_site/cache1

The main point is, CacheDir is appended to VarDir.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Sergi A

Monday 30 May 2011 3:07:25 am

Can't get it working.. now both cache dirs are being created on var/ezflow_site, which seems to be ok.. but then i get same title pages on both sites, same page path (breadcrumbs) on both... and now the styles are being mixed on one of them..

I don't know what else can i do, it should work .. I'm missing somehing

Gaetano Giunta

Monday 30 May 2011 5:51:07 am

I cannot understand aht you are trying to do, really. What I'd go for:

  • same content database: use four siteaccesses (or more) in one ezpublish installation. Different domain names pose no problem. You could even have two sets of users, one group logging to site A, the other logging to site B (and two anon users, with different policies on the different sites)
  • two separate databases: use separate var directory, one ezp install, or
  • two separate databases: use two ezp installs, share kernel/extension php code by symlinking common directories

Principal Consultant International Business
Member of the Community Project Board

Sergi A

Monday 30 May 2011 8:09:54 am

I'm trying to solve this by using the same installation but different siteaccesses. So, now i have both websites in 4 different languages, then i need 8 different siteacces conifugrations? Also, 4 of them should work on a different domain.. is it possible? how should i do it?

Carlos Revillo

Wednesday 08 June 2011 7:23:03 am

Hi Sergi.

What you are trying is perfectly doable with ez publish. about the var thing, as said by the other guys, it's up to you to decide if you want one only database or one database per domain or per siteaccess. but if two siteaccess share db, they should share the same var folder.

i don't understand why you need cache1 folders and things like that...

maybe if you can add some sample of what are trying to achieve we can help a bit more... i mean... something like

i need domain1.com in english and spanish, domain2 only german... or whatever...

also it would be good to know if even they are different domains they share content (i mean, domain.de is the translated version or domain.co.uk, for example)

cheers.

Carlos Revillo

Wednesday 08 June 2011 7:25:57 am

Btw, i would like to add something about this related to the install process. when you run the ez publish install process, and you select a common "one public siteaccess and one admin siteaccess" installation, you end having DatabaseSettings in both siteaccess/[siteaccess]/site.ini.append.php ... but FileSettings are placed in settings/override/site.ini.append.php.

Sometimes i tried to change var folder for one siteaccess and it doesn't work until you realized that setting is in setting/override/file.ini.append.php too...

Cheers.

Marko Žmak

Monday 04 July 2011 4:12:42 am

"

We have different 2 ez publish installations sharing database.. we need, then, to share the var directory, so we are trying to create a soft link on the server from one var folder to the var folder of the other installation.

We are getting some problems with it, the main one being that we are unable to set different caches folders for each installation. Looking at the ez doc it seems that it is possible to set up differnet cache folders via site.ini, something like:

[FileSettings]
VarDir=ln_to_var
CacheDir=cache_folder_inside_var

But this is not working, the caches are being shared for the two insatallations, and we need each one to have itself caches.

"

I had a similar issue today, and here's what I figured out...

If your 2 installations are sharing the var dir, they will also be sharinf the global cache dir "var/cache". Therefore some INI settings you set on one installation will be used from the cache by the other installation too. And therefore, in this case both installation would use the same value for the CacheDir.

I'm not sure if all ini settings are cached here, but the ones from settings/override definitely are.

Maybe this doesn't mean much to you now, but just in case someone encounters this thread...

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Marko Žmak

Monday 04 July 2011 4:36:42 am

Now that I think about it...

It seems like the thing you were trying to do originally, is not doable. The CacheDir ini setting will always be cached in the global cache dir "var/cache" or in the standard cache dir of siteaccess "var/<siteaccess>/cache". Because it's actually this setting that defines the cache dir to be used for the siteaccess. And therefore, all caching done prior to reading this variable has to be put in one of this folders that are used by both of your eZP installation.

So it seems like two eZP installations that share the same var folder cannot have different cache folders for the same siteaccess.

I know I said before that I have done it many times, but now I remember that in such cases I was always using different siteaccess on each installation.

P.S. Maybe implementing a feature like this could be proposed as an enchancement...

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Sergi A

Monday 04 July 2011 5:18:30 am

Marko, what you said has sense to me.. that's why I used to found that the first domain to be refreshed after clearing caches would be the one remaining, and things like the breadcrumbs which is cached, would remain the same for both domains..

I started working on different siteaccesses, and it seems i will have to go on with this solution :(

 

thank you!