BlueMap

BlueMap

31.4k Downloads

Incorrect default values provided in configuration file comments

KW46 opened this issue ยท 3 comments

commented

What i did / Steps to reproduce

I was setting BlueMap up to run in docker with its own database container (using docker compose).
I ignored the "run BlueMap jar to generate configuration files" instruction from wiki, and instead created configuration files manually, only adding entries that bypass default values. As reference, I used https://github.com/BlueMap-Minecraft/BlueMap/tree/master/BlueMapCommon/src/main/resources/de/bluecolored/bluemap/config

Expected result

Configuration option webroot from files webserver.conf and webapp.conf, and configuration option data from file core.conf to have default values as provided in comments. Where:
webroot = "bluemap/web"
data = "bluemap"
Or, expected result is: comment default values showing actual default values

Actual result

Actual default values were:
webroot = "web"
data = "data"

Context

My environment:

  • Docker container holding bluemap webserver/app and a database
  • Minecraft server uploading mapdata to the database

Purpose this environment: Display 2 maps on the web app: A live map from a running server, and display a static map (map of a non existing server), and keep webapp online even if the minecraft server is offline

Even though the following data is not relevant at all (since all that needs to be done for this issue to fix is to update comments), I'm including this anyway because:

  1. It's always nice to give a full picture of a specific environment in issue report
  2. Since this is a very specific setup, might help other people setting up such an environment
  3. I'm not 100% sure I set things up right (<!> specifically, see the sql.php part)

Context: Minecraft server

Stores mapdata to docker database (see Context: BlueMap webapp below)

./plugins/BlueMap/core.conf

accept-download: true
render-thread-count: 1

./plugins/BlueMap/plugin.conf

hide-sneaking: true
write-markers-interval: 10
write-players-interval: 3

(Note that at the time of writing, map is being generated and no tests have been done yet to see if live map (showing players) is working)
./plugins/BlueMap/webapp.conf

enabled: false

./plugins/BlueMap/webserver.conf

enabled: false

./plugins/BlueMap/maps/skellige.conf

world: "skellige"
dimension: "minecraft:overworld"
name: "Skellige"
sorting: 128
remove-caves-below-y: -10000
cave-detection-uses-block-light: true
storage: "sql"

./plugins/BlueMap/storages/sql.conf

storage-type: sql
connection-url: "jdbc:mariadb://127.0.0.1:3360/bluemap"
connection-properties: {
    user: "bluemap",
    password: "VerySecretPassword"
}

Context: BlueMap webapp

Docker container that includes the BlueMap webserver, and database

./docker-compose.yml

services:
  db:
    container_name: bluemap-db
    hostname: bluemap-db
    image: mariadb:11.4.2-ubi9
    restart: always
    ports:
      - 127.0.0.1:3360:3306/tcp
    env_file: .db.env
    volumes:
      - ./db:/var/lib/mysql
    healthcheck:
      test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
      start_period: 10s
      interval: 10s
      timeout: 5s
      retries: 3

  app:
    container_name: bluemap-app
    hostname: bluemap-app
    image: ghcr.io/bluemap-minecraft/bluemap:v5.2
    restart: always
    entrypoint: java -jar cli.jar -r -w # Note: Can just be "command: -r -w" but since I failed several times, I switched to entrypoint, never changed it back
    # More specifically, used "java -cp" to try to add mariadb java client jar to classpath.
    # At this point I wasn't aware of this being configurable in storages/sql.conf, oops
    ports:
      - 127.0.0.1:8100:8100/tcp
    volumes:
      - ./bluemap/config:/app/config
      - ./bluemap/data:/app/data
      - ./bluemap/web:/app/web
      - ./jdbc-connector:/jdbc-connector # Directory containing MariaDB JDBC driver .jar file "mariadb-client-java.jar"
    depends_on:
      db:
        condition: service_healthy

./.db.env

MARIADB_RANDOM_ROOT_PASSWORD=true
MARIADB_ROOT_HOST=localhost
MARIADB_DATABASE=bluemap
MARIADB_USER=bluemap
MARIADB_PASSWORD=VerySecretPassword
MARIADB_HOST=*

./bluemap/config/core.conf

accept-download: true
data: "data"

./bluemap/config/webapp.conf

enabled: true
webroot: "web"

./bluemap/config/webserver.conf

enabled: true
webroot: "web"
port: 8100

./bluemap/storages/sql.conf

storage-type: sql
connection-url: "jdbc:mariadb://db:3306/bluemap"
connection-properties: {
        user: "bluemap",
        password: "VerySecretPassword"
}
driver-jar: "/jdbc-connector/mariadb-java-client.jar" # See docker-compose.yml
driver-class: "org.mariadb.jdbc.Driver"

./bluemaps/maps/skellige.conf

storage: "sql"

./bluemap/web/sql.php

(unchanged)

I just realized this now. According to https://bluemap.bluecolored.de/wiki/webserver/ExternalWebserversSQL.html :
BlueMap renders and saves the map on your SQL-Server. But the webapp requests them like they would be in a normal file-storage inside the webroot. So we need some script that is translating those requests and fetching and providing the correct files from the SQL-Server.
This no longer applies when MariaDB JDBC connector was added?, and map is configured to use sql?
Got stuck on this configuration part for a while and while sharing my configuration files I noticed I didn't set this file on current testrun (which is working fine so far - except I didn't test live users showing on map, and running multiple servers)

/etc/httpd/sites.d/SUBDOMAIN_CONFIG_FILE
To add to the Also sharing this for people that'd like a similar environment part:
As you can see, both bluemap-app and bluemap-db are listening to 127.0.0.1 (thus this wouldn't work for external minecraft servers).
A subdomain is used to connect to the container, which is fully dedicated to showing the BlueMap app. Configuration for that website (using httpd/Apache):

(...)
<VirtualHost *:443>
        #(...) Server* settings

        #(...) SSL settings

        #(...) Header STP setting

        #<!> NOTE: No DocumentRoot or <Directory> config

        ErrorDocument 502 "<p>BlueMap container is booting, check again in a minute...</p>"
        ErrorDocument 503 "<p>BlueMap container is down</p>"

        ProxyPreserveHost On
        ProxyPass / http://127.0.0.1:8100/
</VirtualHost>

EDIT:
Upon reviewing this issue, I realized my real issue was using port 3360 instead of 3306 in webapp storage sql configuration file. (especially since it appears sql.php is not relevant)
However, this doesn't take away the issue of actual bug report: provided default values in comments are incorrect

commented

The default values are correct for all versions of bluemap .. except the bluemap-cli version :D
The paths are a little different there, as they make more sense in a normal cli-usecase.

I agree that the comments should be fixed for the cli-version, we can just add a placeholder to the config-template and fill it with the correct values via code :)


According to https://bluemap.bluecolored.de/wiki/webserver/ExternalWebserversSQL.html : [...]
This no longer applies when MariaDB JDBC connector was added?, and map is configured to use sql?

So actually this wiki-page talks about hosting bluemap directly from the database using an "external webserver" like nginx or apache without any bluemap-cli webserver, but what you are doing is reverse-proxying everything from the "external" webserver to bluemap-cli's "integrated" webserver .. which then indeed doesn't need all this fancy config and also doesn't need the sql.php either :)

commented

except the bluemap-cli version :D LOL
I did indeed think it was a bit weird (the given default values).

talks about hosting bluemap directly from the database using an "external webserver"
Ah, quite obviously actually (I read that as external server, as in, not minecraft server - I already found it all a bit weird lol). Thanks for clearing that up ๐Ÿ‘Œ