User:Ryan52/website

From FreekiWiki
Jump to navigation Jump to search

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.

  • mkdir fgwebsite
  • cd fgwebsite
  • git init
  • mkdir -p themes plugins
  • cat - > .gitignore
*
!/themes/
!/plugins/
!.gitignore
  • cat - > plugins/.gitignore
!*
*~
.svn
/index.php
/hello.php
/akismet/
tmp
  • cat - > themes/.gitignore
!*
*~
.svn
/index.php
/classic/
/default/
/default-fr/
  • 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).

  • 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
MAILTO=ryan52
*/5 * * * * root /home/ryan52/fg-git-tools/git-pull-cron /usr/share/wordpress/wp-content/

Setting up future servers

Should go something like this.

  • rm -fr fg-git-tools
  • git clone git://git.freegeek.org/git/fg-git-tools
  • 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
MAILTO=ryan52
*/5 * * * * root /home/ryan52/fg-git-tools/git-pull-cron /usr/share/wordpress/wp-content/