Skip to content

Commit

Permalink
Merge pull request #7 from MinecraftServerControl/mojo
Browse files Browse the repository at this point in the history
Use Mojolicious instead of CGI and CGI::Ajax
  • Loading branch information
sandain authored Jun 24, 2018
2 parents 56bc5a1 + a5e0ad6 commit 85269f7
Show file tree
Hide file tree
Showing 19 changed files with 393 additions and 443 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2016 Jason M. Wood <[email protected]>
Copyright (c) 2018 Jason M. Wood <[email protected]>

All rights reserved.

Expand Down
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
MSC_USER := minecraft
MSC_GROUP := minecraft
MSC_GUI_HOME := /opt/mscs/gui
MSC_GUI_SERVICE := /etc/systemd/system/msc-gui.service

.PHONY: install update clean

install: $(MSC_GUI_HOME) update
chown -R $(MSC_USER):$(MSC_GROUP) $(MSC_GUI_HOME)
systemctl -f enable msc-gui.service;

update:
cp index.pl $(MSC_GUI_HOME)
cp -R themes $(MSC_GUI_HOME)
install -m 0755 msc-gui $(MSC_GUI_HOME)
install -m 0644 msc-gui.service $(MSC_GUI_SERVICE);
cp -R public $(MSC_GUI_HOME)
cp -R templates $(MSC_GUI_HOME)

clean:
systemctl -f disable msc-gui.service;
rm -R $(MSC_GUI_HOME)

$(MSC_GUI_HOME):
Expand Down
68 changes: 9 additions & 59 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,17 @@ usable state, this message will be removed.

## Prerequisites for installation

The Minecraft Server Control GUI uses Perl to present a web-based interface to the
The Minecraft Server Control GUI uses Perl and
[Mojolicious](https://mojolicious.org/), a Perl-based web framework, to
present a web-based interface to the
[Minecraft Server Control Script](https://github.com/MinecraftServerControl/mscs).
As such, the `mscs` script must be [installed](https://github.com/MinecraftServerControl/mscs/blob/master/README.md#installation)
and working for the GUI to function. Since the GUI is web based, you will need
to have a web server installed and working. These directions assume you are
using [Apache](https://httpd.apache.org), but any web server solution should
function. To install Apache:
As such, the `mscs` script must be
[installed](https://github.com/MinecraftServerControl/mscs/blob/master/README.md#installation)
and working for the GUI to function. Likewise, Mojolicious must be installed
for MSC-GUI to function. If you are running Debian or Ubuntu, you can make
sure that Mojolicious is installed by running:

sudo apt-get install apache2
sudo apt install libmojolicious-perl

## Installation

Expand All @@ -56,58 +58,6 @@ by running:

sudo make install


#### Apache

Here is an example of a file that can be placed in the
`/etc/apache2/sites-enabled/` directory to enable Apache to run a webserver
on port `80` on the host `minecraft.server.com` from the directory
`/var/www`. Change these values to suit your the needs of your website. This
configuration would make the GUI available at `http:\\localhost\gui`.

```
<VirtualHost *:80>
ServerName minecraft.server.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www
Alias /gui /var/www/gui
<Directory "/var/www/gui">
Order Allow,Deny
Allow from all
AllowOverride None
AddHandler cgi-script .pl
Options +ExecCGI -MultiViews -Indexes -Includes +FollowSymLinks
</Directory>
</VirtualHost>
```

Make sure to create a symbolic link so that Apache can actually find the GUI:

sudo ln -s /opt/mscs/gui /var/www/gui

You will also need to enable the Apache CGI module and restart Apache for the
GUI to work:

sudo a2enmod cgi
sudo service apache2 restart

#### Permissions

To allow Apache and the MSC-GUI access to MSCS, use your favorite editor to
create a new file in the `/etc/sudoers.d` folder:

sudo editor /etc/sudoers.d/mscs

and add this text :

# Allow www-data to execute the msctl command as the minecraft user.
www-data ALL=(minecraft:minecraft) NOPASSWD:SETENV: /usr/local/bin/msctl

## Getting started guide


## License

See [LICENSE](LICENSE)
Expand Down
Loading

0 comments on commit 85269f7

Please sign in to comment.