On 10/12/11 22:26, steve reilly wrote:
good afternoon
looking for input on moving a couple small family websites from a
desktop machine running lenny to a poweredge 4600 I just bought.
poweredge has two 73gb scsi drives, perc3 embedded raid. in process of
formatting drives, and then setting up container. desktop has a 300gb
drive, all one partition, but only about 4gb used. ideally would like to
just somehow dd or rsync contents of the desktop to the other machine.
question. how would YOU do it with minimal hassle, ie. having to edit
config files, databases and such. this thing has been running since etch
and been a learning process along the way.... i doubt my idea of cloning
would work, but?
I manage quite a few different web sites, including my own personal one
based on Wordpress. Generically they are all managed in a similar way,
although to be fair, there is a slight difference in how I manage my
workpress one.
Firstly, in general, I have two versions of the web site. One that
remains on my desktop where I develop changes to it, and one that
resides on the production server, wherever that may be. My home server
runs a copy of dnsmasq as a dns server for the house and has a config
file that defines lots of host names for my desktop machine. These name
let me know what site I am using but all sit in the .home domain - so
for instance, my production site is www.chandlerfamily.org.uk, my home
equivalent if cf.home. Another site I manage is
www.melindasbackups.com, my home machine is mb.home. etc etc
I run the apache2-mpm-itk package on my desktop. This allows me to add
the AssignUserId directive to my virtual host config to ensure that I am
reading and writing files to the location in my home directory as me
rather than the more normal www-data.
I run local copies of mysql and postgres (and sqlite) on my desktop
machine as they are all databases that drive the different sites I
manage. There are mostly copies I have taken of the production site,
although I normally ensure that the password to access them is different.
The web site itself is stored in a git repository. Generally speaking
there is the files that make up the web site itself - stored in a sub
directory called web plus other important supporting files (for instance
the apache config) which are stored in other directories.
The important part is post commit/post-merge hooks (stored in
.git/hooks/post-commit with .git/hooks/post-merge symlinked to it). Here
is the version I use with my Wordpress site (which, as I implied above I
manage slightly differently to the other sites, as I only update the
theme files this way). Nevertheless it shows the key use
#!/bin/bash
#
# If merging or committing to site or test branches, load up
appropriate directories on host
branch=$(git branch | sed -n s/^\*\ //p)
version=$(git describe --tags)
cd "$(git rev-parse --show-cdup)"
echo "<?php echo '$version';?>" > web/inc/version.inc
if [ "$branch" == "site" ]; then
# Copy all to the theme directory on main site
rsync -aqz --delete ./
www-data@owl:/var/www/chandlerfamily/wp-content/themes/czen/
fi
# Changelog
#
# 02 Mar 2011 - Initial version after setting theme as its own repository
This interesting part is how I parse the git branch I am on, and
establish a version number for the site. The version gets embedded into
a file for inclusion on the site, then IF I am on the site branch I use
rsync to ssh copy the appropriate files to the appropriate place on the
production server.
(With wordpress, I allow its own update mechanisms to install and manage
itself and the plugins - with other packages - particularly the SMF
forum I use quite a bit I use a different mechanism that is detailed in
this article
http://www.chandlerfamily.org.uk/2011/03/managing-smf-software-in-git/
)
Although my explanation may seem quite complex, it works out as really
useful tidy way to manage sites. They always need updating from time to
time and it is quite hard to remember all the details if you work with
lots of different sites. With my mechanism its simple - ensure you are
on branch master with git (my command line prompt actually includes the
branch name in square brackets when ever I am inside a git repository*)
make the changes and test locally. When you are happy with them do
git checkout site
git merge master
(site is automatically updated to new version)
git checkout master
* The command line prompt is set in .bashrc
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$(output-git-head-or-blank)\$
'
with the command output-git-head-or-blank being
#!/bin/bash
PS_GIT=$(git symbolic-ref HEAD 2>/dev/null)&&echo "[$(basename
$PS_GIT)]"&&exit
# else output nothing
--
Alan Chandler
http://www.chandlerfamily.org.uk
--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/4ee4628b.5040...@chandlerfamily.org.uk