Skip to content
This repository was archived by the owner on Jun 25, 2025. It is now read-only.

Commit c4cbf4a

Browse files
committed
Replacement of OxS with PKP. Fix PHP_INI_DIR issue. Upgrade versions.
1 parent 56bbcc0 commit c4cbf4a

31 files changed

+447
-267
lines changed

.env

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,31 @@ PROJECT_DOMAIN=demo.localhost
44
SERVERNAME=$PROJECT_DOMAIN
55

66
# Web Server:
7-
PHP_INI_DIR=/etc/php/8.1
7+
# PHP_INI_DIR=/etc/php/8.1
88
HTTPS="on"
99
WEB_PATH=/var/www/html
1010
# HTTP_PORT=8100
1111
# HTTPS_PORT=8500
1212

1313
# PKP Tool:
1414
PKP_TOOL=omp
15-
PKP_VERSION=3.3.0-16
15+
PKP_VERSION=3.3.0-21
1616

1717
# Database:
1818
# MYSQL_VERSION=10.3
1919
MYSQL_ROOT_PASSWORD=root
20-
MYSQL_USER=ojs
20+
MYSQL_USER=omp
2121
MYSQL_PASSWORD=changeYourPass
22-
MYSQL_DATABASE=ojs
22+
MYSQL_DATABASE=omp
2323

2424
# To autoinstall (experimental):
25+
# Warning: Former vars can be referenced. Be sure MYSQL_* and OJS_* are consistent.
2526
OJS_CLI_INSTALL=0
2627
OJS_DB_HOST=db
2728
OJS_DB_DRIVER=mysqli
28-
OJS_DB_USER=ojs
29+
OJS_DB_USER=omp
2930
OJS_DB_PASSWORD=changeYourPass
30-
OJS_DB_NAME=ojs
31+
OJS_DB_NAME=omp
3132
OJS_WEB_CONF=/etc/apache2/conf.d/ojs.conf
3233
OJS_CONF=/var/www/html/config.inc.php
3334

Dockerfile

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Default context
2-
ARG BUILD_PKP_TOOL=omp \
2+
ARG BUILD_PKP_TOOL=ojs \
33
BUILD_PKP_VERSION=3.3.0-21 \
44
BUILD_PKP_APP_PATH=/app \
55
BUILD_WEB_SERVER=php:8.1-apache \
@@ -26,20 +26,18 @@ WORKDIR "/${BUILD_PKP_APP_PATH}"
2626
RUN curl -Ss -O "https://pkp.sfu.ca/${BUILD_PKP_TOOL}/download/${BUILD_PKP_TOOL}-${BUILD_PKP_VERSION}.tar.gz" \
2727
&& tar --strip-components=1 -xvzf "${BUILD_PKP_TOOL}-${BUILD_PKP_VERSION}.tar.gz" -C "${BUILD_PKP_APP_PATH}" > /tmp/untar.lst
2828

29-
RUN echo "===============================================================" \
30-
&& echo " ---> PKP application: ${PKP_TOOL}" \
31-
&& echo " ---> Version: ${BUILD_PKP_VERSION}" \
29+
RUN echo "===============================================================" \
30+
&& echo " ---> PKP application: ${PKP_TOOL}" \
31+
&& echo " ---> Version: ${BUILD_PKP_VERSION}" \
32+
&& echo " ---> Web Server: ${BUILD_WEB_SERVER}" \
33+
&& echo " ---> Operating system: ${BUILD_OS}" \
3234
&& echo "==============================================================="
3335

34-
3536
# GET & SET THE LAMP
3637
FROM ${BUILD_WEB_SERVER}
3738

