Vardirlayout scenario

View: New views
4 Messages — Rating Filter:   Alert me  

Vardirlayout scenario

by marcinmilan@xaraya.com-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I recently uploaded the vardirlayout scenario
(com.xaraya.core.jamaica.vardirlayout). The purpose of the scenario is
to make the main Xaraya directories configurable.
It is a step along the road delineated by the text in docs/devDirlayout.txt.

The scenario focuses mainly on 2 directories that can be moved outside a
particular instance of Xaraya to a central place

Conceptually the scenario has the following underpinnings:

- In all installations the known point of departure is the location of
index.php, where the browser points. It is from this "constant" location
that we can set up the configuration for a given instance.

- The root directory of Xaraya can be defined with respect to index.php.
This directory is the central point relative to which the main
directories of the instance are set. The root directory is often thought
of as sitting at the top of a hierarchy of directories (Xaraya and/or
others). In the default setup it sits one level up from the html
directory, for instance. But this not need be so. The root directory is
simply a convenient central reference point for the instance.

That the root directory's usefulness as a construct comes from the fact
that it is distinct from index.php. In a single website installation the
Xaraya configuration could in theory use index.php as its reference
point. But in a multi-site setup, where different instances share the
same code, the root directory becomes a common reference point for all
installs.

- From the root directory we can then go on to define relative locations
to the main components of Xaraya. The file devDirLayout.txt makes some
proposals as to what these can be. The vardirlayout focuses on three
main components:
   - html directory and its subdirectories, which contain the things
that need to be accessible to the web server.
   - lib directory and its subdirectories, which contain the libraries
Xaraya uses.
   - code directory and its subdirectories, which contain the code for
the Xaraya modules (and what more ?).

By making the last 2 of these configurable for each instance we can
greatly simplify multi-site setups. In the scenario's "default" setup
both the lib and code directories are on the same level as the html
directory. The layout paths to these directories are defined in a new
file var/layout.system.php.

Questions

1. Is the code directory needed (or should "modules" replace "code")?
2. The price we pay in the scenario is to move the bootstrap.php file
into the html directory. In fact the only thing needed for the above
concept to work is to have the sys class (and its parent class) live
next to index.php, but rather than taking that out of bootstrap.php it
seems easier to just move the whole file. Is there a better solution?
3. What other directories could be moved out from below the webroot in
the short term? It would make sense to make as many of these moves
before a final 2.0.0 release.
4. Two new static methods in sys appear: lib() and code() that return
the relative paths to the respective directories. Perhaps roll them
along with root() and varpath() into a single method?

On a side note, increasing the flexibility of the configuration layout
will likely lead to complications (or at least potentially more
complexity) of module and theme installations, increasing the need for a
smarter installer/component manager.
_______________________________________________
Xaraya_devel mailing list
Xaraya_devel@...
http://xaraya.com/mailman/listinfo/xaraya_devel

Re: Vardirlayout scenario

by jojodee-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Marc

We have also been working on this for some time and back at the
beginning of July posted a version of the docs/devDirlayout.txt on the
web for  better accessibility for those that wanted to comment on this
prior to our work on the scenario in our cirrus branch.

http://xarigami.com/devnote/cirrus_directory_restructure

In relation to your description and questions:

