3

I have built this CMS that has the option to add entries to the database. Each entry that is created has about 5 to 10 new images showing the product for sale. Each image is about 150Kb in size.

I already know that images should always be stored in Git however my problem is that the sales team users that add new entries in the CMS are obviously working on the production server using the master branch.

Our normal development is development code in your "dev environment" on a branch, then push those changes to the "staging environment" for QA and lastly if all the tests pass, push those changes to "production/live server".

What will be the best way to get those new images that are uploaded on a daily basis into our repository seeing as those images are already on the live server?

  • 1
    Are the images in your DB? If so, why do they need to be in Git? – Aaron Kurtzhals Sep 12 '13 at 16:23
  • 3
    The linked article would be things like icons or backgrounds, not the data of the application. – Sign Sep 12 '13 at 16:55
  • Where is the "one true source of the image" on production? How does this differ in devel and stage? –  Sep 12 '13 at 17:38
  • @AaronKurtzhals, no they are located in an "uploads" folder. – John Crawford Sep 12 '13 at 19:21
  • 1
    The best way to do it probably doesn't involve putting anything in source control - you probably wouldn't store users or orders in there, why products? The actual best way of doing this is largely dependent upon the specific CMS you're using so you should include that information. – Sean McSomething Sep 12 '13 at 22:41

2 Answers2

2

It doesn't seem like this is a task for your source control - this is end-user data that needs to be backed up, but otherwise has nothing to do with the product as an entity itself.

For example, if you decided to sell your CMS to another customer, would they expect to see all your products contained in the DB, or would they expect a (mostly) blank database that they would fill with their own product data?

Git is not a backup solution BTW, you need something that can back up your production system and restore it correctly (though any SCM can be used for this task, its not a primary role for it, and you'd still need to backup the SCM repository).

gbjbaanb
  • 48,354
  • 6
  • 102
  • 172
  • This CMS would never be sold as it is exclusively for the company I work for. With regards to Git not being a backup solution, do you know/recommend any backup solution. Currently I just run a shell script that copies these images from live to our "dev environment"... something that just doesn't feel right. – John Crawford Sep 12 '13 at 19:30
0

I've faced the same problem before. We had to bring live database back into development. It was a manual process and it was carried out on QA lead's request. The more frequently you do this, the better. As the gap (difference) increases, it'll become harder to sync changes.

CodeART
  • 3,992
  • 1
  • 20
  • 23
  • That is what we are currently doing. However I can't help but think that there has to be a better way to solve this issue. – John Crawford Sep 12 '13 at 19:23