[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Local vs Live Config for sites without root control

From: Ryan Schmidt <subversion-2006q2_at_ryandesign.com>
Date: 2006-06-30 00:41:52 CEST

On Jun 30, 2006, at 00:10, Tom Lancaster wrote:

> Ryan Schmidt wrote:
>
>> I do this in my sites:
>> <?php
>> if (LIVE_SERVER) {
>> define('DB_HOST', 'dbserver');
>> define('DB_USER', 'foo');
>> define('DB_PASS', 'bar');
>> } else {
>> define('DB_HOST', 'localhost');
>> define('DB_USER', 'root');
>> define('DB_PASS', '');
>> }
>> ?>
>> And the LIVE_SERVER constant is defined to true only on the
>> development server.
>
> Thank you. I do this also, I'm just wondering if there's a fancy
> way to keep live and dev config files under version control as the
> same file.
>
> Granted it's a minor problem, but it's happened more than once that
> I uploaded my local config file to a staging server which had no
> idea about some non-existent domain.
>
> I think ignore-commit is not perfect, because I want certain
> changes to config files to propagate. I also want other changes to
> propagate, and I certainly want version control on said files.
>
> Probably what I'm asking for is advanced regex hooks into svn
> exports ( when I'm ready to go live I should export, right??? )

I happen to do an export, yes. You don't want your web visitors to be
able to dive into the .svn directory and retrieve your source code
from the text base. But you can also easily configure Apache to deny
access to those directories even if they're there. This does it:

RedirectMatch 404 .*/\.svn(/|$)

Makes it look like they were never even there. The reason I still do
an export as that a working copy update is not atomic -- there could
be a network problem and the update would abort, leaving the working
copy in a half-updated state in which the site might not function.
Therefore I update a working copy, and when it's done, I export that
to a new directory, and then I change a symlink to point to the new
export, and the web server's virtual host only has to point to the
symlink.

In the script we use to deploy our releases to our production server,
there's an option to have it run some other script after the export
is done. You could do something like that: have a script which you
run to deploy the live site, which not only fetches the latest
version from the repository but also fiddles with the config files.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri Jun 30 00:43:21 2006

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.