Skip to content

Commit

Permalink
XMerge branch 'production'
Browse files Browse the repository at this point in the history
  • Loading branch information
uniuuu committed Apr 29, 2023
2 parents 8e00ad6 + bd3a628 commit 03a2dfd
Show file tree
Hide file tree
Showing 21 changed files with 305 additions and 55 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,19 @@ $ cd ..

## Client installation


### BETA: Build client via Docker.

*Run*:
```bash
$ DOCKER_BUILDKIT=1 docker build --progress=plain --file client.Dockerfile --output build .
```
*Run*:
```bash
$ ./build/staging/Zotero_VERSION/zotero)
```


### Dependencies and source code

For [m|l|w]: m=Mac, w=Windows, l=Linux
Expand Down
11 changes: 7 additions & 4 deletions bin/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

set -eux

sudo docker compose exec app-zotprime-dataserver bash -cux 'cd /var/www/zotero/misc && ./init-mysql.sh'
sudo docker compose exec app-zotprime-dataserver bash -cux 'aws --endpoint-url "http://minio:9000" s3 mb s3://zotero'
sudo docker compose exec app-zotprime-dataserver bash -cux 'aws --endpoint-url "http://minio:9000" s3 mb s3://zotero-fulltext'
sudo docker compose exec app-zotprime-dataserver bash -cux 'aws --endpoint-url "http://localstack:4575" sns create-topic --name zotero'
sudo docker compose exec app-zotprime-dataserver sh -cux 'cd /var/www/zotero/misc && ./init-mysql.sh'
#sudo docker compose exec app-zotprime-dataserver sh -cux 'cd /var/www/zotero/misc && ./db_update.sh'
#sudo docker compose exec app-zotprime-dataserver sh -cux 'cd /var/www/zotero/misc/db-updates/2021-10-16 && php ./0_addMasterGroupHasData'
#sudo docker compose exec app-zotprime-dataserver sh -cux 'cd /var/www/zotero/misc/db-updates/2021-10-16 && php ./1_removeMasterGroupTimestampAndVersion'
sudo docker compose exec app-zotprime-dataserver sh -cux 'aws --endpoint-url "http://minio:9000" s3 mb s3://zotero'
sudo docker compose exec app-zotprime-dataserver sh -cux 'aws --endpoint-url "http://minio:9000" s3 mb s3://zotero-fulltext'
sudo docker compose exec app-zotprime-dataserver sh -cux 'aws --endpoint-url "http://localstack:4575" sns create-topic --name zotero'
31 changes: 31 additions & 0 deletions client.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

