Code Monkey home page Code Monkey logo

core's Introduction

Build Status Discord License

NodeMC is a Minecraft hosting solution, and API provider, written in Node.js and powered by open-source software

Helpful Links

Greenkeeper badge

Official Documentation

Official Website

Discord Support Server

Requirements

  • Docker

  • docker-compose (usually included with Docker)

Running

Running NodeMC is easy.

DO NOT RUN npm install, INSTEAD REBUILD CONTAINER.

docker-compose build is your friend.

git clone https://github.com/NodeMC/CORE.git NodeMC

cd NodeMC

cp config/config.example.js config/config.js

docker-compose up

Then navigate to http://localhost:3000 and go through the setup process.

Maintainers

Jared Allard Mathew Da Costa
Jared Allard Mathew Da Costa

Contributions from other developers are welcome, check out CONTRIBUTING.md before you submit a pull request.

Credits

Various OSS modules are used in this project, please check package.json for the extended list of them.

License

MIT

core's People

Contributors

gmemstr avatar greenkeeper[bot] avatar jaredallard avatar kayila avatar mdcfe avatar xarses avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

core's Issues

Docker support

It'd be nice to have a Dockerfile and have automatic tagging and pushing to Docker's repository.

SSL cert exipired

When navigating to https://docs.nodemc.space/ I get this message in Chrome:

This server could not prove that it is docs.nodemc.space; its security certificate expired 2 days ago. This may be caused by a misconfiguration or an attacker intercepting your connection. Your computer's clock is currently set to Tuesday, May 24, 2016. Does that look right? If not, you should correct your system's clock and then refresh this page.

You need to update your Let's Encrypt cert. You should setup a cron job to check and update it every week automatically to prevent this in the future.

Firewalled server not running

The server I would like to run this on is firewalled & part of an network that is not connected to the internet (which I can not change)... this means that it will never run because it tries to access a lot of pages, could make it such that it does not do this:

/Users/Tristan/Minecraft/NodeMC-CORE/Main.js:246
throw err;
^
http://ifconfig.co/x-real-ip : Error: connect EHOSTDOWN 188.113.88.193:80 - Local (0.0.0.0:0),http://icanhazip.com/ : Error: connect EHOSTDOWN 64.182.208.181:80 - Local (0.0.0.0:0),http://ifconfig.io/ip : Error: connect EHOSTDOWN 104.27.153.130:80 - Local (0.0.0.0:0),http://ip.appspot.com/ : Error: connect EHOSTDOWN 216.58.212.177:80 - Local (0.0.0.0:0),http://curlmyip.com/ : Error: connect EHOSTDOWN 184.106.112.172:80 - Local (0.0.0.0:0),http://ident.me/ : Error: connect EHOSTDOWN 176.58.123.25:80 - Local (0.0.0.0:0),http://whatismyip.akamai.com/ : Error: connect EHOSTDOWN 2.16.4.192:80 - Local (0.0.0.0:0),http://tnx.nl/ip : Error: connect EHOSTDOWN 193.200.132.187:80 - Local (0.0.0.0:0),http://myip.dnsomatic.com/ : Error: connect EHOSTDOWN 67.215.92.215:80 - Local (0.0.0.0:0),http://ipecho.net/plain : Error: connect EHOSTDOWN 146.255.36.1:80 - Local (0.0.0.0:0),http://diagnostic.opendns.com/myip : Error: connect EHOSTDOWN 74.125.136.121:80 - Local (0.0.0.0:0)

v6 not starting

I am running the master branch version with no problems :-) But i tried the v6 fork and it will not start:

Node v6.2.2

npm install gives the following warnings:

npm WARN deprecated [email protected]: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue

node server gives:

Failed to read config. This is OK on first run.
Current version: 6.0.0
main: INIT stage 0 (preinit): Started
main: INIT stage 0 (preinit): Finished
main: INIT stage 1 (express::construct): Started
main: INIT stage 1: mount route auth on /v2/auth
main: INIT stage 1: mount route download on /v2/download
main: INIT stage 1: mount route files on /v2/files
main: INIT stage 1: mount route firstrun on /v2/firstrun
main: INIT stage 1: mount route server on /v2/server
TypeError: Cannot read property 'close' of undefined
    at process.on.e (/Users/Tristan/Minecraft/MC/server.js:219:22)
    at emitOne (events.js:96:13)
    at process.emit (events.js:188:7)
    at process._fatalException (node.js:258:21)
Failed to close the Minecraft server log stream.
/Users/Tristan/Minecraft/MC/lib/express.js:99
        throw err;
        ^

ReferenceError: server is not defined
    at Object.<anonymous> (/Users/Tristan/Minecraft/MC/backend/routes/server.js:13:47)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at /Users/Tristan/Minecraft/MC/lib/express.js:76:24
    at /Users/Tristan/Minecraft/MC/node_modules/async/dist/async.js:4637:20

[Feature Request] Multi Server Support

What is the possibility of adding in functionality to allow one to have multiple servers. While one could spin up an instance for each server you are effectively doubling port usage. .

[Feature Request] Add Paperclip, Spigot BuildTools and custom jar support

Add support for Paperclip to always get an up-to-date version of PaperSpigot and for BuildTools to be able to compile the chosen version of either CraftBukkit or Spigot without relying on an external build server. A drop down box on the setup page might be a good way to do this, and would mean we can add support for other servers like Sponge (Vanilla/Forge) and Cauldron at a later date.

(node-temp might be useful for BuildTools.)

Server Start

So currently I have downloaded the repo, and done npm install but when I run it I get the following:

/home/minecraft/Panel/NodeMC-CORE/Main.js:383
tails.jarfile_directory) || fs.mkdirSync(details.jarfile_directory, 0o777, tru
                                                                    ^
SyntaxError: Unexpected token ILLEGAL
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:902:3

Can you have a look please?

I am running Ubuntu Server 14.04:2

Error thrown on last step of setup


| ~/code/NodeMC-CORE @ Antons-MacBook-Pro (necrogami)
| => node Main.js
Naviagte to http://localhost:3000 to set up NodeMC.
Generating new API key
New API key saved
Error: ENOENT: no such file or directory, mkdir ''
at Error (native)
at Object.fs.mkdirSync (fs.js:842:18)
at /Users/necrogami/code/NodeMC-CORE/Main.js:302:56
at Layer.handle as handle_request
at next (/Users/necrogami/code/NodeMC-CORE/node_modules/express/lib/router/route.js:131:13)
at Route.dispatch (/Users/necrogami/code/NodeMC-CORE/node_modules/express/lib/router/route.js:112:3)
at Layer.handle as handle_request
at /Users/necrogami/code/NodeMC-CORE/node_modules/express/lib/router/index.js:277:22
at Function.process_params (/Users/necrogami/code/NodeMC-CORE/node_modules/express/lib/router/index.js:330:12)
at next (/Users/necrogami/code/NodeMC-CORE/node_modules/express/lib/router/index.js:271:10)
Error: ENOENT: no such file or directory, mkdir ''
at Error (native)
at Object.fs.mkdirSync (fs.js:842:18)
at /Users/necrogami/code/NodeMC-CORE/Main.js:302:56
at Layer.handle as handle_request
at next (/Users/necrogami/code/NodeMC-CORE/node_modules/express/lib/router/route.js:131:13)
at Route.dispatch (/Users/necrogami/code/NodeMC-CORE/node_modules/express/lib/router/route.js:112:3)
at Layer.handle as handle_request
at /Users/necrogami/code/NodeMC-CORE/node_modules/express/lib/router/index.js:277:22
at Function.process_params (/Users/necrogami/code/NodeMC-CORE/node_modules/express/lib/router/index.js:330:12)
at next (/Users/necrogami/code/NodeMC-CORE/node_modules/express/lib/router/index.js:271:10)

Missing slash in file path

Error: Invalid or corrupt jarfile /Users/necrogami/.nodemc/jarfilesvanilla.1.8.9.jar
Error: Invalid or corrupt jarfile /Users/necrogami/.nodemc/jarfilesvanilla.1.8.9.jar

Reimplement the plugin system

Add support for events to the plugin system, which will make it much more versatile than v5's one.

  • Add plugin loading
  • Add plugin construction
  • Add core event manager setup (registering events and listeners)
  • Add routes support (based on libs/express.js, passing a express#Router to the plugin to construct them)
  • Add an event manager which emits events to plugins (see below)
  • Migrate command routes and MC logging to use events
  • Add APIs for authentication and sockets
  • Probably something I forgot

Plugin Loading and Construction

Plugins will have to provide either:

  • a single file (.js/.node) in plugins/,
  • a module inside its own subdirectory in plugins/, or
  • a file named index.js in the plugin's subdirectory.

For an example module, see plugins/sampleplugin.js.

Plugin Routes

When plugins are constructed (probably after they have all been loaded) an lib/plugin/api#API will be passed to them. They will have access to the plugin loader itself as well as helpful methods from the API class. This will allow them more freedom than v5's ref/route system allowed. (Compare this to libs/express.js.)

Events Managers

In libs/events.js there will be the event manager. Plugins will be able to listen to (and cancel some of) the events which the server fires. There will be a core event manager for NodeMC itself and an event manager for plugins to fire events (might be useful for inter-plugin communication).
Plugins can fire core events to control the server.

There will be three types of events - regular, one-time and final. By default, events will run asynchronously unless specified.

Planned NodeMC events

  • log - Fired whenever Minecraft outputs to either stdout or stderr. Cancellable; if cancelled, message will not be logged to frontend.
    {text: "This is an error", type: "err"}
  • command - Fired whenever a frontend or plugin tries to fire a command. Cancelable; if cancelled, command will not be sent to server.
    {command: "help"}
  • start - Fired whenever NodeMC tries to start Minecraft (all starts including restarts).
    Cancelable.
  • restart - Fired whenever NodeMC tries to restart Minecraft.
    Cancelable.
  • stop - Fired whenever NodeMC tries to stop Minecraft.
    Cancelable.
  • crash - Fired whenever Minecraft stops without NodeMC triggering it.
  • auth - Fired whenever the frontend tries to authenticate. (This is not an authentication plugin API!)

(May fire events upon stage changes)

Stages to add

  • Core event creation
  • Core event attaching
  • Plugin loading
  • Plugin construction

See branch NodeMC/v6-events.

ES6: Use async/await

Well, since node 7 pretty much supports this out of the box, why not use async/await? This would make the code much more structurally sound and more synchronous like, less callbacks and less });

If no issues, I'll probably do this while I'm on a train for 7 hours without internet on Saturday.

/cc @gmemstr @md678685

[Feature Request] Not start server at startup

Is it possible to have a option not to start the server at startup? Such that I can toggle it on when i want to play with my friend and turn it off when not needed.

If it's already started on my server it takes like 40% cpu idle (the jar that is) which is twice the amount all the other stuff use combined :-) And after every reboot I forget to stop it...

And did I read it correctly there a rest api/json call, or sometime I can call from my home domoticz to start or stop it? That would be sweet!

docker-entrypoint.sh contains CR characters with Windows host

Issue and Steps to Reproduce

When using Windows as a host, if the repo is cloned with Git and core.autocrlf is true, Git will convert the line endings of the files to CRLF. This causes issues when the docker-entrypoint.sh script is copied into the container, as the added CRs are preserved, causing a confusing error message to appear:

': No such file or directorycute 'sh

Expected Behavior

Docker starts NodeMC Core successfully and the container doesn't immediately exit.

Actual Behavior

The arangodb container starts successfully, but the nodemc container shows errors then exits.

Versions

  • Node: 8.5.0
  • Client OS: Windows
  • NodeMC Version: v6 - core is at 7b9a529

Additional Details

This can be temporarily resolved by stripping CRs before the container is built, for example using a tool like dos2unix. Ideally this could be done at build time to reduce the chance of user error.

This was briefly mentioned in #support on the Discord server.

Kill server correctly

Instead of killing the server process with SIGTERM, shouldn't it be done safely doing something like

this.execute("stop");

so the server can shut itself down and not potentially lose data?

Forge in NodeMC

Hey i'm a user of NodeMC and want to use forge how do i do that

Trying to start the server throws errors.

When i try to start the server i get this: ________________________________________________________________________________
| ~/code/NodeMC-CORE @ Antons-MacBook-Pro (necrogami)
| => node Main.js
Generating new API key
/Users/necrogami/code/NodeMC-CORE/Main.js:497
serverSpawnProcess.on('exit', function(code) {
^

TypeError: Cannot read property 'on' of undefined
at Object. (/Users/necrogami/code/NodeMC-CORE/Main.js:497:19)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Function.Module.runMain (module.js:447:10)
at startup (node.js:141:18)
at node.js:933:3

After which the server_files/properties.json file is now empty. I can replace the contents with the contents from github but still when running the node Main.js it happens again.


| ~/code/NodeMC-CORE @ Antons-MacBook-Pro (necrogami)
| => npm version
{ nodemc: '1.0.0',
npm: '3.7.3',
ares: '1.10.1-DEV',
http_parser: '2.6.2',
icu: '56.1',
modules: '47',
node: '5.8.0',
openssl: '1.0.2g',
uv: '1.8.0',
v8: '4.6.85.31',
zlib: '1.2.8' }

CORS prevents using the API via Web.

Hi there, I've been trying to access the API from my own Dashboard which is a bit more complex than the one shipped with NodeMC-CORE and thus not compatible to the njs server.
When accessing the API from port 80 (web) you'll get an error (because of CORS) - this can be prevented by using the CORS plugin which is pretty nice, and can be secured as well - you might consider this.

I've (for now) implemented https://github.com/expressjs/cors in the script (3 line changes) and it's working like a charm.

Error "Failed to get the server properties!" (getServerProps/setport)

I think there is an issue in getServerProps().

When it is called for the first time in setport() (line 206), because srvprp is unitialized and the argument force is never used, the following if (l. 151) is always true.

if (!force || (typeof srvprp !== "undefined" && srvprp !== null)) 

Therefore, getServerProps() will just return srvprp, which is still uninitialized.

Thus, the if in setport() (l. 207)

if (props !== null)

will yield false and subsequently throw the error "Failed to get the server properties!" (l. 225).

The if in line 151 should be replaced with

if (!force && !!srvprp)

so that it will

  • always load server.properties if you force it to do so, regardless whether or not srvprp is defined.
  • always load server.properties if srvprp is not defined.
  • return srvprp only if it is defined and if you do not force it to load server.properties.

Raspberry pi error

every time i try to run NodeMC i get this error:

/home/pi/NodeMC-CORE/Main.js:383
tails.jarfile_directory) || fs.mkdirSync(details.jarfile_directory, 0o777, tru
                                                                    ^
SyntaxError: Unexpected token ILLEGAL
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:906:3

please help!

Can't restart after server crash

I'm running spigot 1.9 and had a crash. I tried both the stop and restart buttons on the NodeMC UI but neither worked. It looks like this is because both of those assume that the server is still running and NodeMC tries to write to the existing log output:

 serverSpawnProcess.stdin.write('say [NodeMC] Restarting server!\n');

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.