added repository for elastic search and install elastic serach package

added wheezy backports repository
added script file to change password of user
fixed problems regarding special characters (UTF-8)
master
Patrick Höhn 2014-11-19 03:27:07 +01:00
parent 349eb346ee
commit a9f8c009d8
2 changed files with 54 additions and 3 deletions

38
change_password Normal file
View File

@ -0,0 +1,38 @@
#!/usr/bin/php
<?
set_include_path("../include");
require("header.inc.php");
if (empty($argv[1])) {
die("Usage: $argv[0] " . '$username $password' . "\n");
}
$username = $argv[1];
$password = $argv[2];
$docRoot = str_replace($_SERVER['SCRIPT_NAME'], '', __FILE__);
echo $docRoot;
echo "changing password for user $username\n";
$passwordhash = password_hash($password, PASSWORD_DEFAULT);
Zotero_DB::beginTransaction();
$sql = "SET NAMES UTF8;";
Zotero_DB::query($sql);
$sql = "UPDATE zotero_www.users SET password=? WHERE username=?";
Zotero_DB::query($sql, array($passwordhash,$username));
Zotero_DB::commit();
?>

View File

@ -12,18 +12,22 @@ echo "######################################################"
echo "install required packages" echo "install required packages"
echo "add debian wheezy repository" echo "add key for elasticsearch repository"
wget -qO - http://packages.elasticsearch.org/GPG-KEY-elasticsearch | apt-key add -
echo "add debian wheezy backports repository"
sed -i '$s,$,\ndeb http://ftp.acc.umu.se./debian wheezy-backports main,' /etc/apt/sources.list sed -i '$s,$,\ndeb http://ftp.acc.umu.se./debian wheezy-backports main,' /etc/apt/sources.list
sed -i '$s,$,\nhttp://packages.elasticsearch.org/elasticsearch/1.3/debian stable main,' /etc/apt/sources.list
echo "update package cache" echo "update package cache"
apt-get update apt-get update
echo "dependencies for dataserver" echo "dependencies for dataserver"
apt-get install -y apache2 libapache2-mod-php5 mysql-server memcached zendframework php5-cli php5-memcache php5-mysql php5-curl php5-memcached apt-get install -y apache2 libapache2-mod-php5 mysql-server memcached zendframework php5-cli php5-memcache php5-mysql php5-curl php5-memcached
apt-get -t wheezy-backports install -y php-aws-sdk php-doctrine-cache apt-get -t wheezy-backports install -y php-aws-sdk php-doctrine-cache
echo "general dependencies" echo "general dependencies"
apt-get install -y git gnutls-bin runit libapache2-modsecurity curl apt-get install -y git gnutls-bin runit libapache2-modsecurity curl elasticsearch openjdk-7-jre
echo "created required directories" echo "created required directories"
mkdir -p /srv/zotero/dataserver mkdir -p /srv/zotero/dataserver
@ -36,6 +40,12 @@ mkdir -p /srv/zotero/log/error
# save current directory # save current directory
cur_dir=$(pwd) cur_dir=$(pwd)
echo "setting elasticsearch to be started during booting"
update-rc.d elasticsearch defaults 95 10
echo "starting elasticsearch"
/etc/init.d/elasticsearch start
echo "download source code of dataserver" echo "download source code of dataserver"
git clone git://github.com/zotero/dataserver.git /srv/zotero/dataserver git clone git://github.com/zotero/dataserver.git /srv/zotero/dataserver
@ -47,6 +57,9 @@ git checkout fc607170ab2ca751097648d48a5d38e15e9d5f6a
echo "install add_user script" echo "install add_user script"
cp add_user /srv/zotero/dataserver/admin cp add_user /srv/zotero/dataserver/admin
echo "install change_password script"
cp change_password /srv/zotero/dataserver/admin
echo "patch master.sql" echo "patch master.sql"
cp master.sql /srv/zotero/dataserver/misc cp master.sql /srv/zotero/dataserver/misc