Git Product home page Git Product logo

rfwadmin's Introduction

rfwadmin

A web and/or command line interface for controlling a MineCraft server, optimized for quickly restarting with custom maps such as Race For Wool (RFW). It requires a Linux server.

To install

Essential steps:

  • Install supporting programs (tmux, java, apache, php, zip).
    • On Ubuntu/Debian/Mint: "sudo apt-get install tmux openjdk-7-jre libapache2-mod-php5 php5-curl wget zip unzip && /etc/init.d/apache2 restart". (The apache restart should be unnecessary, but is due to Debian bug 705350)
    • On Redhat/RHEL/CentOS the command should be "sudo yum -y install tmux java-1.7.0-openjdk php httpd php-curl wget zip unzip lsof". CentOS/RHEL 6 apparently doesn't have a tmux package, so you will have to install tmux in some other way; CentOS/RHEL 7 does have a tmux package. You also need to set "SELINUX=permissive" in /etc/sysconfig/selinux , or the web server will not be able to run the minecraft.sh shell script (any help on avoiding this is appreciated). Before running install.sh below, you also need to start the httpd daemon ("chkconfig httpd on && service httpd start").
  • Run ./install.sh from inside the unpacked rfwadmin directory. Tested on Debian, Ubuntu, and CentOS, but should work on any Linux/Unix.
  • If your server has the address http://example.com , then the web interface should now be available at http://example.com/rfwadmin
  • The install script will generate a random 10-character password for the web interface; you can change it by editing /var/www/rfwadmin/index.php (or /var/www/html/rfwadmin/index.php for redhat)

Optional steps:

  • On fx a default Ubuntu or CentOS install, upload_max_filesize in /etc/php5/apache2/php.ini is set too low for the map upload feature to work.
  • Running multiple servers: Right now fsroot is set up to run one server - to run more than one server, 1) add a /etc/init.d/minecraft2.sh file, 2) add a copy of the /var/www/rfwadmin/index.php file, and edit it, and 3) a /var/lib/minecraft/servers/2 dir. To make it start and stop with an Ubuntu server on boot, run the Ubuntu command "update-rc.d minecraft2.sh defaults". For Redhat based distributions, do "chkconfig --add minecraft2.sh".
  • You might want to set up a cron job to logrotate /var/lib/minecraft/servers/default/tmux.log . The web interface will automatically check and truncate this if it gets too big, but if the web interface is not loaded for months, this file can get 100s of MB big.

Configuration files

Most users should not need to adjust any settings from the default.

  • You can tweak where the files will be installed at the top of install.sh .
  • /var/lib/minecraft/servers/default/minecraft.sh configures how the minecraft server is run, e.g. memory usage.
  • The files below /var/lib/minecraft/servers/default/server , such as /var/lib/minecraft/servers/default/server/server.properties , is the normal minecraft configuration for a single Minecraft server.
  • If you are running multiple servers, or don't use the default /var/lib/minecraft location, you need to tweak the settings inside /var/www/rfwadmin/index.php
  • /var/www/rfwadmin/index.php also contains settings for the web interface.

Some directories and files explained

  • /var/lib/minecraft/maps : The web interface will save uploaded maps here
  • /var/lib/minecraft/jars : server jars and bukkit plugins jars. (the server jars should be managed from the web interface)
  • /var/lib/minecraft/minecraft_base.sh : The shell backend, used by init.d and the web interface
  • /var/lib/minecraft/servers/default/server : A normal minecraft server dir for the server I called "default" (The name "default" is not displayed to end-users).

Using command line interface

You can use rfwadmin as a command line interface by doing commands such as "sudo /etc/init.d/minecraft_default.sh start". Commands include "start", "stop", "restart", "list", "send_command save-all", "send_command op thuejk"; look it the bottom of /var/lib/minecraft/minecraft_base.sh for a list. The command line interface is a heavily modified version of mc-manager, much improved; I recommend always using the rfwadmin version over mc-manager, even if you don't need the web interface. To only use the command line interface without installing the rfwadmin web interface, simply don't install /var/www/rfwadmin/index.php .

Non-vanilla servers

rfwadmin works with Bukkit and Spigot servers. Other modded servers such as Feed the Beast should also work with rfwadmin, but I haven't tested that since running a FtB server in 2013.

About security

  • I think it is safe.
  • The web interface password is stored in unhashed plaintext in index.php, so if somebody can get shell access to your server, he can read it.
  • One possibly fishy thing is the "Or fetch from a direct link to a zip file:" feature, which will happily fetch a file from the internal network (fx 192.168.1.x), thereby bypassing any firewall. Though I don't see how it would benefit them to get this file fetched into the maps folder. Could be a Cross-site scripting problems if you have any web interfaces on the local net making changes using GET (which is why everybody says you should always use POST for such interfaces).