38-
RUN echo "===============================================================" \
39-
&& echo " ---> Web server: ${BUILD_WEB_SERVER} (over debian)" \
40-
&& echo "==============================================================="
41-
4239
# TODO:
40+
# - Move to debian-slim (test php plugins)
4341
# - Concatenate calls to reduce the layers
4442
# - Replace with PKP_variables when possible
4543
# - Remove "vim" in production image
@@ -56,25 +54,25 @@ ARG BUILD_PKP_TOOL \
5654
LABEL maintainer="Public Knowledge Project <marc.bria@uab.es>"
5755
LABEL org.opencontainers.image.vendor="Public Knowledge Project"
5856
LABEL org.opencontainers.image.title="PKP ${BUILD_PKP_TOOL} Web Application"
59-
LABEL org.opencontainers.image.description="Runs a ${BUILD_PKP_TOOL} application over Apache"
60-
LABEL build_version="Docker for ${BUILD_PKP_TOOL} ${BUILD_PKP_VERSION} - Build-date: ${BUILD_LABEL}"
57+
LABEL org.opencontainers.image.description="Runs a ${BUILD_PKP_TOOL} application over ${BUILD_WEB_SERVER}-${BUILD_OS}."
58+
LABEL build_version="${BUILD_PKP_TOOL} ${BUILD_PKP_VERSION} - Build-date: ${BUILD_LABEL}"
6159

6260
# ARGs only work during building time, so they need to be exported to ENVs:
6361
ENV PKP_TOOL="${BUILD_PKP_TOOL:-ojs}" \
64-
PKP_VERSION="${BUILD_PKP_VERSION:-3.3.0-16}" \
62+
PKP_VERSION="${BUILD_PKP_VERSION:-3.3.0-21}" \
6563
SERVERNAME="localhost" \
6664
WWW_USER="www-data" \
6765
WWW_PATH_CONF="/etc/apache2/apache2.conf" \
6866
WWW_PATH_ROOT="/var/www" \
6967
HTTPS="on" \
7068
PKP_CLI_INSTALL="0" \
7169
PKP_DB_HOST="localhost" \
72-
PKP_DB_USER="${MYSQL_USER:-ojs}" \
70+
PKP_DB_USER="${MYSQL_USER:-pkp}" \
7371
PKP_DB_PASSWORD="${MYSQL_PASSWORD:-changeMe}" \
74-
PKP_DB_NAME="${MYSQL_DATABASE:-ojs}" \
75-
PKP_WEB_CONF="/etc/apache2/conf.d/$BUILD_PKP_TOOL.conf" \
72+
PKP_DB_NAME="${MYSQL_DATABASE:-pkp}" \
73+
PKP_WEB_CONF="/etc/apache2/conf.d/pkp.conf" \
7674
PKP_CONF="config.inc.php" \
77-
PKP_CMD="/usr/local/bin/${BUILD_PKP_TOOL:-ojs}-start"
75+
PKP_CMD="/usr/local/bin/pkp-start"
7876

7977

8078
# Basic packages (todo: Remove what don't need to be installed)
@@ -116,10 +114,10 @@ COPY --from=pkp_code "${BUILD_PKP_APP_PATH}" .
116114
RUN mkdir -p /etc/ssl/apache2 "${WWW_PATH_ROOT}/files" /run/apache2
117115
# Make php/conf.d indpendent of the php version:
118116
RUN PHP_INI_DIR=$(php --ini | grep "Configuration File (php.ini) Path" | cut -d: -f2 | xargs) \
119-
&& mkdir -p "$PHP_INI_DIR/conf.d" \
120-
&& mkdir -p "/etc/php" \
121-
&& ln -sfn "$PHP_INI_DIR" /etc/php/conf.d
122-
117+
# Redirect logs to stdout
118+
RUN echo "log_errors = On" >> $PHP_INI_DIR/conf.d/log-errors.ini \
119+
&& echo "error_log = /dev/stderr" >> $PHP_INI_DIR/conf.d/log-errors.ini
120+
# PKP-app config
123121
RUN echo "PKP_CONF: ${PKP_CONF}"
124122
RUN cp -a config.TEMPLATE.inc.php "${WWW_PATH_ROOT}/html/${PKP_CONF}"
125123
RUN chown -R ${WWW_USER}:${WWW_USER} "${WWW_PATH_ROOT}"
@@ -145,7 +143,7 @@ RUN apt-get clean autoclean \
145143