First, the current 1x setup is the most convenient for the specific case
of multisite setup where you have multiple sites running off one code
base for one or more instances and ease of modules and theme directories
(see http://xarigami.com/resources/Multiple_sites-single_code_base).
The new dir layout actually complicates this, not simplifies it as you
suggest, but the new layout has other positives in relation to one place
for libraries, reduction in code duplication across modules, better
sharing of common items etc.

We have found the current dirlayout proposed limiting in some respects
and also from a maintenance and 'neatness' point of view the directories
such as library and modules are best all put as subdirectories in a
directory out of the web root or parallel to an instance of a site (eg
html). We found this better than having multiple directories related to
xaraya running out of the web root.

The library (lib) directory was to be used for xaraya and other 3rd
party libraries and as such the 'code' directory you suggested is
specifically used for xaraya modules in our setup keeping it easier for
upgrades/installations/distributions.

We have found this structure to be most useful for our current needs for
xaraya and multisite setups, although we are still working on this in
some areas where features are not complete. I was going to put the
layout here but due to my unsureness about the resulting display in this
newsgroup I posted it here:

http://xarigami.com/devnote/cirrus_directory_restructure_2

Of particular note is that we only need the one 'xarigami' directory
configurable here in addition to where the specific site is located
(html) as the other main directories are fixed in name and relative to this.

This change in directory structure does pose problems for those that do
not have access to directories above the web root and they would need
their hoster to install it for them. Thus the configurable 'xarigami'
directory (or whatever name you want to call it) makes this easier for them.

The structure also aims to make theme and module installation as simple
as we can given the additional problems we expect to encounter with this
restructure.

I would like to think that jamaica does not have code that puts the
bootstrap file in each of the 'html' site directories. It doesn't have
to be.


Cheers
Jo

marcinmilan@... wrote:

> I recently uploaded the vardirlayout scenario
> (com.xaraya.core.jamaica.vardirlayout). The purpose of the scenario is
> to make the main Xaraya directories configurable.
> It is a step along the road delineated by the text in
> docs/devDirlayout.txt.
>
> The scenario focuses mainly on 2 directories that can be moved outside a
> particular instance of Xaraya to a central place
>
> Conceptually the scenario has the following underpinnings:
>
> - In all installations the known point of departure is the location of
> index.php, where the browser points. It is from this "constant" location
> that we can set up the configuration for a given instance.
>
> - The root directory of Xaraya can be defined with respect to index.php.
> This directory is the central point relative to which the main
> directories of the instance are set. The root directory is often thought
> of as sitting at the top of a hierarchy of directories (Xaraya and/or
> others). In the default setup it sits one level up from the html
> directory, for instance. But this not need be so. The root directory is
> simply a convenient central reference point for the instance.
>
> That the root directory's usefulness as a construct comes from the fact
> that it is distinct from index.php. In a single website installation the
> Xaraya configuration could in theory use index.php as its reference
> point. But in a multi-site setup, where different instances share the
> same code, the root directory becomes a common reference point for all
> installs.
>
> - From the root directory we can then go on to define relative locations
> to the main components of Xaraya. The file devDirLayout.txt makes some
> proposals as to what these can be. The vardirlayout focuses on three
> main components:
>   - html directory and its subdirectories, which contain the things that
> need to be accessible to the web server.
>   - lib directory and its subdirectories, which contain the libraries
> Xaraya uses.
>   - code directory and its subdirectories, which contain the code for
> the Xaraya modules (and what more ?).
>
> By making the last 2 of these configurable for each instance we can
> greatly simplify multi-site setups. In the scenario's "default" setup
> both the lib and code directories are on the same level as the html
> directory. The layout paths to these directories are defined in a new
> file var/layout.system.php.
>
> Questions
>
> 1. Is the code directory needed (or should "modules" replace "code")?
> 2. The price we pay in the scenario is to move the bootstrap.php file
> into the html directory. In fact the only thing needed for the above
> concept to work is to have the sys class (and its parent class) live
> next to index.php, but rather than taking that out of bootstrap.php it
> seems easier to just move the whole file. Is there a better solution?
> 3. What other directories could be moved out from below the webroot in
> the short term? It would make sense to make as many of these moves
> before a final 2.0.0 release.
> 4. Two new static methods in sys appear: lib() and code() that return
> the relative paths to the respective directories. Perhaps roll them
> along with root() and varpath() into a single method?
>
> On a side note, increasing the flexibility of the configuration layout
> will likely lead to complications (or at least potentially more
> complexity) of module and theme installations, increasing the need for a
> smarter installer/component manager.


--
http://xarigami.com :: Creative web development with Xaraya
http://2skies.com   :: Open source hosting and development
_______________________________________________
Xaraya_devel mailing list
Xaraya_devel@...
http://xaraya.com/mailman/listinfo/xaraya_devel

Re: Vardirlayout scenario

by marcinmilan@xaraya.com-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


jojodee wrote:
 > Hi Marc
 >
 > We have also been working on this for some time a...

Thanks to Marcel's work the Jamaica codebase has few and easily
identifiable entry points which makes shuffling the directory structure
quite easy. In the scenario the location of the core and modules code is
no longer relevant because configurable. At that point the question
becomes: what else can we remove from the html dir.

My own preference is to move everything I can out of the web root on the
one hand, but on the other I don't like the idea of having site specific
stuff in 2 places, one under the web root and one not. So my bent would
be to move the remaining common stuff out, at least as a first step.

 From my pov that would mean locales and other "data" for one, which
might lead to a "data" directory somewhere. I shied away from the issue
in the scenario for now because it is an issue that comes into full play
once there are more modules available for jamaica, giving us a bit more
time to think about its structure. Useful procrastination, at least for me.

On the other hand, I don't think I would move the themes directory out
from html. There is nothing so site specific as a theme in my view.

As to the code remaining in html: just as index.php is conceptually the
"front controller" for Xaraya, bootstrap.php is the "backend
controller", and to the degree that the backend is configurable, it
seems to me that something like it (the sys class is the minimum) needs
to be there. For the record the file is less than 15K, so it wouldn't be
taking uo a lot of space.

Marc

_______________________________________________
Xaraya_devel mailing list
Xaraya_devel@...
http://xaraya.com/mailman/listinfo/xaraya_devel

Re: Vardirlayout scenario

by jojodee-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


marcinmilan@... wrote:

>
> My own preference is to move everything I can out of the web root

Mine too.

 on the
> one hand, but on the other I don't like the idea of having site specific
> stuff in 2 places, one under the web root and one not. So my bent would
> be to move the remaining common stuff out, at least as a first step.

>
> From my pov that would mean locales and other "data" for one, which
> might lead to a "data" directory somewhere.

By locales in the proposal i put up, I meant 'locales' and not
translations, just to be clear (the diagram in the link
http://xarigami.com/devnote/cirrus_directory_restructure_2 shows how
this would work).

As to data that could be at the level of a set of sites (eg take some
custom category images, or corporate files used across a set of
multisites), or at the level of an individual site so we need to cater
for both.

The idea of  the 'sites' directory is useful here for data and configs
as both are site specific as well. Note that i had a copy paste error in
the link i posted of our scenario, and it has now been corrected to
'sites' directory.  It was the  'configs' directory in the original
dirlayout doc and not to be confused with the html web root dirs.

The 'default' 'site' directory contains data, including any theme
specific data shared across all sites. ('sites/default' as in the link i
posted previously)
Then there are the specific site directories for site specific data and
config.
There could be all sorts of 'default' or site specific content that goes
in these 'site' directories not just theme /templates.

So this gets around having a separate 'data' directory again for each
site in addition to the configs dir as per the original layout.


> On the other hand, I don't think I would move the themes directory out
> from html. There is nothing so site specific as a theme in my view.
>

Well, I guess that is what we are trying to change a little as i really
find it a burden having the themes so tied to content and is a real time
consumer in terms of development. In fact I think it is a key area
holding xaraya back (but that's for another thread ...) Thus in this
scenario I moved the 'themes' directory out of the web root. I've been
looking at ways to have cleaner, more portable themes, and 'skins' that
can add colour or images to easily upgrade themes. In this case the
themes are less tied to the site than we have now. The specific 'site'
directories would have the custom templates for a given theme/site. It's
another area we are working on at the moment so it may be that the
themes directory does stay in the web root.


> As to the code remaining in html: just as index.php is conceptually the
> "front controller" for Xaraya, bootstrap.php is the "backend
> controller", and to the degree that the backend is configurable, it
> seems to me that something like it (the sys class is the minimum) needs
> to be there. For the record the file is less than 15K, so it wouldn't be
> taking uo a lot of space.


Well it does make it easier having it there.  My concern also is the
additional hits we get from various directory setups  and the ensuing
code required, so I'd very much like to have som input and any
information they can shed on that. The other area of course as you
mentioned is the modules/theme distribution/packaging. We've tried to
adjust the original dir structure to better cater for that or at least
help in simplifying it some.

Been busy but I see the scenario now in mtn, so I'll pull it down and
take it for a ride and then I should have a better idea for discussion.

Thanks
Jo


>
> Marc
>


--
http://xarigami.com :: Creative web development with Xaraya
http://2skies.com   :: Open source hosting and development
_______________________________________________
Xaraya_devel mailing list
Xaraya_devel@...
http://xaraya.com/mailman/listinfo/xaraya_devel