svn - What's a good way to version control a website development project that includes MediaWiki and WordPress installation? -


i trying figure out version control procedures website includes mediawiki , wordpress installations. started thinking these , asking , vague questions.

say website root is

~/public_html 

there various static html pages

~/public_html/page1.html ~/public_html/dir/page2.html ... 

and there installations of mediawiki

~/public_html/wiki/ 

and wordpress

~/public_html/blog/ 

and possible other webapp have database backend.

there few questions not clear me

  • if use subversion, what's first step? have /public_html running on web server machine, need download complete /public_html local development computer first , commit svn server (separate) project? have other software projects version controlled using subversion.

  • if use subversion , when deploy, check out, i.e. website that's used server working copy of repository? mediawiki , wordpress versioned? .svn directories? won't exposed?

  • besides version control files in /public_html how backup databases in way that's streamlined files in public_html?

  • if use mercurial instead, can use public_html repository , don't need clone out repository?

i using source control, scripts , deployment procedures manage few web application projects wordpress, phpbb , custom web applications. on years, refined these , have nice framework seems work me, may suit others facing similar chalenges.

here general points overall strategy:

  • i never have scm , source files on production server. don't see reason put there , don't want repositories exposed in case of server breach. applications on production server have clean latest stable revision. no project files, docs, unit testing, etc. isn't needed isn't there. find important both security , application stability points of view.
  • not turn scm debate found purposes, mercurial (and git) better svn in aspect. don't need "server" , repositories easier maintain.
  • i keep separate repository per project. mercurial repositories cheap , lightweight. keeping every project in own repository gives great flexibility. no 1 big repository "public_html".
  • i work local mercurial repositories on development machine. backed (using whatever backup strategy - additional machines, external drives, cloud backup). sharing code easy giving project's directory. keep repositories on dropbox, can access them anywhere.
  • deployment done automatically deploy script(s) (more details later). exports desired revision, edits , uploads server.
  • databases dumps not stored in scm. not practical real project. store dump of database structure in scm , update time structure changes (i use mysql dump or phpmyadmin this). makes sense store dump of skeleton data in scm along structure (tables defaults, lookup values etc).
  • database backup done automatic script (automysqlbackup works well) runs on production server. dumps database, archives , rotates files (monthly, weekly, daily). there script downloads backup dump files off site location daily. works projects relatively small-medium data sizes. obviously, need change large databases.
  • i keep separate database instances development , productions. messing around production database little possible. when need test/debug something, update development database copy of live data.
  • sometimes have second copy of application on production server staging/unit testing that's describe here.
  • all deployment tunneled on ssh, connection allowed on server (except http/s, of course). keep ssh key file on development machine. alternatively, can use vpn tunnel.
  • i assuming linux/bsd production servers. totally different (and harder) on windows server. used these procedures on windows, mac , linux development machines, tools available on all.

so, answer of questions, i'd other way around. start working environment on development machine (complete web server , database). have applications work , tested there. commit changes local repository needed. once application ready deployment, run deploy script automatically update production site.

my deploy script this:

  • export desired revision local temp deploy directory (mercurial, git, svn have export commands create working directory repository)
  • modify deployed directory make suitable live deployment. includes modifying config files, changing database names, paths, log settings, debug levels etc. using scripts, sed, awk, grep or whatever command line tools needed.
  • if needed, generate version.txt (or whatever name) file scm revision data, deploy date, etc. uploaded server.
  • add ssh key ssh agent (to avoid using passwords each time).
  • use rsync, tunneled on ssh sync server. server need configured rsync destination. use rsync exclude/include filters exclude not needed (often .* except .htaccess).
  • if needed, use ssh remote execution capabilities run commands on server tasks setting special permissions (for example, write permissions on wordpress upload directories).
  • give me nice "deployment successful" message :)

that's it, once script in place deployment becomes fun. run script, go the live server see works, done.

hope helps.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -