CanastaWiki / Canasta

MediaWiki Docker image for Canasta, an all-in-one MediaWiki stack for easy deployment and management of enterprise-ready MediaWiki on production environments.
https://www.canasta.wiki
MIT License
38 stars 28 forks source link

localhost not resolving correctly leading to 502 error #441

Closed silverhikari closed 1 month ago

silverhikari commented 1 month ago

Describe the bug

Summary: problem with localhost not resolving correctly

Description: running docker compose script, and after doing fixes such as creating /mediawiki, try running the script and review compose logs reports that apache can not servername and defaults to some random ip from 172.20.0.2 to 172.20.0.6. setting ServerName localhost in apache.conf did not work(add via volumes)(caused the used random ip to list a varnish cache error). also tried disabling caddy but that changed nothing.

Steps to reproduce the behavior:

  1. create mediawiki dir and add volumes link ./mediawiki:/mediawiki under web in override
  2. Run docker compose up -d
  3. open webpage to localhost:80
  4. see error 502

Expected behavior

System info

Please complete the following information:

silverhikari commented 1 month ago

.env

PORT=80
HTTPS_PORT=443
MYSQL_PASSWORD=mediawiki
MW_SITE_SERVER=https://localhost
MW_SITE_FQDN=localhost
PHP_UPLOAD_MAX_FILESIZE=10M
PHP_POST_MAX_SIZE=10M
PHP_MAX_INPUT_VARS=1000
MW_SITEMAP_SUBDIR=
MW_SITEMAP_IDENTIFIER=mediawiki
USE_EXTERNAL_DB=false

docker-compose.override.yml

# The above version is the Docker Compose manifest's version, not the Canasta Docker Compose stack's version.
#
# --- Canasta Stack for Docker Compose ---
#
# If you need to make changes to the stack, make them here.
# Only edits to docker-compose.override.yml are officially supported by Canasta.
#
# Uncomment the commented services and add lines below them if you would like to make additional customizations to them.
services:
  #db:
  web:
    image: ghcr.io/canastawiki/canasta:2.0.1
    volumes:
        - ./mediawiki:/mediawiki
        # - ./apache2.conf:/etc/apache2/apache2.conf
  #elasticsearch:
  #caddy:
  #varnish:
jeffw16 commented 1 month ago

Why add the MediaWiki volume mapping?

jeffw16 commented 1 month ago

And what happens when you try to get the Apache error log from within the container? You can get it by doing something along the lines of docker compose exec web bash tail /var/log/apache2/error.log

silverhikari commented 1 month ago

Why add the MediaWiki volume mapping?

if i don't when starting it will complain about /mediawiki needing a persistent storage and just get stuck repeating that.

And what happens when you try to get the Apache error log from within the container? You can get it by doing something along the lines of docker compose exec web bash tail /var/log/apache2/error.log

took me a minute to relize i had to do the bash part then run the tail as trying to do it in one line does not seem to work

here is the apache2 log:

Error linking file /var/log/apache2/access_log_20240922 to /var/log/apache2/access_log.current (File exists)
AH00106: piped log program '/usr/bin/rotatelogs -c -f -l -p /rotatelogs-compress.sh -L /var/log/apache2/access_log.current /var/log/apache2/access_log_%Y%m%d 86400' failed unexpectedly
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.20.0.6. Set the 'ServerName' directive globally to suppress this message
[Sun Sep 22 04:58:39.216710 2024] [mpm_event:notice] [pid 414:tid 414] AH00489: Apache/2.4.61 (Debian) mod_fcgid/2.3.9 configured -- resuming normal operations
[Sun Sep 22 04:58:39.216816 2024] [core:notice] [pid 414:tid 414] AH00094: Command line: '/usr/sbin/apache2 -D FOREGROUND'
silverhikari commented 1 month ago

well after reviewing the log after enabling the apache.conf it disables the messages but still sets that random ip address instead of localhost.

though now going to localhost give a err_connection_refused

yaronkoren commented 1 month ago

@silverhikari - sorry for the delay. What was the exact error message(s) you saw before adding the mediawiki/ volume, and any other fixes you tried?

silverhikari commented 1 month ago

for the medawiki folder issue this is the error "Folder /mediawiki contains important data and must be mounted to persistent storage!". this solution was discussed in issue #436.

silverhikari commented 1 month ago

well tried again with a new compose override and just added the mediawiki folder fix and seems to work now.

in the issue number above i did the advice of disabling caddy and disabling caddy make it not bind the ports. so it seems this was less of issue and more of a me not understanding how the different parts of the cansta wiki stack work

yaronkoren commented 1 month ago

That's great to hear! Thank you for your patience.