walterhiggins / ScriptCraft

Write Minecraft Plugins in JavaScript.
MIT License
1.84k stars 378 forks source link

Provide a Docker image #333

Open upayavira opened 7 years ago

upayavira commented 7 years ago

Would you accept a Dockerfile that allows you to push an image to the Docker Hub?

With this, installation could be reduced to something like:

docker run -e EULA=true -p25565:25565 walterhiggins/ScriptCraft

If this would be accepted, I'm happy to provide a patch.

TonyGravagno commented 7 years ago

This note about Docker is in the documentation but I have no idea if the container is still available or the status.

I'm not a Docker guy yet but if you are perhaps you can help to guide and respond to Q&A on this topic.

What can we do to get a container updated whenever the project itself is updated?

walterhiggins commented 6 years ago

A Dockerfile might be useful - thanks. However, ScriptCraft as used by beginning programmers will typically run ScriptCraft/Minecraft locally. I'm not really sure how useful a Dockerfile would be to this audience.

TonyGravagno commented 6 years ago

See docs/Installation.md in my latest update. To help educators avoid that effort, a Docker container with everything built-in would be very helpful.

However, it is illegal to distribute the Spigot.JAR. We cannot get around that.

We can greatly avoid the problems of installation and distribution by supporting Paper in v4+. Paper is a fork of Spigot, independently maintained, and (to my current understanding) not subject to DMCA/licensing issues. I will look into this as time permits.

jonathanperret commented 6 years ago

The way Paper purports to work around licensing issues is by distributing a JAR that actually contains a binary diff between a Spigot-like JAR and the vanilla Mojang JAR. By downloading the vanilla JAR on startup and applying the diff, they obtain a JAR that is very similar to the JAR obtained with a regular Spigot build (using BuildTools). As far as I know, the actual legality of that approach is untested. But in any case, I don't expect there would be anything to do on ScriptCraft's side to "support" Paper — as far as I understand, they are only adding to the Bukkit API so ScriptCraft should run as-is.

There's nothing problematic however in distributing a Docker image that runs BuildTools, and you can find several on the Docker Hub that do just that (e.g. https://hub.docker.com/r/dlord/spigot/). A ScriptCraft image based on one of those would be quite simple to design, I think.

As to whether it would be useful to people wanting to run ScriptCraft locally I'm not sure I follow. Docker runs perfectly on personal computers (it's on Windows now, even!) and is in fact an excellent way to avoid having to install Java, run BuildTools to get a Spigot JAR, etc. — as @upayavira said a published Docker image could indeed reduce the setup instructions to a one-liner.

TonyGravagno commented 6 years ago

I just had a nice chat with the Paper developers. Paper is a fork of Spigot but now it's completely separate. Yes, you start with the MC JAR, then apply Paper patches which takes a few minutes rather than the long BuildTools time. The result is not the same as Spigot. With BuildTools you get a custom build every time, depending on the condition of the sources you load. With Paper, everyone gets the same build because it's the same MC jar and the same Paper patches.

Here are notes on how Paper differs from Spigot. Paper does extend Spigot/Bukkit. And both conform to Bukkit, and ScriptCraft should work as-is with Paper, just by setting the __bukkit flat to true when Paper is detected. But if/when requests for Paper-specific features come in we will need to add __paper checking within __bukkit, and ensure that Paper API requests only go to that engine.

As far as Docker goes, I think we have four primary options: 1) Near-term: Distribute a container that has BuildTools and underpinnings built-in so that a user can follow the instructions and build their own server. After Spigot.jar has been generated, everything afterward is trivial. 2) Mid-term: Distribute a container that has BuildTools and underpinnings built-in so that the container can build its own Spigot.jar. Setup a script that allows for a single-command build of everything, start/stop the server, move the scriptcraft.jar into plugins after the first server start, and then restart the MC server. From here a user just needs to create a new MultiPlayer server definition in-game and point to their local server:port. 3) Longer-term: Hold off on containers until we understand Paper and can similar script it and support its nuances. 4) Unless there is more demand, maybe the thing to do is to provide instructions under /docs for how to create a container rather than making it a part of this project to support/offer one (for Spigot and/or Paper).

upayavira commented 6 years ago

To answer Walters implied question about whether and how a Dockerfile would be useful...

Docker encapsulates complex installations beautifully. Your installation instructions could be:

It will then download everything and start listening on port 80.

Given the spigot issues described above, this is not as simple to achieve as one might hope, but I would argue it could make the project much easier to get started with.

(As an example - I have just worked with an app that was running a custom compile of nginx on production servers, seemingly installed manually. A maintenance nightmare. Fortunately I found the sources, and was able to wrap it in Docker, so now I can compile the nginx into a Docker image and run it anywhere, without having to worry about any of those complexities.)

tclavier commented 5 years ago

Hello, I'm the maintainer of the docker container describe in documentation. It's available and and you can follow official doc to use it.

You can also use directly our public server available on minecraft.tcweb.org

The docker container is describe her : https://github.com/tclavier/docker-scriptcraft/blob/master/Dockerfile you can see I use scriptcraft 3.4.0 (the last release available on github) with spigot 1.13.2 (the last version compatible with scriptcraft).

jwulf commented 5 years ago

Two different Scriptcraft docker images with a cli to control them - one for Bukkit and one for Nukkit:

https://blog.magikcraft.io/how-to-mod-minecraft-without-java-f076ddaec01c