On Oct 13, 12:38*pm, Michael Fesser <neti...@gmx.de wrote:
.oO(lawp...@gma il.com)
>
Well, I can do all that in one fell swoop by creating a symbolic link.
I don't have to worry about whether or not I've deleted anything in
version control that I then need to remove in the production; it's
already done for me. If I had to delete files what were already
deleted in version control, then in my mind, I'm doing manual labor
that the computer should be doing anyway.
That's what synchronizing is for. The computer can easily check which
files have been modified or deleted from the working copy and upload all
required changes to the production server. There are various tools
available for this task.
I suppose there are tools for this. Care to give me a sales pitch on
any of them? Right now an svn export does everything I want, with no
risks of the downsides of copying or synchronizing.
And the deployment tool is built right into the version control
system. Why do I need an extra tool here?
>
Also, by using symbolic links, I can deploy, test, and fallback to the
old directory by re-linking very easily if I need to.
This should happen on a testing server. You hardly need multiple
versions on the production server.
That would always work if the development and production environments
were identical, but in my experience, they're not. Code that passes a
test in the development environment might still have problems when you
roll it out in production. And then that happens, you'll want to roll
it back *really really badly*. :)
The situation I've been involved in before was where we made a change
to the database structure in development which we didn't replicate in
the production database. The code was developed and tested in
production against a new table structure, and it passed all its test.
Then when we went to roll it out, SQL errors all over the place. It
was quite a relief to be able to roll back the website with a simple
command. ( BTW, I'd really like a smart version control system for our
table structure, one that could do ALTER TABLEs appropriately when
deploying).
In our situation, we have a development server, and a production
server with a staging hostname and a production hostname. Once a
feature pasts testing on development, it goes out to staging. Staging
is on the production server and connects to the production database.
We do 'pre-live' testing there.
The great part about this is the seamless deployment from stating to
production. Our initial svn export gets linked to the staging
hostname. E.g.:
$ls
website-release-320
staging.website .com -website-release-320/
website.com -website-release-320/
$svn export
http://svn-host/website/releases/release-345 ./website-
release-345
$rm -rf stating.website .com; ln -s ./website-release-345
staging.website .com
$ls
website-release-320
website-release-345
staging.website .com -website-release-345/
website.com -website-release-320/
Where staging.website .com was previously linked to ./website-
release-320 . Now the new code really is in the production
environment. There shouldn't be any problem in production that
wouldn't be apparent here. So, after we've done the testing at
staging, we do:
$rm -rf website.com; ln -s website-release-320 website.com
$ls
website-release-320
website-release-345
staging.website .com -website-release-345/
website.com -website-release-345/
The deployment of the new code to live takes milliseconds.
We can let the 320 revision hang around for a while; it's not being
served, and it's a "known good configuration" of the website
( provided it doesn't reference any outdated database structures :)
that we can rollback to if needed.
Finally, by using an adequately named directory to symlink to, I know
what version I have deployed as production. If /home/user/website/
production is a symlink to /home/user/website/trunk-R255, then there's
a pretty good chance that it's revision 255 that is currently in
production. If I were just copying files into the website directory, I
would have to have another way to know or guess what revision was
actually deployed.
You could use tags on your repository and then simply assume that it's
always the latest tagged version which goes production. When you reach
the next stable release, tag it and deploy it. Quite easy.
That's a good idea. We're suing subversion, which doesn't have tags,
but the manual says you get the same functionality by doing a release
branch.
Knowing myself and my computing habits, I wouldn't like to assume that
a directory is the latest tagged released; it may not be. ( My most
difficult bash-head-against-wall troubleshooting cases are always
faulty assumptions ). By creating a directory named trunk-R273 or
release-R503, then there's a greater likelihood that that directory
actually *contains* revision 503. Not that there's anything magical in
naming it as such, but hopefully when I'm improperly naming a
directory ( e.g. svn export
http://svn-host/releases/R502 ./website-
release-R498 ), the cognitive dissonance becomes apparent, and I stop
and say "Hey, what am I doing? This is *wrong*!" For me at least,
there's a lesser likelihood of that happening when I'm doing export to
the generic directory name that we've been using for years.