Request for Feature: Serving static resources with Apache recipe

8 Messages Forum Options Options
Embed this topic
Permalink
Sidnei da Silva-2
Request for Feature: Serving static resources with Apache recipe
Reply Threaded More
Print post
Permalink
I've just stumbled on the plone.recipe.apache recipe yesterday. Nice work!!!

One feature I immediatelly thought of is the following: while
configuring VHM and all that, why not use Apache to serve static
resources from the skins? It feels to me like it would be a very
useful feature for offloading at least some content serving from
Plone.

I see it working like this:

"""
[apache-conf]
recipe = plone.recipe.apache
...
resources =
    images:${buildout:directory}/parts/my-products/my.theme/skin/images
    js:${buildout:directory}/parts/my-products/my.theme/skin/js
    css:${buildout:directory}/parts/my-products/my.theme/skin/css
resources-expires =
    (css|js|jpg|png|gif):expires:"access plus 1
week":cache-control:"max-age=172800, public, must-revalidate"
"""

This would generate:

"""
    <IfModule mod_expires.c>
      <FilesMatch "\.(css|js|jpg|png|gif)$">
         ExpiresActive on
         ExpiresDefault "access plus 2 days"
         Header set Cache-Control "max-age=172800, public, must-revalidate"
      </FilesMatch>
    </IfModule>

    Alias /images
/home/sidnei/src/my-buildout/parts/my-products/my.theme/skin/images
    <Directory /home/sidnei/src/my-buildout/parts/my-products/my.theme/skin/images>
        Order allow,deny
        Allow from all
    </Directory>

    RewriteRule ^/images/ - [L]
"""

Thoughts?
--
Sidnei da Silva
Enfold Systems http://enfoldsystems.com
Fax +1 832 201 8856 Office +1 713 942 2377 Ext 214

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Plone-developers mailing list
Plone-developers@...
https://lists.sourceforge.net/lists/listinfo/plone-developers
Yuri-11
Re: Request for Feature: Serving static resources with Apache recipe
Reply Threaded More
Print post
Permalink
Sidnei da Silva ha scritto:

> I've just stumbled on the plone.recipe.apache recipe yesterday. Nice work!!!
>
> One feature I immediatelly thought of is the following: while
> configuring VHM and all that, why not use Apache to serve static
> resources from the skins? It feels to me like it would be a very
> useful feature for offloading at least some content serving from
> Plone.
>
> I see it working like this:
>
> """
> [apache-conf]
> recipe = plone.recipe.apache
> ...
> resources =
>     images:${buildout:directory}/parts/my-products/my.theme/skin/images
>     js:${buildout:directory}/parts/my-products/my.theme/skin/js
>     css:${buildout:directory}/parts/my-products/my.theme/skin/css
> resources-expires =
>     (css|js|jpg|png|gif):expires:"access plus 1
> week":cache-control:"max-age=172800, public, must-revalidate"
> """
>
> This would generate:
>
> """
>     <IfModule mod_expires.c>
>       <FilesMatch "\.(css|js|jpg|png|gif)$">
>          ExpiresActive on
>          ExpiresDefault "access plus 2 days"
>          Header set Cache-Control "max-age=172800, public, must-revalidate"
>       </FilesMatch>
>     </IfModule>
>
>     Alias /images
> /home/sidnei/src/my-buildout/parts/my-products/my.theme/skin/images
>     <Directory /home/sidnei/src/my-buildout/parts/my-products/my.theme/skin/images>
>         Order allow,deny
>         Allow from all
>     </Directory>
>
>     RewriteRule ^/images/ - [L]
> """
>
> Thoughts?
>  

how do you "customize"? :)

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Plone-developers mailing list
Plone-developers@...
https://lists.sourceforge.net/lists/listinfo/plone-developers
Gilles Lenfant
Re: Request for Feature: Serving static resources with Apache recipe
Reply Threaded More
Print post
Permalink
In reply to this post by Sidnei da Silva-2
Le 24 juil. 08 à 14:09, Sidnei da Silva a écrit :

