Skip to content

Commit

Permalink
List of changes:
Browse files Browse the repository at this point in the history
- Moved tinymceclean server to separate container
- Moved stream server to a separate container
- Verified that built of the client v6 succeeded. With Node js v16.
- Fixed issue Minio won't start due to version incompatibility. Set to version RELEASE.2018-10-25T01-27-03Z used at the time of zotprime first release
- Fixed issue Elastica won't start due to version incompatibility. Set to version RELEASE.2018-10-25T01-27-03Z used at the time of zotprime first release
- Fixed issue Class 'Redis' not found
- Fixed issue uWebSockets.js (uws) NPM couldn't build
- Fixed environmental variables in app-zotero container
- Disabled overloading cpu rsyslogd
- Moved apache setup to entrypoint.sh
- Fixed docker/bin/run.sh docker/bin/create-user.sh scripts in regards to latest docker compose plugin version

git submodule status
 f5d249841b839972625fd8359732b1ba0bb8c829 client/zotero-build (heads/uptodatesubmodules)
 fb61ea4ba239f9c748b6345e159b88b7ca57dbf3 client/zotero-client (6.0.23-43-gfb61ea4ba)
 3e5c84346ff59db0cdb28493b440fdeda2d8aaf7 client/zotero-standalone-build (6.0.21-5-g3e5c843)
 66e2ad6264455895e0506b84df03e7189f5f7a71 include/Elastica (v0.16.0.0-2202-g66e2ad62)
 d2063ca003df3294164ae786ad96e29c4c36a832 stream-server (heads/docker)
 f4d74787d182cf0829f98a259e512cae6ca61a58 tinymce-clean-server (heads/docker)
  • Loading branch information