FROM node:16-alpine as intermediate
RUN set -eux; \
apk update && apk upgrade && \
apk add --update --no-cache git bash curl python3 zip perl rsync \
&& rm -rf /var/cache/apk/*
WORKDIR /usr/src/app
COPY . .
RUN git submodule update --init --recursive client/zotero-build
RUN git submodule update --init --recursive client/zotero-standalone-build
RUN git submodule update --init --recursive client/zotero-client
WORKDIR /usr/src/app/client/
RUN set -eux; \
./config.sh
WORKDIR /usr/src/app/client/zotero-client
RUN set -eux; \
npx browserslist@latest --update-db
RUN set -eux; \
npm install
RUN set -eux; \
npm run build
WORKDIR /usr/src/app/client/zotero-standalone-build
RUN set -eux; \
/bin/bash -c './fetch_xulrunner.sh -p l'
RUN set -eux; \
./fetch_pdftools
RUN set -eux; \
./scripts/dir_build -p l

FROM scratch AS export-stage
COPY --from=intermediate /usr/src/app/client/zotero-standalone-build/staging .
26 changes: 26 additions & 0 deletions client.Dockerfile.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
clinet/zotero-clinet/.DS_Store
clinet/zotero-clinet/node_modules
clinet/zotero-clinet/build
clinet/zotero-clinet/.signatures.json
clinet/zotero-clinet/tmp
clinet/zotero-build/config.sh
clinet/zotero-build/node_modules
clinet/zotero-standalone-build/*~
clinet/zotero-standalone-build/cache
clinet/zotero-standalone-build/config-custom.sh
clinet/zotero-standalone-build/dist
clinet/zotero-standalone-build/staging
clinet/zotero-standalone-build/xulrunner
clinet/zotero-standalone-build/pdftools
.github
bin
build
dataserver
doc
docker
stream-server
tinymce-clean-server
Zend
docker-compose.yml
*.Dockerfile
README.md
4 changes: 4 additions & 0 deletions client/config.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/bin/sh

set -eux

sed -i "s#'http://zotero.org/'#'http://localhost:8080/'#g" zotero-client/resource/config.js
sed -i "s#'zotero.org'#'localhost'#g" zotero-client/resource/config.js
sed -i 's#https://api.zotero.org/#http://localhost:8080/#g' zotero-client/resource/config.js
sed -i 's#wss://stream.zotero.org/#ws://localhost:8081/#g' zotero-client/resource/config.js
sed -i 's#https://www.zotero.org/#http://localhost:8080/#g' zotero-client/resource/config.js
Expand Down
2 changes: 1 addition & 1 deletion client/zotero-build
36 changes: 36 additions & 0 deletions clientbuildtest.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

FROM node:16-alpine as intermediate

RUN set -eux; \
apk update && apk upgrade && \
apk add --update --no-cache git bash curl python3 zip perl rsync \
&& rm -rf /var/cache/apk/*
WORKDIR /usr/src/app
RUN mkdir client
RUN cd client
RUN git init
RUN git remote add -f origin https://github.com/uniuuu/zotprime
RUN echo "client/" >> .git/info/sparse-checkout
RUN git pull origin new_dev
RUN git submodule update --init --recursive
WORKDIR /usr/src/app/client/
RUN set -eux; \
./config.sh
WORKDIR /usr/src/app/client/zotero-client
RUN set -eux; \
npx browserslist@latest --update-db
RUN set -eux; \
npm install
RUN set -eux; \
npm run build
WORKDIR /usr/src/app/client/zotero-standalone-build
RUN set -eux; \
./fetch_xulrunner.sh -p l
RUN set -eux; \
./fetch_pdftools
RUN set -eux; \
./scripts/dir_build -p l


FROM scratch AS export-stage
COPY --from=intermediate /usr/src/app/client/zotero-standalone-build/staging/* .
11 changes: 11 additions & 0 deletions clientbuildtest.Dockerfile.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.github
bin
build
dataserver
doc
docker
stream-server
tinymce-clean-server
Zend
docker-compose.yml

3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ services:
environment:
- SERVICES=sns,sqs,apigateway
db-zotprime-minio:
image: minio/minio
# image: minio/minio
build:
context: .
dockerfile: minio.Dockerfile
Expand All @@ -63,6 +63,7 @@ services:
- "./docker/dataserver/config/header.inc.php:/var/www/zotero/include/header.inc.php:ro"
- "./docker/dataserver/config/Storage.inc.php:/var/www/zotero/model/Storage.inc.php:ro"
- "./docker/dataserver/dbinit/init-mysql.sh:/var/www/zotero/misc/init-mysql.sh:ro"
# - "./docker/dataserver/dbinit/db_update.sh:/var/www/zotero/misc/db_update.sh:ro"
- "./docker/dataserver/dbinit/www.sql:/var/www/zotero/misc/www.sql:ro"
- "./docker/dataserver/dbinit/shard.sql:/var/www/zotero/misc/shard.sql:ro"
- "./docker/dataserver/config/create-user.sh:/var/www/zotero/admin/create-user.sh:ro"
Expand Down
2 changes: 1 addition & 1 deletion docker/dataserver/config/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Z_CONFIG {
public static $TESTING_SITE = false;
public static $DEV_SITE = false;

public static $DEBUG_LOG = true;
public static $DEBUG_LOG = false;

public static $BASE_URI = 'http://localhost:8080/';
public static $API_BASE_URI = 'http://localhost:8080/';
Expand Down
11 changes: 11 additions & 0 deletions docker/dataserver/dbinit/db_update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
set -xue

for i in db-updates/*/; do
cd /var/www/zotero/misc/$i
for j in *; do
find . -type f \( ! -name *.sql \) -exec php {} \;
find . -type f -name *.sql -exec bash -c 'mysql -h mysql -P 3306 -u root -pzotero zotero_master < {}' \;
done
done;
cd ../../
17 changes: 10 additions & 7 deletions docker/dataserver/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ export APACHE_LOG_DIR=/var/log/apache2
#/etc/init.d/rsyslog start

# Start rinetd
/etc/init.d/rinetd start
echo "logfile /dev/stdout" >> /etc/rinetd.conf
rinetd -f -c /etc/rinetd.conf &
#/etc/init.d/rinetd start

a2enmod headers
a2enmod rewrite
a2dissite 000-default
a2ensite zotero
a2enconf gzip
#a2enmod headers
#a2enmod rewrite
#a2dissite 000-default
#a2ensite zotero
#a2enconf gzip

# NPM
#cd /var/www/zotero/stream-server
Expand Down Expand Up @@ -57,4 +59,5 @@ cd /var/www/zotero && composer -vv install

# Start Apache2
#exec apache2 -e debug -DNO_DETACH -k start
exec apache2 -e debug -DFOREGROUND -k start
exec httpd -e debug -DFOREGROUND -k start
#exec httpd -DFOREGROUND -k start
Loading

0 comments on commit 03a2dfd

Please sign in to comment.