Skip to content

Commit 86b7b80

Browse files
committed
remove apache and fix startup script
1 parent bdd2902 commit 86b7b80

File tree

2 files changed

+18
-39
lines changed

2 files changed

+18
-39
lines changed

Dockerfile

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ ENV MW_VERSION=REL1_39 \
1010
MW_ORIGIN_FILES=/mw_origin_files \
1111
MW_VOLUME=/mediawiki \
1212
WWW_USER=www-data \
13-
WWW_GROUP=www-data \
14-
APACHE_LOG_DIR=/var/log/apache2
13+
WWW_GROUP=www-data
1514

1615
# System setup
1716
RUN set x; \
@@ -21,7 +20,6 @@ RUN set x; \
2120
&& aptitude -y upgrade \
2221
&& aptitude install -y \
2322
git \
24-
apache2 \
2523
software-properties-common \
2624
gpg \
2725
apt-transport-https \
@@ -58,20 +56,15 @@ RUN set x; \
5856
php7.4-apcu \
5957
php7.4-redis \
6058
php7.4-curl \
61-
php7.4-zip \
59+
php7.4-zip \
60+
php7.4-fpm \
6261
&& aptitude clean \
6362
&& rm -rf /var/lib/apt/lists/*
6463

6564
# Post install configuration
6665
RUN set -x; \
67-
# Remove default config
68-
rm /etc/apache2/sites-enabled/000-default.conf \
69-
&& rm /etc/apache2/sites-available/000-default.conf \
70-
&& rm -rf /var/www/html \
71-
# Enable rewrite module
72-
&& a2enmod rewrite \
7366
# Create directories
74-
&& mkdir -p $MW_HOME \
67+
mkdir -p $MW_HOME \
7568
&& mkdir -p $MW_ORIGIN_FILES \
7669
&& mkdir -p $MW_VOLUME
7770

@@ -631,34 +624,25 @@ ENV MW_ENABLE_JOB_RUNNER=true \
631624
LOG_FILES_REMOVE_OLDER_THAN_DAYS=10
632625

633626
COPY _sources/configs/msmtprc /etc/
634-
COPY _sources/configs/mediawiki.conf /etc/apache2/sites-enabled/
635-
COPY _sources/configs/status.conf /etc/apache2/mods-available/
636627
COPY _sources/configs/php_error_reporting.ini _sources/configs/php_upload_max_filesize.ini /etc/php/7.4/cli/conf.d/
637-
COPY _sources/configs/php_error_reporting.ini _sources/configs/php_upload_max_filesize.ini /etc/php/7.4/apache2/conf.d/
638-
COPY _sources/configs/php_max_input_vars.ini _sources/configs/php_max_input_vars.ini /etc/php/7.4/apache2/conf.d/
639-
COPY _sources/configs/php_timeouts.ini /etc/php/7.4/apache2/conf.d/
628+
COPY _sources/configs/php_error_reporting.ini _sources/configs/php_upload_max_filesize.ini /etc/php/7.4/fpm/conf.d/
640629
COPY _sources/scripts/*.sh /
641630
COPY _sources/scripts/*.php $MW_HOME/maintenance/
642631
COPY _sources/configs/robots.txt $WWW_ROOT/
643632
COPY _sources/configs/.htaccess $WWW_ROOT/
644633
COPY _sources/images/favicon.ico $WWW_ROOT/
645634
COPY _sources/canasta/LocalSettings.php _sources/canasta/CanastaUtils.php _sources/canasta/CanastaDefaultSettings.php $MW_HOME/
646635
COPY _sources/canasta/getMediawikiSettings.php /
647-
COPY _sources/configs/mpm_prefork.conf /etc/apache2/mods-available/mpm_prefork.conf
648636

649637
RUN set -x; \
650638
chmod -v +x /*.sh \
651639
# Sitemap directory
652640
&& ln -s $MW_VOLUME/sitemap $MW_HOME/sitemap \
653-
# Comment out ErrorLog and CustomLog parameters, we use rotatelogs in mediawiki.conf for the log files
654-
&& sed -i 's/^\(\s*ErrorLog .*\)/# \1/g' /etc/apache2/apache2.conf \
655-
&& sed -i 's/^\(\s*CustomLog .*\)/# \1/g' /etc/apache2/apache2.conf \
656641
# Make web installer work with Canasta
657642
&& cp "$MW_HOME/includes/NoLocalSettings.php" "$MW_HOME/includes/CanastaNoLocalSettings.php" \
658643
&& sed -i 's/MW_CONFIG_FILE/CANASTA_CONFIG_FILE/g' "$MW_HOME/includes/CanastaNoLocalSettings.php" \
659-
# Modify config
660-
&& sed -i '/<Directory \/var\/www\/>/,/<\/Directory>/ s/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf \
661-
&& a2enmod expires
644+
# Enable environment variables for FPM workers
645+
&& sed -i '/clear_env/s/^;//' /etc/php/7.4/fpm/pool.d/www.conf
662646

663647
COPY _sources/images/Powered-by-Canasta.png /var/www/mediawiki/w/resources/assets/
664648

_sources/scripts/run-apache.sh

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ prepare_extensions_skins_symlinks
102102
# note that this command will also set all the necessary permissions
103103
echo "Syncing files..."
104104
rsync -ah --inplace --ignore-existing --remove-source-files \
105-
-og --chown=$WWW_GROUP:$WWW_USER --chmod=Fg=rw,Dg=rwx \
105+
-og --chown=$WWW_USER:$WWW_GROUP --chmod=Fg=rw,Dg=rwx \
106106
"$MW_ORIGIN_FILES"/ "$MW_VOLUME"/
107107

108108
# We don't need it anymore
@@ -122,17 +122,10 @@ echo "Checking permissions of $MW_VOLUME..."
122122
if dir_is_writable $MW_VOLUME; then
123123
echo "Permissions are OK!"
124124
else
125-
chown -R "$WWW_GROUP":"$WWW_GROUP" "$MW_VOLUME"
125+
chown -R "$WWW_USER":"$WWW_GROUP" "$MW_VOLUME"
126126
chmod -R g=rwX "$MW_VOLUME"
127127
fi
128128

129-
echo "Checking permissions of $APACHE_LOG_DIR..."
130-
if dir_is_writable $APACHE_LOG_DIR; then
131-
echo "Permissions are OK!"
132-
else
133-
chown -R "$WWW_GROUP":"$WWW_GROUP" $APACHE_LOG_DIR
134-
chmod -R g=rwX $APACHE_LOG_DIR
135-
fi
136129

137130
jobrunner() {
138131
sleep 3
@@ -157,6 +150,13 @@ transcoder() {
157150
sitemapgen() {
158151
sleep 3
159152
if isTrue "$MW_ENABLE_SITEMAP_GENERATOR"; then
153+
echo "Checking permissions of $MW_VOLUME/sitemap"
154+
if dir_is_writable $MW_VOLUME/sitemap; then
155+
echo "Permissions are OK!"
156+
else
157+
chown -R "$WWW_USER":"$WWW_GROUP" "$MW_VOLUME/sitemap"
158+
chmod -R g=rwX "$MW_VOLUME/sitemap"
159+
fi
160160
# Fetch & export script path for sitemap generator
161161
if [ -z "$MW_SCRIPT_PATH" ]; then
162162
MW_SCRIPT_PATH=$(get_mediawiki_variable wgScriptPath)
@@ -223,10 +223,5 @@ jobrunner &
223223
transcoder &
224224
sitemapgen &
225225

226-
############### Run Apache ###############
227-
# Make sure we're not confused by old, incompletely-shutdown httpd
228-
# context after restarting the container. httpd won't start correctly
229-
# if it thinks it is already running.
230-
rm -rf /run/httpd/* /tmp/httpd*
231-
232-
exec /usr/sbin/apachectl -DFOREGROUND
226+
# waiting for maintainenece scripts
227+
wait

0 commit comments

Comments
 (0)