146144
COPY "templates/common/$BUILD_PKP_TOOL/root/" /
147145

148-
RUN echo "${BUILD_PKP_TOOL}-${BUILD_PKP_VERSION} [build:" $(date "+%Y%m%d-%H%M%S") "]" > "${WWW_PATH_ROOT}/container.version" \
146+
RUN echo "${BUILD_PKP_TOOL}-${BUILD_PKP_VERSION} over $BUILD_WEB_SERVER on $BUILD_OS [build:" $(date "+%Y%m%d-%H%M%S") "]" > "${WWW_PATH_ROOT}/container.version" \
149147
&& rm -f "${BUILD_PKP_TOOL}-${BUILD_PKP_VERSION}.tar.gz" \
150148
&& cat "${WWW_PATH_ROOT}/container.version"
151149

@@ -154,7 +152,8 @@ EXPOSE 443
154152

155153
VOLUME [ "${WWW_PATH_ROOT}/files", "${WWW_PATH_ROOT}/public" ]
156154

157-
RUN chmod +x "/usr/local/bin/${BUILD_PKP_TOOL}-start"
155+
# RUN chmod +x "/usr/local/bin/${BUILD_PKP_TOOL}-start"
156+
RUN chmod +x "/usr/local/bin/pkp-start"
158157

159158
RUN echo "===============================================================" \
160159
&& echo " ---> PKP application: ${PKP_TOOL}" \

