Table of Contents
In the past, it was necessary to use a separate PHP application (Akeeba UNiTE) to perform an unattended restoration of your site. This was a problem, as you needed to make sure you had a version of UNiTE which was compatible with the version of the restoration script included in your backup. If it was too old or too new it wouldn't work.
Further to that, UNiTE suffered from scope creep. It could take and download backups remotely, just like Akeeba Remote CLI — but unlike Akeeba Remote CLI it could not just download a remotely stored backup archive. It could download backup archives from Amazon S3 like s3cmd, but not with the versatility of s3cmd. It could also extract backup archives like Kickstart. It was a little bit of everything, and a whole lot of nothing.
The best approach to automation is the UNIX way: one small tool for each individual task, all chained together in a shell script.
To this end, we decided to deprecate UNiTE and move the CLI-based restoration features into BRS itself.
The CLI interface is meant to be straightforward. The
config:make command will create a YAML file named
config.yml.php
inside the
installation
directory. You can customise that
file, then run the execute command to run the
actual restoration. You can even prepare the
config.yml.php
file in advance since it has a
predictable syntax.
![]() | Tip |
---|---|
YAML files are especially suited for being generated or processed by Ansible playbooks. |
Please note that when the config.yml.php
file is present in the installation
directory you
will not be able to use BRS over the web. This is intentional, for two
reasons. First, it ensures that you will not be trying to give BRS
conflicting instructions which could lead to a broken site. Second, it
prevents random visitors who happen upon your site while the
restoration is in progress to see the restoration interface even if
you do not protect BRS with a password.
If you were previously using Akeeba UNiTE to automate your backup restoration you may need additional software to implement your use case.
Use Akeeba Remote CLI.
There are many different alternatives. We recommend s3cmd.
You can use Akeeba Kickstart's built-in CLI interface.
After the backup archive is extracted by Akeeba Kickstart you can use BRS' CLI interface documented below.
You can put everything together using a shell script. For example, let's say that you want to take a remote backup to Amazon S3, download it to your server, extract it, and restore it:
#!/usr/bin/env bash # Take a remote backup # -- The INFIX is the expected date and time added to the backup name. # Below, we assume it's in the GMT timezone. Otherwise, change the TZ, # e.g. TZ=Asia/Nicosia for the Nicosia, Cyprus timezone. export INFIX=$(TZ=gmt date +"%Y%m%d-%H%M") php remote.phar --action=backup --host=http://www.example.com --secret=0Lsp-MjOSLvUL8VuM1h9T2zWfM4EGqMA --profile=1 # Download from S3 # -- We download all .jpa, .j01, etc backup parts s3cmd -c s3cmd_config get s3://my-bucket/site-www.example.com-$INFIX*.j* # Extract using Akeeba Kickstart # -- Gets the latest backup downloaded to the current directory, just in case ITEM=$(ls site-www.example.com-$INFIX*.jpa | sort | head -n 1) # -- Extracts the archive php ./kickstart.php $ITEM /home/myser/mysite/public_html # -- Caches the current directory; we'll need it later ORIGIN=$(pwd) # Restore the backup in the web root pushd /home/myuser/mysite/public_html/installation php ./cli.php execute $ORIGIN/config.json # Remove the installation folder rm -rf installation # Go back to the original directory popd # Remove the backup archive part file(s) rm site-www.example.com-$INFIX*.j*
Based on this simple skeleton script you can create something as complicated as you want.
Most importantly, since each of backup, transfer, extraction, and restoration is a discrete step you can now very easily automate the whole lot with an automation platform such as Ansible. If you are a large web agency with a need for reproducible development, staging, and live server builds the separation of concerns throughout our CLI application portfolio will help you tailor the perfect solution to your needs.