ferrumc-rs / ferrumc

A reimplementation of the minecraft server in rust.
MIT License
662 stars 16 forks source link

Feat: Docker Support/Automatic World Import from Java Edition. #60

Open cappuccinocosmico opened 2 days ago

cappuccinocosmico commented 2 days ago

Is your feature request related to a problem?

If someone is wanting to quickly spin up FerrumC to see the new features, or from browsing on reddit. The current process for this looks like:

  1. Git clone the project, install cargo and the rust toolchain.
  2. Compile the project and move the executable to a seperate folder.
  3. Spin up a version of regular minecraft, Install either a spigot plugin or fabric mod that could run a chunk pregenration task.
  4. Create a new world and run the chunkgen task.
  5. Wait for it to complete, then close the program, and cp the files over to the import directory.
  6. Run the executable with the --import flag, then start the server.

Describe the solution / feature you'd like.

An extremely ugly option to this would be to automate this pipeline with a docker compose, consisting of FerrumC, and a traditional minecrat docker image like https://docker-minecraft-server.readthedocs.io/en/latest/

On startup you would open the Java Edition Server, run the chunk pregen command, transfer them over to FerrumC using a docker volume and every minute or so import the region files in the docker volume into the FerrumC database.

Alternatives you've considered.

All the other options like doing direct API calls to Java Edition, will take much longer to implement, and also potentially mess up the rust code base. The main point of this would be to get you 40% of the benefits of worldgen while being hackable in 1-2 days.

Additional Context

fractalhuman on the discord

I have confimed that...

cappuccinocosmico commented 2 days ago

Super quick mock of what the docker compose might look like:


services:
  ferrumc:
    hostname: ferrumc
    build:
      context: ./
      dockerfile: ./Dockerfile
    volumes:
      - ./volumes/import_world:/app/import
    ports:      
      - "25565:25565"
    command:
      # TODO: Way to get it to run the ./ferrumc --import every 5 minutes or so, probably just set up a cron job in opening command
      - "./ferrumc"

  java-mc:
    image: itzg/minecraft-server
    volumes:
      - ./volumes/import_world:/data/region
    run:
      # Execute commands /chunky radius 2000 and /chunky start. or equivalents
      - "idk what command this would be"```
ReCore-sys commented 1 day ago

If you wanna PR a docker file and update the readme I'll merge it but we won't spend much development time or offer much support on it since streamlining the import process is pretty low down on the list of stuff to get done

cappuccinocosmico commented 14 hours ago

Yeah that makes a lot of sense, I might just throw together something really basic, import an example world from a CDN during the build and just proceed from there.