Welcome Guest, Not a member yet? Register   Sign In
Maintaining Multiple Copies of the Same Core Functionality (Git?)
#1

[eluser]Walter Coots[/eluser]
Using CodeIgniter, I've built a CMS that I use on a variety of websites. I've made the core functionality and configuration as modular as possible, but I've found that I'll make an improvement or bug fix to the CMS on one site, then want to incorporate that change on another site. The more substantial the change, the bigger the hassle since there are a lot of nested folders and files in different places that need to be transferred over.

What I'm looking to do is maintain a core version of the CMS, then when I've finished making whatever changes I want to it, push just those changes to the projects that use it.

Is there an ideal way to do this?
#2

[eluser]WanWizard[/eluser]
Sounds like the perfect job for a version control system.

I would go for git (not the simplest but by far one of the better ones), and if you pick an online repo, you've got off-site backup and the ability to deploy anywhere in one go.

Bitbucket does a few free private repo's, I prefer github, but that's paid. Or get your own VPS and setup gitolite to run your own repo server.
#3

[eluser]Walter Coots[/eluser]
Thanks Wan. I have Git installed and running on my machine, but only basic knowledge of how to use it. I believe my web host also allows for a remote Git installation if I want it.

Once the files are in place in the "parent" repository, would I just check them out to "child" repositories? Is there a Git command that pushes the changes from a parent repository to all of its children, or would I need to do a manual checkout for each project? Lastly, apart from just paying careful attention to what I'm doing, is there an appropriate way to prevent changes or file additions from being committed from a child repository to the parent?
#4

[eluser]Walter Coots[/eluser]
Also - would it be smart to have the CMS and the web site's frontend as separate CodeIgniter applications? e.g. /applications/cms/ and /applications/frontend/ ?
#5

[eluser]WanWizard[/eluser]
You push updates to a repo, and pull updates from a repo. You will have to pull manually, there is no automatic mechanism.

There are (auto)deploy tools available, but a poor mans mechanism is to create a separate branch (or even repo) for your release code, and have the servers run from a local clone. This will allow you to automate the pull, for example via cron, or via a function in your CMS that calls git in the background.

You can then work in a development branch (or repo), and when you want to deploy, merge your development to the release branch.

As to your applications, are they one or seperate entities? Can you use one without the other? Are there seperate versions of one or the other? That would determine how to treat them.
#6

[eluser]Walter Coots[/eluser]
Super helpful Wan, thanks again! This answers all of my questions. Smile
#7

[eluser]WanWizard[/eluser]
if you want to do it right from day one, google "git-flow". Wink

On my staging servers I've setup a cron job that just does a 'git pull' every 15 minutes (I should use deployment tools, but these are remote and difficult to access).

I've got a bash script that does it recursively, so I fire it one for the www root, and it pull everything there is to pull...




Theme © iAndrew 2016 - Forum software by © MyBB