Compare commits
2 commits
4ada31f21a
...
943db56009
| Author | SHA1 | Date | |
|---|---|---|---|
| 943db56009 | |||
| fa94f0e23d |
1 changed files with 60 additions and 56 deletions
114
README.md
114
README.md
|
|
@ -7,40 +7,51 @@ This system is designed from the ground up to be modular, easily configurable, a
|
||||||
## ✨ Features
|
## ✨ Features
|
||||||
|
|
||||||
* **Automated Map Generation:** Leverages `minetestmapper` to create high-resolution PNG maps of your game worlds.
|
* **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.
|
* **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 [Leaflet.js](https://leafletjs.com/), powered by the generated map tiles.
|
* **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.
|
* **Live Player Tracking:** Dynamically fetches and displays player locations as markers on the live map, including custom-styled popups and permanent name labels.
|
||||||
* **Map Archive:** Automatically saves a daily snapshot of the map and makes it available through a dropdown viewer on the world detail page.
|
* **Map Archive:** Automatically saves a daily snapshot of the map and makes it available through a toggle on the world detail page.
|
||||||
* **Template-Driven Site Generation:** Builds all static HTML pages from simple, customizable templates.
|
* **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 sub-config file for every of your worlds.
|
* **Flexible Configuration:** Configuration is easy with a central global config and a `web.conf`-file for every of your worlds.
|
||||||
* **Automation-Ready:** Designed for unattended execution via scheduling tools like cron.
|
* **Automation-Ready:** Designed for unattended execution via scheduling tools like `cron`.
|
||||||
|
|
||||||
## 🔧 Prerequisites
|
## 🔧 Prerequisites
|
||||||
|
|
||||||
To run this system, the following software packages must be installed on your server:
|
To run this system, the following software packages must be installed on your server:
|
||||||
|
|
||||||
* **bash:** The scripting language used for the entire project.
|
* **bash:** The scripting language used for the entire project.
|
||||||
* **ImageMagick:** Required for `identify` (to read image dimensions) and `convert` (to resize images).
|
* **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`
|
* *Debian/Ubuntu Install:* `sudo apt-get install imagemagick`
|
||||||
* **GDAL/OGR:** Provides the `gdal2tiles.py` script for tile generation.
|
* **GDAL/OGR:** Provides the `gdal2tiles.py` script for tile generation.
|
||||||
* *Debian/Ubuntu Install:* `sudo apt-get install gdal-bin python3-gdal`
|
* *Debian/Ubuntu Install:* `sudo apt-get install gdal-bin python3-gdal`
|
||||||
* **minetestmapper:** The executable used to render maps from world data. This must be placed within the project directory.
|
* **SQLite3:** The command-line tool for reading SQLite databases, required by `sync_players.sh`.
|
||||||
|
* *Debian/Ubuntu Install:* `sudo apt-get install sqlite3`
|
||||||
|
* **bc:** The "basic calculator" command-line tool, required for calculations in `sync_players.sh`.
|
||||||
|
* *Debian/Ubuntu Install:* `sudo apt-get install bc`
|
||||||
|
* **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.
|
* **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
|
## ⚙️ Installation & Setup
|
||||||
|
|
||||||
### 1. Clone the Repository
|
### 1. Project Files
|
||||||
|
|
||||||
Download the **latest build** from the [Releases-Page](https://git.geigernet.eu/rainer/luanti-web/releases) and save it to your server's base directory, such as `/opt/luweb/`.
|
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
|
OR
|
||||||
|
|
||||||
Clone all project files to a base directory on your server.
|
Clone the Git repository to a base directory.
|
||||||
|
|
||||||
```
|
```bash
|
||||||
git clone https://git.geigernet.eu/rainer/luanti-web.git /opt/luweb
|
git clone https://git.geigernet.eu/rainer/luanti-web.git /opt/luweb
|
||||||
cd /opt/luweb
|
cd /opt/luweb
|
||||||
chmod +x generate_map.sh generate_site.sh
|
# Make all scripts executable
|
||||||
|
chmod +x generate_map.sh generate_site.sh check_server_status.sh check_dependencies.sh sync_players.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2. Global Configuration
|
### 2. Global Configuration
|
||||||
|
|
@ -50,53 +61,47 @@ The main configuration file is `config.sh`. You must edit this file to match you
|
||||||
**Key variables in `config.sh`:**
|
**Key variables in `config.sh`:**
|
||||||
|
|
||||||
* `BASE_SCRIPT_DIR`: The root directory of the project (e.g., `/opt/luweb`).
|
* `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 (e.g., `<server-path>/worlds/`), docker compatible.
|
* `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`).
|
* `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`).
|
* `LOG_DIR_BASE`: The directory where log files will be written (e.g., `/var/log/luweb`).
|
||||||
|
|
||||||
### 3. Per-World Configuration
|
### 3. Per-World Configuration
|
||||||
|
|
||||||
For each world you want to feature on the website, a `web.conf` file must exist within that world's data directory (e.g., `<server-path>/worlds/my_world/web.conf`). This file allows you to override global defaults with world-specific settings.
|
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.
|
||||||
|
|
||||||
A minimal `web.conf` could look like this and is automatically created for every detected world in your `MINETESTMAPPER_WORLD_DATA_BASE_PATH`:
|
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.
|
||||||
|
|
||||||
```bash
|
|
||||||
# Display name for the world
|
|
||||||
WORLD_DISPLAY_NAME="My Creative World"
|
|
||||||
|
|
||||||
# Server connection details
|
|
||||||
SERVER_ADDRESS="your-server.com"
|
|
||||||
SERVER_PORT="30001"
|
|
||||||
|
|
||||||
# A short description for the world overview page
|
|
||||||
WORLD_SHORT_DESCRIPTION="A brief, catchy description of this world."
|
|
||||||
|
|
||||||
# A detailed HTML description for the world's detail page
|
|
||||||
WORLD_LONG_DESCRIPTION="<p>A longer description with <b>HTML</b> support.</p>"
|
|
||||||
```
|
|
||||||
|
|
||||||
## 📂 Directory Structure
|
## 📂 Directory Structure
|
||||||
|
|
||||||
The system expects the following directory structure:
|
The system now uses a modular structure to improve maintainability:
|
||||||
```md
|
```md
|
||||||
/opt/luweb/
|
/opt/luweb/
|
||||||
├── config.sh
|
├── config.sh
|
||||||
├── generate_map.sh
|
├── generate_map.sh
|
||||||
├── generate_site.sh
|
├── generate_site.sh
|
||||||
|
├── check_server_status.sh
|
||||||
|
├── check_dependencies.sh
|
||||||
|
├── sync_players.sh
|
||||||
├── minetestmapper (executable)
|
├── minetestmapper (executable)
|
||||||
├── site_generator/
|
├── site_generator/
|
||||||
|
│ ├── functions/
|
||||||
|
│ │ ├── 01_utils.sh
|
||||||
|
│ │ ├── 02_init.sh
|
||||||
|
│ │ ├── 03_html_helpers.sh
|
||||||
|
│ │ └── generators/
|
||||||
|
│ │ ├── css_generator.sh
|
||||||
|
│ │ ├── main_orchestrator.sh
|
||||||
|
│ │ ├── static_pages_generator.sh
|
||||||
|
│ │ ├── world_detail_generator.sh
|
||||||
|
│ │ └── world_overview_generator.sh
|
||||||
│ ├── templates/
|
│ ├── templates/
|
||||||
│ │ ├── world_detail_page.template
|
│ │ ├── world_detail_page.template
|
||||||
│ │ ├── world_detail_archive.template
|
|
||||||
│ │ └── ...
|
│ │ └── ...
|
||||||
│ └── examples/
|
│ └── examples/
|
||||||
│ └── web.conf.template
|
│ └── web.conf.template
|
||||||
├── web_content/
|
├── web_content/
|
||||||
│ ├── images/
|
│ ├── images/
|
||||||
│ │ └── players/
|
|
||||||
│ └── static/
|
│ └── static/
|
||||||
│ ├── startseite_content.html
|
|
||||||
│ └── ...
|
|
||||||
└── worldmaps_output/
|
└── worldmaps_output/
|
||||||
└── <world_name>/
|
└── <world_name>/
|
||||||
├── map.png
|
├── map.png
|
||||||
|
|
@ -105,38 +110,37 @@ The system expects the following directory structure:
|
||||||
|
|
||||||
## 🚀 Usage
|
## 🚀 Usage
|
||||||
|
|
||||||
The scripts are designed to be run from the command line, either manually or via automated jobs.
|
### 1. Map Generation
|
||||||
|
|
||||||
### 1. Map and Tile Generation
|
|
||||||
|
|
||||||
The `generate_map.sh` script creates the map, tiles, and archive images for a specific world. It must be called with the "world key" (the name of the world's directory) as an argument.
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Generate map assets for the world located in the 'world' directory
|
./generate_map.sh <world_key>
|
||||||
./generate_map.sh world
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2. Website Generation
|
### 2. Website Generation
|
||||||
|
|
||||||
The `generate_site.sh` script builds the entire website (overview, detail pages, etc.). It scans all configured world directories and creates a detail page for each one.
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Generate the complete website
|
|
||||||
./generate_site.sh
|
./generate_site.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
### 3. Automation (Cronjob)
|
### 3. Status & Player Sync
|
||||||
|
```bash
|
||||||
|
./check_server_status.sh
|
||||||
|
./sync_players.sh <world_key>
|
||||||
|
```
|
||||||
|
|
||||||
For fully automatic operation, setting up cronjobs is recommended.
|
### 4. Automation (Cronjob)
|
||||||
|
|
||||||
**Example for `crontab -e`:**
|
**Example for `crontab -e`:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Generate map assets for the 'world' every 30 minutes
|
# Update player data every minute
|
||||||
*/30 * * * * /opt/luweb/generate_map.sh world >> /var/log/luweb/cron.log 2>&1
|
* * * * * /opt/luweb/sync_players.sh world >> /var/log/luweb/cron.log 2>&1
|
||||||
|
|
||||||
# Re-build the website every 12 hours
|
# Check server online status every 5 minutes
|
||||||
* */12 * * * /opt/luweb/generate_site.sh >> /var/log/luweb/cron.log 2>&1
|
*/5 * * * * /opt/luweb/check_server_status.sh >> /var/log/luweb/cron.log 2>&1
|
||||||
|
|
||||||
|
# Generate map and tiles once per hour
|
||||||
|
0 * * * * /opt/luweb/generate_map.sh world >> /var/log/luweb/cron.log 2>&1
|
||||||
|
|
||||||
|
# Re-build the static site twice a day
|
||||||
|
30 */12 * * * /opt/luweb/generate_site.sh >> /var/log/luweb/cron.log 2>&1
|
||||||
```
|
```
|
||||||
|
|
||||||
## 📄 License
|
## 📄 License
|
||||||
|
|
@ -161,5 +165,5 @@ 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
|
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
||||||
OR OTHER DEALINGS IN THE SOFTWARE.
|
OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
## 👤 Authors
|
## 👤 Autoren
|
||||||
* **Rage87** (Main-Developer)
|
* **Rage87** (Main-Developer)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue