09 October, 2014

Best practices for maintaining Joomla website - part 2

Automatically backup your website in 3 minutes


In the first part of this Joomla Educational series, we provided some highly effective tips for choosing Hosting and Email service. In this blog, we will help you to automate your website backup in just 3 minutes using one single command.

automate your website backup in just 3 minutes
Automate your website backup in just 3 minutes

Tough times never comes alone and no one wants to face this, but it may happen to anybody that your site get hacked, your server get crashed or anything get wrong to your server.

No one can be 100% safe on Internet but if you follow “Alert today. Alive tomorrow.”, means that any of the failures may not cost you any loss of data (assuming your backups are 100% up-to-date).

Its a best practice to backup your websites. The most important tip about backup is to keep it safe. When we talk about backup of your website then it covers 2 things ie Files and databases.

With backup procurement, there are so many hidden questions arises :-

How frequently should backup be taken or delete ?

In today’s era, Joomla is one of the best options for creating dynamic websites and as you know in dynamic website things get change in a flip.

Backing up database is little more challenging, as database changes very frequently (mostly every few minutes). So its better we backup our database every 30 minutes.

<p>Once an approach is established it is imperative to test data
    restoration periodically to ensure that files are properly backup and
    that they have not been corrupted during transportation or
    compression.</p>

<p class="jpp-margin-b30">You need to also delete backups which are no more required to
    avoid large accumulation of backup. You should delete backups older
    than a week.</p>

<h3>What to Back up and where to store these back up ?</h3>

<p class="jpp-margin-b30">Backing up is one of the most important things to do when
    running a website, it includes your files, database, entire website or
    even your server machine like snapshot of current machine. In short -
</p>
<blockquote class="jpp-margin-b30">
    <p class="lead" style="margin: 0;">"Anything that you cannot
        afford to lose should, be backed up."</p>
    <small>Unknown</small>
</blockquote>

<p>
    Should place <strong>multiple copies of backup at your local
        as well as remote server</strong>. Therefore you must move your backups
    off-site, to manage it properly. In case, your website got hacked or
    your server crashed, your backups will remain safe.
</p>

<p>Very often people create backups that are empty or corrupted.
    Nobody likes a ship that sinks with empty lifeboats so its advisable
    to regularly test the restoration of backups in your test / stage
    server.</p>

<p>Here are the highly effective tips that we use for our websites.</p>
<p>
    <strong>Setup an automated process to -</strong>
</p>
<ul class="jpp-margin-b30"><li>Back up website every 24 hour</li>
    <li>Verify that it is restorable.</li>
    <li>Move backups to off-site e.g. like Amazon-S3, Rackspace</li>
    <li>Move one backup every week to Amazon-Glacier to be stored
        forever.</li>
    <li>Delete backups older than 4-6 weeks.</li>
</ul><h3>How one should take backup ?</h3>
<p class="jpp-margin-b30">
    <strong>Backup Solutions :</strong>
</p>
<ol type="a" class="jpp-margin-b30"><li><p><strong>Use backup Extension</strong> - In Joomla world you
        can use Akeeba backup , the simplest and safest method for taking
        backup which essentially require no programming skills. User with
        shared server hosting also can use this.</p></li>

    <li><p><strong>Use any backup Application</strong> - Lots of
        professional applications are available which create separate backup
        of your php files and mysql database separately and then place at
        your desired off-site location like Amazon-s3, rackspace. It’s
        independent of <a href="http://en.wikipedia.org/wiki/Content_management_system">CMS</a>.</p></li>

    <li><p><strong>Utilize Website hosting software</strong> - Now a
        days, most of hosting providers provide back up software tool. So
        within a click in your cpanel you can create backup of your site.
        It’s not advisable to put all your secret data in hands of 3rd party
        service.</p></li>

    <li><p><strong>Build your own custom script</strong> - If you have
        huge database and numerous files then it is difficult to manage such
        backups on hourly or daily basis. So in that case you may need to
        have <strong>automated scripts to take this backup</strong>.</p>
        <p>
            And Today it’s all about geeky backups, so we use shell script. You
            need to have some good hands with <strong>SSH</strong> (Need VPS
            Hosting) and have access of crontab.
        </p>

        <blockquote>
                 <p class="lead" style="margin: 0;">“ Don’t go with generalization, build your own customization.“</p>
                    </blockquote>

        <figure class="text-center jpp-margin-b30"><img class="img-polaroid" src="best-practices-for-maintaining-joomla-website-part-2/workflow-of-automatic-backup.jpg" alt="workflow of Custom Script to manage automatic backup of your site"/><figcaption class="img-caption">Workflow of Custom
                Script to manage automatic backup of your site</figcaption></figure><p>With this automatic script you can take full backup of your
            files, folders and databases within a minute. It will compress all
            of them and move backup to to off site.</p>
        <p>
            This <strong>script will then automatically delete old
                files as per defined time,</strong> so that you don’t get rid of old backups
            and don’t run out of hard disk space. In short, you don’t do
            anything <strong>just type a single command to secure your
                site</strong>.
        </p>
        <p class="jpp-margin-b30">
            We are using this from long time and we really save lots of time and
            efforts with this automate process. We not consider this as our
            achievement until this will help our other Joomla family members. A
            small contribution to all our lovely family members :- <br/><a href="https://github.com/readybytes/joomla-scripts/blob/master/backup/db-backup.sh" target="_blank">https://github.com/readybytes/joomla-scripts/blob/master/backup/db-backup.sh</a>
        </p>
        <figure class="text-center jpp-margin-b30"><img class="img-polaroid" src="best-practices-for-maintaining-joomla-website-part-2/database-backup.png" alt="database backup"/><figcaption class="img-caption">Database Backup</figcaption></figure></li>
</ol></div>

Do back up Now!

Disaster could strike at any time to anyone. Back up your website now and back it up every day. If a nightmare strikes, you'll be ready to take control and get back online within minutes. If having any doubt in using this automate process for your website then drop your comment and we love to help you out.

In our next blog of this educational series we will provide our best practices for “How to manage test and stage server”.

“A step ahead towards to be a Joomla geek”

blog comments powered by Disqus