Dockerfile.expanded

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
# Default context
2+
ARG BUILD_PKP_TOOL=omp \
3+
BUILD_PKP_VERSION=3.3.0-21 \
4+
BUILD_PKP_APP_PATH=/app \
5+
BUILD_WEB_SERVER=php:8.1-apache \
6+
BUILD_OS=alpine:3.18 \
7+
BUILD_LABEL=notset
8+
9+
# GET PKP CODE
10+
FROM ${BUILD_OS} AS pkp_code
11+
12+
# Context
13+
ARG BUILD_PKP_TOOL \
14+
BUILD_PKP_VERSION \
15+
BUILD_PKP_APP_PATH
16+
17+
RUN apk add --update --no-cache curl tar \
18+
&& mkdir "${BUILD_PKP_APP_PATH}"
19+
20+
WORKDIR "/${BUILD_PKP_APP_PATH}"
21+
22+
# ADD is supossed to download, extract and remove, but there is an issue with some docker
23+
# versions so, for compatibility, doing it manually: https://github.com/moby/moby/issues/33849
24+
# ADD "https://pkp.sfu.ca/$BUILD_PKP_TOOL/download/$BUILD_PKP_TOOL-$BUILD_PKP_VERSION.tar.gz" "$BUILD_PKP_APP_PATH"
25+
26+
RUN curl -Ss -O "https://pkp.sfu.ca/${BUILD_PKP_TOOL}/download/${BUILD_PKP_TOOL}-${BUILD_PKP_VERSION}.tar.gz" \
27+
&& tar --strip-components=1 -xvzf "${BUILD_PKP_TOOL}-${BUILD_PKP_VERSION}.tar.gz" -C "${BUILD_PKP_APP_PATH}" > /tmp/untar.lst
28+
29+
RUN echo "===============================================================" \
30+
&& echo " ---> PKP application: ${PKP_TOOL}" \
31+
&& echo " ---> Version: ${BUILD_PKP_VERSION}" \
32+
&& echo "==============================================================="
33+
34+
35+
# GET & SET THE LAMP
36+
FROM ${BUILD_WEB_SERVER}
37+
38+
RUN echo "===============================================================" \
39+
&& echo " ---> Web server: ${BUILD_WEB_SERVER} (over debian)" \
40+
&& echo "==============================================================="
41+
42+
# TODO:
43+
# - Concatenate calls to reduce the layers
44+
# - Replace with PKP_variables when possible
45+
# - Remove "vim" in production image
46+
# - Ensure all required packages and php extensions
47+
# - Test with OJS, OMP and OPS.
48+
# - Redirect log output to stdout & FILE.
49+
50+
# Context
51+
ARG BUILD_PKP_TOOL \
52+
BUILD_PKP_VERSION \
53+
BUILD_LABEL \
54+
BUILD_PKP_APP_PATH
55+
56+
LABEL maintainer="Public Knowledge Project <marc.bria@uab.es>"
57+
LABEL org.opencontainers.image.vendor="Public Knowledge Project"
58+
LABEL org.opencontainers.image.title="PKP ${BUILD_PKP_TOOL} Web Application"
59+
LABEL org.opencontainers.image.description="Runs a ${BUILD_PKP_TOOL} application over Apache"
60+
LABEL build_version="Docker for ${BUILD_PKP_TOOL} ${BUILD_PKP_VERSION} - Build-date: ${BUILD_LABEL}"
61+
62+
# ARGs only work during building time, so they need to be exported to ENVs:
63+
ENV PKP_TOOL="${BUILD_PKP_TOOL:-ojs}" \
64+
PKP_VERSION="${BUILD_PKP_VERSION:-3.3.0-16}" \
65+
SERVERNAME="localhost" \
66+
WWW_USER="www-data" \
67+
WWW_PATH_CONF="/etc/apache2/apache2.conf" \
68+
WWW_PATH_ROOT="/var/www" \
69+
HTTPS="on" \
70+
PKP_CLI_INSTALL="0" \
71+
PKP_DB_HOST="localhost" \
72+
PKP_DB_USER="${MYSQL_USER:-pkp}" \
73+
PKP_DB_PASSWORD="${MYSQL_PASSWORD:-changeMe}" \
74+
PKP_DB_NAME="${MYSQL_DATABASE:-pkp}" \
75+
PKP_WEB_CONF="/etc/apache2/conf.d/$BUILD_PKP_TOOL.conf" \
76+
PKP_CONF="config.inc.php" \
77+
PKP_CMD="/usr/local/bin/${BUILD_PKP_TOOL:-ojs}-start"
78+
79+
80+
# Basic packages (todo: Remove what don't need to be installed)
81+
ENV PACKAGES="cron rsyslog apache2-utils ca-certificates vim"
82+
83+
# DEV packages are not required in production images.
84+
ENV PACKAGES_DEV="zlib1g-dev libmcrypt-dev libonig-dev libpng-dev libxslt-dev libpng-dev libfreetype6-dev libjpeg62-turbo-dev libzip-dev"
85+
86+
# PHP extensions
87+
ENV PHP_EXTENSIONS="gd gettext iconv intl mbstring mysqli pdo_mysql xml xsl zip"
88+
89+
# Extension names as required by docker-php-ext-* helpers. Possible values are:
90+
# bcmath bz2 calendar ctype curl dba dom enchant exif ffi fileinfo filter ftp gd gettext gmp hash iconv imap intl json ldap mbstring mysqli oci8 odbc opcache pcntl pdo pdo_dblib pdo_firebird pdo_mysql pdo_oci pdo_odbc pdo_pgsql pdo_sqlite pgsql phar posix pspell readline reflection session shmop simplexml snmp soap sockets sodium spl standard sysvmsg sysvsem sysvshm tidy tokenizer xml xmlreader xmlwriter xsl zend_test zip
91+
92+
93+
WORKDIR ${WWW_PATH_ROOT}/html
94+
95+
# For Debian:
96+
RUN apt-get update && apt-get install -y ${PACKAGES} ${PACKAGES_DEV}
97+
98+
# By default GD don't include jpeg and freetype support:
99+
RUN docker-php-ext-configure gd --with-freetype --with-jpeg
100+
101+
# Installing PHP extensions:
102+
RUN docker-php-ext-install -j$(nproc) ${PHP_EXTENSIONS}
103+
104+
# Enable installed extensions:
105+
RUN docker-php-ext-enable ${PHP_EXTENSIONS}
106+
107+
# Enable mod_rewrite and mod_ssl
108+
RUN a2enmod rewrite ssl
109+
110+
# Building PKP-TOOL (ie: OJS):
111+
112+
# Get the code
113+
COPY --from=pkp_code "${BUILD_PKP_APP_PATH}" .
114+
115+
# Create directories
116+
RUN mkdir -p /etc/ssl/apache2 "${WWW_PATH_ROOT}/files" /run/apache2
117+
# Make php/conf.d indpendent of the php version:
118+
RUN PHP_INI_DIR=$(php --ini | grep "Configuration File (php.ini) Path" | cut -d: -f2 | xargs) \
119+
&& mkdir -p "$PHP_INI_DIR/conf.d" \
120+
&& mkdir -p "/etc/php" \
121+
&& ln -sfn "$PHP_INI_DIR/conf.d" /etc/php/conf.d
122+
# Redirect logs to stdout
123+
RUN echo "log_errors = On" >> /etc/php/conf.d/log-errors.ini \
124+
&& echo "error_log = /dev/stderr" >> /etc/php/conf.d/log-errors.ini
125+
# OJS config
126+
RUN echo "PKP_CONF: ${PKP_CONF}"
127+
RUN cp -a config.TEMPLATE.inc.php "${WWW_PATH_ROOT}/html/${PKP_CONF}"
128+
RUN chown -R ${WWW_USER}:${WWW_USER} "${WWW_PATH_ROOT}"
129+
# Prepare freefont for captcha
130+
# && ln -s /usr/share/fonts/TTF/FreeSerif.ttf /usr/share/fonts/FreeSerif.ttf \
131+
132+
# Prepare crontab
133+
RUN echo "0 * * * * pkp-run-scheduled" | crontab -
134+
# Prepare httpd.conf
135+
RUN sed -i -e '\#<Directory />#,\#</Directory>#d' ${WWW_PATH_CONF}
136+
RUN sed -i -e "s/^ServerSignature.*/ServerSignature Off/" ${WWW_PATH_CONF}
137+
# Clear the image (files to be deleted were in exclude.list but this is not required with multi-build).
138+
RUN rm -rf /tmp/*
139+
RUN rm -rf /root/.cache/* \
140+
RUN apt-get clean autoclean \
141+
&& apt-get autoremove --yes
142+
143+
# # Optional: Some folders are not required (as .git .travis.yml test .gitignore .gitmodules ...)
144+
# && find . -name ".git" -exec rm -Rf '{}' \; \
145+
# && find . -name ".travis.yml" -exec rm -Rf '{}' \; \
146+
# && find . -name "test" -exec rm -Rf '{}' \; \
147+
# && find . \( -name .gitignore -o -name .gitmodules -o -name .keepme \) -exec rm -Rf '{}' \;
148+
149+
COPY "templates/common/$BUILD_PKP_TOOL/root/" /
150+
151+
RUN echo "${BUILD_PKP_TOOL}-${BUILD_PKP_VERSION} [build:" $(date "+%Y%m%d-%H%M%S") "]" > "${WWW_PATH_ROOT}/container.version" \
152+
&& rm -f "${BUILD_PKP_TOOL}-${BUILD_PKP_VERSION}.tar.gz" \
153+
&& cat "${WWW_PATH_ROOT}/container.version"
154+
155+
EXPOSE 80
156+
EXPOSE 443
157+
158+
VOLUME [ "${WWW_PATH_ROOT}/files", "${WWW_PATH_ROOT}/public" ]
159+
160+
RUN chmod +x "/usr/local/bin/${BUILD_PKP_TOOL}-start"
161+
162+
RUN echo "===============================================================" \
163+
&& echo " ---> PKP application: ${PKP_TOOL}" \
164+
&& echo " ---> Version: ${BUILD_PKP_VERSION}" \
165+
&& echo " ---> BUILD ID: $(cat ${WWW_PATH_ROOT}/container.version)" \
166+
&& echo " ---> Run: ${PKP_CMD}" \
167+
&& echo "==============================================================="
168+
169+
CMD "${PKP_CMD}"

docker-compose.traefik.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ services:
4040
# - ./volumes/public:/var/www/html/public
4141
# - ./volumes/logs/app:/var/log/apache2
4242
# # WARNING: You can only enable file-volumes if file exists in the container.
43-
# - ./volumes/config/ojs.config.inc.php:/var/www/html/config.inc.php
43+
# - ./volumes/config/pkp.config.inc.php:/var/www/html/config.inc.php
4444
- ./volumes/config/apache.htaccess:/var/www/html/.htaccess
4545
# - ./volumes/php.custom.ini:/usr/local/etc/php/conf.d/custom.ini
4646

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ services:
1616
# - ./volumes/db:/var/lib/mysql
1717
# - ./volumes/logs/db:/var/log/mysql
1818
# - ./volumes/config/db.charset.conf:/etc/mysql/conf.d/charset.cnf
19-
# - ./volumes/migration:/docker-entrypoint-initdb.d
19+
# - ./volumes/db-import:/docker-entrypoint-initdb.d
2020
networks:
2121
- inside
2222
restart: unless-stopped
@@ -40,7 +40,7 @@ services:
4040
# - ./volumes/public:/var/www/html/public
4141
# - ./volumes/logs/app:/var/log/apache2
4242
# # WARNING: You can only enable file-volumes if file exists in the container.
43-
# - ./volumes/config/ojs.config.inc.php:/var/www/html/config.inc.php
43+
# - ./volumes/config/pkp.config.inc.php:/var/www/html/config.inc.php
4444
- ./volumes/config/apache.htaccess:/var/www/html/.htaccess
4545
- ./volumes/config/php.custom.ini:/usr/local/etc/php/conf.d/custom.ini
4646

templates/common/ojs/env

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
# PKP Tool:
2-
PKP_TOOL="ojs"
3-
PKP_VERSION="3.3.0-21"
4-
51
# Set your journal Tag:
6-
COMPOSE_PROJECT_NAME=demo
7-
PROJECT_DOMAIN=demo.localhost
8-
SERVERNAME=${PROJECT_DOMAIN}
2+
COMPOSE_PROJECT_NAME=journal
3+
PROJECT_DOMAIN=journal.localhost
4+
SERVERNAME=$PROJECT_DOMAIN
95

106
# Web Server:
117
# PHP_INI_DIR="/etc/php/8.1"
@@ -17,15 +13,18 @@ WEB_PATH="/var/www/html"
1713
# Database:
1814
# MYSQL_VERSION=10.3
1915
MYSQL_ROOT_PASSWORD=changeRootPlease
20-
MYSQL_USER=${PKP_TOOL}
16+
MYSQL_USER=pkp
2117
MYSQL_PASSWORD=changeMePlease
22-
MYSQL_DATABASE=${PKP_TOOL}
18+
MYSQL_DATABASE=pkp
2319

24-
OMP_CLI_INSTALL=0
25-
OMP_DB_HOST=db
26-
OMP_DB_DRIVER=mysqli
27-
OMP_DB_USER=${MYSQL_USER}
28-
OMP_DB_PASSWORD=changeMePlease
29-
OMP_DB_NAME=${PKP_TOOL}
30-
OMP_WEB_CONF="/etc/apache2/conf.d/$PKP_TOOL.conf"
31-
OMP_CONF="/var/www/html/config.inc.php"
20+
# PKP Tool:
21+
PKP_TOOL="ojs"
22+
PKP_VERSION="${PKP_VERSION:-3.3.0-21}"
23+
PKP_CLI_INSTALL=0
24+
PKP_DB_HOST=db
25+
PKP_DB_DRIVER=mysqli
26+
PKP_DB_USER=pkp
27+
PKP_DB_PASSWORD=changeMePlease
28+
PKP_DB_NAME=pkp
29+
PKP_WEB_CONF="/etc/apache2/conf.d/pkp.conf"
30+
PKP_CONF="/var/www/html/config.inc.php"

0 commit comments

Comments
 (0)