User:Ryan52/website

This is how I imported the website into git.

Note that the git stuff doesn't currently deal with ownership and permissions. That has to happen by hand by the sysadmin. I'm willing to script it, tho I don't know what exactly is needed for WP to work.

Creating the repository
On my machine.

* !/themes/ !/plugins/ !.gitignore !* *~ .svn /index.php /hello.php /akismet/ tmp !* *~ .svn /index.php /classic/ /default/ /default-fr/
 * mkdir fgwebsite
 * cd fgwebsite
 * git init
 * mkdir -p themes plugins
 * cat - > .gitignore
 * cat - > plugins/.gitignore
 * cat - > themes/.gitignore
 * git add.
 * git commit -m "create the repository"
 * git remote add origin dev.freegeek.org:/git/fgwebsite
 * git push origin :master
 * git push origin :live
 * git push origin master:master

Importing the production copy
On oahu (live server).


 * sudo rm -fr /usr/share/wordpress/wp-content/.git/
 * rm -fr fgwebsite
 * git clone dev.freegeek.org:/git/fgwebsite
 * sudo mv fgwebsite/.git/ /usr/share/wordpress/wp-content/.git/
 * cd /usr/share/wordpress/wp-content/
 * sudo find . -name .gitignore -delete
 * sudo git checkout .gitignore themes/.gitignore plugins/.gitignore
 * sudo git add.
 * sudo chown -R ryan52:ryan52 .git
 * git commit -m "import the production website"
 * git push
 * git checkout -b live
 * git push origin live:live
 * git branch -d master
 * sed -i 's,dev.freegeek.org:/git/fgwebsite,git://git.freegeek.org/git/fgwebsite,g' .git/config
 * git fetch origin

Importing the devel copy
On press (devel server).

MAILTO=ryan52 */5 * * * * root /home/ryan52/fg-git-tools/git-pull-cron /usr/share/wordpress/wp-content/
 * rm -fr fg-git-tools
 * git clone dev.freegeek.org:/git/fg-git-tools
 * sudo rm -fr /usr/share/wordpress/wp-content/.git/
 * rm -fr fgwebsite
 * git clone dev.freegeek.org:/git/fgwebsite
 * sudo mv fgwebsite/.git/ /usr/share/wordpress/wp-content/.git/
 * cd /usr/share/wordpress/wp-content/
 * sudo find . -name .gitignore -delete
 * sudo git checkout .gitignore themes/.gitignore plugins/.gitignore
 * sudo git add.
 * sudo git rm $(git status | grep deleted: | awk '{print $3}')
 * sudo chown -R ryan52:ryan52 .git
 * git commit -m "import the development website"
 * git push
 * sed -i 's,dev.freegeek.org:/git/fgwebsite,git://git.freegeek.org/git/fgwebsite,g' .git/config
 * sudo sponge /etc/cron.d/fgwebsite

Setting up future servers
Should go something like this.

MAILTO=ryan52 */5 * * * * root /home/ryan52/fg-git-tools/git-pull-cron /usr/share/wordpress/wp-content/
 * rm -fr fgwebsite
 * git clone git://git.freegeek.org/git/fgwebsite
 * cd fgwebsite
 * git checkout -b live origin/live # only for production
 * sudo rm -fr /usr/share/wordpress/wp-content/.git/
 * sudo mv .git/ /usr/share/wordpress/wp-content/.git/
 * cd /usr/share/wordpress/wp-content/
 * sudo git checkout.
 * sudo sponge /etc/cron.d/fgwebsite # only for development