Metadot with SQLite
Work in Progress, non-complete documentation (and the 'patches' might not be 100% yet). This will be tidied up later, but if you know what you are doing, everything you need you sould find below.
These destructions are for poor sysadmins like myself whom have to endure CMS's and to make our lives that bit easier, I have documented how to get metadot (version 6.4.5.4 only, don't ask about Ruby, I am not interested) running under Debian and patched to use SQLite rather than that hideous only-a-database-in-name, MySQL.
Prerequisites
- apache2-mpm-worker
- cronolog
- libapache2-mod-perl2
- sqlite3
- libdbd-sqlite3-perl
- libhtml-format-perl
- libapache2-mod-perl2
- libdate-manip-perl
- libimage-size-perl
- libarchive-zip-perl
- libxml-simple-perl
- libtemplate-perl
- libxml-rss-perl
- libunicode-string-perl
- libdate-calc-perl
- libspreadsheet-writeexcel-perl
- libtext-csv-xs-perl
- libmime-tools-perl
- libnumber-format-perl
- libxml-dumper-perl
Apache2
Modules
- perl
- rewrite
Virtual Host
<VirtualHost *:80>
ServerName metadot.example.com
ServerAdmin webmaster@example.com
DocumentRoot /path/to/metadot
CustomLog "|/usr/bin/cronolog -S /path/to/log/access.log /path/to/log/access-%Y%U.log" combined
ErrorLog "|/usr/bin/cronolog -S /path/to/log/error.log /path/to/log/error-%Y%U.log"
# Alias /logs /path/to/log
Alias /metadot/ /path/to/metadot/metadot/
Alias /images/ /path/to/metadot/html/images/
Alias /js/ /path/to/metadot/html/js/
Alias /public/ /path/to/metadot/sitedata/public/
Alias /skins/ /path/to/metadot/sitedata/skins/
RewriteEngine On
RewriteRule ^/index.pl(.*) /metadot/index.pl$1 [PT]
RewriteRule ^/userchannel.pl(.*) /metadot/userchannel.pl$1 [PT]
# mod_perl2 goodness
PerlOptions +Parent
PerlSwitches -Mlib=/path/to/metadot
<Perl>
use Cwd;
chdir "/path/to/metadot/";
1;
</Perl>
<Location /metadot>
SetHandler perl-script
# see http://marc.info/?l=apache-modperl&m=102802192602444
PerlResponseHandler ModPerl::Registry
# PerlResponseHandler ModPerl::RegistryPrefork
</Location>
</VirtualHost>
Metadot
etc/metadot.conf
Tweak it for the following ('user' and 'pass' is ignored):
name = dbi:SQLite:dbname=/path/to/db/metadot.example.com user = dummy pass = dummy dbtype = SQLite featureset = open public_uploads_dir = ../sitedata/public/ public_uploads_location = /public skin_template_dir = ../sitedata/skins
sqlite
N.B. the schema has one or two glitches in it, plus sqlLock's need to be disabled as metadot uses the ghastly GET_LOCK() and RELEASE_LOCK() commands that do not map to 'BEGIN TRANSACTION' and 'COMMIT' (metadot does not call RELEASE_LOCK() when it should)
Download and copy SQLite.pm into '/path/to/metadot/metadot/DBAccess', along side 'MySQL.pm'.
Download the schema schema.sqlite3.txt to prime the database below.
$ { echo "PRAGMA encoding = \"UTF-8\";"; cat schema.sqlite3.txt; } | sqlite3 /path/to/db
$ { echo "PRAGMA synchronous = 0;"; cat /path/to/metadot/default_data/sampledata.sql; } | sqlite3 /path/to/db
$ chgrp www-data /path/to/db
$ chmod 660 /path/to/db
Migration
Shamelessly stolen from Exporting MySQL data into SQLite3:
$ mysqldump --compatible=ansi --no-create-db --no-create-info --extended-insert=0 -u metadot -p metadotdb | sed '/^INSERT INTO /!D; s/\\n/\n/g; s/\\r/\r/g; s/\\"/"/g; s/\\'\''/'\'\''/g'
Remember to copy the 'sitedata' directory too over from the previous install.