feulf / raintpl3

The easiest Template Engine for PHP
https://feulf.github.io/raintpl
258 stars 57 forks source link

Add patch for NFS compatibility #149

Open rmontagne opened 10 years ago

rmontagne commented 10 years ago

Hello,

I add a patch to make compatibility of raintpl3 with NFS.

Thanks.

kargnas commented 10 years ago

I don't understand why use like this way.

rmontagne commented 10 years ago

I use this method because NFS share doesn't allow php function flock, so i copy the item that i have needed on the tmp directory. I use this solution on production server, and it works great.

rmontagne commented 10 years ago

With your solution i must move all my TPL on the /tmp/ dir ? And i have multiple front which use the same file, and the file architecture is the same. I can’t move the tpl off all my front to the tmp dir because if i upgrade one tpl, i must upgrade all my fronts.

Do you understand my configuration ?

Romain Supvize Envoyé avec Sparrow (http://www.sparrowmailapp.com/?sig)

Le mardi 13 mai 2014 à 08:48, Sang rak, Choi a écrit :

You don't need to do like this. This will works as your purpose:
\Rain\Tpl::configure('tpl_dir', '/tmp');

or \Rain\Tpl::configure(array( 'tpl_dir' => '/tmp', //'your_own_configs' => 'your_own_configs' ));

— Reply to this email directly or view it on GitHub (https://github.com/rainphp/raintpl3/pull/149#issuecomment-42922574).

kargnas commented 10 years ago

This will make huge load for system for production sever. (Always compile again for all page loading! It is same as debug mode) Cannot be used for production. Find other way..

Anyway, the option name nfs is bad name for this code.

kargnas commented 10 years ago

@rmontagne Sorry, I did misunderstand. I deleted that reply and I post new reply just seconds ago.

kargnas commented 10 years ago

I suggest symbolic link:

$ ln -s /data/mynfs/templates /tmp/template
\Rain\Tpl::configure('tpl_dir', '/tmp/template');
rmontagne commented 10 years ago

no problem, In my configuration, the template compile just one times and it store on a memcached server, but if you have another solution compliance with nfs share it's so good. I think you must try a multiple front configuration with nfs yourself.

kargnas commented 10 years ago

I am using raintpl for 5+ php app servers using git repository. I think, NFS is not good as use of source files. NFS is good for unpredictable changes file system like photos by user uploading.

rmontagne commented 10 years ago

So when you make a change on you source code, you must git pull on all off your master ?

rmontagne commented 10 years ago

With a symbolic link, the php flock function return false, so the template engine doesn't compile my template ...

kargnas commented 10 years ago

Sure. I have seperated directory for development in main develop server. Also it has own domain. (http://**dev**.myservice.com)

I make shell script for deployment. Also there are many deployment tools for deployment like Phing.

rmontagne commented 10 years ago

So you must connect on each your front to launch your script or add your ssh key on your deployment server to run this script, i think i keep my solution because it more simple, I just upgrade nfs files and all my front are updated.

Thanks for your help.

kargnas commented 10 years ago

Yes, this is so uncomfortable.

So i found my own way for convenience,

For development, I just always upload files to linked sftp in my IDE. (this maybe same as you) Then test many times in my development site.

And I will commit If I am sure about all changes of sources. And then, run deployment script to pull sources. I usually deploy about 4~10 times in a day.

rmontagne commented 10 years ago

And if you have a problem, you have a script for rollback on all of your front servers ? I think both solutions works great.

kargnas commented 10 years ago

No have for rollback, just rollback source using git, then commit again. then deploy.

But my way is so slow for emergency situation.

rmontagne commented 10 years ago

ok, i understand you configuration, but now for me it must simple to use NFS, the template are generate and store an memcached server, and the performance isn't impact. But for the future, I will think to a deployement system like yours.

kargnas commented 10 years ago

Yes. That is good with memcached or other caching system.

sitthykun commented 10 years ago

I suggest redis for caching system

On Tue, May 13, 2014 at 2:52 PM, Sang rak, Choi notifications@github.comwrote:

Yes. That is good with memcached or other caching system.

— Reply to this email directly or view it on GitHubhttps://github.com/rainphp/raintpl3/pull/149#issuecomment-42926870 .

Sitthykun LY a little developer in the big world \o/ mobile: +85595 7788 39 skype: cityx9 twitter: sitthykun http://twitter.com/sitthykun site: niyum.com

rmontagne commented 10 years ago

Why not, I never tried this system.

sitthykun commented 10 years ago

It is monster cached system and super fast, it generate key by nanosecond I think you will fall in love. I am thinking like your moment above for this

here http://redis.io/topics/quickstart

On Tue, May 13, 2014 at 3:01 PM, rmontagne notifications@github.com wrote:

Why not, I never tried this system.

— Reply to this email directly or view it on GitHubhttps://github.com/rainphp/raintpl3/pull/149#issuecomment-42927511 .

Sitthykun LY a little developer in the big world \o/ mobile: +85595 7788 39 skype: cityx9 twitter: sitthykun http://twitter.com/sitthykun site: niyum.com

rmontagne commented 10 years ago

Thanks , I use this lib to manage my cache : http://maximebf.github.io/CacheCache/ and it compliance with redis, good news for me, when i have time i try to setup a redis server inside of my memcached server, have you a benchmark between both system ?

kargnas commented 10 years ago

I had been use apc/redis/memcached. APC -> Memcached > Redis -> Redis + Back to APC

Memcached / Redis use much system resource. (Socket I/O) I am just using Redis for shared cached data. Others used in APC.

sitthykun commented 10 years ago

Here is benchmark of this comparison, sorry I forgot the live comparison

http://anton.logvinenko.name/en/blog/redis-vs-memcache-vs-memcached.html

My experience I used to develop LiveChat with memcached then I got suffer. I desired to use redis due to redis has monitoring. it's fast; can export data, log and data accuracy.

On Tue, May 13, 2014 at 4:35 PM, Sang rak, Choi notifications@github.comwrote:

I had been use apc/redis/memcached. APC -> Memcached > Redis -> Redis + Back to APC

Memcached / Redis has many system resource. (Socket I/O) I am using Redis for shared cached data. Others used in APC.

— Reply to this email directly or view it on GitHubhttps://github.com/rainphp/raintpl3/pull/149#issuecomment-42935069 .

Sitthykun LY a little developer in the big world \o/ mobile: +85595 7788 39 skype: cityx9 twitter: sitthykun http://twitter.com/sitthykun site: niyum.com