www portfiles - inconsistent settings

Bjarne D Mathiesen macintosh at mathiesen.info
Wed May 30 10:12:26 PDT 2012


Ryan Schmidt wrote:
> 
> On May 30, 2012, at 11:17, Bjarne D Mathiesen wrote:
> 
>> Ryan Schmidt wrote:
>>>
>>> On May 30, 2012, at 10:44, Jeremy Lavergne wrote:
>>>
>>>>> 3) we've got:
>>>>>     /www/${name}
>>>>>     /www/${name}/html
>>>>>     /www/data/${name}
>>>>>     /www/${name}/htdocs
>>>>> these ought to brought in line.
>>>>> My suggestion is : /www/${name}/html
>>>>
>>>> Sounds good to me: all ports' files are contained in their own directories, making it easy to alias them into Apache (or nginx or what have you).
>>>
>>> I tried to have this discussion some years ago and we did not reach an agreement. Some ports got modified to install into ${prefix}/www/${name} at that time because that seemed to make sense to me. I don't see what purpose adding an additional "html" directory serves. 
>>
>> having the additional /html/ makes it possible to have additional
>> directories in a consistent way eg :
>>    www
>>        postfixadmin
>>            html
>>            php-sessions
>>            php-includes
>>            php-tmp
>>            mysql55
>>
> 
> You're proposing that "html" would be the document root? Many web apps are simply installed by copying their entire distribution into such a location; in fact, that's what we do for every web app port we have, as far as I know. Other web apps might be distributed with other files that don't belong in the document root. These apps will have already chosen a name for their document root directory, which might not be "html", and it might not be simple to change what they call it. Do we want to sign up for that effort?

I know that ... that's what I'm seeing in the ones I've presently taken
a look at. Having those other directories is strictly an option for
advanced admins & not something the port ought to install by itself. As
to the specific directories named above:

_mysql_
I personally symlink the mysql directory into ${prefix}/var/db/mysql55.
That makes it possible for me to eg completely nuke that dir and
re-install mysql55 completely without loosing data.

_php-includes_
It's recommended to keep php settings like eg the username & password
for mysql outside the document root. This will of course necessiate some
hacking by the admin of the www website port that macports shouldn't
have anything to do with.

_php-sessions_
by default, php stores session data in /tmp which is insecure & not
recommended.

> 
> Would the port be creating the php-* directories? I've not seen any port do that so far, so that would be new. How would PHP be configured to use those directories instead of the defaults? What if the web app is not PHP but some other language?

Nope ... the port shouldn't create these directories.
Usage of these are defined in eg <Virtualhost>

> 
> I've also not seen any port try to put its databases in its own directory. Ports like phpmyadmin might create databases, but they'll go wherever mysql databases usually go. I don't think it's proper for the port to decide to put the databases somewhere other than where the sysadmin wanted them to go.

Again, it's up to the sysadmin to do this. I'm just suggesting that we
create a dir structure that makes it possible to have everything
regarding a www website port collected in the same place.

> 
> Mysql allows you to upgrade to a newer version. So you might begin by using mysql51 but later upgrade to mysql55. Your databases can still be used. Should the directory name then really contain the mysql version number?

Well, there are ususally some migration problems when upgrading between
mysql versions. When I upgraded mysql51 -> mysql55 I copied the whole
mysql51 dir to mysql55 and had them symlinked. I thus had a stable
mysql51 DB and a test mysql55 DB that I could test and thrash as needed

> 
> Not all web apps use mysql; some might use postgresql.

And if so, I might create a posgresql dir and symlink as needed, but
again : that's fully up to the site admin :-)

>>>
>>> If standardization is a goal, creating a portgroup might be useful.

I do think standardization & consistency is a valuable goal :-)

!!!BUT!!! having said that this file structure shouldn't be made by the
port by default, we might change our mind later -or- a maintainer migth
elect to do some of these things. www websites are in my experience
storing their settings inside the document root because of what's
usually allowed by webhosting firms. Thus creating the /html/ will give
sysadmins a lot of advantages - at least IMHO ;-)

>>
>> Creating a PortGroup is at present _possibly_ a little beyond me ;-)
>> But I can see the advantages as a lot of definitions and tests are the
>> same for all www websites.
> 
> A portgroup is quite simple: it's an include file. Anytime you find yourself repeating code in several portfiles, it's time to think about making that a portgroup.

Jeremy has already written that to me :-)
I'll possibly look into that for the www websites, but at present I've
got other and more important fish to fry before i dive into this problem ;-)

I just noticed these inconsitensies and thougt it was pertinent to bring
them to the attention of the group for discussion :-)

-- 
Bjarne D Mathiesen
København N ; Danmark ; Europa
----------------------------------------------------------------------
denne besked er skrevet i et totalt M$-frit miljø
MacOS X 10.7.3 Lion ; 2.8GHz Intel Core i7 ; 16GB 1067MHz DDR3


More information about the macports-dev mailing list