Skip to content

blockexchange/blockexchange_server

Repository files navigation

minetest blockexchange server software

Coverage Status

Docker Pulls Docker Image Size (latest by date) Discord

Discord-server: https://discord.gg/BEf8hGEQz9

Overview

Corresponding mod and more information: https://github.com/blockexchange/blockexchange

Running

Requirements

  • Running postgres database

Environment variables

Required:

  • PGUSER
  • PGPASSWORD
  • PGHOST
  • PGPORT
  • PGDATABASE
  • BLOCKEXCHANGE_KEY private key to sign the json web tokens with

Optional:

  • DISCORD_SCHEMA_FEED_URL discord webhook for the "new schema" feed
  • BASE_URL Application base url, used for redirects (without trailing slash)
  • GITHUB_APP_SECRET Github app secret key
  • GITHUB_APP_ID Github app ID
  • DISCORD_APP_SECRET Discord app secret key
  • DISCORD_APP_ID Discord app ID
  • MESEHUB_APP_SECRET Mesehub app secret key
  • MESEHUB_APP_ID Mesehub app ID

docker-compose usage

A docker-compose example:

version: "2"

services:
 blockexchange:
  image: blockexchange/blockexchange
  restart: always
  depends_on:
   - postgres
  environment:
   - PGUSER=postgres
   - PGPASSWORD=enter
   - PGHOST=postgres
   - PGDATABASE=postgres
   - PGPORT=5432
   - BLOCKEXCHANGE_NAME=My-Blockexchange
   - BLOCKEXCHANGE_OWNER=yourname
  ports:
   - "8080:8080"

 postgres:
  image: postgres:12
  restart: always
  environment:
   POSTGRES_PASSWORD: enter
  volumes:
   - "./data/postgres:/var/lib/postgresql/data"

Development

Web- and backend development

NOTE: make sure you checked out the submodules too

Prerequisites:

  • docker
  • docker-compose
  • nodejs
# install the frontend deps
cd public && npm ci && cd ..

# start the postgres server in the background
docker-compose up -d postgres

# start the blockexchange server
docker-compose up -d blockexchange

# start the minetest server
docker-compose up -d minetest

The blockexchange UI is at http://127.0.0.1:8080 and the minetest server is reachable via 127.0.0.1:30000

Serialized mapblock format

The on-disk format

-- exemplary metadata
metadata = {
	size = {x=16,y=16,z=16},
	node_mapping = {
		["air"] = 126,
		["default:stone"] = 127
	},
	-- block metadata
	metadata = {
		meta = {
			["(0,0,0)"] = {
				inventory = {},
				fields = {}
			}
		},
		timers = {
			["(0,0,0)"] = {
				timeout = 2.0,
				elapsed = 1.4
			}
		}
	}
}

-- node_id's (2 bytes) / param1 (1 byte) / param2 (1 byte)
data = {
	0,0,0,0
	-- etc
}

-- database format
serialized_metadata = minetest.compress(minetest.write_json(metadata), "deflate")
serialized_data = minetest.compress(data, "deflate")

Serialized example as json, byte-array is encoded as base64 over the wire:

{
	"data":"eJztwQENAAAMAqAHekijm8MNyEdVVVVVVVVVHX8AAAAAAAAAwLwCfjrAlw",
	"metadata":"eJw1ylsKgCAQRuG9/M8RBdLDbCYGnUJQk9Lognsvid4+OOeGl8SGE4NuJOtl3UAhO1cahMXI6DlGG+aajUycXSLNu4xWC0iptnvHzV5ShwPUD23X4PxxfSjlAYnOIYs",
	"offset_x":0.0,
	"offset_y":0.0,
	"offset_z":0.0,
	"order_id":0.0,
	"schema_id":"3a11f5d5-972c-43b9-a11f-1680af3148d1"
}

License

Code: MIT

Other assets

About

minetest blockexchange server software

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published