About quality

  • The PHP code should be mostly ok.
  • I make no claims to be an expert shell programmer.

Regards, Thue

rfwadmin's People

Contributors

gpmidi avatar itsmartin avatar thue 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rfwadmin's Issues

New Server Properties

Newish options have been added to server.properties that would be useful if added

op-permission-level=integer (1-4)
allow-nether=true/false
verify-names=true/false
announce-player-achievements=true/false
force-gamemode=true/false
player-idle-timeout=integer
here's a handy link to the wiki page http://minecraft.gamepedia.com/Server.properties

Also, "texture-pack" is now "resource-pack"

The nether (and end) not being saved is a problem for a new style of games that are played on the same map over and over

Some of us have been playing a series of extra hard UHC-like games on a single map (details here: http://www.reddit.com/r/tesseract/comments/1eyqov/hubris_mode_generations_a_community_series_of/ - it's a lot of fun, you should join us sometime). We only discovered today that the nether isn't saved between server restarts, and that is an issue for us. Since it is extra hard mode, the nether is absolutely terrifying, and we need to be able to slowly establish a safe zone there.

I'm guessing it's intended, to save space, but is it could you maybe add an option to save the nether and the end as well?

tmux issue

I am able to run tmux from the command prompt:
sudo /etc/init.d/minecraft_default.sh start

this works fine.

However, the webpage is unable to start or restart minecraft

On "restart":

Saving world... Saved!
Stopping Minecraft server ... Stopped!
Starting tmux session... failed to connect to server
Failed!

Not sure if server is running

I get a few odd error output near the end the install script

Starting Screen session... Started!
Starting Minecraft server... Command failed: java -Xms1024M -Xmx1024M -server -jar/var/lib/minecraft/jars/serverjars/minecraft_server.1.7.9.jar nogui & echo $! > /var/lib/minecraft/servers/default/minecraft.pid && fg; echo "MMMMinecraft is stopped"; exit

Started!

After that it exits normally and also shows that the server is running in the web interface but I'm not able to connect nor manage the server at all.
It also refuses to stop says that it's unable to save.
If I try to kill it It prints

Sending kill signal to first java process... 
Can't find screen id, so can't find screen pid
Couldn't find screen, so java presumably not running.
Minecraft process seems to have been killed!

Then I try to restart it resulting in the same situation as the first one

Starting Screen session... Started!
Starting Minecraft server... Command failed: java -Xms1024M -Xmx1024M -server -jar /var/lib/minecraft/jars/serverjars/minecraft_server.1.7.9.jar nogui & echo $! > /var/lib/minecraft/servers/default/minecraft.pid && fg; echo "MMMMinecraft is stopped"; exit
Started!

already tried deleting the /var/lib/minecraft directory and running the install script again, still the same problem
OS: Ubuntu 12.04
Anybody knows what's going on?
thanks in advance~

install.sh fails

New to PC Minecraft and though I'd give this a try, so I can help the young ones when I'm at work. When I try and run install.sh here's what I get (sorry for long post, I don't see any code tags):

Downloading latest minecraft server jar from Mojang.
--2013-08-07 17:20:50-- https://s3.amazonaws.com/Minecraft.Download/versions/
Resolving s3.amazonaws.com (s3.amazonaws.com)... 176.32.98.231
Connecting to s3.amazonaws.com (s3.amazonaws.com)|176.32.98.231|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 0 [binary/octet-stream]
Saving to: ‘fsroot/var/lib/minecraft/jars/serverjars/minecraft_server. "release": "1.6.2"\r.jar.tmp’

[ <=>                                                                                           ] 0           --.-K/s   in 0s      

2013-08-07 17:20:50 (0.00 B/s) - ‘fsroot/var/lib/minecraft/jars/serverjars/minecraft_server. "release": "1.6.2"\r.jar.tmp’ saved [0/0]

--2013-08-07 17:20:50-- ftp://%22release%22/
=> ‘.listing’
Resolving "release" ("release")... failed: No such file or directory.
wget: unable to resolve host address ‘"release"’
--2013-08-07 17:20:50-- http://%221.6.2%22%0D/minecraft_server.
Resolving "1.6.2"\r ("1.6.2"\r)... failed: No such file or directory.
wget: unable to resolve host address ‘"1.6.2"\r’
--2013-08-07 17:20:50-- ftp://%22release%22/
=> ‘.listing’
Resolving "release" ("release")... failed: No such file or directory.
wget: unable to resolve host address ‘"release"’
--2013-08-07 17:20:50-- http://%221.6.2%22%0D.jar/
Resolving "1.6.2"\r.jar ("1.6.2"\r.jar)... failed: No such file or directory.
wget: unable to resolve host address ‘"1.6.2"\r.jar’
install.sh: Failed to download minecraft server

