This commit is contained in:
Samuel Hassine
2018-10-25 17:06:12 +02:00
parent 6a1cddc983
commit f787e60d4a
11 changed files with 60 additions and 27 deletions

7
.gitmodules vendored
View File

@@ -7,9 +7,12 @@
[submodule "stream-server"]
path = stream-server
url = https://github.com/zotero/stream-server
[submodule "client/zotero"]
path = client/zotero
[submodule "client/zotero-client"]
path = client/zotero-client
url = https://github.com/zotero/zotero
[submodule "client/zotero-standalone-build"]
path = client/zotero-standalone-build
url = https://github.com/zotero/zotero-standalone-build
[submodule "client/zotero-build"]
path = client/zotero-build
url = https://github.com/zotero/zotero-build

View File

@@ -1,9 +1,11 @@
# Zotero Prime - On-premise Zotero platform
Zotero Prime is a full packaged repository aimed to make on-premise [Zotero](https://www.zotero.org) deployment easier with the last versions of both Zotero client and server. This is the result of sleepness nights spent to deploy Zotero within my organization on a disconnected network. Feel free to open issues or pull requests if you did not managed to use it.
Zotero Prime is a full packaged repository aimed to make on-premise [Zotero](https://www.zotero.org) deployment easier with the last versions of both Zotero client and server. This is the result of sleepness nights spent to deploy Zotero within my organization on a disconnected network. Feel free to open issues or pull requests if you did not manage to use it.
## Installation
### Dependencies and source code
*Install dependencies for client build*:
```bash
$ sudo apt install npm
@@ -21,18 +23,23 @@ $ cd zotero-prime
$ cd client/zotero
$ git submodule init
$ git submodule update
$ cd ../zotero-build
$ git submodule init
$ git submodule update
$ cd ../zotero-standalone-build
$ git submodule init
$ git submodule update
$ cd ../../
```
*Run*:
*Configure and run*:
```bash
$ docker-compose up -d
$ ./config.sh
$ cd docker
$ sudo docker-compose up -d
```
## Initialize installation
### Initialize databases
*Initialize databases*:
```bash
@@ -46,7 +53,6 @@ For [m|l|w]: m=Mac, w=Windows, l=Linux
*Run*:
```bash
$ cd client
$ ./config.sh
$ cd zotero
$ npm install && npm run build
$ cd ../zotero-standalone-build
@@ -59,17 +65,21 @@ $ ./scripts/dir_build -p [m|l|w]
*Run*:
```bash
$ ./staging/zotero(.exe)
$ ./staging/Zotero_VERSION/zotero(.exe)
```
*Available endpoints*:
* API : http://localhost:8080
* Stream Server : ws://localhost:8081
* PHPMyAdmin : http://localhost:8082
* S3 Service : http://localhost:8083
| Name | URL |
| ------------- | --------------------------------------------- |
| Zotero API | http://localhost:8080 |
| PHPMyAdmin | http://localhost:8082 |
| S3 Web UI | http://localhost:8083 |
*Default login/password*:
* Login : admin
* Password: admin
| Name | Login | Password |
| ------------- | --------------------------------------------- |
| Zotero API | admin | admin |
| PHPMyAdmin | root | zotero |
| S3 Web UI | zotero | zoterodocker |
*Create a user*:

View File

@@ -5,7 +5,7 @@ MYSQL="mysql -h mysql -P 3306 -u root -pzotero"
echo "INSERT INTO libraries VALUES (${1}, 'user', '0000-00-00 00:00:00', 0, 1)" | $MYSQL zotero_master
echo "INSERT INTO users VALUES (${1}, ${1}, '${2}', '0000-00-00 00:00:00', '0000-00-00 00:00:00')" | $MYSQL zotero_master
echo "INSERT INTO groupUsers VALUES (1, ${1}, 'member', '0000-00-00 00:00:00', '0000-00-00 00:00:00')" | $MYSQL zotero_master
echo "INSERT INTO users VALUES (${1}, '${2}', MD5('${2}'))" | $MYSQL zotero_www
echo "INSERT INTO users_email (userID, email) VALUES (1, '${2}@ops.fr')" | $MYSQL zotero_www
echo "INSERT INTO users VALUES (${1}, '${2}', MD5('${3}'))" | $MYSQL zotero_www
echo "INSERT INTO users_email (userID, email) VALUES (1, '${4}')" | $MYSQL zotero_www
echo "INSERT INTO shardLibraries VALUES (${1}, 'user', 0, 0)" | $MYSQL zotero_shard_1

View File

@@ -1,6 +0,0 @@
#!/bin/sh
sed -i 's#https://api.zotero.org/#http://localhost:8080#g' zotero/resource/config.js
sed -i 's#wss://stream.zotero.org/#ws://localhost:8081#g' zotero/resource/config.js
sed -i 's#https://www.zotero.org/#http://localhost:8080#g' zotero/resource/config.js
sed -i 's#https://zoteroproxycheck.s3.amazonaws.com/test##g' zotero/resource/config.js

Submodule client/zotero deleted from f26c2c52d8

1
client/zotero-build Submodule

Submodule client/zotero-build added at dae807ab51

8
config.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/sh
sed -i 's#https://api.zotero.org/#http://localhost:8080#g' client/zotero-client/resource/config.js
sed -i 's#https://api.zotero.org/#http://localhost:8080#g' stream-server/config/default.js
sed -i "s#host: '',#host: 'redis',#g" stream-server/config/default.js
sed -i 's#wss://stream.zotero.org/#ws://localhost:8081#g' client/zotero-client/resource/config.js
sed -i 's#https://www.zotero.org/#http://localhost:8080#g' client/zotero-client/resource/config.js
sed -i 's#https://zoteroproxycheck.s3.amazonaws.com/test##g' client/zotero-client/resource/config.js

View File

@@ -9,7 +9,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get -y install software-properties-common
RUN DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:ondrej/php
RUN DEBIAN_FRONTEND=noninteractive apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install apache2 libapache2-mod-php7.0 sudo rsyslog wget mysql-client curl nodejs
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install php7.0-cli php7.0-xml php7.0-mysql php7.0-pgsql php7.0-json php7.0-curl php7.0-mbstring php7.0-intl php7.0-redis php7.0-dev php-pear
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install php7.0-cli php7.0-xml php7.0-mysql php7.0-pgsql php7.0-json php7.0-curl php7.0-mbstring php7.0-intl php7.0-redis php7.0-dev php-pear composer
RUN sed -i 's/memory_limit = 128M/memory_limit = 1G/g' /etc/php/7.0/apache2/php.ini
RUN sed -i 's/max_execution_time = 30/max_execution_time = 300/g' /etc/php/7.0/apache2/php.ini
@@ -35,7 +35,7 @@ RUN ln -s /etc/php/7.0/mods-available/memcached.ini /etc/php/7.0/apache2/conf.d/
RUN DEBIAN_FRONTEND=noninteractive pear install HTTP_Request2
# Setup awscli
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install python python-pip git wget
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install python python-pip git wget npm
RUN DEBIAN_FRONTEND=noninteractive pip install awscli
# Setup Apache2

View File

@@ -1,3 +1,8 @@
#!/bin/sh
sudo docker-compose exec app-zotero /var/www/zotero/admin/create-user.sh ${1} ${2}
if [ -z "$1" -o -z "$2" -o -z "$3" ]; then
echo "Usage: ./create-user.sh {UID} {username} {password}"
exit 1
fi
sudo docker-compose exec app-zotero /var/www/zotero/admin/create-user.sh ${1} ${2} ${3}

View File

@@ -11,6 +11,10 @@ export APACHE_LOG_DIR=/var/log/apache2
# Start log
/etc/init.d/rsyslog start
# NPM
cd /var/www/zotero/stream-server && npm install
cd /var/www/zotero/tinymce-clean-server && npm install
# Start Stream server
cd /var/www/zotero/stream-server && nodejs index.js &
@@ -20,5 +24,11 @@ cd /var/www/zotero/tinymce-clean-server && nodejs server.js &
# Chown
chown -R ${RUN_USER}:${RUN_GROUP} /var/log/apache2
# Chmod
chmod 777 /var/www/zotero/tmp
# Composer
cd /var/www/zotero && composer install
# Start Apache2
exec apache2 -DNO_DETACH -k start

View File

@@ -33,7 +33,7 @@ echo "INSERT INTO groupUsers VALUES (1, 1, 'owner', '0000-00-00 00:00:00', '0000
# Load in www schema
$MYSQL zotero_www < www.sql
echo "INSERT INTO users VALUES (1, 'admin', MD5('admin')" | $MYSQL zotero_www
echo "INSERT INTO users VALUES (1, 'admin', MD5('admin'))" | $MYSQL zotero_www
echo "INSERT INTO users_email (userID, email) VALUES (1, 'admin@zotero.org')" | $MYSQL zotero_www
echo "INSERT INTO storage_institutions (institutionID, domain, storageQuota) VALUES (1, 'zotero.org', 10000)" | $MYSQL zotero_www
echo "INSERT INTO storage_institution_email (institutionID, email) VALUES (1, 'contact@zotero.org')" | $MYSQL zotero_www
@@ -44,6 +44,9 @@ cat triggers.sql | $MYSQL zotero_shard_1
cat shard.sql | $MYSQL zotero_shard_2
cat triggers.sql | $MYSQL zotero_shard_2
echo "INSERT INTO shardLibraries VALUES (1, 'user', 0, 0)" | $MYSQL zotero_shard_1
echo "INSERT INTO shardLibraries VALUES (2, 'group', 0, 0)" | $MYSQL zotero_shard_2
# Load in schema on id servers
$MYSQL zotero_ids < ids.sql