Mura CMS, Git, Submodules, and project structure ideas - Seeking feedback

So I have been working with Mura CMS a lot lately and I have also migrated all of my projects to Git. But I find myself in a situation that I don't really like. I have an idea of how I might fix it, but I am not expert enough in Mura or Git to know if this is a good idea or if I will find myself in a tough position with it in the future.

Mura is different from any of my other projects because it is more modular (plugins, themes, etc) and because it is someone else's code with my code tucked inside (versus other work I have done with frameworks where it is my code with someone else's tucked inside).

The Core Mura CMS files are something I should not and do not want to edit. So I feel like I should not be bothering to put them into my repo. Instead I feel I should be using the GitHub repo from Blue River. But of course, when I go to deploy Mura, I need my files to be in there somewhere. I need my Site directories with their themes inside and other files I have modified. And I need my plugins in the plugins directory.

I currently keep each of my Mura Plugins in their own Git repos (some on Github and some on BitBucket. I would like to keep it that way. And I plan to put my site folder (minus the cache folder) into a BitBucket repo as well.

So here is what I am thinking:

  1. Fork the Mura CMS project over to my Github account
  2. Clone my fork onto my local machine (call it www)
  3. Update .gitignore to not include the plugins/ folder or my site folders
  4. Create git submodule in /www/<site folder> where I can then work on my site files in separate version control from the core Mura files
  5. Create submodules in /www/plugins/<plugin name> for each of my plugins.

As I make changes to each repo I can stage and commit files to their appropriate repos and push to appropriate remotes.

Here is a diagram of what I am thinking:

When new versions of Mura are released I can update my fork. And when I want to grab everything in my project for deployment I can checkout using the --recursive flag when I clone


git clone <path-to-repo> <name-of-folder-to-put-repo-in> --recursive

When you clone recursively git will also clone each of the submodules referenced in the repo. Then I can push the master project (my fork) up to Github, which will only reference the submodules, it will not actually store any of the data there. And then each submodule can be separately pushed to its own remote location and be maintained in its own repo.

So that is what I am thinking. Git seems flexible enough, but I feel like this must have a down-side int here somewhere. Can someone help me find it? Thoughts? Thanks.

Comments
Ben Nadel's Gravatar Jason, very interesting problem. As I've just started to get into Git, I am also very interested in the answer; though, I can't give any advice. I recently ran up against this very thing when I was playing with Node.js. I wanted to create a small Node.js application that had 3rd-party "node modules", some of which were in their own Git repos. So, do I just add them to *my* repo?

I saw arguments in both directions. Some said if its part of YOUR deployment code, it should be in YOUR repo. Other said that the submodule route was the best way to go. I know nothing about submodules, so I just put it all in my own repo.

Anyway, looking forward to seeing what other more knowledgeable people have to offer.
# Posted By Ben Nadel | 2/23/12 1:21 PM
Ben Farrell's Gravatar I'm not very familiar with Mura, but am getting there with Git.
If I understand this correctly though, sounds like you might need a build process - minimally with ANT maybe go as far as Jenkins (or whatever you want).

Since Mura is already under source control, it seems like a waste to dump it into yours. What you could do is just put all the custom bits to your blog under your Git repo as well as a build script. The build script could pull down whatever branch of Mura you want, and combine your custom work in a way that you specify. Sounds like maybe you're just writing plugins? Would be fairly easy to write an ANT task to copy the plugins folder to a final build.

Would also take care of minor updates - when you want to update a plugin you wrote, but don't want to replace all the Mura files. Simply make a task for this.

Sorry if I totally missed the point of what you're talking about, but to me it sounds like a deployment problem which can be automated!
# Posted By Ben Farrell | 2/23/12 2:13 PM
Jason Dean's Gravatar Ben,

At this point I am just developing, not deploying. I don;t want to have to go through a full deployment every time I make a change to code, but I do want to be able to commit when I make changes.

Also, I think you misunderstood. I am not adding Mura to my repo. I am making a fork of the existing project that will server as the master to the whole. I could pull directly from the Mura Github project but then I could not have my "master" project that contains all my submodules hosted anywhere unless I did it myself.

I don't think for what I am planning right now that I need any kind of a build process. And I don't want one, yet. When I am ready to move this project to production I will add it to my Jenkins server, but for right now I just want to be able to easily develop and still keep things in source control.
# Posted By Jason Dean | 2/23/12 3:34 PM
Adam Tuttle's Gravatar Git submodules are something I've yet to really grok, not for lack of trying. Maybe I'm doing it wrong, which is what's making it hard to understand.

I've been using them in the context of two projects, both of which I wanted to make changes to. For example, a framework we use at work (a custom blend of FW/1, OK!, ColdSpring, and others...), as well as plugins for it. The plugins each were their own git repo's and each was a submodule of the framework.

In the end I found it simpler to just keep their repositories separate; but that doesn't mean you can't keep the filesystem together. You could ignore the plugins folder as you mention, and then keep the individual plugin git repo's inside that plugins folder. Nothing stopping you from nesting git repo's as long as you make intelligent use of ignore.

This way I was able to keep things straight in my head -- when making changes to the parent project, commit to it. When making changes to a plugin, commit to it. Then the only possibly confusing part is deployment, but this is easily automated.
# Posted By Adam Tuttle | 2/24/12 8:48 AM
Matt's Gravatar I made a small update today to address this issue.

https://github.com/blueriver/MuraCMS/issues/366

Now, if you set autoDiscoverPlugins=true in your settings.ini.cfm you can simply navigate in to the root plugins directory in terminal and clone the the plugin repo from github. Once that's done you can reload Mura and it will automatically register the plugin in Mura.

If you set <autoDeploy>true</autoDeploy> in the /plugin/config.xml.cfm it will actually completely deploy using any settings that you have's default values.

In addition you can add a siteID element to your plugin/config.xml.cfm to tell Mura what sites to assign the plugin to when it is discovered an auto-deployed.

<siteID>siteA,siteB</siteID>

We're slowly trying improve the development work flow. :)
# Posted By Matt | 4/28/12 12:58 AM
Alex from SEOStyle's Gravatar Jason,

Thank you for sharing your ideas. Rather interesting observations, I have another, may be some off-topic question there. You've switched all your projects to Mura CMS as stated above.
How is it in terms of functionality and usability if compared to Wordpress, Drupal, Joomla or other popular CMS?
# Posted By Alex from SEOStyle | 5/17/12 2:54 PM
Joe Brislin's Gravatar Jason,

How is this workflow with Mura and Git Submodules working out for you since implemented? I've been running across some of the same issues with our Mura development. I don't love the current setup that we have in terms of Git and Mura. We currently maintain everything in a single repo per site and it just doesn't work well right now.

One question that I have is how do you handle the cache files that get generated by Mura? I have not been able to figure out a way to regenerate those cache files. If we don't include them in the repo, then another developer working on the project will receive a missing file error because he won't have the cache file.
# Posted By Joe Brislin | 6/20/12 9:33 AM
Jason Dean's Gravatar @Matt,

Sorry for the delay in responding. There was a problem with my email and I never saw you comment.

Thanks for doing that stuff, that's awesome. I've probably been using it and not even realizing it.

@Joe, I, honestly, have not fully implemented this yet. Currently I just have a repo for each plugin that I am able to work from directly in my local Mura instance.

As for the cache/assets directories. I do not put those into Git. Mine are currently 11GB. Instead I add them to .gitignore and do daily backups. If someone wants to make a local Mura instance with all of those assets they can download the .zip from the backup store. The backup store also has a current backup of the DB.
# Posted By Jason Dean | 6/20/12 11:11 AM
BlogCFC was created by Raymond Camden. This blog is running version 5.9.1. Contact Blog Owner