uniuuu committed Apr 24, 2023
1 parent 7e4d7d5 commit 9511577
Show file tree
Hide file tree
Showing 12 changed files with 179 additions and 48 deletions.
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,31 @@ ZotPrime is a full packaged repository aimed to make on-premise [Zotero](https:/

### Dependencies and source code

*Install latest docker compose plugin*:
```bash
$ sudo apt update
$ sudo apt install docker-compose-plugin
```

*Install dependencies for client build*:
```bash
$ sudo apt install npm
$ sudo apt install nodejs npm
$ npm install -g n
$ n 16.20.0
```

*Clone the repository (with **--recursive**)*:
```bash
$ mkdir /path/to/your/app && cd /path/to/your/app
$ git clone --recursive https://github.com/SamuelHassine/zotero-prime.git
$ cd zotero-prime
$ git clone --recursive https://github.com/uniuuu/zotprime.git
$ git checkout pre-alpha
$ cd zotprime
```

*Configure and run*:
```bash
$ cd docker
$ sudo docker-compose up -d
$ sudo docker compose up -d
```

### Initialize databases
Expand Down
119 changes: 92 additions & 27 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,48 @@ FROM debian:bullseye-slim
#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 apt-get update && apt-get install -y \
libapache2-mod-php mariadb-server mariadb-client memcached php-zend-code php7.4-cli php7.4-memcached php7.4-mysql php7.4-curl \
apache2 uwsgi uwsgi-plugin-psgi libplack-perl libdigest-hmac-perl libjson-xs-perl libfile-util-perl libapache2-mod-uwsgi libswitch-perl \
git gnutls-bin runit wget curl net-tools

RUN apt-get install vim -y
apache2 \
awscli \
composer \
curl \
git \
gnutls-bin \
libapache2-mod-php \
libapache2-mod-uwsgi \
# libc6 \
libdigest-hmac-perl \
libfile-util-perl \
libjson-xs-perl \
libplack-perl \
libswitch-perl \
mariadb-client \
mariadb-server \
memcached \
net-tools \
nodejs \
npm \
php7.4-cli \
php7.4-curl \
php7.4-memcached \
php7.4-mysql \
php-http \
php-igbinary \
php-pear \
php-zend-code \
rinetd \
rsyslog \
runit \
uwsgi \
uwsgi-plugin-psgi \
vim \
wget \
&& rm -rf /var/lib/apt/lists/*


#RUN apt-get install vim -y
#build-essential

RUN apt-get install -y php-pear composer nodejs
#RUN apt-get install -y php-pear composer nodejs

RUN sed -i 's/memory_limit = 128M/memory_limit = 1G/g' /etc/php/7.4/apache2/php.ini
RUN sed -i 's/max_execution_time = 30/max_execution_time = 300/g' /etc/php/7.4/apache2/php.ini
Expand All @@ -31,70 +65,89 @@ RUN sed -i 's/error_reporting = E_ALL \& ~E_DEPRECATED \& ~E_STRICT/error_report


# Setup igbinary
RUN apt-get install -y php-igbinary
#RUN apt-get install -y php-igbinary
# php-dev
#RUN pecl channel-update pecl.php.net
#RUN pecl install igbinary
RUN echo "extension=igbinary.so" >> /etc/php/7.4/mods-available/igbinary.ini

#RUN echo "extension=igbinary.so" >> /etc/php/7.4/mods-available/igbinary.ini

#RUN ln -s /etc/php/7.0/mods-available/igbinary.ini /etc/php/7.0/cli/conf.d/20-igbinary.ini
#RUN ln -s /etc/php/7.0/mods-available/igbinary.ini /etc/php/7.0/apache2/conf.d/20-igbinary.ini


# Setup Memcached
#RUN apt-get -y install libmemcached11 libmemcachedutil2 build-essential libmemcached-dev libz-dev libxml2-dev zlib1g-dev libicu-dev g++
#RUN pecl download memcached-3.0.4 && tar xvzf memcached-3.0.4.tgz && cd memcached-3.0.4 && phpize && ./configure --enable-memcached-igbinary && make && make install
RUN echo "extension=memcached.so" >> /etc/php/7.4/mods-available/memcached.ini
RUN ln -s /etc/php/7.4/mods-available/memcached.ini /etc/php/7.4/cli/conf.d/20-memcached.ini
RUN ln -s /etc/php/7.4/mods-available/memcached.ini /etc/php/7.4/apache2/conf.d/20-memcached.ini


#RUN echo "extension=memcached.so" >> /etc/php/7.4/mods-available/memcached.ini
#RUN ln -s /etc/php/7.4/mods-available/memcached.ini /etc/php/7.4/cli/conf.d/20-memcached.ini
#RUN ln -s /etc/php/7.4/mods-available/memcached.ini /etc/php/7.4/apache2/conf.d/20-memcached.ini

# Setup awscli
#RUN apt-get -y install python3 python3-pip npm rinetd
#RUN pip install awscli
RUN apt-get install -y awscli
#RUN apt-get install -y awscli
#RUN apt-get install -y rinetd


# HTTP_Request2
#RUN pear install HTTP_Request2
#RUN apt-get install -y php-http-request2
RUN apt-get install -y php-http
#RUN apt-get install -y php-http

# Setup Apache2
RUN a2enmod rewrite
#RUN a2enmod rewrite

# Enable the new virtualhost
COPY zotero.conf /etc/apache2/sites-available/
RUN a2dissite 000-default
RUN a2ensite zotero
#RUN a2dissite 000-default
#RUN a2ensite zotero

# Override gzip configuration
COPY gzip.conf /etc/apache2/conf-available/
RUN a2enconf gzip
#


# Install npm
#RUN apt-get install -y npm

# Install rsyslog
RUN apt-get install -y rsyslog
#RUN apt-get install -y rsyslog

# Install rinetd
RUN apt-get install -y rinetd
#RUN apt-get install -y rinetd

#RUN apt-get install -y sudo

RUN apt-get purge --auto-remove -y nodejs
#RUN apt-get update && apt-get install g++
RUN apt-get update && apt-get install ncdu -y
#RUN apt-get install libc6-dev unzip -y
RUN apt-get install php7.4-redis -y

#Install Nodejs
RUN rm -rf /var/lib/apt/lists/*
RUN rm -rf /etc/apt/sources.list.d/*
RUN apt-get update
#RUN wget https://deb.nodesource.com/setup_19.x && bash -x setup_19.x
RUN curl -fsSL https://deb.nodesource.com/setup_19.x | bash -
RUN apt-get install -y nodejs
RUN npm install -g n
#RUN n 16.20.0
RUN n 6.17.1
#RUN npm install -g [email protected]
#RUN apt-get purge --auto-remove -y nodejs
#RUN rm -rf /var/lib/apt/lists/*
#RUN rm -rf /etc/apt/sources.list.d/*
#RUN apt-get update
##RUN wget https://deb.nodesource.com/setup_19.x && bash -x setup_19.x
#RUN curl -fsSL https://deb.nodesource.com/setup_19.x | bash -
#RUN apt-get install -y nodejs

#RUN apt-get install -y libc6

RUN apt-get install -y libc6
#Install Yarn
#RUN npm install --global yarn


#Debug Rsyslog
#RUN sed -i '/^DAEMON=\/usr\/sbin\/rsyslogd/a RSYSLOGD_OPTIONS="-dn"' /etc/init.d/rsyslog

# AWS local credentials
RUN mkdir ~/.aws && bash -c 'echo -e "[default]\nregion = us-east-1" > ~/.aws/config' && bash -c 'echo -e "[default]\naws_access_key_id = zotero\naws_secret_access_key = zoterodocker" > ~/.aws/credentials'

Expand All @@ -104,6 +157,18 @@ RUN chown 33:33 /var/log/apache2
# Rinetd
RUN echo "0.0.0.0 8082 minio 9000" >> /etc/rinetd.conf

#Install uws
#WORKDIR /var/

#ENV APACHE_RUN_USER=${RUN_USER}
#ENV APACHE_RUN_GROUP=${RUN_GROUP}
ENV APACHE_RUN_USER=www-data
ENV APACHE_RUN_GROUP=www-data
ENV APACHE_LOCK_DIR=/var/lock/apache2
ENV APACHE_PID_FILE=/var/run/apache2/apache2.pid
ENV APACHE_RUN_DIR=/var/run/apache2
ENV APACHE_LOG_DIR=/var/log/apache2

# Expose and entrypoint
COPY entrypoint.sh /
RUN chmod +x /entrypoint.sh
Expand Down
2 changes: 1 addition & 1 deletion docker/bin/create-user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ if [ -z "$1" -o -z "$2" -o -z "$3" ]; then
exit 1
fi

sudo docker-compose exec app-zotero /var/www/zotero/admin/create-user.sh ${1} ${2} ${3}
sudo docker compose exec app-zotero /var/www/zotero/admin/create-user.sh ${1} ${2} ${3}
2 changes: 1 addition & 1 deletion docker/bin/run.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh

sudo docker-compose up
sudo docker compose up
2 changes: 1 addition & 1 deletion docker/config/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class Z_CONFIG {
public static $LOG_TIMEZONE = 'US/Eastern';
public static $LOG_TARGET_DEFAULT = 'errors';

public static $HTMLCLEAN_SERVER_URL = 'http://localhost:16342';
public static $HTMLCLEAN_SERVER_URL = 'http://app-zotero-tinymceclean:16342';

public static $PROCESSOR_PORT_DOWNLOAD = 3455;
public static $PROCESSOR_PORT_UPLOAD = 3456;
Expand Down
2 changes: 1 addition & 1 deletion docker/config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var config = {
host: 'redis',
prefix: ''
},
apiURL: 'http://127.0.0.1/',
apiURL: 'http://app-zotero/',
apiVersion: 3,
apiRequestHeaders: {},
longStackTraces: false,
Expand Down
42 changes: 41 additions & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ services:
# command: "sysctl -w vm.max_map_count=262144"
db-zotero-redis:
image: redis:5.0
# privileged: true
# user: root
# sysctls:
# - sysctl vm.overcommit_memory=1
db-zotero-memcached:
image: memcached:1.5
db-zotero-localstack:
Expand All @@ -48,7 +52,7 @@ services:
dockerfile: Dockerfile
ports:
- "8080:80"
- "8081:81"
# - "8081:81"
- "8082:8082"
volumes:
- "../:/var/www/zotero:rw"
Expand All @@ -63,14 +67,50 @@ services:
- db-zotero-elasticsearch
- db-zotero-redis
- db-zotero-memcached
- app-zotero-tinymceclean
- app-zotero-streamserver
links:
- db-zotero-mysql:mysql
- db-zotero-elasticsearch:elasticsearch
- db-zotero-redis:redis
- db-zotero-memcached:memcached
- db-zotero-localstack:localstack
- db-zotero-minio:minio
- app-zotero-tinymceclean:tinymceclean
- app-zotero-streamserver:streamserver
restart: always
app-zotero-tinymceclean:
image: app-zotero-tinymceclean
build:
context: ../tinymce-clean-server/
dockerfile: Dockerfile
# ports:
# - "16342:16342"
depends_on:
- db-zotero-mysql
- db-zotero-elasticsearch
- db-zotero-redis
- db-zotero-memcached
links:
- db-zotero-redis:redis
restart: always
app-zotero-streamserver:
image: app-zotero-streamserver
build:
context: ../stream-server/
dockerfile: Dockerfile
ports:
- "8081:81"
volumes:
- "./config/default.js:/usr/src/app/config/default.js:ro"
restart: always
depends_on:
- db-zotero-mysql
- db-zotero-elasticsearch
- db-zotero-redis
- db-zotero-memcached
links:
- db-zotero-redis:redis
app-zotero-phpmyadmin:
image: phpmyadmin/phpmyadmin
ports:
Expand Down
33 changes: 25 additions & 8 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh

set -x
# Env vars
export APACHE_RUN_USER=${RUN_USER}
export APACHE_RUN_GROUP=${RUN_GROUP}
Expand All @@ -9,29 +9,46 @@ export APACHE_RUN_DIR=/var/run/apache2
export APACHE_LOG_DIR=/var/log/apache2

# Start log
/etc/init.d/rsyslog start
#/etc/init.d/rsyslog start

# Start rinetd
/etc/init.d/rinetd start

a2enmod rewrite
a2dissite 000-default
a2ensite zotero
a2enconf gzip

# NPM
cd /var/www/zotero/stream-server && npm install
cd /var/www/zotero/tinymce-clean-server && npm install
#cd /var/www/zotero/stream-server
#npm cache clean --force
#npx npm-check-updates -u
#npm update
#npm install
#npm update
#yarn add uWebSockets.js@uNetworking/uWebSockets.js#v20.23.0

#cd /var/www/zotero/tinymce-clean-server && npm install

# Start Stream server
cd /var/www/zotero/stream-server && node index.js &
#cd /var/www/zotero/stream-server && node index.js &

# Start Clean server
cd /var/www/zotero/tinymce-clean-server && node server.js &
#cd /var/www/zotero/tinymce-clean-server && node server.js &

# Chown
chown -R ${RUN_USER}:${RUN_GROUP} /var/log/apache2

# Chmod
chmod 777 /var/www/zotero/tmp

# Elastica Composer
#cd /var/www/zotero/include/Elastica && composer -v install

# Composer
cd /var/www/zotero && composer install
#cd /var/www/zotero && composer update && composer -vv install
cd /var/www/zotero && composer -vv install


# Start Apache2
exec apache2 -DNO_DETACH -k start
exec apache2 -e debug -DNO_DETACH -k start
2 changes: 1 addition & 1 deletion docker/minio/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM minio/minio
FROM minio/minio:RELEASE.2018-10-25T01-27-03Z

COPY minio /usr/bin/
RUN chmod +x /usr/bin/minio
2 changes: 1 addition & 1 deletion include/Elastica
Submodule Elastica updated 889 files
2 changes: 1 addition & 1 deletion stream-server
Submodule stream-server updated 2 files
+19 −0 Dockerfile
+20 −0 entrypoint.sh
2 changes: 1 addition & 1 deletion tinymce-clean-server

0 comments on commit 9511577

Please sign in to comment.