NAME
Zanas::Install - create/update/backup/restore Zanas.pm based WEB applications.
SYNOPSIS
#perl -MZanas::Install -e create
create a new application
#cd /path/to/myapp/
#perl -MZanas::Install -e backup
or
#perl -MZanas::Install -e backup [myapp]
create a backup (db dump and libs) in /path/to/app/snapshots/
#cd /path/to/myapp/
#perl -MZanas::Install -e restore 2004-1-1-0-0-0
or
#perl -MZanas::Install -e restore [myapp] 2004-1-1-0-0-0
restore /path/to/myapp/snapshots/2004-1-1-0-0-0.tar.gz
#cd /path/to/myapp/
#perl -MZanas::Install -e backup_master
or
#perl -MZanas::Install -e backup_master [myapp]
# create a backup on master server
#cd /path/to/myapp/
#perl -MZanas::Install -e sync_down
or
#perl -MZanas::Install -e sync_down [myapp]
# create a backup on master and then restore it on local server
#cd /path/to/myapp/
#perl -MZanas::Install -e sync_up
or
#perl -MZanas::Install -e sync_up [myapp]
# packs libs on local and then restore it on master server
DESCRIPTION
Zanas::Install is a set of tools to maniputate Zanas.pm based WEB applications. Its aim is to automate common support tasks like copying/renaming multiple *.pm files, dumping/restoring databases et caetera.
Creating a new application
No more need to manually create MySQL database, set permissions and clone *.pm library from existing application. Simply punch perl -MZanas::Install -e create
and enter all asked values interactively.
At the end of this process you'll need to perform the only administrative task: link the new created application specific httpd.conf
from the global Apache configuration.
Backup/restore
You can take the snapshot of the working application, store it locally and then restore. The snapshot consists of the database dump and all files in lib/ directory.
On the command backup
all of it is packed, named $year-$month-$day-$hour-$minute-$second.tar.gz and then stored in snapshots
directory. This gzipped tar is then symlinked as latest.tar.gz
.
On the command restore $year-$month-$day-$hour-$minute-$second
the old state returns. Don't worry, the current state is automatically backed up before each restore. If no snapshot label is given then latest.tar.gz
is restored.
Replication.
It's common case when an application exists in different places in different versions. Say, you have development, testing and production servers. As usual, you have to mirror down the testing and the production snaphots to the development server and replicate the development libraries up to the testing and the production servers.
Each Zanas based application can have a 'master': testing insatllation is a master one for development and production insatllation is a master one for testing. The master insatllation is pointed in httpd.conf file as follows:
<perl>
...
our $preconf = {
...
master_server => {
user => 'ssh_user',
host => 'ssh_host',
path => '/path/on/remote/server',
},
};
</perl>
Now if the host is accessible with the SSH protocol without the password (key pairs are OK) or ssh_host eq 'localhost'
you can replicate the application up and down.
The sync_down
command generates the application snapshot on the master, copies it to the local server and restores it here.
The sync_up
command packs local libraries, copies it to the master server and unpacks it here.
Note that only code goes up: production data will not be overriden. The database scheme shoud be synced with DBIx::ModelUpdate.
HOW APPLICTATION SETTINGS ARE FETCHED
Without [myapp] arg set Zanas::Install reads the settings from conf/httpd.conf
and lib/MYAPP/Config.pm files (as of current version, only lib/MYAPP/Config.pm matters, this is to know the application libraries name).
When [myapp] arg is given, Zanas::Install trys to guess where your application directory is hidden and chdir there. To do so, apache
or httpd
is asked for the default conf file location, then this last is parsed for Include .../myapp/conf/httpd.conf
. If httpd.conf is located somewhere else, Zanas::Install currently dies with an error message.
[DON'T] PANIC SCENARIOS
Wrong backup restored
#perl -MZanas::Install -e restore [myapp] 2004-1-1-0-0-0
Oh, my! I've lost everything from the New Year!.. Hm, wait a minute... No, I really can undo it!
#perl -MZanas::Install -e restore [myapp]
Old shit from master server
#perl -MZanas::Install -e sync_down [myapp]
Oh, my! I've lost everything from the past release!.. Hm, wait a minute... No, I really can undo it!
#perl -MZanas::Install -e restore [myapp]
Premature release
#perl -MZanas::Install -e sync_up [myapp]
Oh, my! It's buggy! The master app will be broken! Hm, wait a minute... No, I really can undo it!
#perl -MZanas::Install -e restore_master_libs [myapp]
SEE ALSO
Zanas
AUTHORS
Dmitry Ovsyanko <do@zanas.ru>