1

I apologize in advance at the low level of this question, but I'm very new to Magento and just beginning my career as a developer.

I have successfully built a local development site on Magento CE 1.9.1 using MAMP. I am the sole developer on this small project.

I was wondering what are the best practices for backing up the local site as I continue to add to and improve it? Not only would I want backups of the site, but in a sense I would also have some version control going on without setting up Git or SVN (which may be a bit of overkill at this time).

A few other quick questions:

  1. If I disable the Apache and MySQL servers would it then be enough to copy the entirety of the MAMP folder and Magento folder to offsite storage periodically?

  2. Do I need to create exports of the database using PHPMyAdmin in addition to step 1?

  3. Should I also create and then download System and Database/Media backups from inside the Magento back-end?

  4. Before backing up the entire Magento store, do I need to disable things such as indexing, the cache, or put the store in maintenance-mode first? What impact (if any) is there when backing up a database that is possibly in use?

  5. Lastly, I installed the Magento folder inside of the MAMP applications folder (at the direction of a well reviewed Magento development book). Are there any other files or folders outside of MAMP that I should be backing up? (The database is located in: Applications\MAMP\db\mysql).

The help is much appreciated! Hopefully other newbies like myself would find the answers to these questions useful.

P.S. I tried beforehand to find the answers to these questions but there seems to be very little out there regarding the fundamentals of how to do backups using best practices.

2

First off, welcome to the wide world of Magento! Here's a great article with details on different ways to backup Magento that give a good breakdown for a lot of this. The article is geared towards a running server setup but mostly the same rules apply for your local MAMP setup. A lot of pertinent information can be found there.

If I disable the Apache and MySQL servers would it then be enough to copy the entirety of > the MAMP folder and Magento folder to offsite storage periodically?

No need to disable Apache / MySQL. You can backup Magento with everything running. Essentially Magento will either 1) make changes to files or 2) make changes to the database. Most backup methods for the files (drag / drop files to backup, use shell commands like cp or rsync, etc.) will work fine if files are actively being modified such as the var/cache within Magento. The only thing that will happen is maybe at the time of copying the version you have is slightly older because it was updated right after you copied it.

Do I need to create exports of the database using PHPMyAdmin in addition to step 1?

As for MySQL, you should use the mysqldump command (more details in the blog article link above). This will have MySQL do the backup for you so no need to worry about actively using the database. The only concern is that it can add load to the host computer during backup that could slow things down but it shouldn't crash anything. You could also use PHPMyAdmin to do your backup without it crashing / harming anything (again might just slow it down).

Should I also create and then download System and Database/Media backups from inside the >Magento back-end?

Depends. If you're comfortable using command line to move, copy, rsync etc. files then I would skip the Magento backup manager. It can sometimes have issues and be a bit slower. You could use it but not needed in addition to regular backup methods.

Before backing up the entire Magento store, do I need to disable things such as indexing, >the cache, or put the store in maintenance-mode first? What impact (if any) is there when >backing up a database that is possibly in use?

No no and no. You're fine to backup an active running site. The only thing you could do to maybe save yourself a step later would be to either entirely flush the Magento cache storage before backup or just exclude the var/cache/ directory from your backups. It's automatically regenerated upon using Magento either from the Admin or front end.

As for the DB performance, again it can impact performance but that depends entirely on the size of the database and your hardware. If the site is just in dev it's likely a small database (unless you have tens of thousands of products).

Lastly, I installed the Magento folder inside of the MAMP applications folder (at the >direction of a well reviewed Magento development book). Are there any other files or >folders outside of MAMP that I should be backing up? (The database is located in: ?>Applications\MAMP\db\mysql).

I haven't used MAMP much but as for Magento it really consists of 1) the files and 2) the database. Unless it's like some of those goofy installation tools chances are all the Magento files are contained within 1 directory. If that's the case, just making a backup of that directory and then a backup of the database would be enough. Apache configs, tuned mysql settings, etc. are all a different story but with the files and database you could then re-install or setup that Magento site elsewhere (either on your MAMP or deploy to a server, etc.)

And as already stated, GIT is always nice ;)

  • Thank you for taking this much time to create such a great series of answers! Hopefully this helps lots of other Magento newbies like myself. Very much appreciated. I'll say this too: that blog article was spot-on. Take care. – ovrclockd_vic20 Feb 20 '15 at 15:14
1
  • IMHO git is never overkill, even for the smallest project. Simply commiting your changes to an external repository occasionally sounds a lot easier than having to back up your entire site without having a history of changes.

  • For your database, in a development environment simply using phpadmin or mysqldump to backup would be fine. It starts to get a bit more tricky in production environments where you could have large log tables etc. Have a look at n98Magerun it is a handy Magento command line tool and it provides some useful database tools that incorporates most of the best practices.

  • For media simply gzipping your media/ directory would be fine

  • That is very helpful. Much appreciated! (I'd upvote your comment but my rep is too low.) – ovrclockd_vic20 Feb 10 '15 at 4:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.