170 lines
7.5 KiB
Markdown
170 lines
7.5 KiB
Markdown
# Luanti-Web: A dynamic website-toolkit
|
|
|
|
Welcome to the Luanti Web Generator! Born from a passion for creative sandbox gaming, this hobby project provides a powerful, automated toolkit for generating a beautiful and feature-rich static website for your Minetest or Luanti server. Showcase your server, worlds, track your players, and inform your community.
|
|
|
|
This system is designed from the ground up to be modular, easily configurable, and perfect for small communities who want web presence without the hassle.
|
|
|
|
## ✨ Features
|
|
|
|
* **Automated Map Generation:** Leverages `minetestmapper` to create high-resolution PNG maps of your game worlds.
|
|
* **Performant Image Processing:** Uses `vips`, a high-performance and memory-efficient library, to scale even huge maps (tested up to 64k x 64k pixels) for the web.
|
|
* **Tiled Map Generation:** Uses `gdal2tiles.py` to create performant, zoomable map tiles for a smooth user experience.
|
|
* **Dynamic Map Viewer:** Implements an interactive map viewer using **OpenLayers**, powered by the generated map tiles, including digital zoom beyond the highest resolution.
|
|
* **Live Player Tracking:** Dynamically fetches and displays player locations as markers on the live map, including custom-styled popups.
|
|
* **Map Archive:** Automatically saves a daily snapshot of the map and makes it available through a dropdown viewer on the world detail page.
|
|
* **Template-Driven Site Generation:** Builds all static HTML pages from simple, customizable templates.
|
|
* **Flexible Configuration:** Configuration is easy with a central global config and a `web.conf` file for every one of your worlds.
|
|
* **Automation-Ready:** Designed for unattended execution via scheduling tools like `cron`.
|
|
|
|
## 🔧 Prerequisites
|
|
|
|
To run this system, the following software packages must be installed on your server:
|
|
|
|
* **bash:** The scripting language used for the entire project.
|
|
* **vips:** A high-performance image processing library that replaces `convert` (ImageMagick).
|
|
* *Debian/Ubuntu Install:* `sudo apt-get install libvips-tools`
|
|
* **ImageMagick:** Currently still required for the `identify` command (to read image dimensions).
|
|
* *Debian/Ubuntu Install:* `sudo apt-get install imagemagick`
|
|
* **GDAL/OGR:** Provides the `gdal2tiles.py` script for tile generation.
|
|
* *Debian/Ubuntu Install:* `sudo apt-get install gdal-bin python3-gdal`
|
|
* **minetestmapper:** The executable used to render maps from world data. Must be placed within the project directory.
|
|
* **iproute2:** Provides the `ss` command for `check_server_status.sh` (usually pre-installed on most systems).
|
|
* **Web Server:** A web server like Nginx or Apache is needed to serve the generated static files.
|
|
|
|
An included script (`check_dependencies.sh`) can automatically verify all important dependencies.
|
|
|
|
## ⚙️ Installation & Setup
|
|
|
|
### 1. Download/Clone Project Files
|
|
|
|
Download the **latest build** from the [Releases-Page](https://git.geigernet.eu/rainer/luanti-web/releases) and extract it to a base directory on your server, such as `/opt/luweb/`.
|
|
|
|
OR
|
|
|
|
Clone the Git repository to a base directory.
|
|
|
|
```bash
|
|
git clone [https://git.geigernet.eu/rainer/luanti-web.git](https://git.geigernet.eu/rainer/luanti-web.git) /opt/luweb
|
|
cd /opt/luweb
|
|
# Make all scripts executable
|
|
chmod +x generate_map.sh generate_site.sh check_server_status.sh check_dependencies.sh
|
|
```
|
|
|
|
### 2. Global Configuration
|
|
|
|
The main configuration file is `config.sh`. You must edit this file to match your server's environment.
|
|
|
|
**Key variables in `config.sh`:**
|
|
|
|
* `BASE_SCRIPT_DIR`: The root directory of the project (e.g., `/opt/luweb`).
|
|
* `MINETESTMAPPER_WORLD_DATA_BASE_PATH`: The path to your Minetest/Luanti worlds' data directory.
|
|
* `WEB_ROOT_PATH`: The document root of your website where the generated files will be placed (e.g., `/var/www/your-domain.com/web`).
|
|
* `LOG_DIR_BASE`: The directory where log files will be written (e.g., `/var/log/luweb`).
|
|
|
|
### 3. Per-World Configuration
|
|
|
|
The system is designed so that **only worlds with a `web.conf` file** will be displayed in the web frontend. This gives you full control over which worlds are publicly visible.
|
|
|
|
To add a world, copy the template `site_generator/examples/web.conf.template` into the data directory of the respective world (e.g., `<server-path>/worlds/my_world/web.conf`) and adjust the values.
|
|
|
|
## 📂 Directory Structure
|
|
|
|
The system now uses a modular structure to improve maintainability:
|
|
```md
|
|
/opt/luweb/
|
|
├── config.sh
|
|
├── generate_map.sh
|
|
├── generate_site.sh
|
|
├── check_server_status.sh
|
|
├── check_dependencies.sh
|
|
├── minetestmapper (executable)
|
|
├── site_generator/
|
|
│ ├── functions/
|
|
│ │ ├── 01_utils.sh
|
|
│ │ ├── 02_init.sh
|
|
│ │ ├── 03_html_helpers.sh
|
|
│ │ └── generators/
|
|
│ │ ├── css_generator.sh
|
|
│ │ ├── static_pages_generator.sh
|
|
│ │ ├── world_detail_generator.sh
|
|
│ │ └── world_overview_generator.sh
|
|
│ ├── templates/
|
|
│ │ ├── world_detail_page.template
|
|
│ │ └── ...
|
|
│ └── examples/
|
|
│ └── web.conf.template
|
|
├── web_content/
|
|
│ ├── images/
|
|
│ └── static/
|
|
└── worldmaps_output/
|
|
└── <world_name>/
|
|
├── map.png
|
|
└── map_info.txt
|
|
```
|
|
|
|
## 🚀 Usage
|
|
|
|
### 1. Map and Data Generation
|
|
|
|
The `generate_map.sh` script creates the map, tiles, and metadata for a specific world.
|
|
```bash
|
|
# Generate assets for the world in the 'world' directory
|
|
./generate_map.sh world
|
|
```
|
|
|
|
### 2. Website Generation
|
|
|
|
The `generate_site.sh` script builds the entire website for all worlds that have a `web.conf`.
|
|
```bash
|
|
# Generate the complete website
|
|
./generate_site.sh
|
|
```
|
|
|
|
### 3. Live Status Check
|
|
|
|
The `check_server_status.sh` script checks the online status of all configured worlds. It should be run very frequently.
|
|
```bash
|
|
# Check the server status
|
|
./check_server_status.sh
|
|
```
|
|
|
|
### 4. Automation (Cronjob)
|
|
|
|
Setting up cronjobs is recommended for fully automatic operation.
|
|
|
|
**Example for `crontab -e`:**
|
|
```bash
|
|
# Generate map assets for 'world' once per hour
|
|
0 * * * * /opt/luweb/generate_map.sh world >> /var/log/luweb/cron.log 2>&1
|
|
|
|
# Check the server status every 2 minutes
|
|
*/2 * * * * /opt/luweb/check_server_status.sh >> /var/log/luweb/cron.log 2>&1
|
|
|
|
# Re-build the website (e.g., for new admins, changed descriptions) twice a day
|
|
0 */12 * * * /opt/luweb/generate_site.sh >> /var/log/luweb/cron.log 2>&1
|
|
```
|
|
|
|
## 📄 License
|
|
**MIT License**
|
|
Copyright (c) 2025 Rage87 - rage87@geigernet.eu
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
in the Software without restriction, including without limitation the rights
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
The above copyright notice and this permission notice shall be included in all
|
|
copies or substantial portions of the Software.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
|
OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
## 👤 Authors
|
|
* **Rage87** (Main-Developer)
|