Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Managing a Joomla website with Git?

Tags:

git

mysql

joomla

I work at a large university and have been instructed to look in to using a source control system (git, svn, etc) to manage the websites. We use Joomla which relies heavily on MySQL.

Currently, we have a barely functional system that uses a development server which pushes to a live server whenever we change a website. It's a pain and it doesn't always work. Plus, we can and often do overwrite changes that another dev has made.

We want to be able to manage content via the Joomla front end on the dev branch, then push those changes to the test branch, then to the master (live) branch.

Without getting off in tot he weeds: my question is, essentially, what is a good strategy for managing websites using a CMS like Joomla that relies on a database?

like image 282
Kickasstimus Avatar asked Jul 15 '13 14:07

Kickasstimus


1 Answers

Since you also want to sync the database (content is stored in the db, while images and media are on the filesystem), you need the commit/push script to also dump the db to a file, and the pull script to load the db. This can be done with pre and post hooks, http://githooks.com/ or google it.

However there will be different parts of Joomla that you will want to sync separately.

Let's consider three servers:

  • edit server: where content is managed
  • dev server: where extensions are tested and configured
  • test server
  • production server

Let's consider three layers of information:

  1. The user and session data: this should not be synchronized at all so people are not logged out, and if any users register on the production server their login will be preserved.

  2. The contents, user groups and assets (privileges): this is the articles, news, images which have to go from edit to test to production and to dev (unless you have content-specific privileges at the user level i.e. each user has separate privileges on each content item)

  3. The template, extensions, modules, menu configurations: this will go from dev to test to production and edit.

Each of these groups of data will require their own branch and their custom pre-commit hooks to include in the commit/push the relevant database tables. The list of tables for each group depends on the extensions you are using.

I have written an article it's in italian and for svn but you can grab some of the bash scripts we use: http://www.fasterjoomla.com/joomla-tips/svn-per-joomla or translated by google http://translate.google.com/translate?sl=it&tl=en&js=n&prev=_t&hl=it&ie=UTF-8&u=http%3A%2F%2Fwww.fasterjoomla.com%2Fjoomla-tips%2Fsvn-per-joomla

like image 128
Riccardo Zorn Avatar answered Sep 29 '22 12:09

Riccardo Zorn