work in progress adjusting the installation script for vanilla zotero dataserver
parent
4f3144918d
commit
f5340ede89
|
@ -18,18 +18,11 @@ 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
|
apt-get install -y apache2 libapache2-mod-php5 mysql-server memcached zendframework php5-cli php5-memcache php5-mysql php5-curl
|
||||||
|
|
||||||
echo "dependencies for zss"
|
|
||||||
apt-get install -y uwsgi uwsgi-plugin-psgi libplack-perl libdigest-hmac-perl libjson-xs-perl libfile-util-perl libapache2-mod-uwsgi
|
|
||||||
|
|
||||||
echo "general dependencies"
|
echo "general dependencies"
|
||||||
apt-get install -y git gnutls-bin runit
|
apt-get install -y git gnutls-bin runit libapache2-modsecurity curl
|
||||||
|
|
||||||
echo "created required directories"
|
echo "created required directories"
|
||||||
# fuck DEBIAN
|
|
||||||
#mkdir -p /srv/zotero/{dataserver,zss,storage}
|
|
||||||
mkdir -p /srv/zotero/dataserver
|
mkdir -p /srv/zotero/dataserver
|
||||||
mkdir -p /srv/zotero/zss
|
|
||||||
mkdir -p /srv/zotero/storage
|
|
||||||
# fuck DEBIAN
|
# fuck DEBIAN
|
||||||
#mkdir -p /srv/zotero/log/{download,upload,error}
|
#mkdir -p /srv/zotero/log/{download,upload,error}
|
||||||
mkdir -p /srv/zotero/log/download
|
mkdir -p /srv/zotero/log/download
|
||||||
|
@ -37,7 +30,22 @@ mkdir -p /srv/zotero/log/upload
|
||||||
mkdir -p /srv/zotero/log/error
|
mkdir -p /srv/zotero/log/error
|
||||||
|
|
||||||
echo "download source code of dataserver"
|
echo "download source code of dataserver"
|
||||||
git clone git://github.com/sualk/dataserver.git /srv/zotero/dataserver
|
git clone git://github.com/zotero/dataserver.git /srv/zotero/dataserver
|
||||||
|
|
||||||
|
echo "download source code of Elastica"
|
||||||
|
git clone git://github.com/ruflin/Elastica.git /srv/zotero/dataserver/include/Elastica
|
||||||
|
cd /srv/zotero/dataserver/include/Elastica
|
||||||
|
git checkout fc607170ab2ca751097648d48a5d38e15e9d5f6a
|
||||||
|
|
||||||
|
echo "install composer"
|
||||||
|
cd /srv/zotero/dataserver
|
||||||
|
curl -sS https://getcomposer.org/installer | php
|
||||||
|
|
||||||
|
echo "install dependencies"
|
||||||
|
php composer.phar install
|
||||||
|
|
||||||
|
echo "remove composer"
|
||||||
|
rm composer.phar
|
||||||
|
|
||||||
echo "prepare directory rights"
|
echo "prepare directory rights"
|
||||||
chown www-data:www-data /srv/zotero/dataserver/tmp
|
chown www-data:www-data /srv/zotero/dataserver/tmp
|
||||||
|
@ -64,12 +72,6 @@ echo "<VirtualHost *:443>
|
||||||
SSLCertificateFile /etc/apache2/zotero.cert
|
SSLCertificateFile /etc/apache2/zotero.cert
|
||||||
SSLCertificateKeyFile /etc/apache2/zotero.key
|
SSLCertificateKeyFile /etc/apache2/zotero.key
|
||||||
|
|
||||||
<Location /zotero/>
|
|
||||||
SetHandler uwsgi-handler
|
|
||||||
uWSGISocket /var/run/uwsgi/app/zss/socket
|
|
||||||
uWSGImodifier1 5
|
|
||||||
</Location>
|
|
||||||
|
|
||||||
<Directory "/srv/zotero/dataserver/htdocs/">
|
<Directory "/srv/zotero/dataserver/htdocs/">
|
||||||
Options FollowSymLinks MultiViews
|
Options FollowSymLinks MultiViews
|
||||||
AllowOverride All
|
AllowOverride All
|
||||||
|
@ -102,16 +104,55 @@ default-time-zone = '+0:00'" > /etc/mysql/conf.d/zotero.cnf
|
||||||
/etc/init.d/mysql restart
|
/etc/init.d/mysql restart
|
||||||
echo -n "root Password for MySQL: "
|
echo -n "root Password for MySQL: "
|
||||||
read password
|
read password
|
||||||
sed -i "s/PW/${password}/g" /srv/zotero/dataserver/misc/setup_db
|
|
||||||
echo -n "password for zotero database user: "
|
echo -n "password for zotero database user: "
|
||||||
read zotero_password
|
read zotero_password
|
||||||
sed -i "s/foobar/${zotero_password}/g" /srv/zotero/dataserver/misc/setup_db
|
|
||||||
cd /srv/zotero/dataserver/misc/
|
cd /srv/zotero/dataserver/misc
|
||||||
./setup_db
|
|
||||||
|
DB="mysql -h 127.0.0.1 -P 3306 -u root -p${password}"
|
||||||
|
|
||||||
|
echo "DROP DATABASE IF EXISTS zotero_master" | $DB
|
||||||
|
echo "DROP DATABASE IF EXISTS zotero_shards" | $DB
|
||||||
|
echo "DROP DATABASE IF EXISTS zotero_ids" | $DB
|
||||||
|
echo "DROP DATABASE IF EXISTS zotero_www" | $DB
|
||||||
|
|
||||||
|
echo "CREATE DATABASE zotero_master" | $DB
|
||||||
|
echo "CREATE DATABASE zotero_shards" | $DB
|
||||||
|
echo "CREATE DATABASE zotero_ids" | $DB
|
||||||
|
echo "CREATE DATABASE zotero_www" | $DB
|
||||||
|
|
||||||
|
echo "DROP USER IF EXISTS zotero@localhost;" | $DB
|
||||||
|
|
||||||
|
echo "CREATE USER zotero@localhost IDENTIFIED BY '${zotero_password}';" | $DB
|
||||||
|
|
||||||
|
echo "GRANT SELECT, INSERT, UPDATE, DELETE ON zotero_master.* TO zotero@localhost;" | $DB
|
||||||
|
echo "GRANT SELECT, INSERT, UPDATE, DELETE ON zotero_shards.* TO zotero@localhost;" | $DB
|
||||||
|
echo "GRANT SELECT,INSERT,DELETE ON zotero_ids.* TO zotero@localhost;" | $DB
|
||||||
|
echo "GRANT SELECT,INSERT,DELETE ON zotero_www.* TO zotero@localhost;" | $DB
|
||||||
|
|
||||||
|
echo "Load in master schema"
|
||||||
|
$DB zotero_master < master.sql
|
||||||
|
$DB zotero_master < coredata.sql
|
||||||
|
$DB zotero_master < fulltext.sql
|
||||||
|
|
||||||
|
echo "Set up shard info"
|
||||||
|
echo "INSERT INTO shardHosts VALUES (1, '127.0.0.1', 3306, 'up');" | $DB zotero_master
|
||||||
|
echo "INSERT INTO shards VALUES (1, 1, 'zotero_shards', 'up', 0);" | $DB zotero_master
|
||||||
|
|
||||||
|
echo Load in shard schema
|
||||||
|
cat shard.sql | $DB zotero_shards
|
||||||
|
cat triggers.sql | $DB zotero_shards
|
||||||
|
|
||||||
|
echo "Load in schema on id server"
|
||||||
|
cat ids.sql | $DB zotero_ids
|
||||||
|
|
||||||
|
echo "Load in www schema"
|
||||||
|
$DB zotero_www < www.sql
|
||||||
|
|
||||||
echo "#################################"
|
echo "#################################"
|
||||||
echo "Configuration database connection"
|
echo "Configuration database connection"
|
||||||
echo "#################################"
|
echo "#################################"
|
||||||
|
# add code to also configure other databases
|
||||||
cp /srv/zotero/dataserver/include/config/dbconnect.inc.php-sample /srv/zotero/dataserver/include/config/dbconnect.inc.php
|
cp /srv/zotero/dataserver/include/config/dbconnect.inc.php-sample /srv/zotero/dataserver/include/config/dbconnect.inc.php
|
||||||
echo -n "hostname for database: "
|
echo -n "hostname for database: "
|
||||||
read hostname
|
read hostname
|
||||||
|
@ -146,6 +187,9 @@ sed -i "s/API_SUPER_USERNAME\ =\ ''/API_SUPER_USERNAME\ =\ '${API_SUPER_USERNAME
|
||||||
echo -n "api super password: "
|
echo -n "api super password: "
|
||||||
read API_SUPER_PASSWORD
|
read API_SUPER_PASSWORD
|
||||||
sed -i "s/API_SUPER_PASSWORD\ =\ ''/API_SUPER_PASSWORD\ =\ '${API_SUPER_PASSWORD}'/" /srv/zotero/dataserver/include/config/config.inc.php
|
sed -i "s/API_SUPER_PASSWORD\ =\ ''/API_SUPER_PASSWORD\ =\ '${API_SUPER_PASSWORD}'/" /srv/zotero/dataserver/include/config/config.inc.php
|
||||||
|
echo -n "aws access key: "
|
||||||
|
read AWS_ACCESS_KEY
|
||||||
|
sed -i "s/AWS_ACCESS_KEY\ =\ ''/AWS_ACCESS_KEY\ =\ '${AWS_ACCESS_KEY}'/" /srv/zotero/dataserver/include/config/config.inc.php
|
||||||
echo -n "aws secret key: "
|
echo -n "aws secret key: "
|
||||||
read AWS_SECRET_KEY
|
read AWS_SECRET_KEY
|
||||||
sed -i "s/AWS_SECRET_KEY\ =\ ''/AWS_SECRET_KEY\ =\ '${AWS_SECRET_KEY}'/" /srv/zotero/dataserver/include/config/config.inc.php
|
sed -i "s/AWS_SECRET_KEY\ =\ ''/AWS_SECRET_KEY\ =\ '${AWS_SECRET_KEY}'/" /srv/zotero/dataserver/include/config/config.inc.php
|
||||||
|
@ -155,6 +199,8 @@ sed -i "s/S3_BUCKET\ =\ ''/S3_BUCKET\ =\ '${S3_BUCKET}'/" /srv/zotero/dataserver
|
||||||
echo -n "s3 endpoint url: "
|
echo -n "s3 endpoint url: "
|
||||||
read S3_ENDPOINT
|
read S3_ENDPOINT
|
||||||
sed -i "s/S3_ENDPOINT\ =\ 's3.amazonaws.com'/S3_ENDPOINT\ =\ '${S3_ENDPOINT}'/" /srv/zotero/dataserver/include/config/config.inc.php
|
sed -i "s/S3_ENDPOINT\ =\ 's3.amazonaws.com'/S3_ENDPOINT\ =\ '${S3_ENDPOINT}'/" /srv/zotero/dataserver/include/config/config.inc.php
|
||||||
|
read AWS_HOST
|
||||||
|
sed -i "27a\ \ \ \ \ \ \ \ public static \$AWS_HOST\ =\ '${AWS_HOST};'" /srv/zotero/dataserver/include/config/config.inc.php
|
||||||
|
|
||||||
sed -i "30i\ \ \ \ \ \ \ \ public static \$URI_PREFIX_DOMAIN_MAP = array(" /srv/zotero/dataserver/include/config/config.inc.php
|
sed -i "30i\ \ \ \ \ \ \ \ public static \$URI_PREFIX_DOMAIN_MAP = array(" /srv/zotero/dataserver/include/config/config.inc.php
|
||||||
sed -i "31i\ \ \ \ \ \ \ \ \ \ '\/sync\/' => 'sync'" /srv/zotero/dataserver/include/config/config.inc.php
|
sed -i "31i\ \ \ \ \ \ \ \ \ \ '\/sync\/' => 'sync'" /srv/zotero/dataserver/include/config/config.inc.php
|
||||||
|
@ -167,25 +213,12 @@ sed -i "s/'memcached1.localdomain:11211:2',\ 'memcached2.localdomain:11211:1'/'$
|
||||||
|
|
||||||
echo "Configure document root folder"
|
echo "Configure document root folder"
|
||||||
sed -i "s/var\/www\/dataserver/srv\/zotero\/dataserver/" /srv/zotero/dataserver/include/config/config.inc.php
|
sed -i "s/var\/www\/dataserver/srv\/zotero\/dataserver/" /srv/zotero/dataserver/include/config/config.inc.php
|
||||||
# echo "configuring zotero start up scripts"
|
|
||||||
# sed -i "s/processor/dataserver\/processor/" /srv/zotero/dataserver/misc/zotero_download.init
|
echo "##############################################################"
|
||||||
# sed -i "s/processor/dataserver\/processor/" /srv/zotero/dataserver/misc/zotero_error.init
|
echo "patch header.inc.php for including host name for using own AWS"
|
||||||
# sed -i "s/processor/dataserver\/processor/" /srv/zotero/dataserver/misc/zotero_upload.init
|
echo "##############################################################"
|
||||||
#
|
sed -i "225a \$awsconfig['base_url']\ =\ ZCONFIG::\$AWS_HOST;" /srv/zotero/dataserver/include/header.inc.php
|
||||||
# echo "configuring start up of zotero scripts"!
|
|
||||||
# cp /srv/zotero/dataserver/misc/zotero_download.init /etc/init.d/zotero_download
|
|
||||||
# cp /srv/zotero/dataserver/misc/zotero_error.init /etc/init.d/zotero_error
|
|
||||||
# cp /srv/zotero/dataserver/misc/zotero_upload.init /etc/init.d/zotero_upload
|
|
||||||
#
|
|
||||||
# echo "add zotero scripts to autostart"
|
|
||||||
# update-rc.d zotero_download defaults
|
|
||||||
# update-rc.d zotero_error defaults
|
|
||||||
# update-rc.d zotero_upload defaults
|
|
||||||
#
|
|
||||||
# echo "start zotero services"
|
|
||||||
# /etc/init.d/zotero_download start
|
|
||||||
# /etc/init.d/zotero_error start
|
|
||||||
# /etc/init.d/zotero_upload start
|
|
||||||
echo "###############"
|
echo "###############"
|
||||||
echo "Configure runit"
|
echo "Configure runit"
|
||||||
echo "###############"
|
echo "###############"
|
||||||
|
@ -236,26 +269,3 @@ ln -s ../sv/zotero-download /etc/service/
|
||||||
ln -s ../sv/zotero-upload /etc/service/
|
ln -s ../sv/zotero-upload /etc/service/
|
||||||
ln -s ../sv/zotero-error /etc/service/
|
ln -s ../sv/zotero-error /etc/service/
|
||||||
|
|
||||||
echo "#############"
|
|
||||||
echo ZSS
|
|
||||||
echo "#############"
|
|
||||||
|
|
||||||
echo "download source code for ZSS"
|
|
||||||
git clone git://github.com/sualk/zss.git /srv/zotero/zss
|
|
||||||
|
|
||||||
echo "adjust directory rights"
|
|
||||||
chown www-data:www-data /srv/zotero/storage
|
|
||||||
|
|
||||||
echo "adjust path for ZSS.pm"
|
|
||||||
sed -i "s,path/to,srv/zotero/zss," /srv/zotero/zss/zss.psgi
|
|
||||||
|
|
||||||
echo "adjust properties in ZSS.pm"
|
|
||||||
sed -i "s/yoursecretkey/${AWS_SECRET_KEY}/" /srv/zotero/zss/ZSS.pm
|
|
||||||
sed -i "s,path/to,srv/zotero/storage," /srv/zotero/zss/ZSS.pm
|
|
||||||
|
|
||||||
echo "configure uwsgi"
|
|
||||||
echo "uwsgi:
|
|
||||||
\ \ plugin: psgi
|
|
||||||
\ \ psgi: /srv/zotero/zss/zss.psgi" > /etc/uwsgi/apps-available/zss.yaml
|
|
||||||
ln -s /etc/uwsgi/apps-available/zss.yaml /etc/uwsgi/apps-enabled/zss.yaml
|
|
||||||
/etc/init.d/uwsgi restart
|
|
||||||
|
|
Loading…
Reference in New Issue