> I've just stumbled on the plone.recipe.apache recipe yesterday. Nice  
> work!!!
>
> One feature I immediatelly thought of is the following: while
> configuring VHM and all that, why not use Apache to serve static
> resources from the skins? It feels to me like it would be a very
> useful feature for offloading at least some content serving from
> Plone.
>
> I see it working like this:
>
> """
> [apache-conf]
> recipe = plone.recipe.apache
> ...
> resources =
>    images:${buildout:directory}/parts/my-products/my.theme/skin/images
>    js:${buildout:directory}/parts/my-products/my.theme/skin/js
>    css:${buildout:directory}/parts/my-products/my.theme/skin/css
> resources-expires =
>    (css|js|jpg|png|gif):expires:"access plus 1
> week":cache-control:"max-age=172800, public, must-revalidate"
> """
>
> This would generate:
>
> """
>    <IfModule mod_expires.c>
>      <FilesMatch "\.(css|js|jpg|png|gif)$">
>         ExpiresActive on
>         ExpiresDefault "access plus 2 days"
>         Header set Cache-Control "max-age=172800, public, must-
> revalidate"
>      </FilesMatch>
>    </IfModule>
>
>    Alias /images
> /home/sidnei/src/my-buildout/parts/my-products/my.theme/skin/images
>    <Directory /home/sidnei/src/my-buildout/parts/my-products/
> my.theme/skin/images>
>        Order allow,deny
>        Allow from all
>    </Directory>
>
>    RewriteRule ^/images/ - [L]
> """
>
> Thoughts?

Hi,

Isn't it easier to add cache directive in Apache for this ? In  
addition this works for CSS and JS with DTML markup.

--
Gilles Lenfant
INGENIWEB (TM) - SAS 50000 Euros - RC B 438 725 632
Bureaux de la Colline
1 rue Royal
92210 Saint Cloud - France
Phone : 01 78 15 24 00 / Fax : 01 46 02 44 04
web : www.ingeniweb.com - une société du groupe Alter Way


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Plone-developers mailing list
Plone-developers@...
https://lists.sourceforge.net/lists/listinfo/plone-developers
Sidnei da Silva-2
Re: Request for Feature: Serving static resources with Apache recipe
Reply Threaded More
Print post
Permalink
> Hi,
>
> Isn't it easier to add cache directive in Apache for this ? In addition this
> works for CSS and JS with DTML markup.

No?

The intention here is to not serve pure static content through Zope,
*ever*, since that's not what it was designed for. It's not simply a
matter of caching.

Sure, for DTML it might make sense. But there's no reason to trigger a
whole lot of overhead and consuming a ZServer thread for each static,
public, never-changing resource just to get the cache primed when
Apache can do a much better job at serving the file directly in the
first place.

--
Sidnei da Silva
Enfold Systems http://enfoldsystems.com
Fax +1 832 201 8856 Office +1 713 942 2377 Ext 214

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Plone-developers mailing list
Plone-developers@...
https://lists.sourceforge.net/lists/listinfo/plone-developers
Sidnei da Silva-2
Re: Request for Feature: Serving static resources with Apache recipe
Reply Threaded More
Print post
Permalink
Hi all,

I've implemented the features discussed on this thread. If no-one
objects, I will be merging those changes to trunk this coming friday.

  https://svn.plone.org/svn/collective/buildout/plone.recipe.apache/branches/sidnei-static-resources/

--
Sidnei da Silva
Enfold Systems http://enfoldsystems.com
Fax +1 832 201 8856 Office +1 713 942 2377 Ext 214

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Plone-developers mailing list
Plone-developers@...
https://lists.sourceforge.net/lists/listinfo/plone-developers
Jean Jordaan
Re: Request for Feature: Serving static resources with Apache recipe
Reply Threaded More
Print post
Permalink
'lo there

> I've implemented the features discussed on this thread. If no-one
> objects, I will be merging those changes to trunk this coming friday.

So, as Yuri said, this is only to be used by people who won't use the
.../custom folder to override these resources?

--
jean . .. .... //\\\oo///\\

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Plone-developers mailing list
Plone-developers@...
https://lists.sourceforge.net/lists/listinfo/plone-developers
alan runyan-2
Re: Request for Feature: Serving static resources with Apache recipe
Reply Threaded More
Print post
Permalink
This makes perfect for production environments.  NOT development environments.
Responsible customers have (at least) two environments:

  - Development (where customization work can be done)

  - Production (where ZERO customization work is done only minor
configuration adjustments which are done via buildout/conf files)

Sidnei is focused on the production environment as the target for his
recipe. Which makes perfect sense.

--
Alan Runyan
Enfold Systems, Inc.
http://www.enfoldsystems.com/
phone: +1.713.942.2377x111
fax: +1.832.201.8856

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Plone-developers mailing list
Plone-developers@...
https://lists.sourceforge.net/lists/listinfo/plone-developers
Jean Jordaan
Re: Request for Feature: Serving static resources with Apache recipe
Reply Threaded More
Print post
Permalink
'lo Alan

> Sidnei is focused on the production environment as the target

So, as Yuri said, this is only to be used by people who won't use the
.../custom folder to override these resources.

> for his recipe. Which makes perfect sense.

It's not his recipe, he stumbled upon it on the 23rd July. The use
case makes perfect sense, it's just something for recipe users to keep
in mind.

--
jean                               . .. .... //\\\oo///\\

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Plone-developers mailing list
Plone-developers@...
https://lists.sourceforge.net/lists/listinfo/plone-developers