#!/bin/sh

if [ -z "$1" ]; then
    echo usage: $0 "[initdb | createdb | dropdb | syncdb | runserver | resetdb | dumpdata]"
    exit
fi

XOS_DIR=/opt/xos
BACKUP_DIR=/opt/xos_backups
DBNAME=planetstack

DJANGO_17=`python -c "import django; from distutils.version import StrictVersion; print int(StrictVersion(django.get_version()) >= StrictVersion('1.7'))"`

cd $XOS_DIR

function ensure_postgres_running {
    # "sudo -u postgres pg_ctl -D /var/lib/postgres/data status" doesn't work
    # right on Vicci, so let's try to detect it by seeing if the port is
    # being listened on

    netstat -nl | grep -i ":5432 "
    if [[ $? == 0 ]]; then
        echo "Postgres is already running"
        return
    fi

    /sbin/service postgresql initdb
    /sbin/service postgresql start
    /sbin/chkconfig postgresql on

    netstat -nl | grep -i ":5432 "
    if [[ $? != 0 ]]; then
        # it's still not running
        echo "Trying fallback mechanism to start Postgres"
        sudo -u postgres initdb -D /var/lib/pgsql/data/
        sudo -u postgres pg_ctl -D /var/lib/pgsql/data -l logfile start
    fi

}
function createdb {
    echo "Creating XOS database..."
    sudo -u postgres createdb $DBNAME
}
function dropdb {
    echo "Dropping XOS database..."
    sudo -u postgres dropdb $DBNAME
}
function syncdb {
    echo "Syncing XOS services..."
    python $XOS_DIR/manage.py syncdb --noinput
    if [[ $DJANGO_17 ]]; then
        echo "Loading initial data from fixture..."
        python $XOS_DIR/manage.py --noobserver --nomodelpolicy loaddata $XOS_DIR/core/fixtures/initial_data.json
    fi
}
function evolvedb {
    echo "Evolving XOS services..."
    python $XOS_DIR/manage.py evolve --hint --execute --noinput
}
function migratedb {
    echo "Migrating XOS services..."
    python $XOS_DIR/manage.py migrate
}
function stopserver {
    echo "Stopping any running XOS Service(s)"
    pkill -f "python.*runserver"
}
function runserver {
    PUBLIC_HOSTNAME=`$XOS_DIR/xos-config.py get server_hostname $HOSTNAME`
    echo "Starting XOS Service on $PUBLIC_HOSTNAME:8000"
    python manage.py runserver $PUBLIC_HOSTNAME:8000 --insecure&
}

function dumpdata {
    mkdir -p $BACKUP_DIR
    FN="$BACKUP_DIR/dumpdata-`date +%Y-%m-%d_%H:%M:%S`.json"
    echo "Saving data to $FN"
    python manage.py dumpdata core hpc syndicate_storage requestrouter -a --indent 4 > $FN
    if [[ ! -f $FN ]]; then
        echo "FAILED to create $FN"
        exit
    fi
    SIZE=$(du -k "$FN" | cut -f 1)
    if [[ $SIZE -lt 9 ]]; then
        echo "Dumpdata was empty. Deleting and aborting"
        rm $FN
        exit
    fi
    rm -f $BACKUP_DIR/dumpdata-latest.json
    ln -s $FN $BACKUP_DIR/dumpdata-latest.json
}

function genkeys {
    mkdir -p public_keys
    mkdir -p private_keys
    echo "Generating keys"
	keyczart create --location=private_keys --name="OpenCloud" --purpose=crypt --asymmetric=rsa
	keyczart addkey --location=private_keys --status=primary --size=1024
	keyczart pubkey --location=private_keys --destination=public_keys
    if [[ ! -f public_keys/1 ]]; then
        echo "FAILED to create keys"
        exit
    fi
}

COMMAND=$1

if [ "$COMMAND" = "initdb" ]; then
    stopserver
    ensure_postgres_running
    createdb
    syncdb
fi
if [ "$COMMAND" = "repairdb" ]; then
    stopserver
    ensure_postgres_running
    dumpdata
    # TODO: This is where we could run migration scripts to upgrade the
    #   dumped data to the new models.
    mv $XOS_DIR/core/fixtures/initial_data.json $XOS_DIR/core/fixtures/initial_data.json-old
    cp $BACKUP_DIR/dumpdata-latest.json $XOS_DIR/core/fixtures/initial_data.json
    dropdb
    createdb
    syncdb
fi
if [ "$COMMAND" = "restoredb" ]; then
    if [[ ! -f $BACKUP_DIR/dumpdata-latest.json ]]; then
       echo There is no dumpdata to restore
       exit
    fi
    stopserver
    ensure_postgres_running
    mv $XOS_DIR/core/fixtures/initial_data.json $XOS_DIR/core/fixtures/initial_data.json-old
    cp $BACKUP_DIR/dumpdata-latest.json $XOS_DIR/core/fixtures/initial_data.json
    dropdb
    createdb
    syncdb
fi
if [ "$COMMAND" = "evolvedb" -o "$COMMAND" = "migratedb" ]; then
    stopserver
    ensure_postgres_running
    if [[ $DJANGO_17 ]]; then
        migratedb
    else
        evolvedb
    fi
fi
if [ "$COMMAND" = "resetdb" ]; then
    stopserver
    dropdb
    createdb
    syncdb
fi
if [ "$COMMAND" = "syncdb" ]; then
    stopserver
    syncdb
fi
if [ "$COMMAND" = "runserver" ]; then
    stopserver
    runserver
fi
if [ "$COMMAND" = "stopserver" ]; then
    stopserver
fi
if [ "$COMMAND" = "dumpdata" ]; then
    dumpdata
fi
if [ "$COMMAND" = "genkeys" ]; then
    genkeys
fi