Any ideas? Running Lubuntu 12.04

Feature Request - Ability for users to add server jars

The option to download and add Bukkit jars is pretty well broken and I kinda doubt will ever work again. BUT we could manage just fine if a feature was added to be able to add a server jar, similar to how we can upload our own Bukkit plugins!

Also calling some relevant names to this issue @parkervcp, @threetwo

Latest snapshots break RFWadmin

Recent snapshots break this. It's broken because of the new way that Mojang adds players by their UUID. Dunno if you guys are still into this stuff, but it was pretty useful for gpmidi and I for server loading and mapmaking purposes (the server reset/reload map was great for testing maps!).

Docker - Build Issue

The error below is occurring during the automatic build since Thue's changes were merged with mine in 55e8f2b.

Note: For the moment my Docker indexer/build account uses my git repo, not Thue's.

Marking Minecraft EULA as accepted in /var/lib/minecraft/servers/default/server/eula.txt (otherwise the server won't start) 
mkdir: created directory `/var/www/html/rfwadmin' 
`fsroot/var/www/index.php.customized' -> `/var/www/html/rfwadmin/index.php' 
su: incorrect password

The command [/bin/sh -c service httpd start   && sleep 5   && bash --login -c "cd /root/rfwadmin/ && /bin/bash /root/rfwadmin/install.sh && /etc/init.d/minecraft_default.sh stop"   && service httpd stop] returned a non-zero code: 125

Permission Issue

I am running Redhat on AWS.
Even after changing server.properties permission to 777, i am getting this error:


Warning: file_put_contents(/var/lib/minecraft/servers/default/server/server.properties): failed to open stream: Permission denied in /var/lib/minecraft/web/include/libs/properties.php on line 157
Failed to save server.properties. The web server user probably doesn't have permission to write that file.

Edit server.properties

It would be useful to be able to edit the server.properties file from the web interface.

Server Keeps Crashing

Anyone facing this issue?

Can't keep up! Did the system time change, or is the server overloaded?

I am running it on micro AWS linux

name_to_uuid() is broken

it appears that you have hard coded your name in the name_to_uuid function so that your uuid:
8f7b3387-e959-4b3b-84c8-0a27a2991b7d
is the only uuid returned.

you call name_to_uuid() with an argument... but don't use it.

public static function name_to_uuid() {
    $postData = array(
            'name' => 'thuejk',
            'agent' => 'minecraft',
    );

jack - not 8f7b3387-e959-4b3b-84c8-0a27a2991b7d

selection_082

Superfluous slash in PATH_SERVER

The trailing slash in PATH_SERVER="$PATH_BASE/servers/$SERVER_SUBDIR/" in the file minecraft_base.sh makes the java invocation have a double slash (before minecraft.pid).

Don't know if this will cause problems. But I removed it and it seems to work fine then at least.

Any command returns error:

stat: cannot stat '/var/lib/minecraft/servers/default/minecraft.sh.lock': No such file or directory
/var/lib/minecraft/minecraft_base.sh: line 660: ((: 1437525346 - > 30 : syntax error: operand expected (error token is "> 30 ")
Another process is currently running the server control script - aborting. The other process is:
cat: /var/lib/minecraft/servers/default/minecraft.sh.lock: No such file or directory
failed to lock!

Tried to give more RAM to server and BOOM

Hello.
I need your help as quick as you can provide me plz.
I tried to add more ram to my Minecraft Server and i did it by editing the file minecraft_base.sh
I couldn't add the Ram because it started to give this Bug.:

/var/lib/minecraft/minecraft_base.sh: line 12: $'\r': command not found
/var/lib/minecraft/minecraft_base.sh: line 14: $'\r': command not found
/var/lib/minecraft/minecraft_base.sh: line 17: $'\r': command not found
/var/lib/minecraft/minecraft_base.sh: line 63: syntax error near unexpected token $'{\r'' /var/lib/minecraft/minecraft_base.sh: line 63:function set_server_log() {

'

I managed to revert the changes but now this same error does not disapear.
Do you know what i should do to fix it?
The whole panel seems non responsive and i am not able to stop or reboot my server, however it is still running.

Plz help.
Thank you sir.

Missing Files

After Trying this Script, i did miss some files in my www Directory,
It seems that the folder rfwadmin_files is corrupted.

Docker outdated

Docker should be updated to reflect the switch from screen to tmux.

Documentation for supporting Spigot's Autorecovery scripts

Spigot has a line in it's config for autorecovery where you point it (usually at) start.sh and it'll just restart itself when it hangs. However, I'd love to have the documentation for what command needs to be put in it's place. I've tried using the one in /etc/init.d, and a few others, but none of the .sh scripts I've tried result in a successful autorecovery that reflects in the web admin.

Docker Image - Preview

I've created a first stab at a Docker image that includes both an env. for Minecraft to run and the rfwadmin web interface pre-configured. The tl;dr is that you run one command and Docker will download the image, run it, share out the required ports (local only, doesn't affect the user's border router for example), and "revert" any changes made to the system when done.

I should point out that the image does not include the Minecraft jar. When the UI is first launched you must use the UI to download and install one of the Minecraft server jars. The README.md in the "docker" directory includes a good bit of info. Although it's a long way from complete.

Any thoughts as to things that should be changed/added/removed before I toss a pull request your way?

https://github.com/gpmidi/rfwadmin

To run a non-persisted instance you could run:

docker.io run -i -t --publish="8080:80" --publish="25565:25565" --volume="/var/lib/minecraft/maps" --volume="/var/log" --volume="/var/lib/minecraft/servers/default/server" gpmidi/rfwadmin

Feature suggestion: API

For CotM, I would like to be able to automate things more. I would love to be able to use rfwadmin programatically to set up the server for a match, so that our referees don't need to directly access rfwadmin at all. For example, I would like our referee control panel to be able to do the following things:

  • Check the current status of the server (started or not)
  • Load a specific map
  • Enable / disable specific plugins or server jars
  • Start / restart / stop the server
  • Send console commands

I suspect this is all possible already by sending the appropriate POST requests, but it's difficult to work out exactly how to do it. So perhaps all that I need is some documentation :)

Upload maps error and GUI broken

I get the error message "unknown command!" then uploading a zip with a map. Is the maps supposed to live in a special folder structure in the zip?

The GUI seems to be broken for me also, see attacehd image.
2013-03-02 21-44-06

I'm running Ubuntu 12.10, a clean server install with apache and php 5.4.6

session issue

after running for a while.. I end up with:

apache 4785 4176 0 Dec06 ? 00:00:00 tail -f -n +0 /var/lib/minecraft/servers/default/server/logs/latest.log
apache 5534 4789 0 Dec06 ? 00:00:00 tail -f -n +0 /var/lib/minecraft/servers/default/server/logs/latest.log
apache 6250 5540 0 Dec06 ? 00:00:00 tail -f -n +0 /var/lib/minecraft/servers/default/server/logs/latest.log
apache 7809 14031 0 Dec08 ? 00:00:00 tail -f -n +0 /var/lib/minecraft/servers/default/server/logs/latest.log
apache 10682 13246 0 Dec12 ? 00:00:00 tail -f -n +0 /var/lib/minecraft/servers/default/server/logs/latest.log
apache 10938 14033 0 Dec12 ? 00:00:00 tail -f -n +0 /var/lib/minecraft/servers/default/server/logs/latest.log
apache 16512 10441 0 11:58 ? 00:00:00 tail -f -n +0 /var/lib/minecraft/servers/default/server/logs/latest.log
apache 16598 10445 0 11:59 ? 00:00:00 tail -f -n +0 /var/lib/minecraft/servers/default/server/logs/latest.log
apache 16726 16603 0 12:01 ? 00:00:00 tail -f -n +0 /var/lib/minecraft/servers/default/server/logs/latest.log
apache 16805 19976 0 12:01 ? 00:00:00 tail -f -n +0 /var/lib/minecraft/servers/default/server/logs/latest.log
apache 16898 16810 0 12:02 ? 00:00:00 tail -f -n +0 /var/lib/minecraft/servers/default/server/logs/latest.log
apache 17008 16902 0 12:02 ? 00:00:00 tail -f -n +0 /var/lib/minecraft/servers/default/server/logs/latest.log

my daughter is the ONLY one using the rfwadmin interface. She accesses it from her phone while she plays minecraft. Besides the tail on latest.log, there are other similar duplicated processes. They never end. I have to restart the apache process to clean things up.

Does this just happen to me because of the way my daughter uses her android phone to view the rfwadmin interface or what?

I haven't looked at this much... other than what I have here... it seems like the 'fix' might be to use a session cookie and each time you come back... reuse the same session and tie the processes that get started to the session. ... something like that.

jack

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.