UsageΒΆ
Before we can start to create backup-projects we have to configure the local and remote storage. This global
configuration will be shared for all projects of the executing user. The configuration will be written in the file
~/.nanbando.yml
.
nanbando:
storage:
local_directory: "%home%/nanbando/local"
remote_service: filesystem.remote
oneup_flysystem:
adapters:
remote:
local:
directory: "%home%/nanbando/remote"
filesystems:
remote:
adapter: remote
alias: filesystem.remote
plugins:
- filesystem.list_files
Note
In the configuration you can use the parameter %home%
which points to the home directory of the current user.
The application contains a simple directory backup plugin which we will use in this simple usage example. To start a new
backup goto the root directory of your website and create a file named nanbando.json
which contains the
configuration and later also the dependencies for this backup-project.
{
"name": "application",
"backup": {
"data": {
"plugin": "directory",
"parameter": {
"directory": "path/to/data/directory"
}
}
},
"require": {
}
}
After you have created this file you can run following command to configure the local installation with the given
configuration. If you have added requirements to the configuration the application will install them into the folder
.nanbando
.
Note
For readonly filesystems you can overwrite the folder .nanando
by setting the environment variable
NANBANDO_DIR
.
php nanbando.phar reconfigure
php nanbando.phar backup
The second command will create a new backup zip in the local folder
~/nanbando/local/application/<date>_<environment>_<label>.zip
. The environment and the label are optional and will
be omitted if not exists (e.g. without environment <date>_<label>.zip
or without label and environment
<date>.zip
).
Note
The environment can be set via the config file "environment"
or env-variable NANBANDO_ENVIRONMENT
.
Example: NANBANDO_ENVIRONMENT=prod php nanbando.phar backup
.
After this steps you can do following steps:
php nanbando.phar restore
- restore a local backupphp nanbando.phar push
- push backups to remote storagephp nanbando.phar fetch
- fetch a backup on a different machine to restore it there